Skip to content

Commit 9a85c09

Browse files
pcercueilinusw
authored andcommitted
pinctrl: ingenic: Fix JZ4760 support
- JZ4760 and JZ4760B have a similar register layout as the JZ4740, and don't use the new register layout, which was introduced with the JZ4770 SoC and not the JZ4760 or JZ4760B SoCs. - The JZ4740 code path only expected two function modes to be configurable for each pin, and wouldn't work with more than two. Fix it for the JZ4760, which has four configurable function modes. Fixes: 0257595 ("pinctrl: Ingenic: Add pinctrl driver for JZ4760 and JZ4760B.") Cc: <[email protected]> # 5.3 Signed-off-by: Paul Cercueil <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent 5c8fe58 commit 9a85c09

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

drivers/pinctrl/pinctrl-ingenic.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1688,7 +1688,7 @@ static inline bool ingenic_gpio_get_value(struct ingenic_gpio_chip *jzgc,
16881688
static void ingenic_gpio_set_value(struct ingenic_gpio_chip *jzgc,
16891689
u8 offset, int value)
16901690
{
1691-
if (jzgc->jzpc->info->version >= ID_JZ4760)
1691+
if (jzgc->jzpc->info->version >= ID_JZ4770)
16921692
ingenic_gpio_set_bit(jzgc, JZ4760_GPIO_PAT0, offset, !!value);
16931693
else
16941694
ingenic_gpio_set_bit(jzgc, JZ4740_GPIO_DATA, offset, !!value);
@@ -1718,7 +1718,7 @@ static void irq_set_type(struct ingenic_gpio_chip *jzgc,
17181718
break;
17191719
}
17201720

1721-
if (jzgc->jzpc->info->version >= ID_JZ4760) {
1721+
if (jzgc->jzpc->info->version >= ID_JZ4770) {
17221722
reg1 = JZ4760_GPIO_PAT1;
17231723
reg2 = JZ4760_GPIO_PAT0;
17241724
} else {
@@ -1758,7 +1758,7 @@ static void ingenic_gpio_irq_enable(struct irq_data *irqd)
17581758
struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc);
17591759
int irq = irqd->hwirq;
17601760

1761-
if (jzgc->jzpc->info->version >= ID_JZ4760)
1761+
if (jzgc->jzpc->info->version >= ID_JZ4770)
17621762
ingenic_gpio_set_bit(jzgc, JZ4760_GPIO_INT, irq, true);
17631763
else
17641764
ingenic_gpio_set_bit(jzgc, JZ4740_GPIO_SELECT, irq, true);
@@ -1774,7 +1774,7 @@ static void ingenic_gpio_irq_disable(struct irq_data *irqd)
17741774

17751775
ingenic_gpio_irq_mask(irqd);
17761776

1777-
if (jzgc->jzpc->info->version >= ID_JZ4760)
1777+
if (jzgc->jzpc->info->version >= ID_JZ4770)
17781778
ingenic_gpio_set_bit(jzgc, JZ4760_GPIO_INT, irq, false);
17791779
else
17801780
ingenic_gpio_set_bit(jzgc, JZ4740_GPIO_SELECT, irq, false);
@@ -1799,7 +1799,7 @@ static void ingenic_gpio_irq_ack(struct irq_data *irqd)
17991799
irq_set_type(jzgc, irq, IRQ_TYPE_LEVEL_HIGH);
18001800
}
18011801

1802-
if (jzgc->jzpc->info->version >= ID_JZ4760)
1802+
if (jzgc->jzpc->info->version >= ID_JZ4770)
18031803
ingenic_gpio_set_bit(jzgc, JZ4760_GPIO_FLAG, irq, false);
18041804
else
18051805
ingenic_gpio_set_bit(jzgc, JZ4740_GPIO_DATA, irq, true);
@@ -1856,7 +1856,7 @@ static void ingenic_gpio_irq_handler(struct irq_desc *desc)
18561856

18571857
chained_irq_enter(irq_chip, desc);
18581858

1859-
if (jzgc->jzpc->info->version >= ID_JZ4760)
1859+
if (jzgc->jzpc->info->version >= ID_JZ4770)
18601860
flag = ingenic_gpio_read_reg(jzgc, JZ4760_GPIO_FLAG);
18611861
else
18621862
flag = ingenic_gpio_read_reg(jzgc, JZ4740_GPIO_FLAG);
@@ -1938,7 +1938,7 @@ static int ingenic_gpio_get_direction(struct gpio_chip *gc, unsigned int offset)
19381938
struct ingenic_pinctrl *jzpc = jzgc->jzpc;
19391939
unsigned int pin = gc->base + offset;
19401940

1941-
if (jzpc->info->version >= ID_JZ4760) {
1941+
if (jzpc->info->version >= ID_JZ4770) {
19421942
if (ingenic_get_pin_config(jzpc, pin, JZ4760_GPIO_INT) ||
19431943
ingenic_get_pin_config(jzpc, pin, JZ4760_GPIO_PAT1))
19441944
return GPIO_LINE_DIRECTION_IN;
@@ -1996,15 +1996,15 @@ static int ingenic_pinmux_set_pin_fn(struct ingenic_pinctrl *jzpc,
19961996
ingenic_shadow_config_pin(jzpc, pin, JZ4760_GPIO_PAT1, func & 0x2);
19971997
ingenic_shadow_config_pin(jzpc, pin, JZ4760_GPIO_PAT0, func & 0x1);
19981998
ingenic_shadow_config_pin_load(jzpc, pin);
1999-
} else if (jzpc->info->version >= ID_JZ4760) {
1999+
} else if (jzpc->info->version >= ID_JZ4770) {
20002000
ingenic_config_pin(jzpc, pin, JZ4760_GPIO_INT, false);
20012001
ingenic_config_pin(jzpc, pin, GPIO_MSK, false);
20022002
ingenic_config_pin(jzpc, pin, JZ4760_GPIO_PAT1, func & 0x2);
20032003
ingenic_config_pin(jzpc, pin, JZ4760_GPIO_PAT0, func & 0x1);
20042004
} else {
20052005
ingenic_config_pin(jzpc, pin, JZ4740_GPIO_FUNC, true);
20062006
ingenic_config_pin(jzpc, pin, JZ4740_GPIO_TRIG, func & 0x2);
2007-
ingenic_config_pin(jzpc, pin, JZ4740_GPIO_SELECT, func > 0);
2007+
ingenic_config_pin(jzpc, pin, JZ4740_GPIO_SELECT, func & 0x1);
20082008
}
20092009

20102010
return 0;
@@ -2061,7 +2061,7 @@ static int ingenic_pinmux_gpio_set_direction(struct pinctrl_dev *pctldev,
20612061
ingenic_shadow_config_pin(jzpc, pin, GPIO_MSK, true);
20622062
ingenic_shadow_config_pin(jzpc, pin, JZ4760_GPIO_PAT1, input);
20632063
ingenic_shadow_config_pin_load(jzpc, pin);
2064-
} else if (jzpc->info->version >= ID_JZ4760) {
2064+
} else if (jzpc->info->version >= ID_JZ4770) {
20652065
ingenic_config_pin(jzpc, pin, JZ4760_GPIO_INT, false);
20662066
ingenic_config_pin(jzpc, pin, GPIO_MSK, true);
20672067
ingenic_config_pin(jzpc, pin, JZ4760_GPIO_PAT1, input);
@@ -2091,7 +2091,7 @@ static int ingenic_pinconf_get(struct pinctrl_dev *pctldev,
20912091
unsigned int offt = pin / PINS_PER_GPIO_CHIP;
20922092
bool pull;
20932093

2094-
if (jzpc->info->version >= ID_JZ4760)
2094+
if (jzpc->info->version >= ID_JZ4770)
20952095
pull = !ingenic_get_pin_config(jzpc, pin, JZ4760_GPIO_PEN);
20962096
else
20972097
pull = !ingenic_get_pin_config(jzpc, pin, JZ4740_GPIO_PULL_DIS);
@@ -2141,7 +2141,7 @@ static void ingenic_set_bias(struct ingenic_pinctrl *jzpc,
21412141
REG_SET(X1830_GPIO_PEH), bias << idxh);
21422142
}
21432143

2144-
} else if (jzpc->info->version >= ID_JZ4760) {
2144+
} else if (jzpc->info->version >= ID_JZ4770) {
21452145
ingenic_config_pin(jzpc, pin, JZ4760_GPIO_PEN, !bias);
21462146
} else {
21472147
ingenic_config_pin(jzpc, pin, JZ4740_GPIO_PULL_DIS, !bias);
@@ -2151,7 +2151,7 @@ static void ingenic_set_bias(struct ingenic_pinctrl *jzpc,
21512151
static void ingenic_set_output_level(struct ingenic_pinctrl *jzpc,
21522152
unsigned int pin, bool high)
21532153
{
2154-
if (jzpc->info->version >= ID_JZ4760)
2154+
if (jzpc->info->version >= ID_JZ4770)
21552155
ingenic_config_pin(jzpc, pin, JZ4760_GPIO_PAT0, high);
21562156
else
21572157
ingenic_config_pin(jzpc, pin, JZ4740_GPIO_DATA, high);

0 commit comments

Comments
 (0)