Lines Matching +full:dma +full:- +full:spear1340

1 // SPDX-License-Identifier: GPL-2.0
3 * Platform driver for the Synopsys DesignWare DMA Controller
5 * Copyright (C) 2007-2008 Atmel Corporation
6 * Copyright (C) 2010-2011 ST Microelectronics
18 #include <linux/dma-mapping.h>
31 struct device *dev = &pdev->dev; in dw_probe()
36 return -ENODEV; in dw_probe()
38 data = devm_kmemdup(&pdev->dev, match, sizeof(*match), GFP_KERNEL); in dw_probe()
40 return -ENOMEM; in dw_probe()
44 return -ENOMEM; in dw_probe()
46 chip->irq = platform_get_irq(pdev, 0); in dw_probe()
47 if (chip->irq < 0) in dw_probe()
48 return chip->irq; in dw_probe()
50 chip->regs = devm_platform_ioremap_resource(pdev, 0); in dw_probe()
51 if (IS_ERR(chip->regs)) in dw_probe()
52 return PTR_ERR(chip->regs); in dw_probe()
54 ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); in dw_probe()
58 if (!data->pdata) in dw_probe()
59 data->pdata = dev_get_platdata(dev); in dw_probe()
60 if (!data->pdata) in dw_probe()
61 data->pdata = dw_dma_parse_dt(pdev); in dw_probe()
63 chip->dev = dev; in dw_probe()
64 chip->id = pdev->id; in dw_probe()
65 chip->pdata = data->pdata; in dw_probe()
67 data->chip = chip; in dw_probe()
69 chip->clk = devm_clk_get_optional(chip->dev, "hclk"); in dw_probe()
70 if (IS_ERR(chip->clk)) in dw_probe()
71 return PTR_ERR(chip->clk); in dw_probe()
72 ret = clk_prepare_enable(chip->clk); in dw_probe()
76 pm_runtime_enable(&pdev->dev); in dw_probe()
78 ret = data->probe(chip); in dw_probe()
84 dw_dma_of_controller_register(chip->dw); in dw_probe()
86 dw_dma_acpi_controller_register(chip->dw); in dw_probe()
91 pm_runtime_disable(&pdev->dev); in dw_probe()
92 clk_disable_unprepare(chip->clk); in dw_probe()
99 struct dw_dma_chip *chip = data->chip; in dw_remove()
102 dw_dma_acpi_controller_free(chip->dw); in dw_remove()
104 dw_dma_of_controller_free(chip->dw); in dw_remove()
106 ret = data->remove(chip); in dw_remove()
108 dev_warn(chip->dev, "can't remove device properly: %d\n", ret); in dw_remove()
110 pm_runtime_disable(&pdev->dev); in dw_remove()
111 clk_disable_unprepare(chip->clk); in dw_remove()
117 struct dw_dma_chip *chip = data->chip; in dw_shutdown()
121 * some platforms we can't do that since DMA device is powered off. in dw_shutdown()
128 pm_runtime_get_sync(chip->dev); in dw_shutdown()
130 pm_runtime_put_sync_suspend(chip->dev); in dw_shutdown()
132 clk_disable_unprepare(chip->clk); in dw_shutdown()
137 { .compatible = "snps,dma-spear1340", .data = &dw_dma_chip_pdata },
138 { .compatible = "renesas,rzn1-dma", .data = &dw_dma_chip_pdata },
150 /* Elkhart Lake iDMA 32-bit (PSE DMA) */
165 struct dw_dma_chip *chip = data->chip; in dw_suspend_late()
168 clk_disable_unprepare(chip->clk); in dw_suspend_late()
176 struct dw_dma_chip *chip = data->chip; in dw_resume_early()
179 ret = clk_prepare_enable(chip->clk); in dw_resume_early()
217 MODULE_DESCRIPTION("Synopsys DesignWare DMA Controller platform driver");