diff options
author | David Lechner <david@lechnology.com> | 2016-10-26 20:18:15 -0400 |
---|---|---|
committer | Sekhar Nori <nsekhar@ti.com> | 2016-10-31 07:50:27 -0400 |
commit | 9b504750923cb71473cf55e0a3a594a39e57e268 (patch) | |
tree | cc1046f7fa3fe7872016ccce53237334ba62ac2f | |
parent | ec7cc27ed157a7323d08c31d73cada1dfe101642 (diff) |
ARM: davinci: da8xx: Add USB PHY platform device
There is now a proper phy driver for the DA8xx SoC USB PHY. This adds the
platform device declarations needed to use it.
Signed-off-by: David Lechner <david@lechnology.com>
[nsekhar@ti.com: keep usb-davinci.h included in board-da830-evm.c
minor subject line adjustment]
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
-rw-r--r-- | arch/arm/mach-davinci/board-da830-evm.c | 21 | ||||
-rw-r--r-- | arch/arm/mach-davinci/board-omapl138-hawk.c | 5 | ||||
-rw-r--r-- | arch/arm/mach-davinci/include/mach/da8xx.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-davinci/usb-da8xx.c | 11 |
4 files changed, 24 insertions, 14 deletions
diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c index 6001b32305ec..53172add5248 100644 --- a/arch/arm/mach-davinci/board-da830-evm.c +++ b/arch/arm/mach-davinci/board-da830-evm.c | |||
@@ -112,7 +112,7 @@ static __init void da830_evm_usb_init(void) | |||
112 | int ret; | 112 | int ret; |
113 | 113 | ||
114 | /* | 114 | /* |
115 | * Set up USB clock/mode in the CFGCHIP2 register. | 115 | * Set up USB clock in the CFGCHIP2 register. |
116 | * FYI: CFGCHIP2 is 0x0000ef00 initially. | 116 | * FYI: CFGCHIP2 is 0x0000ef00 initially. |
117 | */ | 117 | */ |
118 | cfgchip2 = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG)); | 118 | cfgchip2 = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG)); |
@@ -129,22 +129,15 @@ static __init void da830_evm_usb_init(void) | |||
129 | cfgchip2 &= ~CFGCHIP2_USB1PHYCLKMUX; | 129 | cfgchip2 &= ~CFGCHIP2_USB1PHYCLKMUX; |
130 | cfgchip2 |= CFGCHIP2_USB2PHYCLKMUX; | 130 | cfgchip2 |= CFGCHIP2_USB2PHYCLKMUX; |
131 | 131 | ||
132 | /* | ||
133 | * We have to override VBUS/ID signals when MUSB is configured into the | ||
134 | * host-only mode -- ID pin will float if no cable is connected, so the | ||
135 | * controller won't be able to drive VBUS thinking that it's a B-device. | ||
136 | * Otherwise, we want to use the OTG mode and enable VBUS comparators. | ||
137 | */ | ||
138 | cfgchip2 &= ~CFGCHIP2_OTGMODE_MASK; | ||
139 | #ifdef CONFIG_USB_MUSB_HOST | ||
140 | cfgchip2 |= CFGCHIP2_FORCE_HOST; | ||
141 | #else | ||
142 | cfgchip2 |= CFGCHIP2_SESENDEN | CFGCHIP2_VBDTCTEN; | ||
143 | #endif | ||
144 | |||
145 | __raw_writel(cfgchip2, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG)); | 132 | __raw_writel(cfgchip2, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG)); |
146 | 133 | ||
147 | /* USB_REFCLKIN is not used. */ | 134 | /* USB_REFCLKIN is not used. */ |
135 | |||
136 | ret = da8xx_register_usb_phy(); | ||
137 | if (ret) | ||
138 | pr_warn("%s: USB PHY registration failed: %d\n", | ||
139 | __func__, ret); | ||
140 | |||
148 | ret = davinci_cfg_reg(DA830_USB0_DRVVBUS); | 141 | ret = davinci_cfg_reg(DA830_USB0_DRVVBUS); |
149 | if (ret) | 142 | if (ret) |
150 | pr_warn("%s: USB 2.0 PinMux setup failed: %d\n", __func__, ret); | 143 | pr_warn("%s: USB 2.0 PinMux setup failed: %d\n", __func__, ret); |
diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c index 70ed5ef2ef8c..67477ca4f15a 100644 --- a/arch/arm/mach-davinci/board-omapl138-hawk.c +++ b/arch/arm/mach-davinci/board-omapl138-hawk.c | |||
@@ -260,6 +260,11 @@ static __init void omapl138_hawk_usb_init(void) | |||
260 | cfgchip2 |= CFGCHIP2_REFFREQ_24MHZ; | 260 | cfgchip2 |= CFGCHIP2_REFFREQ_24MHZ; |
261 | __raw_writel(cfgchip2, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG)); | 261 | __raw_writel(cfgchip2, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG)); |
262 | 262 | ||
263 | ret = da8xx_register_usb_phy(); | ||
264 | if (ret) | ||
265 | pr_warn("%s: USB PHY registration failed: %d\n", | ||
266 | __func__, ret); | ||
267 | |||
263 | ret = gpio_request_one(DA850_USB1_VBUS_PIN, | 268 | ret = gpio_request_one(DA850_USB1_VBUS_PIN, |
264 | GPIOF_DIR_OUT, "USB1 VBUS"); | 269 | GPIOF_DIR_OUT, "USB1 VBUS"); |
265 | if (ret < 0) { | 270 | if (ret < 0) { |
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h index 2f6fe2f0c733..5e07d06f60e4 100644 --- a/arch/arm/mach-davinci/include/mach/da8xx.h +++ b/arch/arm/mach-davinci/include/mach/da8xx.h | |||
@@ -89,6 +89,7 @@ int da850_register_edma(struct edma_rsv_info *rsv[2]); | |||
89 | int da8xx_register_i2c(int instance, struct davinci_i2c_platform_data *pdata); | 89 | int da8xx_register_i2c(int instance, struct davinci_i2c_platform_data *pdata); |
90 | int da8xx_register_spi_bus(int instance, unsigned num_chipselect); | 90 | int da8xx_register_spi_bus(int instance, unsigned num_chipselect); |
91 | int da8xx_register_watchdog(void); | 91 | int da8xx_register_watchdog(void); |
92 | int da8xx_register_usb_phy(void); | ||
92 | int da8xx_register_usb20(unsigned mA, unsigned potpgt); | 93 | int da8xx_register_usb20(unsigned mA, unsigned potpgt); |
93 | int da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata); | 94 | int da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata); |
94 | int da8xx_register_emac(void); | 95 | int da8xx_register_emac(void); |
diff --git a/arch/arm/mach-davinci/usb-da8xx.c b/arch/arm/mach-davinci/usb-da8xx.c index f141f5171906..4bb190380060 100644 --- a/arch/arm/mach-davinci/usb-da8xx.c +++ b/arch/arm/mach-davinci/usb-da8xx.c | |||
@@ -3,6 +3,7 @@ | |||
3 | */ | 3 | */ |
4 | #include <linux/dma-mapping.h> | 4 | #include <linux/dma-mapping.h> |
5 | #include <linux/init.h> | 5 | #include <linux/init.h> |
6 | #include <linux/phy/phy.h> | ||
6 | #include <linux/platform_data/usb-davinci.h> | 7 | #include <linux/platform_data/usb-davinci.h> |
7 | #include <linux/platform_device.h> | 8 | #include <linux/platform_device.h> |
8 | #include <linux/usb/musb.h> | 9 | #include <linux/usb/musb.h> |
@@ -15,6 +16,16 @@ | |||
15 | #define DA8XX_USB0_BASE 0x01e00000 | 16 | #define DA8XX_USB0_BASE 0x01e00000 |
16 | #define DA8XX_USB1_BASE 0x01e25000 | 17 | #define DA8XX_USB1_BASE 0x01e25000 |
17 | 18 | ||
19 | static struct platform_device da8xx_usb_phy = { | ||
20 | .name = "da8xx-usb-phy", | ||
21 | .id = -1, | ||
22 | }; | ||
23 | |||
24 | int __init da8xx_register_usb_phy(void) | ||
25 | { | ||
26 | return platform_device_register(&da8xx_usb_phy); | ||
27 | } | ||
28 | |||
18 | #if IS_ENABLED(CONFIG_USB_MUSB_HDRC) | 29 | #if IS_ENABLED(CONFIG_USB_MUSB_HDRC) |
19 | 30 | ||
20 | static struct musb_hdrc_config musb_config = { | 31 | static struct musb_hdrc_config musb_config = { |