diff options
Diffstat (limited to 'drivers/usb/chipidea/core.c')
-rw-r--r-- | drivers/usb/chipidea/core.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 9a883bd5e113..8b9d06fd0325 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c | |||
@@ -332,6 +332,49 @@ static irqreturn_t ci_irq(int irq, void *data) | |||
332 | return ci->role == CI_ROLE_END ? ret : ci_role(ci)->irq(ci); | 332 | return ci->role == CI_ROLE_END ? ret : ci_role(ci)->irq(ci); |
333 | } | 333 | } |
334 | 334 | ||
335 | struct platform_device *ci13xxx_add_device(struct device *dev, | ||
336 | struct resource *res, int nres, | ||
337 | struct ci13xxx_platform_data *platdata) | ||
338 | { | ||
339 | struct platform_device *pdev; | ||
340 | int ret; | ||
341 | |||
342 | /* FIXME: find a way to choose id */ | ||
343 | pdev = platform_device_alloc("ci_hdrc", -1); | ||
344 | if (!pdev) | ||
345 | return ERR_PTR(-ENOMEM); | ||
346 | |||
347 | pdev->dev.parent = dev; | ||
348 | pdev->dev.dma_mask = dev->dma_mask; | ||
349 | pdev->dev.dma_parms = dev->dma_parms; | ||
350 | dma_set_coherent_mask(&pdev->dev, dev->coherent_dma_mask); | ||
351 | |||
352 | ret = platform_device_add_resources(pdev, res, nres); | ||
353 | if (ret) | ||
354 | goto err; | ||
355 | |||
356 | ret = platform_device_add_data(pdev, platdata, sizeof(*platdata)); | ||
357 | if (ret) | ||
358 | goto err; | ||
359 | |||
360 | ret = platform_device_add(pdev); | ||
361 | if (ret) | ||
362 | goto err; | ||
363 | |||
364 | return pdev; | ||
365 | |||
366 | err: | ||
367 | platform_device_put(pdev); | ||
368 | return ERR_PTR(ret); | ||
369 | } | ||
370 | EXPORT_SYMBOL_GPL(ci13xxx_add_device); | ||
371 | |||
372 | void ci13xxx_remove_device(struct platform_device *pdev) | ||
373 | { | ||
374 | platform_device_unregister(pdev); | ||
375 | } | ||
376 | EXPORT_SYMBOL_GPL(ci13xxx_remove_device); | ||
377 | |||
335 | static int __devinit ci_hdrc_probe(struct platform_device *pdev) | 378 | static int __devinit ci_hdrc_probe(struct platform_device *pdev) |
336 | { | 379 | { |
337 | struct device *dev = &pdev->dev; | 380 | struct device *dev = &pdev->dev; |