gpio: uclass: Introduce gpio-hog-optional property
PATCH 1/1 gpio: uclass: Introduce gpio-hog-optional property
gpio_hog_probe_all is invoked by init_sequence_r in board_r.c. If device_probe fails for any gpio-hog, boot hangs with the following error:
Quoted 2 lines
initcall sequence
00000000fffc8e18failed at call000000004023b320(err=-121) ### ERROR ### Please RESET the board ###
gpio-hog-optional allows the boot sequence to continue if device_probe fails for optional gpio-hog(s).
--- doc/device-tree-bindings/gpio/gpio.txt | 1 + drivers/gpio/gpio-uclass.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-)
doc/device-tree-bindings/gpio/gpio.txt +1 -0
@@ -189,6 +189,7 @@ gpio-controller's driver probe function. Each GPIO hog definition is represented as a child node of the GPIO controller. Required properties: - gpio-hog: A property specifying that this child node represents a GPIO hog. +- gpio-hog-optional: A property specifying to continue boot when device_probe fails in gpio_hog_probe_all - gpios: Store the GPIO information (id, flags, ...) for each GPIO to affect. Shall contain an integer multiple of the number of cells specified in its parent node (GPIO controller node).
drivers/gpio/gpio-uclass.c +3 -1
@@ -329,7 +329,9 @@ int gpio_hog_probe_all(void)if (ret) {printf ("Failed to probe device %s err: %d\n" , dev->name, ret); - retval = ret; +if (!dev_read_bool (dev,"gpio-hog-optional" )) { + retval = ret; + } } } }
Signature · 1 line
2.37.3
Quoted 7 lines · Nate Drude
gpio_hog_probe_allis invoked byinit_sequence_rinboard_r.c. Ifdevice_probefails for any gpio-hog, boot hangs with the following error:Quoted 2 lines
initcall sequence
00000000fffc8e18failed at call000000004023b320(err=-121) ### ERROR ### Please RESET the board ###
Quoted 8 lines
gpio-hog-optional allows the boot sequence to continue if
device_probefails for optional gpio-hog(s).Signed-off-by Nate Drude <[email protected]>--- doc/device-tree-bindings/gpio/gpio.txt | 1 + drivers/gpio/gpio-uclass.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-)
nit below
Quoted 18 lines
doc/device-tree-bindings/gpio/gpio.txt +1
-0@@ -189,6 +189,7 @@ gpio-controller's driver probe function. Each GPIO hog definition is represented as a child node of the GPIO controller. Required properties: - gpio-hog: A property specifying that this child node represents a GPIO hog. +- gpio-hog-optional: A property specifying to continue boot when device_probe fails in gpio_hog_probe_all - gpios: Store the GPIO information (id, flags, ...) for each GPIO to affect. Shall contain an integer multiple of the number of cells specified in its parent node (GPIO controller node).drivers/gpio/gpio-uclass.c +0
-0
drivers/gpio/gpio-uclass.c int gpio_hog_probe_all(void) · line 334
Quoted 7 lines
drivers/gpio/gpio-uclass.c +3
-1@@ -329,7 +329,9 @@ int gpio_hog_probe_all(void)if (ret) {printf ("Failed to probe device %s err: %d\n" , dev->name, ret); - retval = ret; +if (!dev_read_bool (dev,"gpio-hog-optional" )) { + retval = ret; + }
Should not have {} for single-line statements
Quoted 6 lines
drivers/gpio/gpio-uclass.c +0
-1} } } --2.37.3
Regards,
Simon
Hi Nate and Simon,
Quoted 21 lines · Nate Drude
gpio_hog_probe_allis invoked byinit_sequence_rinboard_r.c. Ifdevice_probefails for any gpio-hog, boot hangs with the following error:Quoted 2 lines
initcall sequence
00000000fffc8e18failed at call000000004023b320(err=-121) ### ERROR ### Please RESET the board ###gpio-hog-optional allows the boot sequence to continue if
device_probefails for optional gpio-hog(s).Signed-off-by Nate Drude <[email protected]>--- doc/device-tree-bindings/gpio/gpio.txt | 1 + drivers/gpio/gpio-uclass.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-)doc/device-tree-bindings/gpio/gpio.txt +0
-0
doc/device-tree-bindings/gpio/gpio.txt gpio-controller's driver probe function. · line 192
Quoted 4 lines
doc/device-tree-bindings/gpio/gpio.txt +1
-0@@ -189,6 +189,7 @@ gpio-controller's driver probe function. Each GPIO hog definition is represented as a child node of the GPIO controller. Required properties: - gpio-hog: A property specifying that this child node represents a GPIO hog. +- gpio-hog-optional: A property specifying to continue boot when device_probe fails in gpio_hog_probe_all
gpio-hog-optional property does not exist in Linux.
If this property is introduced then U-Boot and Linux devicetrees will not be in sync.
Can this be fixed differently?
Hi,
Quoted 32 lines · Fabio Estevam
Hi Nate and Simon,
Quoted 21 lines · Nate Drude
gpio_hog_probe_allis invoked byinit_sequence_rinboard_r.c. Ifdevice_probefails for any gpio-hog, boot hangs with the following error:Quoted 2 lines
initcall sequence
00000000fffc8e18failed at call000000004023b320(err=-121) ### ERROR ### Please RESET the board ###gpio-hog-optional allows the boot sequence to continue if
device_probefails for optional gpio-hog(s).Signed-off-by Nate Drude <[email protected]>--- doc/device-tree-bindings/gpio/gpio.txt | 1 + drivers/gpio/gpio-uclass.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-)doc/device-tree-bindings/gpio/gpio.txt +0
-0doc/device-tree-bindings/gpio/gpio.txt gpio-controller's driver probe function. · line 192
Quoted 4 lines
doc/device-tree-bindings/gpio/gpio.txt +1
-0@@ -189,6 +189,7 @@ gpio-controller's driver probe function. Each GPIO hog definition is represented as a child node of the GPIO controller. Required properties: - gpio-hog: A property specifying that this child node represents a GPIO hog. +- gpio-hog-optional: A property specifying to continue boot when device_probe fails in gpio_hog_probe_allgpio-hog-optional property does not exist in Linux.
Quoted 4 lines
If this property is introduced then U-Boot and Linux devicetrees will not be in sync.
Can this be fixed differently?
Nate, can you send a patch to Linux with the binding update?
Regards,
Simon
Hi Simon and Fabio,
Quoted 38 lines · Simon Glass
Hi,
Quoted 35 lines · Fabio Estevam
Hi Nate and Simon,
Quoted 21 lines · Nate Drude
gpio_hog_probe_allis invoked byinit_sequence_rinboard_r.c. Ifdevice_probefails for any gpio-hog, boot hangs with the following error:Quoted 2 lines
initcall sequence
00000000fffc8e18failed at call000000004023b320(err=-121) ### ERROR ### Please RESET the board ###gpio-hog-optional allows the boot sequence to continue if
device_probefails for optional gpio-hog(s).Signed-off-by Nate Drude <[email protected]>--- doc/device-tree-bindings/gpio/gpio.txt | 1 + drivers/gpio/gpio-uclass.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-)doc/device-tree-bindings/gpio/gpio.txt +0
-0doc/device-tree-bindings/gpio/gpio.txt gpio-controller's driver probe function. · line 192
Quoted 4 lines
doc/device-tree-bindings/gpio/gpio.txt +1
-0@@ -189,6 +189,7 @@ gpio-controller's driver probe function. Each GPIO hog definition is represented as a child node of the GPIO controller. Required properties: - gpio-hog: A property specifying that this child node represents a GPIO hog. +- gpio-hog-optional: A property specifying to continue boot when device_probe fails in gpio_hog_probe_allgpio-hog-optional property does not exist in Linux.
If this property is introduced then U-Boot and Linux devicetrees will not be in sync.
Quoted 6 lines
Quoted 1 line
Can this be fixed differently?
Nate, can you send a patch to Linux with the binding update?
Regards,
Simon
Thanks for your responses and feedback.
I don't think gpio-hog-optional is relevant to Linux.
The problem is if gpio_hog_probe_all returns an error, board_init_r will hang()
See:
- https://github.com/u-boot/u-boot/blob/v2022.07/common/board_r.c#L824-L825
- https://github.com/u-boot/u-boot/blob/v2022.07/common/board_r.c#L763
- https://github.com/u-boot/u-boot/blob/v2022.07/drivers/gpio/gpio-uclass.c#L330-L332
A practical example of how this may occur is when an i2c gpio expander (e.g. nxp,pca9534) uses gpio-hog, but the gpio expander is depopulated.
Arguably, the best solution is to use a different device tree when the gpio expander is not populated. This patch allows the gpio-hog to fail gracefully and continue booting if gpio-hog-optional is used.
Do you have any suggestions for a better approach? Does it make sense for gpio_hog_probe_all to cause a fatal error when the gpio hog probe fails (most devices, including the gpio-expander, will not cause a hang if they fail to probe)?
Regards,
Nate
Hi Nate,
Quoted 44 lines · Nate Drude
Hi Simon and Fabio,
Quoted 40 lines · Simon Glass
Hi,
Quoted 36 lines · Fabio Estevam
Hi Nate and Simon,
Quoted 21 lines · Nate Drude
gpio_hog_probe_allis invoked byinit_sequence_rinboard_r.c. Ifdevice_probefails for any gpio-hog, boot hangs with the following error:Quoted 2 lines
initcall sequence
00000000fffc8e18failed at call000000004023b320(err=-121) ### ERROR ### Please RESET the board ###gpio-hog-optional allows the boot sequence to continue if
device_probefails for optional gpio-hog(s).Signed-off-by Nate Drude <[email protected]>--- doc/device-tree-bindings/gpio/gpio.txt | 1 + drivers/gpio/gpio-uclass.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-)doc/device-tree-bindings/gpio/gpio.txt +0
-0doc/device-tree-bindings/gpio/gpio.txt gpio-controller's driver probe function. · line 192
Quoted 4 lines
doc/device-tree-bindings/gpio/gpio.txt +1
-0@@ -189,6 +189,7 @@ gpio-controller's driver probe function. Each GPIO hog definition is represented as a child node of the GPIO controller. Required properties: - gpio-hog: A property specifying that this child node represents a GPIO hog. +- gpio-hog-optional: A property specifying to continue boot when device_probe fails in gpio_hog_probe_allgpio-hog-optional property does not exist in Linux.
If this property is introduced then U-Boot and Linux devicetrees will not be in sync.
Can this be fixed differently?
Quoted 8 lines
Quoted 4 lines
Nate, can you send a patch to Linux with the binding update?
Regards,
SimonThanks for your responses and feedback.
I don't think gpio-hog-optional is relevant to Linux.
Sure, but Linux is (for better or worse) the main repo for the device tree bindings.
Quoted 13 lines
The problem is if
gpio_hog_probe_allreturns an error,board_init_rwillhang()See:
- https://github.com/u-boot/u-boot/blob/v2022.07/common/board_r.c#L824-L825
- https://github.com/u-boot/u-boot/blob/v2022.07/common/board_r.c#L763
-
https://github.com/u-boot/u-boot/blob/v2022.07/drivers/gpio/gpio-uclass.c#L330-L332A practical example of how this may occur is when an i2c gpio expander (e.g. nxp,pca9534) uses gpio-hog, but the gpio expander is depopulated.
Quoted 8 lines
Arguably, the best solution is to use a different device tree when the gpio expander is not populated. This patch allows the gpio-hog to fail gracefully and continue booting if gpio-hog-optional is used.
Do you have any suggestions for a better approach? Does it make sense for
gpio_hog_probe_allto cause a fatal error when the gpio hog probe fails (most devices, including the gpio-expander, will not cause a hang if they fail to probe)?
I think your approach is fine as is.
Regards,
Simon
Hi Simon,
Quoted 52 lines · Simon Glass
Hi Nate,
Quoted 49 lines · Nate Drude
Hi Simon and Fabio,
Quoted 44 lines · Simon Glass
Hi,
Quoted 32 lines · Fabio Estevam
Hi Nate and Simon,
Quoted 21 lines · Nate Drude
gpio_hog_probe_allis invoked byinit_sequence_rinboard_r.c. Ifdevice_probefails for any gpio-hog, boot hangs with the following error:Quoted 2 lines
initcall sequence
00000000fffc8e18failed at call000000004023b320(err=-121) ### ERROR ### Please RESET the board ###gpio-hog-optional allows the boot sequence to continue if
device_probefails for optional gpio-hog(s).Signed-off-by Nate Drude <[email protected]>--- doc/device-tree-bindings/gpio/gpio.txt | 1 + drivers/gpio/gpio-uclass.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-)doc/device-tree-bindings/gpio/gpio.txt +0
-0doc/device-tree-bindings/gpio/gpio.txt gpio-controller's driver probe function. · line 192
Quoted 4 lines
doc/device-tree-bindings/gpio/gpio.txt +1
-0@@ -189,6 +189,7 @@ gpio-controller's driver probe function. Each GPIO hog definition is represented as a child node of the GPIO controller. Required properties: - gpio-hog: A property specifying that this child node represents a GPIO hog. +- gpio-hog-optional: A property specifying to continue boot when device_probe fails in gpio_hog_probe_allgpio-hog-optional property does not exist in Linux.
Quoted 4 lines
If this property is introduced then U-Boot and Linux devicetrees will not be in sync.
Can this be fixed differently?
Nate, can you send a patch to Linux with the binding update?
Regards,
Simon
Quoted 6 lines
Quoted 3 lines
Thanks for your responses and feedback.
I don't think gpio-hog-optional is relevant to Linux.
Sure, but Linux is (for better or worse) the main repo for the device tree bindings.
I am not understanding the action. I think you're suggesting I update the Linux device tree bindings so they stay aligned with U-Boot, adding a property gpio-hog-optional after this line: https://github.com/torvalds/linux/blob/v6.0-rc5/Documentation/devicetree/bindings/gpio/gpio.txt#L191
However, since it's not relevant to Linux, I think it will be confusing since it will have no effect and won't be be used in any Linux code.
Can you please advise what description I should use for the gpio-hog-optional property so that the Linux maintainers would accept such a patch?
Quoted 18 lines
Quoted 18 lines
The problem is if
gpio_hog_probe_allreturns an error,board_init_rwillhang()See:
- https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fu-boot%2Fu-boot%2Fblob%2Fv2022.07%2Fcommon%2Fboard_r.c%23L824-L825&data=05%7C01%7Cnate.d%40variscite.com%7C105f793941264d50bdad08da964f8a23%7C399ae6ac38f44ef094a8440b0ad581de%7C1%7C0%7C637987565614703613%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=wU%2Fz3uWE%2Bqj6jKzLeCx61Gfvyln7z60jRmONTN5Q46o%3D&reserved=0
- https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fu-boot%2Fu-boot%2Fblob%2Fv2022.07%2Fcommon%2Fboard_r.c%23L763&data=05%7C01%7Cnate.d%40variscite.com%7C105f793941264d50bdad08da964f8a23%7C399ae6ac38f44ef094a8440b0ad581de%7C1%7C0%7C637987565614703613%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=b%2BtvcG21zH4WZqP39DFs%2FylUD9UOZp6tRZ%2BmeUwL2lc%3D&reserved=0
-
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fu-boot%2Fu-boot%2Fblob%2Fv2022.07%2Fdrivers%2Fgpio%2Fgpio-uclass.c%23L330-L332&data=05%7C01%7Cnate.d%40variscite.com%7C105f793941264d50bdad08da964f8a23%7C399ae6ac38f44ef094a8440b0ad581de%7C1%7C0%7C637987565614859942%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=FwqsboWzGmSdUHrFUL48AwfTDbAPFpUmKbaQJEnprq0%3D&reserved=0A practical example of how this may occur is when an i2c gpio expander (e.g. nxp,pca9534) uses gpio-hog, but the gpio expander is depopulated.
Arguably, the best solution is to use a different device tree when the gpio expander is not populated. This patch allows the gpio-hog to fail gracefully and continue booting if gpio-hog-optional is used.
Quoted 6 lines
Quoted 4 lines
Do you have any suggestions for a better approach? Does it make sense for
gpio_hog_probe_allto cause a fatal error when the gpio hog probe fails (most devices, including the gpio-expander, will not cause a hang if they fail to probe)?I think your approach is fine as is.
An alternate approach is to modify the default behavior so that gpio_hog_probe_all will not trigger a fatal error. Do you think this is better?
Quoted 3 lines
Regards,
Simon
Thanks,
Nate
Hi Nate,
Quoted 3 lines · Nate Drude
An alternate approach is to modify the default behavior so that
gpio_hog_probe_allwill not trigger a fatal error. Do you think this is better?
IMHO that would be better, as we could keep using the same devicetree files from Linux.
Thanks
Quoted 66 lines · Nate Drude
Hi Simon,
Quoted 52 lines · Simon Glass
Hi Nate,
Quoted 49 lines · Nate Drude
Hi Simon and Fabio,
Quoted 44 lines · Simon Glass
Hi,
Quoted 32 lines · Fabio Estevam
Hi Nate and Simon,
Quoted 21 lines · Nate Drude
gpio_hog_probe_allis invoked byinit_sequence_rinboard_r.c. Ifdevice_probefails for any gpio-hog, boot hangs with the following error:Quoted 2 lines
initcall sequence
00000000fffc8e18failed at call000000004023b320(err=-121) ### ERROR ### Please RESET the board ###gpio-hog-optional allows the boot sequence to continue if
device_probefails for optional gpio-hog(s).Signed-off-by Nate Drude <[email protected]>--- doc/device-tree-bindings/gpio/gpio.txt | 1 + drivers/gpio/gpio-uclass.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-)doc/device-tree-bindings/gpio/gpio.txt +0
-0doc/device-tree-bindings/gpio/gpio.txt gpio-controller's driver probe function. · line 192
Quoted 4 lines
doc/device-tree-bindings/gpio/gpio.txt +1
-0@@ -189,6 +189,7 @@ gpio-controller's driver probe function. Each GPIO hog definition is represented as a child node of the GPIO controller. Required properties: - gpio-hog: A property specifying that this child node represents a GPIO hog. +- gpio-hog-optional: A property specifying to continue boot when device_probe fails in gpio_hog_probe_allgpio-hog-optional property does not exist in Linux.
Quoted 4 lines
If this property is introduced then U-Boot and Linux devicetrees will not be in sync.
Can this be fixed differently?
Nate, can you send a patch to Linux with the binding update?
Regards,
SimonQuoted 6 lines
Quoted 3 lines
Thanks for your responses and feedback.
I don't think gpio-hog-optional is relevant to Linux.
Sure, but Linux is (for better or worse) the main repo for the device tree bindings.
I am not understanding the action. I think you're suggesting I update the
Linux device tree bindings so they stay aligned with U-Boot, adding a
property gpio-hog-optional after this line: https://github.com/torvalds/linux/blob/v6.0-rc5/Documentation/devicetree/bindings/gpio/gpio.txt#L191
Quoted 6 lines
However, since it's not relevant to Linux, I think it will be confusing since it will have no effect and won't be be used in any Linux code.
Can you please advise what description I should use for the gpio-hog-optional property so that the Linux maintainers would accept such a patch?
Yes, that would be one way to go about this, and there are other non-Linux bindings in the Linux kernel tree, but this might be the first property of an existing binding, so that might also be a bit challenging to get accepted, or find out what the preferred solution is.
[snip]
Quoted 10 lines
Quoted 6 lines
Quoted 4 lines
Do you have any suggestions for a better approach? Does it make sense for
gpio_hog_probe_allto cause a fatal error when the gpio hog probe fails (most devices, including the gpio-expander, will not cause a hang if they fail to probe)?I think your approach is fine as is.
An alternate approach is to modify the default behavior so that
gpio_hog_probe_allwill not trigger a fatal error. Do you think this is better?
This too would be acceptable.
Signature · 1 line
Tom
Hi All,
Quoted 85 lines · Tom Rini
Quoted 66 lines · Nate Drude
Hi Simon,
Quoted 52 lines · Simon Glass
Hi Nate,
Quoted 49 lines · Nate Drude
Hi Simon and Fabio,
Quoted 44 lines · Simon Glass
Hi,
Quoted 32 lines · Fabio Estevam
Hi Nate and Simon,
Quoted 21 lines · Nate Drude
gpio_hog_probe_allis invoked byinit_sequence_rinboard_r.c. Ifdevice_probefails for any gpio-hog, boot hangs with the following error:Quoted 2 lines
initcall sequence
00000000fffc8e18failed at call000000004023b320(err=-121) ### ERROR ### Please RESET the board ###gpio-hog-optional allows the boot sequence to continue if
device_probefails for optional gpio-hog(s).Signed-off-by Nate Drude <[email protected]>--- doc/device-tree-bindings/gpio/gpio.txt | 1 + drivers/gpio/gpio-uclass.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-)doc/device-tree-bindings/gpio/gpio.txt +0
-0doc/device-tree-bindings/gpio/gpio.txt gpio-controller's driver probe function. · line 192
Quoted 4 lines
doc/device-tree-bindings/gpio/gpio.txt +1
-0@@ -189,6 +189,7 @@ gpio-controller's driver probe function. Each GPIO hog definition is represented as a child node of the GPIO controller. Required properties: - gpio-hog: A property specifying that this child node represents a GPIO hog. +- gpio-hog-optional: A property specifying to continue boot when device_probe fails in gpio_hog_probe_allgpio-hog-optional property does not exist in Linux.
Quoted 4 lines
If this property is introduced then U-Boot and Linux devicetrees will not be in sync.
Can this be fixed differently?
Nate, can you send a patch to Linux with the binding update?
Regards,
SimonQuoted 6 lines
Quoted 3 lines
Thanks for your responses and feedback.
I don't think gpio-hog-optional is relevant to Linux.
Sure, but Linux is (for better or worse) the main repo for the device tree bindings.
I am not understanding the action. I think you're suggesting I update the
Linux device tree bindings so they stay aligned with U-Boot, adding a
property gpio-hog-optional after this line: https://github.com/torvalds/linux/blob/v6.0-rc5/Documentation/devicetree/bindings/gpio/gpio.txt#L191Quoted 6 lines
However, since it's not relevant to Linux, I think it will be confusing since it will have no effect and won't be be used in any Linux code.
Can you please advise what description I should use for the gpio-hog-optional property so that the Linux maintainers would accept such a patch?
Yes, that would be one way to go about this, and there are other non-Linux bindings in the Linux kernel tree, but this might be the first property of an existing binding, so that might also be a bit challenging to get accepted, or find out what the preferred solution is.
[snip]
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Do you have any suggestions for a better approach? Does it make sense for
gpio_hog_probe_allto cause a fatal error when the gpio hog probe fails (most devices, including the gpio-expander, will not cause a hang if they fail to probe)?
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
I think your approach is fine as is.
An alternate approach is to modify the default behavior so that
gpio_hog_probe_allwill not trigger a fatal error. Do you think this is better?This too would be acceptable.
Thanks for the discussion and feedback. I prefer to avoid changing the bindings in Linux if possible.
Would it be acceptable if I rework gpio_hog_probe_all so that it prints an error "Failed to probe device..." if any device_probe fails, but always returns 0 to avoid a fatal error in board_init_r? I can submit a v2 patch, but I want to screen any problems with the approach first.
Thanks,
Nate
Hi,
Quoted 77 lines · Nate Drude
Hi All,
Quoted 73 lines · Tom Rini
Quoted 72 lines · Nate Drude
Hi Simon,
Quoted 52 lines · Simon Glass
Hi Nate,
Quoted 49 lines · Nate Drude
Hi Simon and Fabio,
Quoted 44 lines · Simon Glass
Hi,
Quoted 32 lines · Fabio Estevam
Hi Nate and Simon,
Quoted 21 lines · Nate Drude
gpio_hog_probe_allis invoked byinit_sequence_rinboard_r.c. Ifdevice_probefails for any gpio-hog, boot hangs with the following error:Quoted 2 lines
initcall sequence
00000000fffc8e18failed at call000000004023b320(err=-121) ### ERROR ### Please RESET the board ###gpio-hog-optional allows the boot sequence to continue if
device_probefails for optional gpio-hog(s).Signed-off-by Nate Drude <[email protected]>--- doc/device-tree-bindings/gpio/gpio.txt | 1 + drivers/gpio/gpio-uclass.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-)doc/device-tree-bindings/gpio/gpio.txt +0
-0doc/device-tree-bindings/gpio/gpio.txt gpio-controller's driver probe function. · line 192
Quoted 4 lines
doc/device-tree-bindings/gpio/gpio.txt +1
-0@@ -189,6 +189,7 @@ gpio-controller's driver probe function. Each GPIO hog definition is represented as a child node of the GPIO controller. Required properties: - gpio-hog: A property specifying that this child node represents a GPIO hog. +- gpio-hog-optional: A property specifying to continue boot when device_probe fails in gpio_hog_probe_allgpio-hog-optional property does not exist in Linux.
Quoted 4 lines
If this property is introduced then U-Boot and Linux devicetrees will not be in sync.
Can this be fixed differently?
Nate, can you send a patch to Linux with the binding update?
Regards,
SimonQuoted 6 lines
Quoted 3 lines
Thanks for your responses and feedback.
I don't think gpio-hog-optional is relevant to Linux.
Sure, but Linux is (for better or worse) the main repo for the device tree bindings.
I am not understanding the action. I think you're suggesting I update the
Linux device tree bindings so they stay aligned with U-Boot, adding a
property gpio-hog-optional after this line: https://github.com/torvalds/linux/blob/v6.0-rc5/Documentation/devicetree/bindings/gpio/gpio.txt#L191However, since it's not relevant to Linux, I think it will be confusing since it will have no effect and won't be be used in any Linux code.
Can you please advise what description I should use for the gpio-hog-optional property so that the Linux maintainers would accept such a patch?
You can mention why it is needed and use a u-boot, property-name prefix perhaps.
Quoted 12 lines
Quoted 12 lines
Yes, that would be one way to go about this, and there are other non-Linux bindings in the Linux kernel tree, but this might be the first property of an existing binding, so that might also be a bit challenging to get accepted, or find out what the preferred solution is.
[snip]
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Do you have any suggestions for a better approach? Does it make sense for
gpio_hog_probe_allto cause a fatal error when the gpio hog probe fails (most devices, including the gpio-expander, will not cause a hang if they fail to probe)?
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
I think your approach is fine as is.
An alternate approach is to modify the default behavior so that
gpio_hog_probe_allwill not trigger a fatal error. Do you think this is better?This too would be acceptable.
I don't like this as it introduces undefined behaviour and may cause the boot to fail with no indication of what has happened, nor any way for higher-level code to resolve the issue.
Anything we do here should be deterministic. Failures should be ignored only when the board vendor wants that.
Quoted 9 lines
Quoted 1 line
Thanks for the discussion and feedback. I prefer to avoid changing the bindings in Linux if possible.
Would it be acceptable if I rework
gpio_hog_probe_allso that it prints an error "Failed to probe device..." if anydevice_probefails, but always returns 0 to avoid a fatal error inboard_init_r? I can submit a v2 patch, but I want to screen any problems with the approach first.
How would this be controlled? One option might be to add a binding to the /options node. I don't like it, but it could be a fallback if you get push-back on this binding.
Regards,
Simon
Hi Nate,
Quoted 7 lines · Nate Drude
Thanks for the discussion and feedback. I prefer to avoid changing the bindings in Linux if possible.
Would it be acceptable if I rework
gpio_hog_probe_allso that it prints an error "Failed to probe device..." if anydevice_probefails, but always returns 0 to avoid a fatal error inboard_init_r? I can submit a v2 patch, but I want to screen any problems with the approach first.
Does the patch from Marek help?
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/