diff options
author | Felipe Balbi <balbi@ti.com> | 2012-07-19 06:56:07 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2012-09-10 12:29:42 -0400 |
commit | a418cc4ea552884e9f2aa875aaa0afa1f0ffe07d (patch) | |
tree | 4b3433e71d0f027312947328f0766e40a002f6b1 /drivers | |
parent | e3ec3eb79481d23b7d371b6e9567e2b6972efc92 (diff) |
usb: dwc3: omap: add nop transceiver support
We will be adding support for transceivers on
dwc3 driver but not all boards have controllable
transceivers.
For those which don't provide controllable transceivers
we will register nop transceivers.
Note that once OMAP's transceiver drivers reach mainline,
this glue layer will change accordingly.
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/dwc3/dwc3-omap.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index 479dc047da3a..ee57a10d90d0 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c | |||
@@ -48,6 +48,9 @@ | |||
48 | #include <linux/io.h> | 48 | #include <linux/io.h> |
49 | #include <linux/of.h> | 49 | #include <linux/of.h> |
50 | 50 | ||
51 | #include <linux/usb/otg.h> | ||
52 | #include <linux/usb/nop-usb-xceiv.h> | ||
53 | |||
51 | #include "core.h" | 54 | #include "core.h" |
52 | 55 | ||
53 | /* | 56 | /* |
@@ -131,6 +134,8 @@ struct dwc3_omap { | |||
131 | spinlock_t lock; | 134 | spinlock_t lock; |
132 | 135 | ||
133 | struct platform_device *dwc3; | 136 | struct platform_device *dwc3; |
137 | struct platform_device *usb2_phy; | ||
138 | struct platform_device *usb3_phy; | ||
134 | struct device *dev; | 139 | struct device *dev; |
135 | 140 | ||
136 | int irq; | 141 | int irq; |
@@ -152,6 +157,59 @@ static inline void dwc3_omap_writel(void __iomem *base, u32 offset, u32 value) | |||
152 | writel(value, base + offset); | 157 | writel(value, base + offset); |
153 | } | 158 | } |
154 | 159 | ||
160 | static int __devinit dwc3_omap_register_phys(struct dwc3_omap *omap) | ||
161 | { | ||
162 | struct nop_usb_xceiv_platform_data pdata; | ||
163 | struct platform_device *pdev; | ||
164 | int ret; | ||
165 | |||
166 | memset(&pdata, 0x00, sizeof(pdata)); | ||
167 | |||
168 | pdev = platform_device_alloc("nop_usb_xceiv", 0); | ||
169 | if (!pdev) | ||
170 | return -ENOMEM; | ||
171 | |||
172 | omap->usb2_phy = pdev; | ||
173 | pdata.type = USB_PHY_TYPE_USB2; | ||
174 | |||
175 | ret = platform_device_add_data(omap->usb2_phy, &pdata, sizeof(pdata)); | ||
176 | if (ret) | ||
177 | goto err1; | ||
178 | |||
179 | pdev = platform_device_alloc("nop_usb_xceiv", 1); | ||
180 | if (!pdev) { | ||
181 | ret = -ENOMEM; | ||
182 | goto err1; | ||
183 | } | ||
184 | |||
185 | omap->usb3_phy = pdev; | ||
186 | pdata.type = USB_PHY_TYPE_USB3; | ||
187 | |||
188 | ret = platform_device_add_data(omap->usb3_phy, &pdata, sizeof(pdata)); | ||
189 | if (ret) | ||
190 | goto err2; | ||
191 | |||
192 | ret = platform_device_add(omap->usb2_phy); | ||
193 | if (ret) | ||
194 | goto err2; | ||
195 | |||
196 | ret = platform_device_add(omap->usb3_phy); | ||
197 | if (ret) | ||
198 | goto err3; | ||
199 | |||
200 | return 0; | ||
201 | |||
202 | err3: | ||
203 | platform_device_del(omap->usb2_phy); | ||
204 | |||
205 | err2: | ||
206 | platform_device_put(omap->usb3_phy); | ||
207 | |||
208 | err1: | ||
209 | platform_device_put(omap->usb2_phy); | ||
210 | |||
211 | return ret; | ||
212 | } | ||
155 | 213 | ||
156 | static irqreturn_t dwc3_omap_interrupt(int irq, void *_omap) | 214 | static irqreturn_t dwc3_omap_interrupt(int irq, void *_omap) |
157 | { | 215 | { |
@@ -251,6 +309,12 @@ static int __devinit dwc3_omap_probe(struct platform_device *pdev) | |||
251 | return -ENOMEM; | 309 | return -ENOMEM; |
252 | } | 310 | } |
253 | 311 | ||
312 | ret = dwc3_omap_register_phys(omap); | ||
313 | if (ret) { | ||
314 | dev_err(dev, "couldn't register PHYs\n"); | ||
315 | return ret; | ||
316 | } | ||
317 | |||
254 | devid = dwc3_get_device_id(); | 318 | devid = dwc3_get_device_id(); |
255 | if (devid < 0) | 319 | if (devid < 0) |
256 | return -ENODEV; | 320 | return -ENODEV; |
@@ -371,6 +435,8 @@ static int __devexit dwc3_omap_remove(struct platform_device *pdev) | |||
371 | struct dwc3_omap *omap = platform_get_drvdata(pdev); | 435 | struct dwc3_omap *omap = platform_get_drvdata(pdev); |
372 | 436 | ||
373 | platform_device_unregister(omap->dwc3); | 437 | platform_device_unregister(omap->dwc3); |
438 | platform_device_unregister(omap->usb2_phy); | ||
439 | platform_device_unregister(omap->usb3_phy); | ||
374 | 440 | ||
375 | dwc3_put_device_id(omap->dwc3->id); | 441 | dwc3_put_device_id(omap->dwc3->id); |
376 | 442 | ||