Skip to content

Commit 9757300

Browse files
ninadnaik-quiclinusw
authored andcommitted
pinctrl: qcom: Add intr_target_width field to support increased number of interrupt targets
SA8775 and newer target have added support for an increased number of interrupt targets. To implement this change, the intr_target field, which is used to configure the interrupt target in the interrupt configuration register is increased from 3 bits to 4 bits. In accordance to these updates, a new intr_target_width member is introduced in msm_pingroup structure. This member stores the value of width of intr_target field in the interrupt configuration register. This value is used to dynamically calculate and generate mask for setting the intr_target field. By default, this mask is set to 3 bit wide, to ensure backward compatibility with the older targets. Fixes: 4b6b185 ("pinctrl: qcom: add the tlmm driver sa8775p platforms") Tested-by: Andrew Halaney <ahalaney@redhat.com> # sa8775p-ride Signed-off-by: Ninad Naik <quic_ninanaik@quicinc.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org> Reviewed-by: Bjorn Andersson <quic_bjorande@quicinc.com> Link: https://lore.kernel.org/r/20230809100634.3961-1-quic_ninanaik@quicinc.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent f00295e commit 9757300

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

drivers/pinctrl/qcom/pinctrl-msm.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,6 +1038,7 @@ static int msm_gpio_irq_set_type(struct irq_data *d, unsigned int type)
10381038
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
10391039
struct msm_pinctrl *pctrl = gpiochip_get_data(gc);
10401040
const struct msm_pingroup *g;
1041+
u32 intr_target_mask = GENMASK(2, 0);
10411042
unsigned long flags;
10421043
bool was_enabled;
10431044
u32 val;
@@ -1074,13 +1075,15 @@ static int msm_gpio_irq_set_type(struct irq_data *d, unsigned int type)
10741075
* With intr_target_use_scm interrupts are routed to
10751076
* application cpu using scm calls.
10761077
*/
1078+
if (g->intr_target_width)
1079+
intr_target_mask = GENMASK(g->intr_target_width - 1, 0);
1080+
10771081
if (pctrl->intr_target_use_scm) {
10781082
u32 addr = pctrl->phys_base[0] + g->intr_target_reg;
10791083
int ret;
10801084

10811085
qcom_scm_io_readl(addr, &val);
1082-
1083-
val &= ~(7 << g->intr_target_bit);
1086+
val &= ~(intr_target_mask << g->intr_target_bit);
10841087
val |= g->intr_target_kpss_val << g->intr_target_bit;
10851088

10861089
ret = qcom_scm_io_writel(addr, val);
@@ -1090,7 +1093,7 @@ static int msm_gpio_irq_set_type(struct irq_data *d, unsigned int type)
10901093
d->hwirq);
10911094
} else {
10921095
val = msm_readl_intr_target(pctrl, g);
1093-
val &= ~(7 << g->intr_target_bit);
1096+
val &= ~(intr_target_mask << g->intr_target_bit);
10941097
val |= g->intr_target_kpss_val << g->intr_target_bit;
10951098
msm_writel_intr_target(val, pctrl, g);
10961099
}

drivers/pinctrl/qcom/pinctrl-msm.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ struct pinctrl_pin_desc;
5959
* @intr_status_bit: Offset in @intr_status_reg for reading and acking the interrupt
6060
* status.
6161
* @intr_target_bit: Offset in @intr_target_reg for configuring the interrupt routing.
62+
* @intr_target_width: Number of bits used for specifying interrupt routing target.
6263
* @intr_target_kpss_val: Value in @intr_target_bit for specifying that the interrupt from
6364
* this gpio should get routed to the KPSS processor.
6465
* @intr_raw_status_bit: Offset in @intr_cfg_reg for the raw status bit.
@@ -100,6 +101,7 @@ struct msm_pingroup {
100101
unsigned intr_ack_high:1;
101102

102103
unsigned intr_target_bit:5;
104+
unsigned intr_target_width:5;
103105
unsigned intr_target_kpss_val:5;
104106
unsigned intr_raw_status_bit:5;
105107
unsigned intr_polarity_bit:5;

drivers/pinctrl/qcom/pinctrl-sa8775p.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
.intr_enable_bit = 0, \
4747
.intr_status_bit = 0, \
4848
.intr_target_bit = 5, \
49+
.intr_target_width = 4, \
4950
.intr_target_kpss_val = 3, \
5051
.intr_raw_status_bit = 4, \
5152
.intr_polarity_bit = 1, \

0 commit comments

Comments
 (0)