mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-19 19:34:35 +00:00
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. Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
This commit is contained in:
parent
4eb7c5030d
commit
237d1f60b1
1 changed files with 16 additions and 16 deletions
|
@ -44,7 +44,7 @@ struct dwc3_generic_priv {
|
||||||
void *base;
|
void *base;
|
||||||
struct dwc3 dwc3;
|
struct dwc3 dwc3;
|
||||||
struct phy_bulk phys;
|
struct phy_bulk phys;
|
||||||
struct gpio_desc ulpi_reset;
|
struct gpio_desc *ulpi_reset;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dwc3_generic_host_priv {
|
struct dwc3_generic_host_priv {
|
||||||
|
@ -91,23 +91,23 @@ static int dwc3_generic_probe(struct udevice *dev,
|
||||||
|
|
||||||
if (CONFIG_IS_ENABLED(DM_GPIO) &&
|
if (CONFIG_IS_ENABLED(DM_GPIO) &&
|
||||||
device_is_compatible(dev->parent, "xlnx,zynqmp-dwc3")) {
|
device_is_compatible(dev->parent, "xlnx,zynqmp-dwc3")) {
|
||||||
rc = gpio_request_by_name(dev->parent, "reset-gpios", 0,
|
priv->ulpi_reset = devm_gpiod_get_optional(dev->parent, "reset",
|
||||||
&priv->ulpi_reset, GPIOD_ACTIVE_LOW);
|
GPIOD_ACTIVE_LOW);
|
||||||
if (rc)
|
/* property is optional, don't return error! */
|
||||||
return rc;
|
if (priv->ulpi_reset) {
|
||||||
|
/* Toggle ulpi to reset the phy. */
|
||||||
|
rc = dm_gpio_set_value(priv->ulpi_reset, 1);
|
||||||
|
if (rc)
|
||||||
|
return rc;
|
||||||
|
|
||||||
/* Toggle ulpi to reset the phy. */
|
mdelay(5);
|
||||||
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;
|
||||||
|
|
||||||
rc = dm_gpio_set_value(&priv->ulpi_reset, 0);
|
mdelay(5);
|
||||||
if (rc)
|
}
|
||||||
return rc;
|
|
||||||
|
|
||||||
mdelay(5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device_is_compatible(dev->parent, "rockchip,rk3399-dwc3"))
|
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) &&
|
if (CONFIG_IS_ENABLED(DM_GPIO) &&
|
||||||
device_is_compatible(dev->parent, "xlnx,zynqmp-dwc3")) {
|
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);
|
dm_gpio_free(ulpi_reset->dev, ulpi_reset);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue