The series contains several small patches to fix various issues in the pinctrl driver for Armada 3700.
Signed-off-by: Gabor Juhos j4g8y7@gmail.com --- Gabor Juhos (7): pinctrl: armada-37xx: use correct OUTPUT_VAL register for GPIOs > 31 pinctrl: armada-37xx: propagate error from armada_37xx_gpio_direction_output() pinctrl: armada-37xx: set GPIO output value before setting direction pinctrl: armada-37xx: propagate error from armada_37xx_gpio_get() pinctrl: armada-37xx: propagate error from armada_37xx_pmx_gpio_set_direction() pinctrl: armada-37xx: propagate error from armada_37xx_gpio_get_direction() pinctrl: armada-37xx: propagate error from armada_37xx_pmx_set_by_name()
drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 35 ++++++++++++++++------------- 1 file changed, 20 insertions(+), 15 deletions(-) --- base-commit: 82f2b0b97b36ee3fcddf0f0780a9a0825d52fec3 change-id: 20250512-pinctrl-a37xx-fixes-98fabc45cb11
Best regards,
The controller has two consecutive OUTPUT_VAL registers and both holds output value for 32 GPIOs. Due to a missing adjustment, the current code always uses the first register while setting the output value whereas it should use the second one for GPIOs > 31.
Add the missing armada_37xx_update_reg() call to adjust the register according to the 'offset' parameter of the function to fix the issue.
Cc: stable@vger.kernel.org Fixes: 6702abb3bf23 ("pinctrl: armada-37xx: Fix direction_output() callback behavior") Signed-off-by: Gabor Juhos j4g8y7@gmail.com Signed-off-by: Imre Kaloz kaloz@openwrt.org --- drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c index 335744ac831057576473dd62c5533168b243a656..43034d29292687e875136aafa530b62479dc55ec 100644 --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c @@ -417,6 +417,7 @@ static int armada_37xx_gpio_direction_output(struct gpio_chip *chip, unsigned int offset, int value) { struct armada_37xx_pinctrl *info = gpiochip_get_data(chip); + unsigned int val_offset = offset; unsigned int reg = OUTPUT_EN; unsigned int mask, val, ret;
@@ -429,6 +430,8 @@ static int armada_37xx_gpio_direction_output(struct gpio_chip *chip, return ret;
reg = OUTPUT_VAL; + armada_37xx_update_reg(®, &val_offset); + val = value ? mask : 0; regmap_update_bits(info->regmap, reg, mask, val);
On Mon, May 12, 2025 at 04:22:37PM +0200, Gabor Juhos wrote:
The controller has two consecutive OUTPUT_VAL registers and both holds output value for 32 GPIOs. Due to a missing adjustment, the current code always uses the first register while setting the output value whereas it should use the second one for GPIOs > 31.
Add the missing armada_37xx_update_reg() call to adjust the register according to the 'offset' parameter of the function to fix the issue.
Cc: stable@vger.kernel.org Fixes: 6702abb3bf23 ("pinctrl: armada-37xx: Fix direction_output() callback behavior") Signed-off-by: Gabor Juhos j4g8y7@gmail.com Signed-off-by: Imre Kaloz kaloz@openwrt.org
Reviewed-by: Andrew Lunn andrew@lunn.ch
Andrew
The regmap_update_bits() function can fail, so propagate its error up to the stack instead of silently ignoring that.
Cc: stable@vger.kernel.org Fixes: 6702abb3bf23 ("pinctrl: armada-37xx: Fix direction_output() callback behavior") Signed-off-by: Gabor Juhos j4g8y7@gmail.com Signed-off-by: Imre Kaloz kaloz@openwrt.org --- drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c index 43034d29292687e875136aafa530b62479dc55ec..e0c8eebf40588a1b49b80e2a1ddcc2a35fa7c07b 100644 --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c @@ -433,9 +433,7 @@ static int armada_37xx_gpio_direction_output(struct gpio_chip *chip, armada_37xx_update_reg(®, &val_offset);
val = value ? mask : 0; - regmap_update_bits(info->regmap, reg, mask, val); - - return 0; + return regmap_update_bits(info->regmap, reg, mask, val); }
static int armada_37xx_gpio_get(struct gpio_chip *chip, unsigned int offset)
On Mon, May 12, 2025 at 04:22:38PM +0200, Gabor Juhos wrote:
The regmap_update_bits() function can fail, so propagate its error up to the stack instead of silently ignoring that.
Cc: stable@vger.kernel.org Fixes: 6702abb3bf23 ("pinctrl: armada-37xx: Fix direction_output() callback behavior") Signed-off-by: Gabor Juhos j4g8y7@gmail.com Signed-off-by: Imre Kaloz kaloz@openwrt.org
Reviewed-by: Andrew Lunn andrew@lunn.ch
Andrew
Changing the direction before updating the output value in the OUTPUT_VAL register may result in a glitch on the output line if the previous value in the OUTPUT_VAL register is different from the one we want to set.
In order to avoid that, update the output value before changing the direction.
Cc: stable@vger.kernel.org Fixes: 6702abb3bf23 ("pinctrl: armada-37xx: Fix direction_output() callback behavior") Signed-off-by: Gabor Juhos j4g8y7@gmail.com Signed-off-by: Imre Kaloz kaloz@openwrt.org --- drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c index e0c8eebf40588a1b49b80e2a1ddcc2a35fa7c07b..8d93d36af63ab9496376219454214c05db30971f 100644 --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c @@ -417,23 +417,22 @@ static int armada_37xx_gpio_direction_output(struct gpio_chip *chip, unsigned int offset, int value) { struct armada_37xx_pinctrl *info = gpiochip_get_data(chip); - unsigned int val_offset = offset; - unsigned int reg = OUTPUT_EN; + unsigned int en_offset = offset; + unsigned int reg = OUTPUT_VAL; unsigned int mask, val, ret;
armada_37xx_update_reg(®, &offset); mask = BIT(offset); + val = value ? mask : 0;
- ret = regmap_update_bits(info->regmap, reg, mask, mask); - + ret = regmap_update_bits(info->regmap, reg, mask, val); if (ret) return ret;
- reg = OUTPUT_VAL; - armada_37xx_update_reg(®, &val_offset); + reg = OUTPUT_EN; + armada_37xx_update_reg(®, &en_offset);
- val = value ? mask : 0; - return regmap_update_bits(info->regmap, reg, mask, val); + return regmap_update_bits(info->regmap, reg, mask, mask); }
static int armada_37xx_gpio_get(struct gpio_chip *chip, unsigned int offset)
On Mon, May 12, 2025 at 04:22:39PM +0200, Gabor Juhos wrote:
Changing the direction before updating the output value in the OUTPUT_VAL register may result in a glitch on the output line if the previous value in the OUTPUT_VAL register is different from the one we want to set.
In order to avoid that, update the output value before changing the direction.
Cc: stable@vger.kernel.org Fixes: 6702abb3bf23 ("pinctrl: armada-37xx: Fix direction_output() callback behavior") Signed-off-by: Gabor Juhos j4g8y7@gmail.com Signed-off-by: Imre Kaloz kaloz@openwrt.org
Reviewed-by: Andrew Lunn andrew@lunn.ch
Andrew
The regmap_read() function can fail, so propagate its error up to the stack instead of silently ignoring that.
Cc: stable@vger.kernel.org Fixes: 5715092a458c ("pinctrl: armada-37xx: Add gpio support") Signed-off-by: Gabor Juhos j4g8y7@gmail.com Signed-off-by: Imre Kaloz kaloz@openwrt.org --- drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c index 8d93d36af63ab9496376219454214c05db30971f..2e88a0399d1a205064b58890db6477e2202bf311 100644 --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c @@ -440,11 +440,14 @@ static int armada_37xx_gpio_get(struct gpio_chip *chip, unsigned int offset) struct armada_37xx_pinctrl *info = gpiochip_get_data(chip); unsigned int reg = INPUT_VAL; unsigned int val, mask; + int ret;
armada_37xx_update_reg(®, &offset); mask = BIT(offset);
- regmap_read(info->regmap, reg, &val); + ret = regmap_read(info->regmap, reg, &val); + if (ret) + return ret;
return (val & mask) != 0; }
On Mon, May 12, 2025 at 04:22:40PM +0200, Gabor Juhos wrote:
The regmap_read() function can fail, so propagate its error up to the stack instead of silently ignoring that.
Cc: stable@vger.kernel.org Fixes: 5715092a458c ("pinctrl: armada-37xx: Add gpio support") Signed-off-by: Gabor Juhos j4g8y7@gmail.com Signed-off-by: Imre Kaloz kaloz@openwrt.org
Reviewed-by: Andrew Lunn andrew@lunn.ch
Andrew
The armada_37xx_gpio_direction_{in,out}put() functions can fail, so propagate their error values back to the stack instead of silently ignoring those.
Cc: stable@vger.kernel.org Fixes: 5715092a458c ("pinctrl: armada-37xx: Add gpio support") Signed-off-by: Gabor Juhos j4g8y7@gmail.com Signed-off-by: Imre Kaloz kaloz@openwrt.org --- drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c index 2e88a0399d1a205064b58890db6477e2202bf311..aed0069b085ced5867993e95e0244df7ccda556d 100644 --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c @@ -472,16 +472,17 @@ static int armada_37xx_pmx_gpio_set_direction(struct pinctrl_dev *pctldev, { struct armada_37xx_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); struct gpio_chip *chip = range->gc; + int ret;
dev_dbg(info->dev, "gpio_direction for pin %u as %s-%d to %s\n", offset, range->name, offset, input ? "input" : "output");
if (input) - armada_37xx_gpio_direction_input(chip, offset); + ret = armada_37xx_gpio_direction_input(chip, offset); else - armada_37xx_gpio_direction_output(chip, offset, 0); + ret = armada_37xx_gpio_direction_output(chip, offset, 0);
- return 0; + return ret; }
static int armada_37xx_gpio_request_enable(struct pinctrl_dev *pctldev,
On Mon, May 12, 2025 at 04:22:41PM +0200, Gabor Juhos wrote:
The armada_37xx_gpio_direction_{in,out}put() functions can fail, so propagate their error values back to the stack instead of silently ignoring those.
Cc: stable@vger.kernel.org Fixes: 5715092a458c ("pinctrl: armada-37xx: Add gpio support") Signed-off-by: Gabor Juhos j4g8y7@gmail.com Signed-off-by: Imre Kaloz kaloz@openwrt.org
Reviewed-by: Andrew Lunn andrew@lunn.ch
Andrew
The regmap_read() function can fail, so propagate its error up to the stack instead of silently ignoring that.
Cc: stable@vger.kernel.org Fixes: 5715092a458c ("pinctrl: armada-37xx: Add gpio support") Signed-off-by: Gabor Juhos j4g8y7@gmail.com Signed-off-by: Imre Kaloz kaloz@openwrt.org --- drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c index aed0069b085ced5867993e95e0244df7ccda556d..18c6c5026b26c294ee65e3deea02d2e852e10622 100644 --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c @@ -402,10 +402,13 @@ static int armada_37xx_gpio_get_direction(struct gpio_chip *chip, struct armada_37xx_pinctrl *info = gpiochip_get_data(chip); unsigned int reg = OUTPUT_EN; unsigned int val, mask; + int ret;
armada_37xx_update_reg(®, &offset); mask = BIT(offset); - regmap_read(info->regmap, reg, &val); + ret = regmap_read(info->regmap, reg, &val); + if (ret) + return ret;
if (val & mask) return GPIO_LINE_DIRECTION_OUT;
On Mon, May 12, 2025 at 04:22:42PM +0200, Gabor Juhos wrote:
The regmap_read() function can fail, so propagate its error up to the stack instead of silently ignoring that.
Cc: stable@vger.kernel.org Fixes: 5715092a458c ("pinctrl: armada-37xx: Add gpio support") Signed-off-by: Gabor Juhos j4g8y7@gmail.com Signed-off-by: Imre Kaloz kaloz@openwrt.org
Reviewed-by: Andrew Lunn andrew@lunn.ch
Andrew
The regmap_update_bits() function can fail, so propagate its error up to the stack instead of silently ignoring that.
Cc: stable@vger.kernel.org Fixes: 87466ccd9401 ("pinctrl: armada-37xx: Add pin controller support for Armada 37xx") Signed-off-by: Gabor Juhos j4g8y7@gmail.com Signed-off-by: Imre Kaloz kaloz@openwrt.org --- drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c index 18c6c5026b26c294ee65e3deea02d2e852e10622..f35bf0cd98c97419ba0ab0291a23d4774a595d39 100644 --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c @@ -358,9 +358,7 @@ static int armada_37xx_pmx_set_by_name(struct pinctrl_dev *pctldev,
val = grp->val[func];
- regmap_update_bits(info->regmap, reg, mask, val); - - return 0; + return regmap_update_bits(info->regmap, reg, mask, val); }
static int armada_37xx_pmx_set(struct pinctrl_dev *pctldev,
On Mon, May 12, 2025 at 04:22:43PM +0200, Gabor Juhos wrote:
The regmap_update_bits() function can fail, so propagate its error up to the stack instead of silently ignoring that.
Cc: stable@vger.kernel.org Fixes: 87466ccd9401 ("pinctrl: armada-37xx: Add pin controller support for Armada 37xx") Signed-off-by: Gabor Juhos j4g8y7@gmail.com Signed-off-by: Imre Kaloz kaloz@openwrt.org
Reviewed-by: Andrew Lunn andrew@lunn.ch
Andrew
On Mon, May 12, 2025 at 04:22:36PM +0200, Gabor Juhos wrote:
The series contains several small patches to fix various issues in the pinctrl driver for Armada 3700.
I'm not sure all these should be for stable. Some are clear bugs, but not propagating the errors has not bothered anybody so far, a requirement for stable.
Andrew
On Mon, May 12, 2025 at 11:33 PM Andrew Lunn andrew@lunn.ch wrote:
On Mon, May 12, 2025 at 04:22:36PM +0200, Gabor Juhos wrote:
The series contains several small patches to fix various issues in the pinctrl driver for Armada 3700.
I'm not sure all these should be for stable. Some are clear bugs, but not propagating the errors has not bothered anybody so far, a requirement for stable.
So we are at -rc6 so I'm not sending these as fixes to Torvalds right now unless they are super-critical.
I will merge this for v6.16 (-rc1) and then the stable maintainers will have to decide from the point it enters mainline.
Gabor: can you look over the tags? Once you have decided on stable/non-stable tags I will merge the series.
Yours, Linus Walleij
2025. 05. 13. 15:36 keltezéssel, Linus Walleij írta:
On Mon, May 12, 2025 at 11:33 PM Andrew Lunn andrew@lunn.ch wrote:
On Mon, May 12, 2025 at 04:22:36PM +0200, Gabor Juhos wrote:
The series contains several small patches to fix various issues in the pinctrl driver for Armada 3700.
I'm not sure all these should be for stable. Some are clear bugs, but not propagating the errors has not bothered anybody so far, a requirement for stable.
So we are at -rc6 so I'm not sending these as fixes to Torvalds right now unless they are super-critical.
I will merge this for v6.16 (-rc1) and then the stable maintainers will have to decide from the point it enters mainline.
Gabor: can you look over the tags? Once you have decided on stable/non-stable tags I will merge the series.
Sure, I will send a v2. Just a question, shall I also remove the 'Fixes' tags along with the 'stable' ones? If I keep those, they might land up in stable trees anyway.
Regards, Gabor
On Tue, May 13, 2025 at 06:51:35PM +0200, Gabor Juhos wrote:
- 15:36 keltezéssel, Linus Walleij írta:
On Mon, May 12, 2025 at 11:33 PM Andrew Lunn andrew@lunn.ch wrote:
On Mon, May 12, 2025 at 04:22:36PM +0200, Gabor Juhos wrote:
The series contains several small patches to fix various issues in the pinctrl driver for Armada 3700.
I'm not sure all these should be for stable. Some are clear bugs, but not propagating the errors has not bothered anybody so far, a requirement for stable.
So we are at -rc6 so I'm not sending these as fixes to Torvalds right now unless they are super-critical.
I will merge this for v6.16 (-rc1) and then the stable maintainers will have to decide from the point it enters mainline.
Gabor: can you look over the tags? Once you have decided on stable/non-stable tags I will merge the series.
Sure, I will send a v2. Just a question, shall I also remove the 'Fixes' tags along with the 'stable' ones? If I keep those, they might land up in stable trees anyway.
For the return values patches, i would drop the Fixes. It is just really continuing development work for the driver.
Andrew
2025. 05. 13. 20:46 keltezéssel, Andrew Lunn írta:
On Tue, May 13, 2025 at 06:51:35PM +0200, Gabor Juhos wrote:
- 15:36 keltezéssel, Linus Walleij írta:
On Mon, May 12, 2025 at 11:33 PM Andrew Lunn andrew@lunn.ch wrote:
On Mon, May 12, 2025 at 04:22:36PM +0200, Gabor Juhos wrote:
The series contains several small patches to fix various issues in the pinctrl driver for Armada 3700.
I'm not sure all these should be for stable. Some are clear bugs, but not propagating the errors has not bothered anybody so far, a requirement for stable.
So we are at -rc6 so I'm not sending these as fixes to Torvalds right now unless they are super-critical.
I will merge this for v6.16 (-rc1) and then the stable maintainers will have to decide from the point it enters mainline.
Gabor: can you look over the tags? Once you have decided on stable/non-stable tags I will merge the series.
Sure, I will send a v2. Just a question, shall I also remove the 'Fixes' tags along with the 'stable' ones? If I keep those, they might land up in stable trees anyway.
For the return values patches, i would drop the Fixes. It is just really continuing development work for the driver.
Ok, thanks!
-Gabor
linux-stable-mirror@lists.linaro.org