Message ID | 20220830120914.2329522-4-patrice.chotard@foss.st.com |
---|---|
State | Accepted |
Commit | 2c38f7c31806c5724a2f9c58a47cf76979fd6f0a |
Delegated to: | Tom Rini |
Headers | show |
Series | gpio: update gpio_get_status() | expand |
Hi, On 8/30/22 14:09, Patrice Chotard wrote: > Populate uc_priv->name[] with pinmux node's name in order to indicate > the pinmuxing's name in case GPIO is configured in alternate. > > For example, for STM32 SoC's based platform, "gpio status" command > output : > > before > Bank GPIOZ: > GPIOZ0: unused : 0 [ ] > GPIOZ1: unused : 0 [ ] > GPIOZ2: unused : 0 [ ] > GPIOZ3: unused : 0 [ ] > GPIOZ4: func > GPIOZ5: func > GPIOZ6: unused : 0 [ ] > GPIOZ7: unused : 0 [ ] > GPIOZ8: unknown > GPIOZ9: unknown > GPIOZ10: unknown > GPIOZ11: unknown > GPIOZ12: unknown > GPIOZ13: unknown > GPIOZ14: unknown > GPIOZ15: unknown > > After > Bank GPIOZ: > GPIOZ0: unused : 0 [ ] > GPIOZ1: unused : 0 [ ] > GPIOZ2: unused : 0 [ ] > GPIOZ3: unused : 0 [ ] > GPIOZ4: func i2c4-0 > GPIOZ5: func i2c4-0 > GPIOZ6: unused : 0 [ ] > GPIOZ7: unused : 0 [ ] > GPIOZ8: unknown > GPIOZ9: unknown > GPIOZ10: unknown > GPIOZ11: unknown > GPIOZ12: unknown > GPIOZ13: unknown > GPIOZ14: unknown > GPIOZ15: unknown > > Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> > --- > > (no changes since v1) > > drivers/pinctrl/pinctrl_stm32.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Thanks Patrick
On Tue, Aug 30, 2022 at 02:09:13PM +0200, Patrice Chotard wrote: > Populate uc_priv->name[] with pinmux node's name in order to indicate > the pinmuxing's name in case GPIO is configured in alternate. > > For example, for STM32 SoC's based platform, "gpio status" command > output : > > before > Bank GPIOZ: > GPIOZ0: unused : 0 [ ] > GPIOZ1: unused : 0 [ ] > GPIOZ2: unused : 0 [ ] > GPIOZ3: unused : 0 [ ] > GPIOZ4: func > GPIOZ5: func > GPIOZ6: unused : 0 [ ] > GPIOZ7: unused : 0 [ ] > GPIOZ8: unknown > GPIOZ9: unknown > GPIOZ10: unknown > GPIOZ11: unknown > GPIOZ12: unknown > GPIOZ13: unknown > GPIOZ14: unknown > GPIOZ15: unknown > > After > Bank GPIOZ: > GPIOZ0: unused : 0 [ ] > GPIOZ1: unused : 0 [ ] > GPIOZ2: unused : 0 [ ] > GPIOZ3: unused : 0 [ ] > GPIOZ4: func i2c4-0 > GPIOZ5: func i2c4-0 > GPIOZ6: unused : 0 [ ] > GPIOZ7: unused : 0 [ ] > GPIOZ8: unknown > GPIOZ9: unknown > GPIOZ10: unknown > GPIOZ11: unknown > GPIOZ12: unknown > GPIOZ13: unknown > GPIOZ14: unknown > GPIOZ15: unknown > > Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> > Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Applied to u-boot/next, thanks!
diff --git a/drivers/pinctrl/pinctrl_stm32.c b/drivers/pinctrl/pinctrl_stm32.c index 990cd19286..b755fa42b4 100644 --- a/drivers/pinctrl/pinctrl_stm32.c +++ b/drivers/pinctrl/pinctrl_stm32.c @@ -257,10 +257,12 @@ static int stm32_pinctrl_probe(struct udevice *dev) return 0; } -static int stm32_gpio_config(struct gpio_desc *desc, +static int stm32_gpio_config(ofnode node, + struct gpio_desc *desc, const struct stm32_gpio_ctl *ctl) { struct stm32_gpio_priv *priv = dev_get_priv(desc->dev); + struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(desc->dev); struct stm32_gpio_regs *regs = priv->regs; struct stm32_pinctrl_priv *ctrl_priv; int ret; @@ -291,6 +293,8 @@ static int stm32_gpio_config(struct gpio_desc *desc, index = desc->offset; clrsetbits_le32(®s->otyper, OTYPE_MSK << index, ctl->otype << index); + uc_priv->name[desc->offset] = strdup(ofnode_get_name(node)); + hwspinlock_unlock(&ctrl_priv->hws); return 0; @@ -385,7 +389,7 @@ static int stm32_pinctrl_config(ofnode node) if (rv) return rv; desc.offset = gpio_dsc.pin; - rv = stm32_gpio_config(&desc, &gpio_ctl); + rv = stm32_gpio_config(node, &desc, &gpio_ctl); log_debug("rv = %d\n\n", rv); if (rv) return rv;
Populate uc_priv->name[] with pinmux node's name in order to indicate the pinmuxing's name in case GPIO is configured in alternate. For example, for STM32 SoC's based platform, "gpio status" command output : before Bank GPIOZ: GPIOZ0: unused : 0 [ ] GPIOZ1: unused : 0 [ ] GPIOZ2: unused : 0 [ ] GPIOZ3: unused : 0 [ ] GPIOZ4: func GPIOZ5: func GPIOZ6: unused : 0 [ ] GPIOZ7: unused : 0 [ ] GPIOZ8: unknown GPIOZ9: unknown GPIOZ10: unknown GPIOZ11: unknown GPIOZ12: unknown GPIOZ13: unknown GPIOZ14: unknown GPIOZ15: unknown After Bank GPIOZ: GPIOZ0: unused : 0 [ ] GPIOZ1: unused : 0 [ ] GPIOZ2: unused : 0 [ ] GPIOZ3: unused : 0 [ ] GPIOZ4: func i2c4-0 GPIOZ5: func i2c4-0 GPIOZ6: unused : 0 [ ] GPIOZ7: unused : 0 [ ] GPIOZ8: unknown GPIOZ9: unknown GPIOZ10: unknown GPIOZ11: unknown GPIOZ12: unknown GPIOZ13: unknown GPIOZ14: unknown GPIOZ15: unknown Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> --- (no changes since v1) drivers/pinctrl/pinctrl_stm32.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)