From 349cf343ce0599dcc0e0f8d9e38f905c05e4c786 Mon Sep 17 00:00:00 2001 From: Dongjin Kim Date: Tue, 24 Jul 2018 13:17:46 +0900 Subject: [PATCH] ODROID-C3/N2: usb/phy: use 'CONFIG_ARCH_MESON64_ODROID_COMMON' Change-Id: Ib78b7e773705e930f3493fa3b56be2617450d0f2 Signed-off-by: Dongjin Kim --- drivers/amlogic/usb/phy/phy-aml-new-usb3-v2.c | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/amlogic/usb/phy/phy-aml-new-usb3-v2.c b/drivers/amlogic/usb/phy/phy-aml-new-usb3-v2.c index 3c97500bb819..df2cb7472f6d 100644 --- a/drivers/amlogic/usb/phy/phy-aml-new-usb3-v2.c +++ b/drivers/amlogic/usb/phy/phy-aml-new-usb3-v2.c @@ -535,6 +535,10 @@ static int amlogic_new_usb3_v2_probe(struct platform_device *pdev) u32 u3_hhi_mem_pd_shift = 0; u32 u3_hhi_mem_pd_mask = 0; u32 u3_ctrl_iso_shift = 0; +#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON) + struct gpio_desc *huben_gd = NULL; + struct gpio_desc *hubrst_gd = NULL; +#endif gpio_name = of_get_property(dev->of_node, "gpio-vbus-power", NULL); if (gpio_name) { @@ -545,6 +549,32 @@ static int amlogic_new_usb3_v2_probe(struct platform_device *pdev) return -1; } +#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON) + gpio_name = of_get_property(dev->of_node, "hub-en", NULL); + if (gpio_name) { + huben_gd = gpiod_get_index(&pdev->dev, + NULL, 1, GPIOD_OUT_HIGH); + if (IS_ERR(huben_gd)) + return -1; + gpiod_direction_output(huben_gd, 1); + mdelay(20); + gpiod_put(huben_gd); + } + + gpio_name = of_get_property(dev->of_node, "hub-rst", NULL); + if (gpio_name) { + hubrst_gd = gpiod_get_index(&pdev->dev, + NULL, 2, GPIOD_OUT_HIGH); + if (IS_ERR(hubrst_gd)) + return -1; + gpiod_direction_output(hubrst_gd, 0); + mdelay(20); + gpiod_direction_output(hubrst_gd, 1); + mdelay(20); + gpiod_put(hubrst_gd); + } +#endif + prop = of_get_property(dev->of_node, "portnum", NULL); if (prop) portnum = of_read_ulong(prop, 1);