All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] pinctrl: stm32: correction for pinmux status
@ 2021-01-21 16:39 Patrick Delaunay
  2021-01-21 16:39 ` [PATCH 1/2] pinctrl: stm32: correct management pin display of OTYPE Patrick Delaunay
  2021-01-21 16:39 ` [PATCH 2/2] pinctrl: stm32: bind only the enabled GPIO subnode Patrick Delaunay
  0 siblings, 2 replies; 7+ messages in thread
From: Patrick Delaunay @ 2021-01-21 16:39 UTC (permalink / raw)
  To: u-boot


This serie solve 2 issues found in output of command
"pinmux status -a" when I test the serie [1].

[1] "gpio: Update and simplify the uclass API"
    http://patchwork.ozlabs.org/project/uboot/list/?series=225585



Patrick Delaunay (2):
  pinctrl: stm32: correct management pin display of OTYPE
  pinctrl: stm32: bind only the enabled GPIO subnode

 drivers/pinctrl/pinctrl_stm32.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

-- 
2.17.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] pinctrl: stm32: correct management pin display of OTYPE
  2021-01-21 16:39 [PATCH 0/2] pinctrl: stm32: correction for pinmux status Patrick Delaunay
@ 2021-01-21 16:39 ` Patrick Delaunay
  2021-01-22  8:33   ` Patrice CHOTARD
  2021-02-09  9:33   ` Patrick DELAUNAY
  2021-01-21 16:39 ` [PATCH 2/2] pinctrl: stm32: bind only the enabled GPIO subnode Patrick Delaunay
  1 sibling, 2 replies; 7+ messages in thread
From: Patrick Delaunay @ 2021-01-21 16:39 UTC (permalink / raw)
  To: u-boot

OTYPE can be used for output or for alternate function to select
PP = push-pull or OP = open-drain mode, according reference manual
(Table 81. Port bit configuration table).

This patch removes this indication for input pins and adds it
for AF and output pins for pinmux command output.

Fixes: b305dbc08b08 ("pinctrl: stm32: display bias information for all pins")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---

 drivers/pinctrl/pinctrl_stm32.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/pinctrl/pinctrl_stm32.c b/drivers/pinctrl/pinctrl_stm32.c
index a1f53a793b..374f76d881 100644
--- a/drivers/pinctrl/pinctrl_stm32.c
+++ b/drivers/pinctrl/pinctrl_stm32.c
@@ -56,7 +56,7 @@ static const char * const pinmux_bias[] = {
 	[STM32_GPIO_PUPD_DOWN] = "pull-down",
 };
 
-static const char * const pinmux_input[] = {
+static const char * const pinmux_otype[] = {
 	[STM32_GPIO_OTYPE_PP] = "push-pull",
 	[STM32_GPIO_OTYPE_OD] = "open-drain",
 };
@@ -216,7 +216,7 @@ static int stm32_pinctrl_get_pin_muxing(struct udevice *dev,
 		selector, gpio_idx, mode);
 	priv = dev_get_priv(gpio_dev);
 	pupd = (readl(&priv->regs->pupdr) >> (gpio_idx * 2)) & PUPD_MASK;
-
+	otype = (readl(&priv->regs->otyper) >> gpio_idx) & OTYPE_MSK;
 
 	switch (mode) {
 	case GPIOF_UNKNOWN:
@@ -227,18 +227,16 @@ static int stm32_pinctrl_get_pin_muxing(struct udevice *dev,
 		break;
 	case GPIOF_FUNC:
 		af_num = stm32_pinctrl_get_af(gpio_dev, gpio_idx);
-		snprintf(buf, size, "%s %d %s", pinmux_mode[mode], af_num,
-			 pinmux_bias[pupd]);
+		snprintf(buf, size, "%s %d %s %s", pinmux_mode[mode], af_num,
+			 pinmux_otype[otype], pinmux_bias[pupd]);
 		break;
 	case GPIOF_OUTPUT:
-		snprintf(buf, size, "%s %s %s",
-			 pinmux_mode[mode], pinmux_bias[pupd],
-			 label ? label : "");
+		snprintf(buf, size, "%s %s %s %s",
+			 pinmux_mode[mode], pinmux_otype[otype],
+			 pinmux_bias[pupd], label ? label : "");
 		break;
 	case GPIOF_INPUT:
-		otype = (readl(&priv->regs->otyper) >> gpio_idx) & OTYPE_MSK;
-		snprintf(buf, size, "%s %s %s %s",
-			 pinmux_mode[mode], pinmux_input[otype],
+		snprintf(buf, size, "%s %s %s", pinmux_mode[mode],
 			 pinmux_bias[pupd], label ? label : "");
 		break;
 	}
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] pinctrl: stm32: bind only the enabled GPIO subnode
  2021-01-21 16:39 [PATCH 0/2] pinctrl: stm32: correction for pinmux status Patrick Delaunay
  2021-01-21 16:39 ` [PATCH 1/2] pinctrl: stm32: correct management pin display of OTYPE Patrick Delaunay
@ 2021-01-21 16:39 ` Patrick Delaunay
  2021-01-22  8:33   ` Patrice CHOTARD
  2021-02-09  9:33   ` Patrick DELAUNAY
  1 sibling, 2 replies; 7+ messages in thread
From: Patrick Delaunay @ 2021-01-21 16:39 UTC (permalink / raw)
  To: u-boot

Bind only the enabled GPIO subnode, to avoid to probe the node
"gpio-controller" present in SOC dtsi (disabled by default) but
not enabled in the included pincontrol dtsi file.

For example, in stm32mp15xxac-pinctrl.dtsi 2 gpio bank are absent:
 gpioj: gpio at 5000b000
 gpiok: gpio at 5000c000

Then these GPIO are absent in output of command "dm tree" and
"gpio status -a"

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---

 drivers/pinctrl/pinctrl_stm32.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/pinctrl/pinctrl_stm32.c b/drivers/pinctrl/pinctrl_stm32.c
index 374f76d881..6c98538f56 100644
--- a/drivers/pinctrl/pinctrl_stm32.c
+++ b/drivers/pinctrl/pinctrl_stm32.c
@@ -409,6 +409,9 @@ static int stm32_pinctrl_bind(struct udevice *dev)
 	dev_for_each_subnode(node, dev) {
 		dev_dbg(dev, "bind %s\n", ofnode_get_name(node));
 
+		if (!ofnode_is_enabled(node))
+			continue;
+
 		ofnode_get_property(node, "gpio-controller", &ret);
 		if (ret < 0)
 			continue;
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 1/2] pinctrl: stm32: correct management pin display of OTYPE
  2021-01-21 16:39 ` [PATCH 1/2] pinctrl: stm32: correct management pin display of OTYPE Patrick Delaunay
@ 2021-01-22  8:33   ` Patrice CHOTARD
  2021-02-09  9:33   ` Patrick DELAUNAY
  1 sibling, 0 replies; 7+ messages in thread
From: Patrice CHOTARD @ 2021-01-22  8:33 UTC (permalink / raw)
  To: u-boot

Hi Patrick

On 1/21/21 5:39 PM, Patrick Delaunay wrote:
> OTYPE can be used for output or for alternate function to select
> PP = push-pull or OP = open-drain mode, according reference manual
> (Table 81. Port bit configuration table).
> 
> This patch removes this indication for input pins and adds it
> for AF and output pins for pinmux command output.
> 
> Fixes: b305dbc08b08 ("pinctrl: stm32: display bias information for all pins")
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
> 
>  drivers/pinctrl/pinctrl_stm32.c | 18 ++++++++----------
>  1 file changed, 8 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl_stm32.c b/drivers/pinctrl/pinctrl_stm32.c
> index a1f53a793b..374f76d881 100644
> --- a/drivers/pinctrl/pinctrl_stm32.c
> +++ b/drivers/pinctrl/pinctrl_stm32.c
> @@ -56,7 +56,7 @@ static const char * const pinmux_bias[] = {
>  	[STM32_GPIO_PUPD_DOWN] = "pull-down",
>  };
>  
> -static const char * const pinmux_input[] = {
> +static const char * const pinmux_otype[] = {
>  	[STM32_GPIO_OTYPE_PP] = "push-pull",
>  	[STM32_GPIO_OTYPE_OD] = "open-drain",
>  };
> @@ -216,7 +216,7 @@ static int stm32_pinctrl_get_pin_muxing(struct udevice *dev,
>  		selector, gpio_idx, mode);
>  	priv = dev_get_priv(gpio_dev);
>  	pupd = (readl(&priv->regs->pupdr) >> (gpio_idx * 2)) & PUPD_MASK;
> -
> +	otype = (readl(&priv->regs->otyper) >> gpio_idx) & OTYPE_MSK;
>  
>  	switch (mode) {
>  	case GPIOF_UNKNOWN:
> @@ -227,18 +227,16 @@ static int stm32_pinctrl_get_pin_muxing(struct udevice *dev,
>  		break;
>  	case GPIOF_FUNC:
>  		af_num = stm32_pinctrl_get_af(gpio_dev, gpio_idx);
> -		snprintf(buf, size, "%s %d %s", pinmux_mode[mode], af_num,
> -			 pinmux_bias[pupd]);
> +		snprintf(buf, size, "%s %d %s %s", pinmux_mode[mode], af_num,
> +			 pinmux_otype[otype], pinmux_bias[pupd]);
>  		break;
>  	case GPIOF_OUTPUT:
> -		snprintf(buf, size, "%s %s %s",
> -			 pinmux_mode[mode], pinmux_bias[pupd],
> -			 label ? label : "");
> +		snprintf(buf, size, "%s %s %s %s",
> +			 pinmux_mode[mode], pinmux_otype[otype],
> +			 pinmux_bias[pupd], label ? label : "");
>  		break;
>  	case GPIOF_INPUT:
> -		otype = (readl(&priv->regs->otyper) >> gpio_idx) & OTYPE_MSK;
> -		snprintf(buf, size, "%s %s %s %s",
> -			 pinmux_mode[mode], pinmux_input[otype],
> +		snprintf(buf, size, "%s %s %s", pinmux_mode[mode],
>  			 pinmux_bias[pupd], label ? label : "");
>  		break;
>  	}
> 

Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks
Patrice

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/2] pinctrl: stm32: bind only the enabled GPIO subnode
  2021-01-21 16:39 ` [PATCH 2/2] pinctrl: stm32: bind only the enabled GPIO subnode Patrick Delaunay
@ 2021-01-22  8:33   ` Patrice CHOTARD
  2021-02-09  9:33   ` Patrick DELAUNAY
  1 sibling, 0 replies; 7+ messages in thread
From: Patrice CHOTARD @ 2021-01-22  8:33 UTC (permalink / raw)
  To: u-boot

Hi Patrick

On 1/21/21 5:39 PM, Patrick Delaunay wrote:
> Bind only the enabled GPIO subnode, to avoid to probe the node
> "gpio-controller" present in SOC dtsi (disabled by default) but
> not enabled in the included pincontrol dtsi file.
> 
> For example, in stm32mp15xxac-pinctrl.dtsi 2 gpio bank are absent:
>  gpioj: gpio at 5000b000
>  gpiok: gpio at 5000c000
> 
> Then these GPIO are absent in output of command "dm tree" and
> "gpio status -a"
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
> 
>  drivers/pinctrl/pinctrl_stm32.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/pinctrl/pinctrl_stm32.c b/drivers/pinctrl/pinctrl_stm32.c
> index 374f76d881..6c98538f56 100644
> --- a/drivers/pinctrl/pinctrl_stm32.c
> +++ b/drivers/pinctrl/pinctrl_stm32.c
> @@ -409,6 +409,9 @@ static int stm32_pinctrl_bind(struct udevice *dev)
>  	dev_for_each_subnode(node, dev) {
>  		dev_dbg(dev, "bind %s\n", ofnode_get_name(node));
>  
> +		if (!ofnode_is_enabled(node))
> +			continue;
> +
>  		ofnode_get_property(node, "gpio-controller", &ret);
>  		if (ret < 0)
>  			continue;
> 

Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks
Patrice

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] pinctrl: stm32: correct management pin display of OTYPE
  2021-01-21 16:39 ` [PATCH 1/2] pinctrl: stm32: correct management pin display of OTYPE Patrick Delaunay
  2021-01-22  8:33   ` Patrice CHOTARD
@ 2021-02-09  9:33   ` Patrick DELAUNAY
  1 sibling, 0 replies; 7+ messages in thread
From: Patrick DELAUNAY @ 2021-02-09  9:33 UTC (permalink / raw)
  To: u-boot

Hi,

On 1/21/21 5:39 PM, Patrick Delaunay wrote:
> OTYPE can be used for output or for alternate function to select
> PP = push-pull or OP = open-drain mode, according reference manual
> (Table 81. Port bit configuration table).
>
> This patch removes this indication for input pins and adds it
> for AF and output pins for pinmux command output.
>
> Fixes: b305dbc08b08 ("pinctrl: stm32: display bias information for all pins")
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
>
>   drivers/pinctrl/pinctrl_stm32.c | 18 ++++++++----------
>   1 file changed, 8 insertions(+), 10 deletions(-)
>

Applied to u-boot-stm/master, thanks!

Regards

Patrick

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/2] pinctrl: stm32: bind only the enabled GPIO subnode
  2021-01-21 16:39 ` [PATCH 2/2] pinctrl: stm32: bind only the enabled GPIO subnode Patrick Delaunay
  2021-01-22  8:33   ` Patrice CHOTARD
@ 2021-02-09  9:33   ` Patrick DELAUNAY
  1 sibling, 0 replies; 7+ messages in thread
From: Patrick DELAUNAY @ 2021-02-09  9:33 UTC (permalink / raw)
  To: u-boot

Hi,

On 1/21/21 5:39 PM, Patrick Delaunay wrote:
> Bind only the enabled GPIO subnode, to avoid to probe the node
> "gpio-controller" present in SOC dtsi (disabled by default) but
> not enabled in the included pincontrol dtsi file.
>
> For example, in stm32mp15xxac-pinctrl.dtsi 2 gpio bank are absent:
>   gpioj: gpio at 5000b000
>   gpiok: gpio at 5000c000
>
> Then these GPIO are absent in output of command "dm tree" and
> "gpio status -a"
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
>
>   drivers/pinctrl/pinctrl_stm32.c | 3 +++
>   1 file changed, 3 insertions(+)
>
Applied to u-boot-stm/master, thanks!

Regards

Patrick

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-02-09  9:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-21 16:39 [PATCH 0/2] pinctrl: stm32: correction for pinmux status Patrick Delaunay
2021-01-21 16:39 ` [PATCH 1/2] pinctrl: stm32: correct management pin display of OTYPE Patrick Delaunay
2021-01-22  8:33   ` Patrice CHOTARD
2021-02-09  9:33   ` Patrick DELAUNAY
2021-01-21 16:39 ` [PATCH 2/2] pinctrl: stm32: bind only the enabled GPIO subnode Patrick Delaunay
2021-01-22  8:33   ` Patrice CHOTARD
2021-02-09  9:33   ` Patrick DELAUNAY

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.