aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/imx-sdma.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dma/imx-sdma.c')
-rw-r--r--drivers/dma/imx-sdma.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index f7626e37d0b8..88afc48c2ca7 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -1334,7 +1334,7 @@ err_firmware:
1334 release_firmware(fw); 1334 release_firmware(fw);
1335} 1335}
1336 1336
1337static int __init sdma_get_firmware(struct sdma_engine *sdma, 1337static int sdma_get_firmware(struct sdma_engine *sdma,
1338 const char *fw_name) 1338 const char *fw_name)
1339{ 1339{
1340 int ret; 1340 int ret;
@@ -1448,7 +1448,7 @@ static struct dma_chan *sdma_xlate(struct of_phandle_args *dma_spec,
1448 return dma_request_channel(mask, sdma_filter_fn, &data); 1448 return dma_request_channel(mask, sdma_filter_fn, &data);
1449} 1449}
1450 1450
1451static int __init sdma_probe(struct platform_device *pdev) 1451static int sdma_probe(struct platform_device *pdev)
1452{ 1452{
1453 const struct of_device_id *of_id = 1453 const struct of_device_id *of_id =
1454 of_match_device(sdma_dt_ids, &pdev->dev); 1454 of_match_device(sdma_dt_ids, &pdev->dev);
@@ -1603,6 +1603,8 @@ static int __init sdma_probe(struct platform_device *pdev)
1603 sdma->dma_device.dev->dma_parms = &sdma->dma_parms; 1603 sdma->dma_device.dev->dma_parms = &sdma->dma_parms;
1604 dma_set_max_seg_size(sdma->dma_device.dev, 65535); 1604 dma_set_max_seg_size(sdma->dma_device.dev, 65535);
1605 1605
1606 platform_set_drvdata(pdev, sdma);
1607
1606 ret = dma_async_device_register(&sdma->dma_device); 1608 ret = dma_async_device_register(&sdma->dma_device);
1607 if (ret) { 1609 if (ret) {
1608 dev_err(&pdev->dev, "unable to register\n"); 1610 dev_err(&pdev->dev, "unable to register\n");
@@ -1640,7 +1642,27 @@ err_irq:
1640 1642
1641static int sdma_remove(struct platform_device *pdev) 1643static int sdma_remove(struct platform_device *pdev)
1642{ 1644{
1643 return -EBUSY; 1645 struct sdma_engine *sdma = platform_get_drvdata(pdev);
1646 struct resource *iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1647 int irq = platform_get_irq(pdev, 0);
1648 int i;
1649
1650 dma_async_device_unregister(&sdma->dma_device);
1651 kfree(sdma->script_addrs);
1652 free_irq(irq, sdma);
1653 iounmap(sdma->regs);
1654 release_mem_region(iores->start, resource_size(iores));
1655 /* Kill the tasklet */
1656 for (i = 0; i < MAX_DMA_CHANNELS; i++) {
1657 struct sdma_channel *sdmac = &sdma->channel[i];
1658
1659 tasklet_kill(&sdmac->tasklet);
1660 }
1661 kfree(sdma);
1662
1663 platform_set_drvdata(pdev, NULL);
1664 dev_info(&pdev->dev, "Removed...\n");
1665 return 0;
1644} 1666}
1645 1667
1646static struct platform_driver sdma_driver = { 1668static struct platform_driver sdma_driver = {
@@ -1650,13 +1672,10 @@ static struct platform_driver sdma_driver = {
1650 }, 1672 },
1651 .id_table = sdma_devtypes, 1673 .id_table = sdma_devtypes,
1652 .remove = sdma_remove, 1674 .remove = sdma_remove,
1675 .probe = sdma_probe,
1653}; 1676};
1654 1677
1655static int __init sdma_module_init(void) 1678module_platform_driver(sdma_driver);
1656{
1657 return platform_driver_probe(&sdma_driver, sdma_probe);
1658}
1659module_init(sdma_module_init);
1660 1679
1661MODULE_AUTHOR("Sascha Hauer, Pengutronix <s.hauer@pengutronix.de>"); 1680MODULE_AUTHOR("Sascha Hauer, Pengutronix <s.hauer@pengutronix.de>");
1662MODULE_DESCRIPTION("i.MX SDMA driver"); 1681MODULE_DESCRIPTION("i.MX SDMA driver");