aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/imx-sdma.c40
-rw-r--r--drivers/dma/ipu/ipu_idmac.c6
-rw-r--r--drivers/dma/mv_xor.c15
-rw-r--r--drivers/dma/mv_xor.h1
4 files changed, 47 insertions, 15 deletions
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index a472a29d8497..fb4f4990f5eb 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -323,7 +323,8 @@ struct sdma_engine {
323 struct sdma_context_data *context; 323 struct sdma_context_data *context;
324 dma_addr_t context_phys; 324 dma_addr_t context_phys;
325 struct dma_device dma_device; 325 struct dma_device dma_device;
326 struct clk *clk; 326 struct clk *clk_ipg;
327 struct clk *clk_ahb;
327 spinlock_t channel_0_lock; 328 spinlock_t channel_0_lock;
328 struct sdma_script_start_addrs *script_addrs; 329 struct sdma_script_start_addrs *script_addrs;
329}; 330};
@@ -867,7 +868,8 @@ static int sdma_alloc_chan_resources(struct dma_chan *chan)
867 sdmac->peripheral_type = data->peripheral_type; 868 sdmac->peripheral_type = data->peripheral_type;
868 sdmac->event_id0 = data->dma_request; 869 sdmac->event_id0 = data->dma_request;
869 870
870 clk_enable(sdmac->sdma->clk); 871 clk_enable(sdmac->sdma->clk_ipg);
872 clk_enable(sdmac->sdma->clk_ahb);
871 873
872 ret = sdma_request_channel(sdmac); 874 ret = sdma_request_channel(sdmac);
873 if (ret) 875 if (ret)
@@ -904,7 +906,8 @@ static void sdma_free_chan_resources(struct dma_chan *chan)
904 906
905 dma_free_coherent(NULL, PAGE_SIZE, sdmac->bd, sdmac->bd_phys); 907 dma_free_coherent(NULL, PAGE_SIZE, sdmac->bd, sdmac->bd_phys);
906 908
907 clk_disable(sdma->clk); 909 clk_disable(sdma->clk_ipg);
910 clk_disable(sdma->clk_ahb);
908} 911}
909 912
910static struct dma_async_tx_descriptor *sdma_prep_slave_sg( 913static struct dma_async_tx_descriptor *sdma_prep_slave_sg(
@@ -1177,12 +1180,14 @@ static void sdma_load_firmware(const struct firmware *fw, void *context)
1177 addr = (void *)header + header->script_addrs_start; 1180 addr = (void *)header + header->script_addrs_start;
1178 ram_code = (void *)header + header->ram_code_start; 1181 ram_code = (void *)header + header->ram_code_start;
1179 1182
1180 clk_enable(sdma->clk); 1183 clk_enable(sdma->clk_ipg);
1184 clk_enable(sdma->clk_ahb);
1181 /* download the RAM image for SDMA */ 1185 /* download the RAM image for SDMA */
1182 sdma_load_script(sdma, ram_code, 1186 sdma_load_script(sdma, ram_code,
1183 header->ram_code_size, 1187 header->ram_code_size,
1184 addr->ram_code_start_addr); 1188 addr->ram_code_start_addr);
1185 clk_disable(sdma->clk); 1189 clk_disable(sdma->clk_ipg);
1190 clk_disable(sdma->clk_ahb);
1186 1191
1187 sdma_add_scripts(sdma, addr); 1192 sdma_add_scripts(sdma, addr);
1188 1193
@@ -1224,7 +1229,8 @@ static int __init sdma_init(struct sdma_engine *sdma)
1224 return -ENODEV; 1229 return -ENODEV;
1225 } 1230 }
1226 1231
1227 clk_enable(sdma->clk); 1232 clk_enable(sdma->clk_ipg);
1233 clk_enable(sdma->clk_ahb);
1228 1234
1229 /* Be sure SDMA has not started yet */ 1235 /* Be sure SDMA has not started yet */
1230 writel_relaxed(0, sdma->regs + SDMA_H_C0PTR); 1236 writel_relaxed(0, sdma->regs + SDMA_H_C0PTR);
@@ -1277,12 +1283,14 @@ static int __init sdma_init(struct sdma_engine *sdma)
1277 /* Initializes channel's priorities */ 1283 /* Initializes channel's priorities */
1278 sdma_set_channel_priority(&sdma->channel[0], 7); 1284 sdma_set_channel_priority(&sdma->channel[0], 7);
1279 1285
1280 clk_disable(sdma->clk); 1286 clk_disable(sdma->clk_ipg);
1287 clk_disable(sdma->clk_ahb);
1281 1288
1282 return 0; 1289 return 0;
1283 1290
1284err_dma_alloc: 1291err_dma_alloc:
1285 clk_disable(sdma->clk); 1292 clk_disable(sdma->clk_ipg);
1293 clk_disable(sdma->clk_ahb);
1286 dev_err(sdma->dev, "initialisation failed with %d\n", ret); 1294 dev_err(sdma->dev, "initialisation failed with %d\n", ret);
1287 return ret; 1295 return ret;
1288} 1296}
@@ -1321,12 +1329,21 @@ static int __init sdma_probe(struct platform_device *pdev)
1321 goto err_request_region; 1329 goto err_request_region;
1322 } 1330 }
1323 1331
1324 sdma->clk = clk_get(&pdev->dev, NULL); 1332 sdma->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
1325 if (IS_ERR(sdma->clk)) { 1333 if (IS_ERR(sdma->clk_ipg)) {
1326 ret = PTR_ERR(sdma->clk); 1334 ret = PTR_ERR(sdma->clk_ipg);
1327 goto err_clk; 1335 goto err_clk;
1328 } 1336 }
1329 1337
1338 sdma->clk_ahb = devm_clk_get(&pdev->dev, "ahb");
1339 if (IS_ERR(sdma->clk_ahb)) {
1340 ret = PTR_ERR(sdma->clk_ahb);
1341 goto err_clk;
1342 }
1343
1344 clk_prepare(sdma->clk_ipg);
1345 clk_prepare(sdma->clk_ahb);
1346
1330 sdma->regs = ioremap(iores->start, resource_size(iores)); 1347 sdma->regs = ioremap(iores->start, resource_size(iores));
1331 if (!sdma->regs) { 1348 if (!sdma->regs) {
1332 ret = -ENOMEM; 1349 ret = -ENOMEM;
@@ -1436,7 +1453,6 @@ err_alloc:
1436err_request_irq: 1453err_request_irq:
1437 iounmap(sdma->regs); 1454 iounmap(sdma->regs);
1438err_ioremap: 1455err_ioremap:
1439 clk_put(sdma->clk);
1440err_clk: 1456err_clk:
1441 release_mem_region(iores->start, resource_size(iores)); 1457 release_mem_region(iores->start, resource_size(iores));
1442err_request_region: 1458err_request_region:
diff --git a/drivers/dma/ipu/ipu_idmac.c b/drivers/dma/ipu/ipu_idmac.c
index 62e3f8ec2461..5ec72044ea4c 100644
--- a/drivers/dma/ipu/ipu_idmac.c
+++ b/drivers/dma/ipu/ipu_idmac.c
@@ -1715,7 +1715,7 @@ static int __init ipu_probe(struct platform_device *pdev)
1715 } 1715 }
1716 1716
1717 /* Make sure IPU HSP clock is running */ 1717 /* Make sure IPU HSP clock is running */
1718 clk_enable(ipu_data.ipu_clk); 1718 clk_prepare_enable(ipu_data.ipu_clk);
1719 1719
1720 /* Disable all interrupts */ 1720 /* Disable all interrupts */
1721 idmac_write_ipureg(&ipu_data, 0, IPU_INT_CTRL_1); 1721 idmac_write_ipureg(&ipu_data, 0, IPU_INT_CTRL_1);
@@ -1747,7 +1747,7 @@ static int __init ipu_probe(struct platform_device *pdev)
1747err_idmac_init: 1747err_idmac_init:
1748err_attach_irq: 1748err_attach_irq:
1749 ipu_irq_detach_irq(&ipu_data, pdev); 1749 ipu_irq_detach_irq(&ipu_data, pdev);
1750 clk_disable(ipu_data.ipu_clk); 1750 clk_disable_unprepare(ipu_data.ipu_clk);
1751 clk_put(ipu_data.ipu_clk); 1751 clk_put(ipu_data.ipu_clk);
1752err_clk_get: 1752err_clk_get:
1753 iounmap(ipu_data.reg_ic); 1753 iounmap(ipu_data.reg_ic);
@@ -1765,7 +1765,7 @@ static int __exit ipu_remove(struct platform_device *pdev)
1765 1765
1766 ipu_idmac_exit(ipu); 1766 ipu_idmac_exit(ipu);
1767 ipu_irq_detach_irq(ipu, pdev); 1767 ipu_irq_detach_irq(ipu, pdev);
1768 clk_disable(ipu->ipu_clk); 1768 clk_disable_unprepare(ipu->ipu_clk);
1769 clk_put(ipu->ipu_clk); 1769 clk_put(ipu->ipu_clk);
1770 iounmap(ipu->reg_ic); 1770 iounmap(ipu->reg_ic);
1771 iounmap(ipu->reg_ipu); 1771 iounmap(ipu->reg_ipu);
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index fa5d55fea46c..0b12e68bf79c 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -25,6 +25,7 @@
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/platform_device.h> 26#include <linux/platform_device.h>
27#include <linux/memory.h> 27#include <linux/memory.h>
28#include <linux/clk.h>
28#include <plat/mv_xor.h> 29#include <plat/mv_xor.h>
29 30
30#include "dmaengine.h" 31#include "dmaengine.h"
@@ -1307,11 +1308,25 @@ static int mv_xor_shared_probe(struct platform_device *pdev)
1307 if (dram) 1308 if (dram)
1308 mv_xor_conf_mbus_windows(msp, dram); 1309 mv_xor_conf_mbus_windows(msp, dram);
1309 1310
1311 /* Not all platforms can gate the clock, so it is not
1312 * an error if the clock does not exists.
1313 */
1314 msp->clk = clk_get(&pdev->dev, NULL);
1315 if (!IS_ERR(msp->clk))
1316 clk_prepare_enable(msp->clk);
1317
1310 return 0; 1318 return 0;
1311} 1319}
1312 1320
1313static int mv_xor_shared_remove(struct platform_device *pdev) 1321static int mv_xor_shared_remove(struct platform_device *pdev)
1314{ 1322{
1323 struct mv_xor_shared_private *msp = platform_get_drvdata(pdev);
1324
1325 if (!IS_ERR(msp->clk)) {
1326 clk_disable_unprepare(msp->clk);
1327 clk_put(msp->clk);
1328 }
1329
1315 return 0; 1330 return 0;
1316} 1331}
1317 1332
diff --git a/drivers/dma/mv_xor.h b/drivers/dma/mv_xor.h
index 654876b7ba1d..a5b422f5a8ab 100644
--- a/drivers/dma/mv_xor.h
+++ b/drivers/dma/mv_xor.h
@@ -55,6 +55,7 @@
55struct mv_xor_shared_private { 55struct mv_xor_shared_private {
56 void __iomem *xor_base; 56 void __iomem *xor_base;
57 void __iomem *xor_high_base; 57 void __iomem *xor_high_base;
58 struct clk *clk;
58}; 59};
59 60
60 61