aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-samsung/s3c-pl330.c
diff options
context:
space:
mode:
authorSeungwhan Youn <sw.youn@samsung.com>2010-10-19 05:44:16 -0400
committerKukjin Kim <kgene.kim@samsung.com>2010-10-25 03:10:56 -0400
commit6c69abb27f1a7e2c15a678fb9e7ab55293c8f820 (patch)
treefc6ff6d84d3ff4f13d04cc98fdcce2e0f62e5258 /arch/arm/plat-samsung/s3c-pl330.c
parent9d59c17ab5e0d1891f10df951d8e5fc0c83cb966 (diff)
ARM: SAMSUNG: Move DMA clock enable into S3C PL330 driver
This patch moves DMA clock enable functionality into pl330_probe() of plat-samsung/s3c_pl330.c (PL330 DMAC driver) and disable functionality into pl330_remove(). For now according to clock policy of Samsung SoCs' mainline, clocks which are used in the driver should be controlled by each own. Signed-off-by: Seungwhan Youn <sw.youn@samsung.com> Acked-by: Jassi Brar <jassi.brar@samsung.com> [kgene.kim@samsung.com: minor title and comment edit] Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'arch/arm/plat-samsung/s3c-pl330.c')
-rw-r--r--arch/arm/plat-samsung/s3c-pl330.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/arch/arm/plat-samsung/s3c-pl330.c b/arch/arm/plat-samsung/s3c-pl330.c
index a91305a60aed..b4ff8d74ac40 100644
--- a/arch/arm/plat-samsung/s3c-pl330.c
+++ b/arch/arm/plat-samsung/s3c-pl330.c
@@ -15,6 +15,8 @@
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/clk.h>
19#include <linux/err.h>
18 20
19#include <asm/hardware/pl330.h> 21#include <asm/hardware/pl330.h>
20 22
@@ -27,6 +29,7 @@
27 * @node: To attach to the global list of DMACs. 29 * @node: To attach to the global list of DMACs.
28 * @pi: PL330 configuration info for the DMAC. 30 * @pi: PL330 configuration info for the DMAC.
29 * @kmcache: Pool to quickly allocate xfers for all channels in the dmac. 31 * @kmcache: Pool to quickly allocate xfers for all channels in the dmac.
32 * @clk: Pointer of DMAC operation clock.
30 */ 33 */
31struct s3c_pl330_dmac { 34struct s3c_pl330_dmac {
32 unsigned busy_chan; 35 unsigned busy_chan;
@@ -34,6 +37,7 @@ struct s3c_pl330_dmac {
34 struct list_head node; 37 struct list_head node;
35 struct pl330_info *pi; 38 struct pl330_info *pi;
36 struct kmem_cache *kmcache; 39 struct kmem_cache *kmcache;
40 struct clk *clk;
37}; 41};
38 42
39/** 43/**
@@ -1072,16 +1076,25 @@ static int pl330_probe(struct platform_device *pdev)
1072 if (ret) 1076 if (ret)
1073 goto probe_err4; 1077 goto probe_err4;
1074 1078
1075 ret = pl330_add(pl330_info);
1076 if (ret)
1077 goto probe_err5;
1078
1079 /* Allocate a new DMAC */ 1079 /* Allocate a new DMAC */
1080 s3c_pl330_dmac = kmalloc(sizeof(*s3c_pl330_dmac), GFP_KERNEL); 1080 s3c_pl330_dmac = kmalloc(sizeof(*s3c_pl330_dmac), GFP_KERNEL);
1081 if (!s3c_pl330_dmac) { 1081 if (!s3c_pl330_dmac) {
1082 ret = -ENOMEM; 1082 ret = -ENOMEM;
1083 goto probe_err5;
1084 }
1085
1086 /* Get operation clock and enable it */
1087 s3c_pl330_dmac->clk = clk_get(&pdev->dev, "pdma");
1088 if (IS_ERR(s3c_pl330_dmac->clk)) {
1089 dev_err(&pdev->dev, "Cannot get operation clock.\n");
1090 ret = -EINVAL;
1083 goto probe_err6; 1091 goto probe_err6;
1084 } 1092 }
1093 clk_enable(s3c_pl330_dmac->clk);
1094
1095 ret = pl330_add(pl330_info);
1096 if (ret)
1097 goto probe_err7;
1085 1098
1086 /* Hook the info */ 1099 /* Hook the info */
1087 s3c_pl330_dmac->pi = pl330_info; 1100 s3c_pl330_dmac->pi = pl330_info;
@@ -1094,7 +1107,7 @@ static int pl330_probe(struct platform_device *pdev)
1094 1107
1095 if (!s3c_pl330_dmac->kmcache) { 1108 if (!s3c_pl330_dmac->kmcache) {
1096 ret = -ENOMEM; 1109 ret = -ENOMEM;
1097 goto probe_err7; 1110 goto probe_err8;
1098 } 1111 }
1099 1112
1100 /* Get the list of peripherals */ 1113 /* Get the list of peripherals */
@@ -1120,10 +1133,13 @@ static int pl330_probe(struct platform_device *pdev)
1120 1133
1121 return 0; 1134 return 0;
1122 1135
1136probe_err8:
1137 pl330_del(pl330_info);
1123probe_err7: 1138probe_err7:
1124 kfree(s3c_pl330_dmac); 1139 clk_disable(s3c_pl330_dmac->clk);
1140 clk_put(s3c_pl330_dmac->clk);
1125probe_err6: 1141probe_err6:
1126 pl330_del(pl330_info); 1142 kfree(s3c_pl330_dmac);
1127probe_err5: 1143probe_err5:
1128 free_irq(irq, pl330_info); 1144 free_irq(irq, pl330_info);
1129probe_err4: 1145probe_err4:
@@ -1188,6 +1204,10 @@ static int pl330_remove(struct platform_device *pdev)
1188 } 1204 }
1189 } 1205 }
1190 1206
1207 /* Disable operation clock */
1208 clk_disable(dmac->clk);
1209 clk_put(dmac->clk);
1210
1191 /* Remove the DMAC */ 1211 /* Remove the DMAC */
1192 list_del(&dmac->node); 1212 list_del(&dmac->node);
1193 kfree(dmac); 1213 kfree(dmac);