Commit 4a271cb1b4ffdf33073c0dc8ee1e185c037275f4
exynos: usb: Switch USB VBUS GPIOs to be device tree configured
Some Exynos boards, such as the SMDK5250, control USB port power through a GPIO pin. For now this had been hardcoded in the exynos5-dt board file, but not all boards use the same pin, requiring local changes to support different boards. This patch moves the GPIO initialization into the USB host controller drivers which they belong to, and uses the samsung,vbus-gpio parameter in the device tree to configure it. Signed-off-by: Julius Werner <jwerner@chromium.org> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com> Cc: Simon Glass <sjg@chromium.org> Cc: Minkyu Kang <mk7.kang@samsung.com> Cc: Marek Vasut <marex@denx.de>
Showing 3 changed files with 22 additions and 19 deletions Side-by-side Diff
... | ... | @@ -61,22 +61,6 @@ |
61 | 61 | |
62 | 62 | static struct local_info local; |
63 | 63 | |
64 | -#ifdef CONFIG_USB_EHCI_EXYNOS | |
65 | -int board_usb_vbus_init(void) | |
66 | -{ | |
67 | - struct exynos5_gpio_part1 *gpio1 = (struct exynos5_gpio_part1 *) | |
68 | - samsung_get_base_gpio_part1(); | |
69 | - | |
70 | - /* Enable VBUS power switch */ | |
71 | - s5p_gpio_direction_output(&gpio1->x2, 6, 1); | |
72 | - | |
73 | - /* VBUS turn ON time */ | |
74 | - mdelay(3); | |
75 | - | |
76 | - return 0; | |
77 | -} | |
78 | -#endif | |
79 | - | |
80 | 64 | #ifdef CONFIG_SOUND_MAX98095 |
81 | 65 | static void board_enable_audio_codec(void) |
82 | 66 | { |
... | ... | @@ -122,9 +106,6 @@ |
122 | 106 | if (board_init_cros_ec_devices(gd->fdt_blob)) |
123 | 107 | return -1; |
124 | 108 | |
125 | -#ifdef CONFIG_USB_EHCI_EXYNOS | |
126 | - board_usb_vbus_init(); | |
127 | -#endif | |
128 | 109 | #ifdef CONFIG_SOUND_MAX98095 |
129 | 110 | board_enable_audio_codec(); |
130 | 111 | #endif |
... | ... | @@ -16,6 +16,7 @@ |
16 | 16 | #include <asm/arch/ehci.h> |
17 | 17 | #include <asm/arch/system.h> |
18 | 18 | #include <asm/arch/power.h> |
19 | +#include <asm/gpio.h> | |
19 | 20 | #include <asm-generic/errno.h> |
20 | 21 | #include <linux/compat.h> |
21 | 22 | #include "ehci.h" |
... | ... | @@ -30,6 +31,7 @@ |
30 | 31 | struct exynos_ehci { |
31 | 32 | struct exynos_usb_phy *usb; |
32 | 33 | struct ehci_hccr *hcd; |
34 | + struct fdt_gpio_state vbus_gpio; | |
33 | 35 | }; |
34 | 36 | |
35 | 37 | static struct exynos_ehci exynos; |
... | ... | @@ -58,6 +60,9 @@ |
58 | 60 | |
59 | 61 | exynos->hcd = (struct ehci_hccr *)addr; |
60 | 62 | |
63 | + /* Vbus gpio */ | |
64 | + fdtdec_decode_gpio(blob, node, "samsung,vbus-gpio", &exynos->vbus_gpio); | |
65 | + | |
61 | 66 | depth = 0; |
62 | 67 | node = fdtdec_next_compatible_subnode(blob, node, |
63 | 68 | COMPAT_SAMSUNG_EXYNOS_USB_PHY, &depth); |
... | ... | @@ -148,6 +153,12 @@ |
148 | 153 | #else |
149 | 154 | ctx->usb = (struct exynos_usb_phy *)samsung_get_base_usb_phy(); |
150 | 155 | ctx->hcd = (struct ehci_hccr *)samsung_get_base_usb_ehci(); |
156 | +#endif | |
157 | + | |
158 | +#ifdef CONFIG_OF_CONTROL | |
159 | + /* setup the Vbus gpio here */ | |
160 | + if (!fdtdec_setup_gpio(&ctx->vbus_gpio)) | |
161 | + gpio_direction_output(ctx->vbus_gpio.gpio, 1); | |
151 | 162 | #endif |
152 | 163 | |
153 | 164 | setup_usb_phy(ctx->usb); |
... | ... | @@ -22,6 +22,7 @@ |
22 | 22 | #include <asm/arch/cpu.h> |
23 | 23 | #include <asm/arch/power.h> |
24 | 24 | #include <asm/arch/xhci-exynos.h> |
25 | +#include <asm/gpio.h> | |
25 | 26 | #include <asm-generic/errno.h> |
26 | 27 | #include <linux/compat.h> |
27 | 28 | #include <linux/usb/dwc3.h> |
... | ... | @@ -39,6 +40,7 @@ |
39 | 40 | struct exynos_usb3_phy *usb3_phy; |
40 | 41 | struct xhci_hccr *hcd; |
41 | 42 | struct dwc3 *dwc3_reg; |
43 | + struct fdt_gpio_state vbus_gpio; | |
42 | 44 | }; |
43 | 45 | |
44 | 46 | static struct exynos_xhci exynos; |
... | ... | @@ -66,6 +68,9 @@ |
66 | 68 | } |
67 | 69 | exynos->hcd = (struct xhci_hccr *)addr; |
68 | 70 | |
71 | + /* Vbus gpio */ | |
72 | + fdtdec_decode_gpio(blob, node, "samsung,vbus-gpio", &exynos->vbus_gpio); | |
73 | + | |
69 | 74 | depth = 0; |
70 | 75 | node = fdtdec_next_compatible_subnode(blob, node, |
71 | 76 | COMPAT_SAMSUNG_EXYNOS5_USB3_PHY, &depth); |
... | ... | @@ -290,6 +295,12 @@ |
290 | 295 | #endif |
291 | 296 | |
292 | 297 | ctx->dwc3_reg = (struct dwc3 *)((char *)(ctx->hcd) + DWC3_REG_OFFSET); |
298 | + | |
299 | +#ifdef CONFIG_OF_CONTROL | |
300 | + /* setup the Vbus gpio here */ | |
301 | + if (!fdtdec_setup_gpio(&ctx->vbus_gpio)) | |
302 | + gpio_direction_output(ctx->vbus_gpio.gpio, 1); | |
303 | +#endif | |
293 | 304 | |
294 | 305 | ret = exynos_xhci_core_init(ctx); |
295 | 306 | if (ret) { |
-
mentioned in commit e6e493
-
mentioned in commit e6e493
-
mentioned in commit e6e493
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c
-
mentioned in commit e6e493
-
mentioned in commit 68904c