diff options
-rw-r--r-- | drivers/phy/Kconfig | 14 | ||||
-rw-r--r-- | drivers/phy/Makefile | 1 | ||||
-rw-r--r-- | drivers/phy/phy-omap-control.c (renamed from drivers/usb/phy/phy-omap-control.c) | 165 | ||||
-rw-r--r-- | drivers/phy/phy-omap-usb2.c | 8 | ||||
-rw-r--r-- | drivers/phy/phy-ti-pipe3.c | 8 | ||||
-rw-r--r-- | drivers/usb/musb/omap2430.c | 2 | ||||
-rw-r--r-- | drivers/usb/phy/Kconfig | 10 | ||||
-rw-r--r-- | drivers/usb/phy/Makefile | 1 | ||||
-rw-r--r-- | include/linux/phy/omap_control_phy.h (renamed from include/linux/usb/omap_control_usb.h) | 36 |
9 files changed, 123 insertions, 122 deletions
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 1b607d7cb03d..fe8c0096f9e4 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig | |||
@@ -31,12 +31,22 @@ config PHY_MVEBU_SATA | |||
31 | depends on OF | 31 | depends on OF |
32 | select GENERIC_PHY | 32 | select GENERIC_PHY |
33 | 33 | ||
34 | config OMAP_CONTROL_PHY | ||
35 | tristate "OMAP CONTROL PHY Driver" | ||
36 | help | ||
37 | Enable this to add support for the PHY part present in the control | ||
38 | module. This driver has API to power on the USB2 PHY and to write to | ||
39 | the mailbox. The mailbox is present only in omap4 and the register to | ||
40 | power on the USB2 PHY is present in OMAP4 and OMAP5. OMAP5 has an | ||
41 | additional register to power on USB3 PHY/SATA PHY/PCIE PHY | ||
42 | (PIPE3 PHY). | ||
43 | |||
34 | config OMAP_USB2 | 44 | config OMAP_USB2 |
35 | tristate "OMAP USB2 PHY Driver" | 45 | tristate "OMAP USB2 PHY Driver" |
36 | depends on ARCH_OMAP2PLUS | 46 | depends on ARCH_OMAP2PLUS |
37 | depends on USB_PHY | 47 | depends on USB_PHY |
38 | select GENERIC_PHY | 48 | select GENERIC_PHY |
39 | select OMAP_CONTROL_USB | 49 | select OMAP_CONTROL_PHY |
40 | help | 50 | help |
41 | Enable this to support the transceiver that is part of SOC. This | 51 | Enable this to support the transceiver that is part of SOC. This |
42 | driver takes care of all the PHY functionality apart from comparator. | 52 | driver takes care of all the PHY functionality apart from comparator. |
@@ -47,7 +57,7 @@ config TI_PIPE3 | |||
47 | tristate "TI PIPE3 PHY Driver" | 57 | tristate "TI PIPE3 PHY Driver" |
48 | depends on ARCH_OMAP2PLUS || COMPILE_TEST | 58 | depends on ARCH_OMAP2PLUS || COMPILE_TEST |
49 | select GENERIC_PHY | 59 | select GENERIC_PHY |
50 | select OMAP_CONTROL_USB | 60 | select OMAP_CONTROL_PHY |
51 | help | 61 | help |
52 | Enable this to support the PIPE3 PHY that is part of TI SOCs. This | 62 | Enable this to support the PIPE3 PHY that is part of TI SOCs. This |
53 | driver takes care of all the PHY functionality apart from comparator. | 63 | driver takes care of all the PHY functionality apart from comparator. |
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index ecf0d3f5bf1d..8da05a841112 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile | |||
@@ -7,6 +7,7 @@ obj-$(CONFIG_BCM_KONA_USB2_PHY) += phy-bcm-kona-usb2.o | |||
7 | obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO) += phy-exynos-dp-video.o | 7 | obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO) += phy-exynos-dp-video.o |
8 | obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO) += phy-exynos-mipi-video.o | 8 | obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO) += phy-exynos-mipi-video.o |
9 | obj-$(CONFIG_PHY_MVEBU_SATA) += phy-mvebu-sata.o | 9 | obj-$(CONFIG_PHY_MVEBU_SATA) += phy-mvebu-sata.o |
10 | obj-$(CONFIG_OMAP_CONTROL_PHY) += phy-omap-control.o | ||
10 | obj-$(CONFIG_OMAP_USB2) += phy-omap-usb2.o | 11 | obj-$(CONFIG_OMAP_USB2) += phy-omap-usb2.o |
11 | obj-$(CONFIG_TI_PIPE3) += phy-ti-pipe3.o | 12 | obj-$(CONFIG_TI_PIPE3) += phy-ti-pipe3.o |
12 | obj-$(CONFIG_TWL4030_USB) += phy-twl4030-usb.o | 13 | obj-$(CONFIG_TWL4030_USB) += phy-twl4030-usb.o |
diff --git a/drivers/usb/phy/phy-omap-control.c b/drivers/phy/phy-omap-control.c index e7253182e47d..17fc200210c8 100644 --- a/drivers/usb/phy/phy-omap-control.c +++ b/drivers/phy/phy-omap-control.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * omap-control-usb.c - The USB part of control module. | 2 | * omap-control-phy.c - The PHY part of control module. |
3 | * | 3 | * |
4 | * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com | 4 | * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
@@ -24,36 +24,36 @@ | |||
24 | #include <linux/err.h> | 24 | #include <linux/err.h> |
25 | #include <linux/io.h> | 25 | #include <linux/io.h> |
26 | #include <linux/clk.h> | 26 | #include <linux/clk.h> |
27 | #include <linux/usb/omap_control_usb.h> | 27 | #include <linux/phy/omap_control_phy.h> |
28 | 28 | ||
29 | /** | 29 | /** |
30 | * omap_control_usb_phy_power - power on/off the phy using control module reg | 30 | * omap_control_phy_power - power on/off the phy using control module reg |
31 | * @dev: the control module device | 31 | * @dev: the control module device |
32 | * @on: 0 or 1, based on powering on or off the PHY | 32 | * @on: 0 or 1, based on powering on or off the PHY |
33 | */ | 33 | */ |
34 | void omap_control_usb_phy_power(struct device *dev, int on) | 34 | void omap_control_phy_power(struct device *dev, int on) |
35 | { | 35 | { |
36 | u32 val; | 36 | u32 val; |
37 | unsigned long rate; | 37 | unsigned long rate; |
38 | struct omap_control_usb *control_usb; | 38 | struct omap_control_phy *control_phy; |
39 | 39 | ||
40 | if (IS_ERR(dev) || !dev) { | 40 | if (IS_ERR(dev) || !dev) { |
41 | pr_err("%s: invalid device\n", __func__); | 41 | pr_err("%s: invalid device\n", __func__); |
42 | return; | 42 | return; |
43 | } | 43 | } |
44 | 44 | ||
45 | control_usb = dev_get_drvdata(dev); | 45 | control_phy = dev_get_drvdata(dev); |
46 | if (!control_usb) { | 46 | if (!control_phy) { |
47 | dev_err(dev, "%s: invalid control usb device\n", __func__); | 47 | dev_err(dev, "%s: invalid control phy device\n", __func__); |
48 | return; | 48 | return; |
49 | } | 49 | } |
50 | 50 | ||
51 | if (control_usb->type == OMAP_CTRL_TYPE_OTGHS) | 51 | if (control_phy->type == OMAP_CTRL_TYPE_OTGHS) |
52 | return; | 52 | return; |
53 | 53 | ||
54 | val = readl(control_usb->power); | 54 | val = readl(control_phy->power); |
55 | 55 | ||
56 | switch (control_usb->type) { | 56 | switch (control_phy->type) { |
57 | case OMAP_CTRL_TYPE_USB2: | 57 | case OMAP_CTRL_TYPE_USB2: |
58 | if (on) | 58 | if (on) |
59 | val &= ~OMAP_CTRL_DEV_PHY_PD; | 59 | val &= ~OMAP_CTRL_DEV_PHY_PD; |
@@ -62,19 +62,20 @@ void omap_control_usb_phy_power(struct device *dev, int on) | |||
62 | break; | 62 | break; |
63 | 63 | ||
64 | case OMAP_CTRL_TYPE_PIPE3: | 64 | case OMAP_CTRL_TYPE_PIPE3: |
65 | rate = clk_get_rate(control_usb->sys_clk); | 65 | rate = clk_get_rate(control_phy->sys_clk); |
66 | rate = rate/1000000; | 66 | rate = rate/1000000; |
67 | 67 | ||
68 | if (on) { | 68 | if (on) { |
69 | val &= ~(OMAP_CTRL_USB_PWRCTL_CLK_CMD_MASK | | 69 | val &= ~(OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_MASK | |
70 | OMAP_CTRL_USB_PWRCTL_CLK_FREQ_MASK); | 70 | OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_MASK); |
71 | val |= OMAP_CTRL_USB3_PHY_TX_RX_POWERON << | 71 | val |= OMAP_CTRL_PIPE3_PHY_TX_RX_POWERON << |
72 | OMAP_CTRL_USB_PWRCTL_CLK_CMD_SHIFT; | 72 | OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT; |
73 | val |= rate << OMAP_CTRL_USB_PWRCTL_CLK_FREQ_SHIFT; | 73 | val |= rate << |
74 | OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT; | ||
74 | } else { | 75 | } else { |
75 | val &= ~OMAP_CTRL_USB_PWRCTL_CLK_CMD_MASK; | 76 | val &= ~OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_MASK; |
76 | val |= OMAP_CTRL_USB3_PHY_TX_RX_POWEROFF << | 77 | val |= OMAP_CTRL_PIPE3_PHY_TX_RX_POWEROFF << |
77 | OMAP_CTRL_USB_PWRCTL_CLK_CMD_SHIFT; | 78 | OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT; |
78 | } | 79 | } |
79 | break; | 80 | break; |
80 | 81 | ||
@@ -100,66 +101,66 @@ void omap_control_usb_phy_power(struct device *dev, int on) | |||
100 | break; | 101 | break; |
101 | default: | 102 | default: |
102 | dev_err(dev, "%s: type %d not recognized\n", | 103 | dev_err(dev, "%s: type %d not recognized\n", |
103 | __func__, control_usb->type); | 104 | __func__, control_phy->type); |
104 | break; | 105 | break; |
105 | } | 106 | } |
106 | 107 | ||
107 | writel(val, control_usb->power); | 108 | writel(val, control_phy->power); |
108 | } | 109 | } |
109 | EXPORT_SYMBOL_GPL(omap_control_usb_phy_power); | 110 | EXPORT_SYMBOL_GPL(omap_control_phy_power); |
110 | 111 | ||
111 | /** | 112 | /** |
112 | * omap_control_usb_host_mode - set AVALID, VBUSVALID and ID pin in grounded | 113 | * omap_control_usb_host_mode - set AVALID, VBUSVALID and ID pin in grounded |
113 | * @ctrl_usb: struct omap_control_usb * | 114 | * @ctrl_phy: struct omap_control_phy * |
114 | * | 115 | * |
115 | * Writes to the mailbox register to notify the usb core that a usb | 116 | * Writes to the mailbox register to notify the usb core that a usb |
116 | * device has been connected. | 117 | * device has been connected. |
117 | */ | 118 | */ |
118 | static void omap_control_usb_host_mode(struct omap_control_usb *ctrl_usb) | 119 | static void omap_control_usb_host_mode(struct omap_control_phy *ctrl_phy) |
119 | { | 120 | { |
120 | u32 val; | 121 | u32 val; |
121 | 122 | ||
122 | val = readl(ctrl_usb->otghs_control); | 123 | val = readl(ctrl_phy->otghs_control); |
123 | val &= ~(OMAP_CTRL_DEV_IDDIG | OMAP_CTRL_DEV_SESSEND); | 124 | val &= ~(OMAP_CTRL_DEV_IDDIG | OMAP_CTRL_DEV_SESSEND); |
124 | val |= OMAP_CTRL_DEV_AVALID | OMAP_CTRL_DEV_VBUSVALID; | 125 | val |= OMAP_CTRL_DEV_AVALID | OMAP_CTRL_DEV_VBUSVALID; |
125 | writel(val, ctrl_usb->otghs_control); | 126 | writel(val, ctrl_phy->otghs_control); |
126 | } | 127 | } |
127 | 128 | ||
128 | /** | 129 | /** |
129 | * omap_control_usb_device_mode - set AVALID, VBUSVALID and ID pin in high | 130 | * omap_control_usb_device_mode - set AVALID, VBUSVALID and ID pin in high |
130 | * impedance | 131 | * impedance |
131 | * @ctrl_usb: struct omap_control_usb * | 132 | * @ctrl_phy: struct omap_control_phy * |
132 | * | 133 | * |
133 | * Writes to the mailbox register to notify the usb core that it has been | 134 | * Writes to the mailbox register to notify the usb core that it has been |
134 | * connected to a usb host. | 135 | * connected to a usb host. |
135 | */ | 136 | */ |
136 | static void omap_control_usb_device_mode(struct omap_control_usb *ctrl_usb) | 137 | static void omap_control_usb_device_mode(struct omap_control_phy *ctrl_phy) |
137 | { | 138 | { |
138 | u32 val; | 139 | u32 val; |
139 | 140 | ||
140 | val = readl(ctrl_usb->otghs_control); | 141 | val = readl(ctrl_phy->otghs_control); |
141 | val &= ~OMAP_CTRL_DEV_SESSEND; | 142 | val &= ~OMAP_CTRL_DEV_SESSEND; |
142 | val |= OMAP_CTRL_DEV_IDDIG | OMAP_CTRL_DEV_AVALID | | 143 | val |= OMAP_CTRL_DEV_IDDIG | OMAP_CTRL_DEV_AVALID | |
143 | OMAP_CTRL_DEV_VBUSVALID; | 144 | OMAP_CTRL_DEV_VBUSVALID; |
144 | writel(val, ctrl_usb->otghs_control); | 145 | writel(val, ctrl_phy->otghs_control); |
145 | } | 146 | } |
146 | 147 | ||
147 | /** | 148 | /** |
148 | * omap_control_usb_set_sessionend - Enable SESSIONEND and IDIG to high | 149 | * omap_control_usb_set_sessionend - Enable SESSIONEND and IDIG to high |
149 | * impedance | 150 | * impedance |
150 | * @ctrl_usb: struct omap_control_usb * | 151 | * @ctrl_phy: struct omap_control_phy * |
151 | * | 152 | * |
152 | * Writes to the mailbox register to notify the usb core it's now in | 153 | * Writes to the mailbox register to notify the usb core it's now in |
153 | * disconnected state. | 154 | * disconnected state. |
154 | */ | 155 | */ |
155 | static void omap_control_usb_set_sessionend(struct omap_control_usb *ctrl_usb) | 156 | static void omap_control_usb_set_sessionend(struct omap_control_phy *ctrl_phy) |
156 | { | 157 | { |
157 | u32 val; | 158 | u32 val; |
158 | 159 | ||
159 | val = readl(ctrl_usb->otghs_control); | 160 | val = readl(ctrl_phy->otghs_control); |
160 | val &= ~(OMAP_CTRL_DEV_AVALID | OMAP_CTRL_DEV_VBUSVALID); | 161 | val &= ~(OMAP_CTRL_DEV_AVALID | OMAP_CTRL_DEV_VBUSVALID); |
161 | val |= OMAP_CTRL_DEV_IDDIG | OMAP_CTRL_DEV_SESSEND; | 162 | val |= OMAP_CTRL_DEV_IDDIG | OMAP_CTRL_DEV_SESSEND; |
162 | writel(val, ctrl_usb->otghs_control); | 163 | writel(val, ctrl_phy->otghs_control); |
163 | } | 164 | } |
164 | 165 | ||
165 | /** | 166 | /** |
@@ -174,30 +175,30 @@ static void omap_control_usb_set_sessionend(struct omap_control_usb *ctrl_usb) | |||
174 | void omap_control_usb_set_mode(struct device *dev, | 175 | void omap_control_usb_set_mode(struct device *dev, |
175 | enum omap_control_usb_mode mode) | 176 | enum omap_control_usb_mode mode) |
176 | { | 177 | { |
177 | struct omap_control_usb *ctrl_usb; | 178 | struct omap_control_phy *ctrl_phy; |
178 | 179 | ||
179 | if (IS_ERR(dev) || !dev) | 180 | if (IS_ERR(dev) || !dev) |
180 | return; | 181 | return; |
181 | 182 | ||
182 | ctrl_usb = dev_get_drvdata(dev); | 183 | ctrl_phy = dev_get_drvdata(dev); |
183 | 184 | ||
184 | if (!ctrl_usb) { | 185 | if (!ctrl_phy) { |
185 | dev_err(dev, "Invalid control usb device\n"); | 186 | dev_err(dev, "Invalid control phy device\n"); |
186 | return; | 187 | return; |
187 | } | 188 | } |
188 | 189 | ||
189 | if (ctrl_usb->type != OMAP_CTRL_TYPE_OTGHS) | 190 | if (ctrl_phy->type != OMAP_CTRL_TYPE_OTGHS) |
190 | return; | 191 | return; |
191 | 192 | ||
192 | switch (mode) { | 193 | switch (mode) { |
193 | case USB_MODE_HOST: | 194 | case USB_MODE_HOST: |
194 | omap_control_usb_host_mode(ctrl_usb); | 195 | omap_control_usb_host_mode(ctrl_phy); |
195 | break; | 196 | break; |
196 | case USB_MODE_DEVICE: | 197 | case USB_MODE_DEVICE: |
197 | omap_control_usb_device_mode(ctrl_usb); | 198 | omap_control_usb_device_mode(ctrl_phy); |
198 | break; | 199 | break; |
199 | case USB_MODE_DISCONNECT: | 200 | case USB_MODE_DISCONNECT: |
200 | omap_control_usb_set_sessionend(ctrl_usb); | 201 | omap_control_usb_set_sessionend(ctrl_phy); |
201 | break; | 202 | break; |
202 | default: | 203 | default: |
203 | dev_vdbg(dev, "invalid omap control usb mode\n"); | 204 | dev_vdbg(dev, "invalid omap control usb mode\n"); |
@@ -207,13 +208,13 @@ EXPORT_SYMBOL_GPL(omap_control_usb_set_mode); | |||
207 | 208 | ||
208 | #ifdef CONFIG_OF | 209 | #ifdef CONFIG_OF |
209 | 210 | ||
210 | static const enum omap_control_usb_type otghs_data = OMAP_CTRL_TYPE_OTGHS; | 211 | static const enum omap_control_phy_type otghs_data = OMAP_CTRL_TYPE_OTGHS; |
211 | static const enum omap_control_usb_type usb2_data = OMAP_CTRL_TYPE_USB2; | 212 | static const enum omap_control_phy_type usb2_data = OMAP_CTRL_TYPE_USB2; |
212 | static const enum omap_control_usb_type pipe3_data = OMAP_CTRL_TYPE_PIPE3; | 213 | static const enum omap_control_phy_type pipe3_data = OMAP_CTRL_TYPE_PIPE3; |
213 | static const enum omap_control_usb_type dra7usb2_data = OMAP_CTRL_TYPE_DRA7USB2; | 214 | static const enum omap_control_phy_type dra7usb2_data = OMAP_CTRL_TYPE_DRA7USB2; |
214 | static const enum omap_control_usb_type am437usb2_data = OMAP_CTRL_TYPE_AM437USB2; | 215 | static const enum omap_control_phy_type am437usb2_data = OMAP_CTRL_TYPE_AM437USB2; |
215 | 216 | ||
216 | static const struct of_device_id omap_control_usb_id_table[] = { | 217 | static const struct of_device_id omap_control_phy_id_table[] = { |
217 | { | 218 | { |
218 | .compatible = "ti,control-phy-otghs", | 219 | .compatible = "ti,control-phy-otghs", |
219 | .data = &otghs_data, | 220 | .data = &otghs_data, |
@@ -236,84 +237,84 @@ static const struct of_device_id omap_control_usb_id_table[] = { | |||
236 | }, | 237 | }, |
237 | {}, | 238 | {}, |
238 | }; | 239 | }; |
239 | MODULE_DEVICE_TABLE(of, omap_control_usb_id_table); | 240 | MODULE_DEVICE_TABLE(of, omap_control_phy_id_table); |
240 | #endif | 241 | #endif |
241 | 242 | ||
242 | 243 | ||
243 | static int omap_control_usb_probe(struct platform_device *pdev) | 244 | static int omap_control_phy_probe(struct platform_device *pdev) |
244 | { | 245 | { |
245 | struct resource *res; | 246 | struct resource *res; |
246 | const struct of_device_id *of_id; | 247 | const struct of_device_id *of_id; |
247 | struct omap_control_usb *control_usb; | 248 | struct omap_control_phy *control_phy; |
248 | 249 | ||
249 | of_id = of_match_device(of_match_ptr(omap_control_usb_id_table), | 250 | of_id = of_match_device(of_match_ptr(omap_control_phy_id_table), |
250 | &pdev->dev); | 251 | &pdev->dev); |
251 | if (!of_id) | 252 | if (!of_id) |
252 | return -EINVAL; | 253 | return -EINVAL; |
253 | 254 | ||
254 | control_usb = devm_kzalloc(&pdev->dev, sizeof(*control_usb), | 255 | control_phy = devm_kzalloc(&pdev->dev, sizeof(*control_phy), |
255 | GFP_KERNEL); | 256 | GFP_KERNEL); |
256 | if (!control_usb) { | 257 | if (!control_phy) { |
257 | dev_err(&pdev->dev, "unable to alloc memory for control usb\n"); | 258 | dev_err(&pdev->dev, "unable to alloc memory for control phy\n"); |
258 | return -ENOMEM; | 259 | return -ENOMEM; |
259 | } | 260 | } |
260 | 261 | ||
261 | control_usb->dev = &pdev->dev; | 262 | control_phy->dev = &pdev->dev; |
262 | control_usb->type = *(enum omap_control_usb_type *)of_id->data; | 263 | control_phy->type = *(enum omap_control_phy_type *)of_id->data; |
263 | 264 | ||
264 | if (control_usb->type == OMAP_CTRL_TYPE_OTGHS) { | 265 | if (control_phy->type == OMAP_CTRL_TYPE_OTGHS) { |
265 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, | 266 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, |
266 | "otghs_control"); | 267 | "otghs_control"); |
267 | control_usb->otghs_control = devm_ioremap_resource( | 268 | control_phy->otghs_control = devm_ioremap_resource( |
268 | &pdev->dev, res); | 269 | &pdev->dev, res); |
269 | if (IS_ERR(control_usb->otghs_control)) | 270 | if (IS_ERR(control_phy->otghs_control)) |
270 | return PTR_ERR(control_usb->otghs_control); | 271 | return PTR_ERR(control_phy->otghs_control); |
271 | } else { | 272 | } else { |
272 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, | 273 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, |
273 | "power"); | 274 | "power"); |
274 | control_usb->power = devm_ioremap_resource(&pdev->dev, res); | 275 | control_phy->power = devm_ioremap_resource(&pdev->dev, res); |
275 | if (IS_ERR(control_usb->power)) { | 276 | if (IS_ERR(control_phy->power)) { |
276 | dev_err(&pdev->dev, "Couldn't get power register\n"); | 277 | dev_err(&pdev->dev, "Couldn't get power register\n"); |
277 | return PTR_ERR(control_usb->power); | 278 | return PTR_ERR(control_phy->power); |
278 | } | 279 | } |
279 | } | 280 | } |
280 | 281 | ||
281 | if (control_usb->type == OMAP_CTRL_TYPE_PIPE3) { | 282 | if (control_phy->type == OMAP_CTRL_TYPE_PIPE3) { |
282 | control_usb->sys_clk = devm_clk_get(control_usb->dev, | 283 | control_phy->sys_clk = devm_clk_get(control_phy->dev, |
283 | "sys_clkin"); | 284 | "sys_clkin"); |
284 | if (IS_ERR(control_usb->sys_clk)) { | 285 | if (IS_ERR(control_phy->sys_clk)) { |
285 | pr_err("%s: unable to get sys_clkin\n", __func__); | 286 | pr_err("%s: unable to get sys_clkin\n", __func__); |
286 | return -EINVAL; | 287 | return -EINVAL; |
287 | } | 288 | } |
288 | } | 289 | } |
289 | 290 | ||
290 | dev_set_drvdata(control_usb->dev, control_usb); | 291 | dev_set_drvdata(control_phy->dev, control_phy); |
291 | 292 | ||
292 | return 0; | 293 | return 0; |
293 | } | 294 | } |
294 | 295 | ||
295 | static struct platform_driver omap_control_usb_driver = { | 296 | static struct platform_driver omap_control_phy_driver = { |
296 | .probe = omap_control_usb_probe, | 297 | .probe = omap_control_phy_probe, |
297 | .driver = { | 298 | .driver = { |
298 | .name = "omap-control-usb", | 299 | .name = "omap-control-phy", |
299 | .owner = THIS_MODULE, | 300 | .owner = THIS_MODULE, |
300 | .of_match_table = of_match_ptr(omap_control_usb_id_table), | 301 | .of_match_table = of_match_ptr(omap_control_phy_id_table), |
301 | }, | 302 | }, |
302 | }; | 303 | }; |
303 | 304 | ||
304 | static int __init omap_control_usb_init(void) | 305 | static int __init omap_control_phy_init(void) |
305 | { | 306 | { |
306 | return platform_driver_register(&omap_control_usb_driver); | 307 | return platform_driver_register(&omap_control_phy_driver); |
307 | } | 308 | } |
308 | subsys_initcall(omap_control_usb_init); | 309 | subsys_initcall(omap_control_phy_init); |
309 | 310 | ||
310 | static void __exit omap_control_usb_exit(void) | 311 | static void __exit omap_control_phy_exit(void) |
311 | { | 312 | { |
312 | platform_driver_unregister(&omap_control_usb_driver); | 313 | platform_driver_unregister(&omap_control_phy_driver); |
313 | } | 314 | } |
314 | module_exit(omap_control_usb_exit); | 315 | module_exit(omap_control_phy_exit); |
315 | 316 | ||
316 | MODULE_ALIAS("platform: omap_control_usb"); | 317 | MODULE_ALIAS("platform: omap_control_phy"); |
317 | MODULE_AUTHOR("Texas Instruments Inc."); | 318 | MODULE_AUTHOR("Texas Instruments Inc."); |
318 | MODULE_DESCRIPTION("OMAP Control Module USB Driver"); | 319 | MODULE_DESCRIPTION("OMAP Control Module PHY Driver"); |
319 | MODULE_LICENSE("GPL v2"); | 320 | MODULE_LICENSE("GPL v2"); |
diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c index 3cc4aba6e50e..a2205a841e5e 100644 --- a/drivers/phy/phy-omap-usb2.c +++ b/drivers/phy/phy-omap-usb2.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <linux/err.h> | 27 | #include <linux/err.h> |
28 | #include <linux/pm_runtime.h> | 28 | #include <linux/pm_runtime.h> |
29 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
30 | #include <linux/usb/omap_control_usb.h> | 30 | #include <linux/phy/omap_control_phy.h> |
31 | #include <linux/phy/phy.h> | 31 | #include <linux/phy/phy.h> |
32 | #include <linux/of_platform.h> | 32 | #include <linux/of_platform.h> |
33 | 33 | ||
@@ -105,7 +105,7 @@ static int omap_usb_power_off(struct phy *x) | |||
105 | { | 105 | { |
106 | struct omap_usb *phy = phy_get_drvdata(x); | 106 | struct omap_usb *phy = phy_get_drvdata(x); |
107 | 107 | ||
108 | omap_control_usb_phy_power(phy->control_dev, 0); | 108 | omap_control_phy_power(phy->control_dev, 0); |
109 | 109 | ||
110 | return 0; | 110 | return 0; |
111 | } | 111 | } |
@@ -114,7 +114,7 @@ static int omap_usb_power_on(struct phy *x) | |||
114 | { | 114 | { |
115 | struct omap_usb *phy = phy_get_drvdata(x); | 115 | struct omap_usb *phy = phy_get_drvdata(x); |
116 | 116 | ||
117 | omap_control_usb_phy_power(phy->control_dev, 1); | 117 | omap_control_phy_power(phy->control_dev, 1); |
118 | 118 | ||
119 | return 0; | 119 | return 0; |
120 | } | 120 | } |
@@ -251,7 +251,7 @@ static int omap_usb2_probe(struct platform_device *pdev) | |||
251 | } | 251 | } |
252 | 252 | ||
253 | phy->control_dev = &control_pdev->dev; | 253 | phy->control_dev = &control_pdev->dev; |
254 | omap_control_usb_phy_power(phy->control_dev, 0); | 254 | omap_control_phy_power(phy->control_dev, 0); |
255 | 255 | ||
256 | otg->set_host = omap_usb_set_host; | 256 | otg->set_host = omap_usb_set_host; |
257 | otg->set_peripheral = omap_usb_set_peripheral; | 257 | otg->set_peripheral = omap_usb_set_peripheral; |
diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c index c8d16746a5e2..fd029b14cb3e 100644 --- a/drivers/phy/phy-ti-pipe3.c +++ b/drivers/phy/phy-ti-pipe3.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <linux/io.h> | 26 | #include <linux/io.h> |
27 | #include <linux/pm_runtime.h> | 27 | #include <linux/pm_runtime.h> |
28 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
29 | #include <linux/usb/omap_control_usb.h> | 29 | #include <linux/phy/omap_control_phy.h> |
30 | #include <linux/of_platform.h> | 30 | #include <linux/of_platform.h> |
31 | 31 | ||
32 | #define PLL_STATUS 0x00000004 | 32 | #define PLL_STATUS 0x00000004 |
@@ -134,7 +134,7 @@ static int ti_pipe3_power_off(struct phy *x) | |||
134 | return -EBUSY; | 134 | return -EBUSY; |
135 | } | 135 | } |
136 | 136 | ||
137 | omap_control_usb_phy_power(phy->control_dev, 0); | 137 | omap_control_phy_power(phy->control_dev, 0); |
138 | 138 | ||
139 | return 0; | 139 | return 0; |
140 | } | 140 | } |
@@ -232,7 +232,7 @@ static int ti_pipe3_init(struct phy *x) | |||
232 | if (ret) | 232 | if (ret) |
233 | return ret; | 233 | return ret; |
234 | 234 | ||
235 | omap_control_usb_phy_power(phy->control_dev, 1); | 235 | omap_control_phy_power(phy->control_dev, 1); |
236 | 236 | ||
237 | return 0; | 237 | return 0; |
238 | } | 238 | } |
@@ -304,7 +304,7 @@ static int ti_pipe3_probe(struct platform_device *pdev) | |||
304 | 304 | ||
305 | phy->control_dev = &control_pdev->dev; | 305 | phy->control_dev = &control_pdev->dev; |
306 | 306 | ||
307 | omap_control_usb_phy_power(phy->control_dev, 0); | 307 | omap_control_phy_power(phy->control_dev, 0); |
308 | 308 | ||
309 | platform_set_drvdata(pdev, phy); | 309 | platform_set_drvdata(pdev, phy); |
310 | pm_runtime_enable(phy->dev); | 310 | pm_runtime_enable(phy->dev); |
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 8aa59a2c5eb2..d341c149a2f9 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #include <linux/err.h> | 37 | #include <linux/err.h> |
38 | #include <linux/delay.h> | 38 | #include <linux/delay.h> |
39 | #include <linux/usb/musb-omap.h> | 39 | #include <linux/usb/musb-omap.h> |
40 | #include <linux/usb/omap_control_usb.h> | 40 | #include <linux/phy/omap_control_phy.h> |
41 | #include <linux/of_platform.h> | 41 | #include <linux/of_platform.h> |
42 | 42 | ||
43 | #include "musb_core.h" | 43 | #include "musb_core.h" |
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig index c337ba2d066b..416e0c8cf6ff 100644 --- a/drivers/usb/phy/Kconfig +++ b/drivers/usb/phy/Kconfig | |||
@@ -75,16 +75,6 @@ config NOP_USB_XCEIV | |||
75 | built-in with usb ip or which are autonomous and doesn't require any | 75 | built-in with usb ip or which are autonomous and doesn't require any |
76 | phy programming such as ISP1x04 etc. | 76 | phy programming such as ISP1x04 etc. |
77 | 77 | ||
78 | config OMAP_CONTROL_USB | ||
79 | tristate "OMAP CONTROL USB Driver" | ||
80 | depends on ARCH_OMAP2PLUS || COMPILE_TEST | ||
81 | help | ||
82 | Enable this to add support for the USB part present in the control | ||
83 | module. This driver has API to power on the USB2 PHY and to write to | ||
84 | the mailbox. The mailbox is present only in omap4 and the register to | ||
85 | power on the USB2 PHY is present in OMAP4 and OMAP5. OMAP5 has an | ||
86 | additional register to power on USB3 PHY. | ||
87 | |||
88 | config AM335X_CONTROL_USB | 78 | config AM335X_CONTROL_USB |
89 | tristate | 79 | tristate |
90 | 80 | ||
diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile index 15f1878388f4..f8fa719a31b9 100644 --- a/drivers/usb/phy/Makefile +++ b/drivers/usb/phy/Makefile | |||
@@ -13,7 +13,6 @@ obj-$(CONFIG_ISP1301_OMAP) += phy-isp1301-omap.o | |||
13 | obj-$(CONFIG_MV_U3D_PHY) += phy-mv-u3d-usb.o | 13 | obj-$(CONFIG_MV_U3D_PHY) += phy-mv-u3d-usb.o |
14 | obj-$(CONFIG_NOP_USB_XCEIV) += phy-generic.o | 14 | obj-$(CONFIG_NOP_USB_XCEIV) += phy-generic.o |
15 | obj-$(CONFIG_TAHVO_USB) += phy-tahvo.o | 15 | obj-$(CONFIG_TAHVO_USB) += phy-tahvo.o |
16 | obj-$(CONFIG_OMAP_CONTROL_USB) += phy-omap-control.o | ||
17 | obj-$(CONFIG_AM335X_CONTROL_USB) += phy-am335x-control.o | 16 | obj-$(CONFIG_AM335X_CONTROL_USB) += phy-am335x-control.o |
18 | obj-$(CONFIG_AM335X_PHY_USB) += phy-am335x.o | 17 | obj-$(CONFIG_AM335X_PHY_USB) += phy-am335x.o |
19 | obj-$(CONFIG_OMAP_OTG) += phy-omap-otg.o | 18 | obj-$(CONFIG_OMAP_OTG) += phy-omap-otg.o |
diff --git a/include/linux/usb/omap_control_usb.h b/include/linux/phy/omap_control_phy.h index 69ae383ee3cc..5450403c7546 100644 --- a/include/linux/usb/omap_control_usb.h +++ b/include/linux/phy/omap_control_phy.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * omap_control_usb.h - Header file for the USB part of control module. | 2 | * omap_control_phy.h - Header file for the PHY part of control module. |
3 | * | 3 | * |
4 | * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com | 4 | * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
@@ -16,10 +16,10 @@ | |||
16 | * | 16 | * |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #ifndef __OMAP_CONTROL_USB_H__ | 19 | #ifndef __OMAP_CONTROL_PHY_H__ |
20 | #define __OMAP_CONTROL_USB_H__ | 20 | #define __OMAP_CONTROL_PHY_H__ |
21 | 21 | ||
22 | enum omap_control_usb_type { | 22 | enum omap_control_phy_type { |
23 | OMAP_CTRL_TYPE_OTGHS = 1, /* Mailbox OTGHS_CONTROL */ | 23 | OMAP_CTRL_TYPE_OTGHS = 1, /* Mailbox OTGHS_CONTROL */ |
24 | OMAP_CTRL_TYPE_USB2, /* USB2_PHY, power down in CONTROL_DEV_CONF */ | 24 | OMAP_CTRL_TYPE_USB2, /* USB2_PHY, power down in CONTROL_DEV_CONF */ |
25 | OMAP_CTRL_TYPE_PIPE3, /* PIPE3 PHY, DPLL & seperate Rx/Tx power */ | 25 | OMAP_CTRL_TYPE_PIPE3, /* PIPE3 PHY, DPLL & seperate Rx/Tx power */ |
@@ -27,7 +27,7 @@ enum omap_control_usb_type { | |||
27 | OMAP_CTRL_TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */ | 27 | OMAP_CTRL_TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */ |
28 | }; | 28 | }; |
29 | 29 | ||
30 | struct omap_control_usb { | 30 | struct omap_control_phy { |
31 | struct device *dev; | 31 | struct device *dev; |
32 | 32 | ||
33 | u32 __iomem *otghs_control; | 33 | u32 __iomem *otghs_control; |
@@ -36,7 +36,7 @@ struct omap_control_usb { | |||
36 | 36 | ||
37 | struct clk *sys_clk; | 37 | struct clk *sys_clk; |
38 | 38 | ||
39 | enum omap_control_usb_type type; | 39 | enum omap_control_phy_type type; |
40 | }; | 40 | }; |
41 | 41 | ||
42 | enum omap_control_usb_mode { | 42 | enum omap_control_usb_mode { |
@@ -54,14 +54,14 @@ enum omap_control_usb_mode { | |||
54 | #define OMAP_CTRL_DEV_SESSEND BIT(3) | 54 | #define OMAP_CTRL_DEV_SESSEND BIT(3) |
55 | #define OMAP_CTRL_DEV_IDDIG BIT(4) | 55 | #define OMAP_CTRL_DEV_IDDIG BIT(4) |
56 | 56 | ||
57 | #define OMAP_CTRL_USB_PWRCTL_CLK_CMD_MASK 0x003FC000 | 57 | #define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_MASK 0x003FC000 |
58 | #define OMAP_CTRL_USB_PWRCTL_CLK_CMD_SHIFT 0xE | 58 | #define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT 0xE |
59 | 59 | ||
60 | #define OMAP_CTRL_USB_PWRCTL_CLK_FREQ_MASK 0xFFC00000 | 60 | #define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_MASK 0xFFC00000 |
61 | #define OMAP_CTRL_USB_PWRCTL_CLK_FREQ_SHIFT 0x16 | 61 | #define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT 0x16 |
62 | 62 | ||
63 | #define OMAP_CTRL_USB3_PHY_TX_RX_POWERON 0x3 | 63 | #define OMAP_CTRL_PIPE3_PHY_TX_RX_POWERON 0x3 |
64 | #define OMAP_CTRL_USB3_PHY_TX_RX_POWEROFF 0x0 | 64 | #define OMAP_CTRL_PIPE3_PHY_TX_RX_POWEROFF 0x0 |
65 | 65 | ||
66 | #define OMAP_CTRL_USB2_PHY_PD BIT(28) | 66 | #define OMAP_CTRL_USB2_PHY_PD BIT(28) |
67 | 67 | ||
@@ -70,13 +70,13 @@ enum omap_control_usb_mode { | |||
70 | #define AM437X_CTRL_USB2_OTGVDET_EN BIT(19) | 70 | #define AM437X_CTRL_USB2_OTGVDET_EN BIT(19) |
71 | #define AM437X_CTRL_USB2_OTGSESSEND_EN BIT(20) | 71 | #define AM437X_CTRL_USB2_OTGSESSEND_EN BIT(20) |
72 | 72 | ||
73 | #if IS_ENABLED(CONFIG_OMAP_CONTROL_USB) | 73 | #if IS_ENABLED(CONFIG_OMAP_CONTROL_PHY) |
74 | extern void omap_control_usb_phy_power(struct device *dev, int on); | 74 | void omap_control_phy_power(struct device *dev, int on); |
75 | extern void omap_control_usb_set_mode(struct device *dev, | 75 | void omap_control_usb_set_mode(struct device *dev, |
76 | enum omap_control_usb_mode mode); | 76 | enum omap_control_usb_mode mode); |
77 | #else | 77 | #else |
78 | 78 | ||
79 | static inline void omap_control_usb_phy_power(struct device *dev, int on) | 79 | static inline void omap_control_phy_power(struct device *dev, int on) |
80 | { | 80 | { |
81 | } | 81 | } |
82 | 82 | ||
@@ -86,4 +86,4 @@ static inline void omap_control_usb_set_mode(struct device *dev, | |||
86 | } | 86 | } |
87 | #endif | 87 | #endif |
88 | 88 | ||
89 | #endif /* __OMAP_CONTROL_USB_H__ */ | 89 | #endif /* __OMAP_CONTROL_PHY_H__ */ |