diff options
Diffstat (limited to 'recipes-kernel/linux/linux-xlnx/usb-host-zynq-dr-of-PHY-reset-during-probe.patch')
-rw-r--r-- | recipes-kernel/linux/linux-xlnx/usb-host-zynq-dr-of-PHY-reset-during-probe.patch | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-xlnx/usb-host-zynq-dr-of-PHY-reset-during-probe.patch b/recipes-kernel/linux/linux-xlnx/usb-host-zynq-dr-of-PHY-reset-during-probe.patch new file mode 100644 index 00000000..6ef36098 --- /dev/null +++ b/recipes-kernel/linux/linux-xlnx/usb-host-zynq-dr-of-PHY-reset-during-probe.patch @@ -0,0 +1,58 @@ +From: Mike Looijmans <mike.looijmans@topic.nl> +Date: Thu, 25 Sep 2014 07:53:49 +0200 +Subject: [PATCH] usb/host/zynq-dr-of: PHY reset during probe + +--- + drivers/usb/host/zynq-dr-of.c | 24 ++++++++++++++++++++++++ + 1 file changed, 24 insertions(+) + +diff --git a/drivers/usb/host/zynq-dr-of.c b/drivers/usb/host/zynq-dr-of.c +index 9ab936a..2765894 100644 +--- a/drivers/usb/host/zynq-dr-of.c ++++ b/drivers/usb/host/zynq-dr-of.c +@@ -26,6 +26,8 @@ + #include <linux/string.h> + #include <linux/clk.h> + #include <linux/usb/ulpi.h> ++#include <linux/gpio.h> ++#include <linux/of_gpio.h> + + #include "ehci-zynq.h" + +@@ -152,11 +154,33 @@ static int zynq_dr_of_probe(struct platform_device *ofdev) + static unsigned int idx; + struct resource *res; + int i, phy_init; ++ int reset_gpio; + int ret; + + pdata = &data; + memset(pdata, 0, sizeof(data)); + ++ reset_gpio = of_get_named_gpio(np, "xlnx,phy-reset-gpio", 0); ++ if (gpio_is_valid(reset_gpio)) { ++ ret = devm_gpio_request_one(&ofdev->dev, reset_gpio, ++ GPIOF_INIT_LOW, "ulpi resetb"); ++ if (ret) { ++ dev_err(&ofdev->dev, "Failed to request ULPI reset gpio: %d\n", ret); ++ return ret; ++ } ++ udelay(1); /* ULPI Datasheet specifies a 1us pulse width for reset */ ++ if (of_property_read_bool(np, "xlnx,phy-reset-gpio-tristate")) ++ gpio_direction_input(reset_gpio); ++ else ++ gpio_set_value_cansleep(reset_gpio, 1); ++ udelay(1); /* ULPI will assert the DIR line, give it time to do so */ ++ } else { ++ /* GPIO controller is not yet available, try again later. */ ++ if (reset_gpio == -EPROBE_DEFER) { ++ return -EPROBE_DEFER; ++ } ++ } ++ + res = platform_get_resource(ofdev, IORESOURCE_IRQ, 0); + if (IS_ERR(res)) { + dev_err(&ofdev->dev, +-- +2.1.1 + |