usb: dwc3: Use the devm_gpiod_get_optional() API for reset gpio
Subsystems (2)
PATCH v2 1/1 usb: dwc3: Use the devm_gpiod_get_optional() API for reset gpio
As the "reset-gpios" property is optional, don't return the error and just skip the gpio reset sequence.
---
Changes in v2:
- Replaced the gpio_request_by_name() the API with devm_gpiod_get_optional().
--- drivers/usb/dwc3/dwc3-generic.c | 38 ++++++++++++++++----------------- 1 file changed, 19 insertions(+), 19 deletions(-)
drivers/usb/dwc3/dwc3-generic.c +19 -19
@@ -44,7 +44,7 @@ struct dwc3_generic_priv {void *base;struct dwc3 dwc3;struct phy_bulk phys; -struct gpio_desc ulpi_reset; +struct gpio_desc *ulpi_reset; };struct dwc3_generic_host_priv {
@@ -91,23 +91,23 @@ static int dwc3_generic_probe(struct udevice *dev,if (CONFIG_IS_ENABLED (DM_GPIO ) &&device_is_compatible (dev->parent,"xlnx,zynqmp-dwc3" )) { - rc =gpio_request_by_name (dev->parent,"reset-gpios" ,0 , - &priv->ulpi_reset,GPIOD_ACTIVE_LOW ); -if (rc) -return rc; - -/* Toggle ulpi to reset the phy. */ - rc =dm_gpio_set_value (&priv->ulpi_reset,1 ); -if (rc) -return rc; - -mdelay (5 ); - - rc =dm_gpio_set_value (&priv->ulpi_reset,0 ); -if (rc) -return rc; - -mdelay (5 ); + priv->ulpi_reset =devm_gpiod_get_optional (dev->parent,"reset" , +GPIOD_ACTIVE_LOW ); +/* property is optional, don't return error! */ +if (priv->ulpi_reset) { +/* Toggle ulpi to reset the phy. */ + rc =dm_gpio_set_value (priv->ulpi_reset,1 ); +if (rc) +return rc; + +mdelay (5 ); + + rc =dm_gpio_set_value (priv->ulpi_reset,0 ); +if (rc) +return rc; + +mdelay (5 ); + } }if (device_is_compatible (dev->parent,"rockchip,rk3399-dwc3" ))
@@ -133,7 +133,7 @@ static int dwc3_generic_remove(struct udevice *dev,if (CONFIG_IS_ENABLED (DM_GPIO ) &&device_is_compatible (dev->parent,"xlnx,zynqmp-dwc3" )) { -struct gpio_desc *ulpi_reset = &priv->ulpi_reset; +struct gpio_desc *ulpi_reset = priv->ulpi_reset;dm_gpio_free (ulpi_reset->dev, ulpi_reset); }
Signature · 1 line
2.17.1
Quoted 8 lines · Venkatesh Yadav Abbarapu
As the "reset-gpios" property is optional, don't return the error and just skip the gpio reset sequence.
Signed-off-by Venkatesh Yadav Abbarapu <[email protected]>---
Changes in v2:
- Replaced thegpio_request_by_name()the API withdevm_gpiod_get_optional().
The PX30 seems to fail to build:
https://source.denx.de/u-boot/custodians/u-boot-usb/-/jobs/580968
Quoted 10 lines · Marek Vasut
Quoted 8 lines · Venkatesh Yadav Abbarapu
As the "reset-gpios" property is optional, don't return the error and just skip the gpio reset sequence.
Signed-off-by Venkatesh Yadav Abbarapu <[email protected]>---
Changes in v2:
- Replaced thegpio_request_by_name()the API withdevm_gpiod_get_optional().
Quoted 3 lines
The PX30 seems to fail to build:
https://source.denx.de/u-boot/custodians/u-boot-usb/-/jobs/580968
Doesn't look usb related.
+Please report this bug.
+make[4]: *** [scripts/Makefile.build:257: spl/drivers/mmc/mmc.o] Error 1 +make[3]: *** [scripts/Makefile.build:397: spl/drivers/mmc] Error 2 +make[2]: *** [scripts/Makefile.spl:533: spl/drivers] Error 2
Can you please double check it?
Thanks,
Michal
Quoted 24 lines · Michal Simek
Quoted 10 lines · Marek Vasut
Quoted 8 lines · Venkatesh Yadav Abbarapu
As the "reset-gpios" property is optional, don't return the error and just skip the gpio reset sequence.
Signed-off-by Venkatesh Yadav Abbarapu <[email protected]>---
Changes in v2:
- Replaced thegpio_request_by_name()the API withdevm_gpiod_get_optional().Quoted 3 lines
The PX30 seems to fail to build:
https://source.denx.de/u-boot/custodians/u-boot-usb/-/jobs/580968
Doesn't look usb related.
(quoted diff) +4
-0+Please report this bug. +make[4]: *** [scripts/Makefile.build:257: spl/drivers/mmc/mmc.o] Error 1 +make[3]: *** [scripts/Makefile.build:397: spl/drivers/mmc] Error 2 +make[2]: *** [scripts/Makefile.spl:533: spl/drivers] Error 2
Quoted 1 line
Can you please double check it?
u-boot/master without this patch built fine, usb/next just built fine too. I did retrigger the failing build to see if this is transient failure, but it would be good if someone at xilinx could build-test the px30 too .
Quoted 20 lines · Marek Vasut
Quoted 19 lines · Michal Simek
Quoted 10 lines · Marek Vasut
Quoted 8 lines · Venkatesh Yadav Abbarapu
As the "reset-gpios" property is optional, don't return the error and just skip the gpio reset sequence.
Signed-off-by Venkatesh Yadav Abbarapu <[email protected]>---
Changes in v2:
- Replaced thegpio_request_by_name()the API withdevm_gpiod_get_optional().Quoted 3 lines
The PX30 seems to fail to build:
https://source.denx.de/u-boot/custodians/u-boot-usb/-/jobs/580968
Doesn't look usb related.
Quoted 8 lines
Quoted 6 lines
(quoted diff) +4
-0+Please report this bug. +make[4]: *** [scripts/Makefile.build:257: spl/drivers/mmc/mmc.o] Error 1 +make[3]: *** [scripts/Makefile.build:397: spl/drivers/mmc] Error 2 +make[2]: *** [scripts/Makefile.spl:533: spl/drivers] Error 2Can you please double check it?
u-boot/master without this patch built fine, usb/next just built fine too. I did retrigger the failing build to see if this is transient failure, but it would be good if someone at xilinx could build-test the px30 too .
TBH. I actually was building it myself before I sent this email.
M
Quoted 29 lines · Michal Simek
Quoted 26 lines · Marek Vasut
Quoted 25 lines · Michal Simek
Quoted 10 lines · Marek Vasut
Quoted 8 lines · Venkatesh Yadav Abbarapu
As the "reset-gpios" property is optional, don't return the error and just skip the gpio reset sequence.
Signed-off-by Venkatesh Yadav Abbarapu <[email protected]>---
Changes in v2:
- Replaced thegpio_request_by_name()the API withdevm_gpiod_get_optional().Quoted 3 lines
The PX30 seems to fail to build:
https://source.denx.de/u-boot/custodians/u-boot-usb/-/jobs/580968
Doesn't look usb related.
(quoted diff) +2
-0+Please report this bug. +make[4]: *** [scripts/Makefile.build:257: spl/drivers/mmc/mmc.o]Error 1
(quoted diff) +2
-0+make[3]: *** [scripts/Makefile.build:397: spl/drivers/mmc] Error 2 +make[2]: *** [scripts/Makefile.spl:533: spl/drivers] Error 2
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Can you please double check it?
u-boot/master without this patch built fine, usb/next just built fine too. I did retrigger the failing build to see if this is transient failure, but it would be good if someone at xilinx could build-test the px30 too .
TBH. I actually was building it myself before I sent this email.
The build passed, so it was a transient error, this patch is now part of u-boot/master too.