Re: [U-Boot] [PATCH v1 2/2] dm: pinctrl: Skip gpio-controller node in pinconfig_post_bind()

2019-02-18 Thread Patrick DELAUNAY
Hi,

> From: Simon Glass 
> Sent: vendredi 15 février 2019 18:12
> 
> On Fri, 15 Feb 2019 at 15:31, Patrice Chotard  wrote:
> >
> > From: Patrick Delaunay 
> >
> > Some binding define child node gpio-controller without compatible property.
> > This patch avoid to bind the pinconfig uclass to these node.
> 
> Some bindings define a child node gpio-controller without a compatible 
> property.
> Avoid binding the pinconfig uclass to these node since ...(add explanation 
> here)

Ok , we will add more explanation in v2.

For example, the binding for st,stm32-pinctrl  
(./device-tree-bindings/pinctrl/st,stm32-pinctrl.txt)
defines the GPIO controller/bank node as sub-node of pincontrol (for example 
st,stm32f429-pinctrl)
but without compatible (as it is not mandatory).

Without the added check, the gpio node with " gpio-controller" parameter is 
bounded as pinconfig.
This patch remove the need to add a compatible in u-boot device tree.

As example ./arch/arm/dts/stm32f429-disco-u-boot.dtsi

 {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};

 {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};


 {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};


PS: today "st,stm32-gpio" is still needing to bind the driver 
drivers/gpio/stm32f7_gpio.c
  To gpio-controller node...
   But we are expecting to remove this modification of kernel device tree 
by directly 
   bind sub-node to UCLASS_GPIO "gpio_stm32" in pincontrol driver.


static int stm32_pinctrl_bind(struct udevice *dev)
{
const void *blob = gd->fdt_blob;
int offset = dev_of_offset(dev);
const char *name;
int ret;

for (offset = fdt_first_subnode(blob, offset);
 offset > 0;
 offset = fdt_next_subnode(blob, offset)) {
fdt_get_property(blob, offset, "gpio-controller", );
if (ret < 0)
continue;
/* Get the name of each gpio node */
name = fdt_get_name(blob, offset, NULL);
if (!name)
return -EINVAL;

/* Bind each gpio node */
ret = device_bind_driver_to_node(dev, "stm32mp-gpio",
 name, offset, NULL);
if (ret)
return ret;

debug("%s: bind %s\n", __func__, name);
}

return 0;
}

> >
> > Signed-off-by: Patrick Delaunay 
> > Signed-off-by: Patrice Chotard 
> > ---
> >
> >  drivers/pinctrl/pinctrl-uclass.c | 3 +++
> >  1 file changed, 3 insertions(+)
> 
> Reviewed-by: Simon Glass 
> 
> 
> >
> > diff --git a/drivers/pinctrl/pinctrl-uclass.c 
> > b/drivers/pinctrl/pinctrl-uclass.c
> > index abb622cfe79e..9df06a262cd5 100644
> > --- a/drivers/pinctrl/pinctrl-uclass.c
> > +++ b/drivers/pinctrl/pinctrl-uclass.c
> > @@ -149,6 +149,9 @@ static int pinconfig_post_bind(struct udevice *dev)
> > ofnode_get_property(node, "compatible", );
> > if (ret >= 0)
> > continue;
> > +   /* If this node has "gpio-controller" property, skip */
> > +   if (ofnode_read_bool(node, "gpio-controller"))
> > +   continue;
> >
> > if (ret != -FDT_ERR_NOTFOUND)
> > return ret;
> > --
> > 1.9.1
> >

Patrick
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v1 2/2] dm: pinctrl: Skip gpio-controller node in pinconfig_post_bind()

2019-02-15 Thread Simon Glass
On Fri, 15 Feb 2019 at 15:31, Patrice Chotard  wrote:
>
> From: Patrick Delaunay 
>
> Some binding define child node gpio-controller without compatible property.
> This patch avoid to bind the pinconfig uclass to these node.

Some bindings define a child node gpio-controller without a compatible property.
Avoid binding the pinconfig uclass to these node since ...(add explanation here)

>
> Signed-off-by: Patrick Delaunay 
> Signed-off-by: Patrice Chotard 
> ---
>
>  drivers/pinctrl/pinctrl-uclass.c | 3 +++
>  1 file changed, 3 insertions(+)

Reviewed-by: Simon Glass 


>
> diff --git a/drivers/pinctrl/pinctrl-uclass.c 
> b/drivers/pinctrl/pinctrl-uclass.c
> index abb622cfe79e..9df06a262cd5 100644
> --- a/drivers/pinctrl/pinctrl-uclass.c
> +++ b/drivers/pinctrl/pinctrl-uclass.c
> @@ -149,6 +149,9 @@ static int pinconfig_post_bind(struct udevice *dev)
> ofnode_get_property(node, "compatible", );
> if (ret >= 0)
> continue;
> +   /* If this node has "gpio-controller" property, skip */
> +   if (ofnode_read_bool(node, "gpio-controller"))
> +   continue;
>
> if (ret != -FDT_ERR_NOTFOUND)
> return ret;
> --
> 1.9.1
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v1 2/2] dm: pinctrl: Skip gpio-controller node in pinconfig_post_bind()

2019-02-15 Thread Patrice Chotard
From: Patrick Delaunay 

Some binding define child node gpio-controller without compatible property.
This patch avoid to bind the pinconfig uclass to these node.

Signed-off-by: Patrick Delaunay 
Signed-off-by: Patrice Chotard 
---

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

diff --git a/drivers/pinctrl/pinctrl-uclass.c b/drivers/pinctrl/pinctrl-uclass.c
index abb622cfe79e..9df06a262cd5 100644
--- a/drivers/pinctrl/pinctrl-uclass.c
+++ b/drivers/pinctrl/pinctrl-uclass.c
@@ -149,6 +149,9 @@ static int pinconfig_post_bind(struct udevice *dev)
ofnode_get_property(node, "compatible", );
if (ret >= 0)
continue;
+   /* If this node has "gpio-controller" property, skip */
+   if (ofnode_read_bool(node, "gpio-controller"))
+   continue;
 
if (ret != -FDT_ERR_NOTFOUND)
return ret;
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot