aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3/dwc3-omap.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/dwc3/dwc3-omap.c')
-rw-r--r--drivers/usb/dwc3/dwc3-omap.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index 062552b5fc8a..3274ac8f1200 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -48,6 +48,7 @@
48#include <linux/io.h> 48#include <linux/io.h>
49#include <linux/module.h> 49#include <linux/module.h>
50 50
51#include "core.h"
51#include "io.h" 52#include "io.h"
52 53
53/* 54/*
@@ -200,6 +201,7 @@ static int __devinit dwc3_omap_probe(struct platform_device *pdev)
200 struct dwc3_omap *omap; 201 struct dwc3_omap *omap;
201 struct resource *res; 202 struct resource *res;
202 203
204 int devid;
203 int ret = -ENOMEM; 205 int ret = -ENOMEM;
204 int irq; 206 int irq;
205 207
@@ -236,16 +238,20 @@ static int __devinit dwc3_omap_probe(struct platform_device *pdev)
236 goto err1; 238 goto err1;
237 } 239 }
238 240
239 dwc3 = platform_device_alloc("dwc3-omap", -1); 241 devid = dwc3_get_device_id();
242 if (devid < 0)
243 goto err2;
244
245 dwc3 = platform_device_alloc("dwc3", devid);
240 if (!dwc3) { 246 if (!dwc3) {
241 dev_err(&pdev->dev, "couldn't allocate dwc3 device\n"); 247 dev_err(&pdev->dev, "couldn't allocate dwc3 device\n");
242 goto err2; 248 goto err3;
243 } 249 }
244 250
245 context = kzalloc(resource_size(res), GFP_KERNEL); 251 context = kzalloc(resource_size(res), GFP_KERNEL);
246 if (!context) { 252 if (!context) {
247 dev_err(&pdev->dev, "couldn't allocate dwc3 context memory\n"); 253 dev_err(&pdev->dev, "couldn't allocate dwc3 context memory\n");
248 goto err3; 254 goto err4;
249 } 255 }
250 256
251 spin_lock_init(&omap->lock); 257 spin_lock_init(&omap->lock);
@@ -299,7 +305,7 @@ static int __devinit dwc3_omap_probe(struct platform_device *pdev)
299 if (ret) { 305 if (ret) {
300 dev_err(&pdev->dev, "failed to request IRQ #%d --> %d\n", 306 dev_err(&pdev->dev, "failed to request IRQ #%d --> %d\n",
301 omap->irq, ret); 307 omap->irq, ret);
302 goto err4; 308 goto err5;
303 } 309 }
304 310
305 /* enable all IRQs */ 311 /* enable all IRQs */
@@ -322,26 +328,29 @@ static int __devinit dwc3_omap_probe(struct platform_device *pdev)
322 pdev->num_resources); 328 pdev->num_resources);
323 if (ret) { 329 if (ret) {
324 dev_err(&pdev->dev, "couldn't add resources to dwc3 device\n"); 330 dev_err(&pdev->dev, "couldn't add resources to dwc3 device\n");
325 goto err5; 331 goto err6;
326 } 332 }
327 333
328 ret = platform_device_add(dwc3); 334 ret = platform_device_add(dwc3);
329 if (ret) { 335 if (ret) {
330 dev_err(&pdev->dev, "failed to register dwc3 device\n"); 336 dev_err(&pdev->dev, "failed to register dwc3 device\n");
331 goto err5; 337 goto err6;
332 } 338 }
333 339
334 return 0; 340 return 0;
335 341
336err5: 342err6:
337 free_irq(omap->irq, omap); 343 free_irq(omap->irq, omap);
338 344
339err4: 345err5:
340 kfree(omap->context); 346 kfree(omap->context);
341 347
342err3: 348err4:
343 platform_device_put(dwc3); 349 platform_device_put(dwc3);
344 350
351err3:
352 dwc3_put_device_id(devid);
353
345err2: 354err2:
346 iounmap(base); 355 iounmap(base);
347 356
@@ -358,6 +367,7 @@ static int __devexit dwc3_omap_remove(struct platform_device *pdev)
358 367
359 platform_device_unregister(omap->dwc3); 368 platform_device_unregister(omap->dwc3);
360 369
370 dwc3_put_device_id(omap->dwc3->id);
361 free_irq(omap->irq, omap); 371 free_irq(omap->irq, omap);
362 iounmap(omap->base); 372 iounmap(omap->base);
363 373
@@ -384,18 +394,9 @@ static struct platform_driver dwc3_omap_driver = {
384 }, 394 },
385}; 395};
386 396
397module_platform_driver(dwc3_omap_driver);
398
399MODULE_ALIAS("platform:omap-dwc3");
387MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>"); 400MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>");
388MODULE_LICENSE("Dual BSD/GPL"); 401MODULE_LICENSE("Dual BSD/GPL");
389MODULE_DESCRIPTION("DesignWare USB3 OMAP Glue Layer"); 402MODULE_DESCRIPTION("DesignWare USB3 OMAP Glue Layer");
390
391static int __devinit dwc3_omap_init(void)
392{
393 return platform_driver_register(&dwc3_omap_driver);
394}
395module_init(dwc3_omap_init);
396
397static void __exit dwc3_omap_exit(void)
398{
399 platform_driver_unregister(&dwc3_omap_driver);
400}
401module_exit(dwc3_omap_exit);