diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-26 15:42:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-26 15:42:29 -0400 |
commit | 27953437059c64d14086196eb96f43c78caa9db3 (patch) | |
tree | 0cfd5fb21262a6db3de0c64462847b4c0c43e9df /drivers/dma/imx-sdma.c | |
parent | 2c757fd5d1a92086f225a75a8fac7cab242d11b0 (diff) | |
parent | 3c0dec5f58b3c7b3627715126d1bf9b030a076f0 (diff) |
Merge tag 'clock' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull arm-soc clock driver changes from Olof Johansson:
"The new clock subsystem was merged in linux-3.4 without any users,
this now moves the first three platforms over to it: imx, mxs and
spear.
The series also contains the changes for the clock subsystem itself,
since Mike preferred to have it together with the platforms that
require these changes, in order to avoid interdependencies and
conflicts."
Fix up trivial conflicts in arch/arm/mach-kirkwood/common.c (code
removed in one branch, added OF support in another) and
drivers/dma/imx-sdma.c (independent changes next to each other).
* tag 'clock' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (97 commits)
clk: Fix CLK_SET_RATE_GATE flag validation in clk_set_rate().
clk: Provide dummy clk_unregister()
SPEAr: Update defconfigs
SPEAr: Add SMI NOR partition info in dts files
SPEAr: Switch to common clock framework
SPEAr: Call clk_prepare() before calling clk_enable
SPEAr: clk: Add General Purpose Timer Synthesizer clock
SPEAr: clk: Add Fractional Synthesizer clock
SPEAr: clk: Add Auxiliary Synthesizer clock
SPEAr: clk: Add VCO-PLL Synthesizer clock
SPEAr: Add DT bindings for SPEAr's timer
ARM i.MX: remove now unused clock files
ARM: i.MX6: implement clocks using common clock framework
ARM i.MX35: implement clocks using common clock framework
ARM i.MX5: implement clocks using common clock framework
ARM: Kirkwood: Replace clock gating
ARM: Orion: Audio: Add clk/clkdev support
ARM: Orion: PCIE: Add support for clk
ARM: Orion: XOR: Add support for clk
ARM: Orion: CESA: Add support for clk
...
Diffstat (limited to 'drivers/dma/imx-sdma.c')
-rw-r--r-- | drivers/dma/imx-sdma.c | 40 |
1 files changed, 28 insertions, 12 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 | ||
910 | static struct dma_async_tx_descriptor *sdma_prep_slave_sg( | 913 | static 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 | ||
1284 | err_dma_alloc: | 1291 | err_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: | |||
1436 | err_request_irq: | 1453 | err_request_irq: |
1437 | iounmap(sdma->regs); | 1454 | iounmap(sdma->regs); |
1438 | err_ioremap: | 1455 | err_ioremap: |
1439 | clk_put(sdma->clk); | ||
1440 | err_clk: | 1456 | err_clk: |
1441 | release_mem_region(iores->start, resource_size(iores)); | 1457 | release_mem_region(iores->start, resource_size(iores)); |
1442 | err_request_region: | 1458 | err_request_region: |