|
13 | 13 | #include <linux/of.h> |
14 | 14 | #include <linux/platform_device.h> |
15 | 15 | #include <linux/dma-mapping.h> |
| 16 | +#include <linux/of_gpio.h> |
16 | 17 | #include <linux/of_platform.h> |
17 | 18 | #include <linux/pm_runtime.h> |
18 | 19 | #include <linux/reset.h> |
@@ -98,6 +99,7 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data) |
98 | 99 | { |
99 | 100 | struct device *dev = priv_data->dev; |
100 | 101 | struct reset_control *crst, *hibrst, *apbrst; |
| 102 | + struct gpio_desc *reset_gpio; |
101 | 103 | struct phy *usb3_phy; |
102 | 104 | int ret = 0; |
103 | 105 | u32 reg; |
@@ -201,6 +203,21 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data) |
201 | 203 | } |
202 | 204 |
|
203 | 205 | skip_usb3_phy: |
| 206 | + /* ulpi reset via gpio-modepin or gpio-framework driver */ |
| 207 | + reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); |
| 208 | + if (IS_ERR(reset_gpio)) { |
| 209 | + return dev_err_probe(dev, PTR_ERR(reset_gpio), |
| 210 | + "Failed to request reset GPIO\n"); |
| 211 | + } |
| 212 | + |
| 213 | + if (reset_gpio) { |
| 214 | + /* Toggle ulpi to reset the phy. */ |
| 215 | + gpiod_set_value_cansleep(reset_gpio, 1); |
| 216 | + usleep_range(5000, 10000); |
| 217 | + gpiod_set_value_cansleep(reset_gpio, 0); |
| 218 | + usleep_range(5000, 10000); |
| 219 | + } |
| 220 | + |
204 | 221 | /* |
205 | 222 | * This routes the USB DMA traffic to go through FPD path instead |
206 | 223 | * of reaching DDR directly. This traffic routing is needed to |
|
0 commit comments