public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] dm: pinctrl: Skip not associated gpio phandle and rise an error message
@ 2019-09-15 11:45 Michael Trimarchi
  2019-09-17  5:48 ` Simon Glass
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Trimarchi @ 2019-09-15 11:45 UTC (permalink / raw)
  To: u-boot

Skip not associated gpio phandle let register the other gpios and
the error message add some information to debug the problem using
a decompiled version of the dts

dtc -I dtb -O dts -o devicetree.dts spl/u-boot-spl.dtb

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
---
 drivers/pinctrl/pinctrl-uclass.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-uclass.c b/drivers/pinctrl/pinctrl-uclass.c
index 5b1cd29d86..87b0c3e35b 100644
--- a/drivers/pinctrl/pinctrl-uclass.c
+++ b/drivers/pinctrl/pinctrl-uclass.c
@@ -91,12 +91,18 @@ static int pinctrl_select_state_full(struct udevice *dev, const char *statename)
 		phandle = fdt32_to_cpu(*list++);
 		ret = uclass_get_device_by_phandle_id(UCLASS_PINCONFIG, phandle,
 						      &config);
-		if (ret)
-			return ret;
+		if (ret) {
+			dev_err(dev, "%s: uclass_get_device_by_phandle_id: err=%d\n",
+				__func__, ret);
+			continue;
+		}
 
 		ret = pinctrl_config_one(config);
-		if (ret)
-			return ret;
+		if (ret) {
+			dev_err(dev, "%s: pinctrl_config_one: err=%d\n",
+				__func__, ret);
+			continue;
+		}
 	}
 
 	return 0;
-- 
2.17.1

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

* [U-Boot] [PATCH] dm: pinctrl: Skip not associated gpio phandle and rise an error message
  2019-09-15 11:45 [U-Boot] [PATCH] dm: pinctrl: Skip not associated gpio phandle and rise an error message Michael Trimarchi
@ 2019-09-17  5:48 ` Simon Glass
  2019-09-17 17:11   ` Michael Nazzareno Trimarchi
  2019-09-17 20:06   ` [U-Boot] [PATCH V2] dm: pinctrl: Skip not associated gpio phandle and rise a warning message Michael Trimarchi
  0 siblings, 2 replies; 6+ messages in thread
From: Simon Glass @ 2019-09-17  5:48 UTC (permalink / raw)
  To: u-boot

Hi Michael,

On Sun, 15 Sep 2019 at 04:45, Michael Trimarchi
<michael@amarulasolutions.com> wrote:
>
> Skip not associated gpio phandle let register the other gpios and
> the error message add some information to debug the problem using
> a decompiled version of the dts
>
> dtc -I dtb -O dts -o devicetree.dts spl/u-boot-spl.dtb
>
> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
> ---
>  drivers/pinctrl/pinctrl-uclass.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pinctrl/pinctrl-uclass.c b/drivers/pinctrl/pinctrl-uclass.c
> index 5b1cd29d86..87b0c3e35b 100644
> --- a/drivers/pinctrl/pinctrl-uclass.c
> +++ b/drivers/pinctrl/pinctrl-uclass.c
> @@ -91,12 +91,18 @@ static int pinctrl_select_state_full(struct udevice *dev, const char *statename)
>                 phandle = fdt32_to_cpu(*list++);
>                 ret = uclass_get_device_by_phandle_id(UCLASS_PINCONFIG, phandle,
>                                                       &config);
> -               if (ret)
> -                       return ret;
> +               if (ret) {
> +                       dev_err(dev, "%s: uclass_get_device_by_phandle_id: err=%d\n",
> +                               __func__, ret);
> +                       continue;

If is is an error, why continue?

Perhaps a warning or a log_debug() instead?

> +               }
>
>                 ret = pinctrl_config_one(config);
> -               if (ret)
> -                       return ret;
> +               if (ret) {
> +                       dev_err(dev, "%s: pinctrl_config_one: err=%d\n",
> +                               __func__, ret);
> +                       continue;
> +               }
>         }
>
>         return 0;
> --
> 2.17.1
>

Regards,
Simon

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

* [U-Boot] [PATCH] dm: pinctrl: Skip not associated gpio phandle and rise an error message
  2019-09-17  5:48 ` Simon Glass
@ 2019-09-17 17:11   ` Michael Nazzareno Trimarchi
  2019-09-17 20:06   ` [U-Boot] [PATCH V2] dm: pinctrl: Skip not associated gpio phandle and rise a warning message Michael Trimarchi
  1 sibling, 0 replies; 6+ messages in thread
From: Michael Nazzareno Trimarchi @ 2019-09-17 17:11 UTC (permalink / raw)
  To: u-boot

Hi

On Tue, Sep 17, 2019 at 7:48 AM Simon Glass <sjg@chromium.org> wrote:
>
> Hi Michael,
>
> On Sun, 15 Sep 2019 at 04:45, Michael Trimarchi
> <michael@amarulasolutions.com> wrote:
> >
> > Skip not associated gpio phandle let register the other gpios and
> > the error message add some information to debug the problem using
> > a decompiled version of the dts
> >
> > dtc -I dtb -O dts -o devicetree.dts spl/u-boot-spl.dtb
> >
> > Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
> > ---
> >  drivers/pinctrl/pinctrl-uclass.c | 14 ++++++++++----
> >  1 file changed, 10 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/pinctrl/pinctrl-uclass.c b/drivers/pinctrl/pinctrl-uclass.c
> > index 5b1cd29d86..87b0c3e35b 100644
> > --- a/drivers/pinctrl/pinctrl-uclass.c
> > +++ b/drivers/pinctrl/pinctrl-uclass.c
> > @@ -91,12 +91,18 @@ static int pinctrl_select_state_full(struct udevice *dev, const char *statename)
> >                 phandle = fdt32_to_cpu(*list++);
> >                 ret = uclass_get_device_by_phandle_id(UCLASS_PINCONFIG, phandle,
> >                                                       &config);
> > -               if (ret)
> > -                       return ret;
> > +               if (ret) {
> > +                       dev_err(dev, "%s: uclass_get_device_by_phandle_id: err=%d\n",
> > +                               __func__, ret);
> > +                       continue;
>
> If is is an error, why continue?

It's not a fatal error, it helps to people to fix their board-uboot.dtsi file
>
> Perhaps a warning or a log_debug() instead?

Ok I will change

Michael

>
> > +               }
> >
> >                 ret = pinctrl_config_one(config);
> > -               if (ret)
> > -                       return ret;
> > +               if (ret) {
> > +                       dev_err(dev, "%s: pinctrl_config_one: err=%d\n",
> > +                               __func__, ret);
> > +                       continue;
> > +               }
> >         }
> >
> >         return 0;
> > --
> > 2.17.1
> >
>
> Regards,
> Simon



-- 
| Michael Nazzareno Trimarchi                     Amarula Solutions BV |
| COO  -  Founder                                      Cruquiuskade 47 |
| +31(0)851119172                                 Amsterdam 1018 AM NL |
|                  [`as] http://www.amarulasolutions.com               |

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

* [U-Boot] [PATCH V2] dm: pinctrl: Skip not associated gpio phandle and rise a warning message
  2019-09-17  5:48 ` Simon Glass
  2019-09-17 17:11   ` Michael Nazzareno Trimarchi
@ 2019-09-17 20:06   ` Michael Trimarchi
  2019-09-18  2:27     ` Simon Glass
  1 sibling, 1 reply; 6+ messages in thread
From: Michael Trimarchi @ 2019-09-17 20:06 UTC (permalink / raw)
  To: u-boot

Skip not associated gpio phandle let register the other gpios on a group.
We need anyway to send out a warning to the user to fix their uboot-board.dtsi.
Thhe handle id can be found inside the decompiled dtb

dtc -I dtb -O dts -o devicetree.dts spl/u-boot-spl.dtb

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
---
V1 -> V2:
	- move dev_err to dev_warn
	- adjust the commit message
---
 drivers/pinctrl/pinctrl-uclass.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-uclass.c b/drivers/pinctrl/pinctrl-uclass.c
index 5b1cd29d86..7d98fbc4ec 100644
--- a/drivers/pinctrl/pinctrl-uclass.c
+++ b/drivers/pinctrl/pinctrl-uclass.c
@@ -91,12 +91,18 @@ static int pinctrl_select_state_full(struct udevice *dev, const char *statename)
 		phandle = fdt32_to_cpu(*list++);
 		ret = uclass_get_device_by_phandle_id(UCLASS_PINCONFIG, phandle,
 						      &config);
-		if (ret)
-			return ret;
+		if (ret) {
+			dev_warn(dev, "%s: uclass_get_device_by_phandle_id: err=%d\n",
+				__func__, ret);
+			continue;
+		}
 
 		ret = pinctrl_config_one(config);
-		if (ret)
-			return ret;
+		if (ret) {
+			dev_warn(dev, "%s: pinctrl_config_one: err=%d\n",
+				__func__, ret);
+			continue;
+		}
 	}
 
 	return 0;
-- 
2.17.1

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

* [U-Boot] [PATCH V2] dm: pinctrl: Skip not associated gpio phandle and rise a warning message
  2019-09-17 20:06   ` [U-Boot] [PATCH V2] dm: pinctrl: Skip not associated gpio phandle and rise a warning message Michael Trimarchi
@ 2019-09-18  2:27     ` Simon Glass
  2019-09-27 23:28       ` sjg at google.com
  0 siblings, 1 reply; 6+ messages in thread
From: Simon Glass @ 2019-09-18  2:27 UTC (permalink / raw)
  To: u-boot

On Tue, 17 Sep 2019 at 13:06, Michael Trimarchi
<michael@amarulasolutions.com> wrote:
>
> Skip not associated gpio phandle let register the other gpios on a group.
> We need anyway to send out a warning to the user to fix their uboot-board.dtsi.
> Thhe handle id can be found inside the decompiled dtb
>
> dtc -I dtb -O dts -o devicetree.dts spl/u-boot-spl.dtb
>
> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
> ---
> V1 -> V2:
>         - move dev_err to dev_warn
>         - adjust the commit message
> ---
>  drivers/pinctrl/pinctrl-uclass.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

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

* [U-Boot] [PATCH V2] dm: pinctrl: Skip not associated gpio phandle and rise a warning message
  2019-09-18  2:27     ` Simon Glass
@ 2019-09-27 23:28       ` sjg at google.com
  0 siblings, 0 replies; 6+ messages in thread
From: sjg at google.com @ 2019-09-27 23:28 UTC (permalink / raw)
  To: u-boot

On Tue, 17 Sep 2019 at 13:06, Michael Trimarchi
<michael@amarulasolutions.com> wrote:
>
> Skip not associated gpio phandle let register the other gpios on a group.
> We need anyway to send out a warning to the user to fix their uboot-board.dtsi.
> Thhe handle id can be found inside the decompiled dtb
>
> dtc -I dtb -O dts -o devicetree.dts spl/u-boot-spl.dtb
>
> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
> ---
> V1 -> V2:
>         - move dev_err to dev_warn
>         - adjust the commit message
> ---
>  drivers/pinctrl/pinctrl-uclass.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks!

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

end of thread, other threads:[~2019-09-27 23:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-15 11:45 [U-Boot] [PATCH] dm: pinctrl: Skip not associated gpio phandle and rise an error message Michael Trimarchi
2019-09-17  5:48 ` Simon Glass
2019-09-17 17:11   ` Michael Nazzareno Trimarchi
2019-09-17 20:06   ` [U-Boot] [PATCH V2] dm: pinctrl: Skip not associated gpio phandle and rise a warning message Michael Trimarchi
2019-09-18  2:27     ` Simon Glass
2019-09-27 23:28       ` sjg at google.com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox