aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2012-11-15 09:29:53 -0500
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2012-11-20 09:58:59 -0500
commit297eedbae1677c8276df082fb17fb1344058fed0 (patch)
tree0bb22fd693ff21d0e8c6266e8d6bae7028dae75a
parent1ef48a262b0d50add7d293a37b8c8bad4bec30a1 (diff)
dma: mv_xor: rename mv_xor_private to mv_xor_device
Now that mv_xor_device is no longer used to designate the per-channel DMA devices, use it know to designate the XOR engine themselves (currently composed of two XOR channels). So, now we have the nice organization where: - mv_xor_device represents each XOR engine in the system - mv_xor_chan represents each XOR channel of a given XOR engine Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-rw-r--r--drivers/dma/mv_xor.c66
-rw-r--r--drivers/dma/mv_xor.h4
2 files changed, 35 insertions, 35 deletions
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index 3b81ee1b555d..aec771917d54 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -1086,7 +1086,7 @@ static int mv_xor_channel_remove(struct mv_xor_chan *mv_chan)
1086} 1086}
1087 1087
1088static struct mv_xor_chan * 1088static struct mv_xor_chan *
1089mv_xor_channel_add(struct mv_xor_private *msp, 1089mv_xor_channel_add(struct mv_xor_device *xordev,
1090 struct platform_device *pdev, 1090 struct platform_device *pdev,
1091 int hw_id, dma_cap_mask_t cap_mask, 1091 int hw_id, dma_cap_mask_t cap_mask,
1092 size_t pool_size, int irq) 1092 size_t pool_size, int irq)
@@ -1118,7 +1118,7 @@ mv_xor_channel_add(struct mv_xor_private *msp,
1118 1118
1119 /* discover transaction capabilites from the platform data */ 1119 /* discover transaction capabilites from the platform data */
1120 dma_dev->cap_mask = cap_mask; 1120 dma_dev->cap_mask = cap_mask;
1121 mv_chan->shared = msp; 1121 mv_chan->shared = xordev;
1122 1122
1123 INIT_LIST_HEAD(&dma_dev->channels); 1123 INIT_LIST_HEAD(&dma_dev->channels);
1124 1124
@@ -1139,7 +1139,7 @@ mv_xor_channel_add(struct mv_xor_private *msp,
1139 dma_dev->device_prep_dma_xor = mv_xor_prep_dma_xor; 1139 dma_dev->device_prep_dma_xor = mv_xor_prep_dma_xor;
1140 } 1140 }
1141 1141
1142 mv_chan->mmr_base = msp->xor_base; 1142 mv_chan->mmr_base = xordev->xor_base;
1143 if (!mv_chan->mmr_base) { 1143 if (!mv_chan->mmr_base) {
1144 ret = -ENOMEM; 1144 ret = -ENOMEM;
1145 goto err_free_dma; 1145 goto err_free_dma;
@@ -1200,10 +1200,10 @@ mv_xor_channel_add(struct mv_xor_private *msp,
1200} 1200}
1201 1201
1202static void 1202static void
1203mv_xor_conf_mbus_windows(struct mv_xor_private *msp, 1203mv_xor_conf_mbus_windows(struct mv_xor_device *xordev,
1204 const struct mbus_dram_target_info *dram) 1204 const struct mbus_dram_target_info *dram)
1205{ 1205{
1206 void __iomem *base = msp->xor_base; 1206 void __iomem *base = xordev->xor_base;
1207 u32 win_enable = 0; 1207 u32 win_enable = 0;
1208 int i; 1208 int i;
1209 1209
@@ -1233,50 +1233,50 @@ mv_xor_conf_mbus_windows(struct mv_xor_private *msp,
1233static int mv_xor_probe(struct platform_device *pdev) 1233static int mv_xor_probe(struct platform_device *pdev)
1234{ 1234{
1235 const struct mbus_dram_target_info *dram; 1235 const struct mbus_dram_target_info *dram;
1236 struct mv_xor_private *msp; 1236 struct mv_xor_device *xordev;
1237 struct mv_xor_platform_data *pdata = pdev->dev.platform_data; 1237 struct mv_xor_platform_data *pdata = pdev->dev.platform_data;
1238 struct resource *res; 1238 struct resource *res;
1239 int i, ret; 1239 int i, ret;
1240 1240
1241 dev_notice(&pdev->dev, "Marvell XOR driver\n"); 1241 dev_notice(&pdev->dev, "Marvell XOR driver\n");
1242 1242
1243 msp = devm_kzalloc(&pdev->dev, sizeof(*msp), GFP_KERNEL); 1243 xordev = devm_kzalloc(&pdev->dev, sizeof(*xordev), GFP_KERNEL);
1244 if (!msp) 1244 if (!xordev)
1245 return -ENOMEM; 1245 return -ENOMEM;
1246 1246
1247 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1247 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1248 if (!res) 1248 if (!res)
1249 return -ENODEV; 1249 return -ENODEV;
1250 1250
1251 msp->xor_base = devm_ioremap(&pdev->dev, res->start, 1251 xordev->xor_base = devm_ioremap(&pdev->dev, res->start,
1252 resource_size(res)); 1252 resource_size(res));
1253 if (!msp->xor_base) 1253 if (!xordev->xor_base)
1254 return -EBUSY; 1254 return -EBUSY;
1255 1255
1256 res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 1256 res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
1257 if (!res) 1257 if (!res)
1258 return -ENODEV; 1258 return -ENODEV;
1259 1259
1260 msp->xor_high_base = devm_ioremap(&pdev->dev, res->start, 1260 xordev->xor_high_base = devm_ioremap(&pdev->dev, res->start,
1261 resource_size(res)); 1261 resource_size(res));
1262 if (!msp->xor_high_base) 1262 if (!xordev->xor_high_base)
1263 return -EBUSY; 1263 return -EBUSY;
1264 1264
1265 platform_set_drvdata(pdev, msp); 1265 platform_set_drvdata(pdev, xordev);
1266 1266
1267 /* 1267 /*
1268 * (Re-)program MBUS remapping windows if we are asked to. 1268 * (Re-)program MBUS remapping windows if we are asked to.
1269 */ 1269 */
1270 dram = mv_mbus_dram_info(); 1270 dram = mv_mbus_dram_info();
1271 if (dram) 1271 if (dram)
1272 mv_xor_conf_mbus_windows(msp, dram); 1272 mv_xor_conf_mbus_windows(xordev, dram);
1273 1273
1274 /* Not all platforms can gate the clock, so it is not 1274 /* Not all platforms can gate the clock, so it is not
1275 * an error if the clock does not exists. 1275 * an error if the clock does not exists.
1276 */ 1276 */
1277 msp->clk = clk_get(&pdev->dev, NULL); 1277 xordev->clk = clk_get(&pdev->dev, NULL);
1278 if (!IS_ERR(msp->clk)) 1278 if (!IS_ERR(xordev->clk))
1279 clk_prepare_enable(msp->clk); 1279 clk_prepare_enable(xordev->clk);
1280 1280
1281 if (pdata && pdata->channels) { 1281 if (pdata && pdata->channels) {
1282 for (i = 0; i < MV_XOR_MAX_CHANNELS; i++) { 1282 for (i = 0; i < MV_XOR_MAX_CHANNELS; i++) {
@@ -1295,12 +1295,12 @@ static int mv_xor_probe(struct platform_device *pdev)
1295 goto err_channel_add; 1295 goto err_channel_add;
1296 } 1296 }
1297 1297
1298 msp->channels[i] = 1298 xordev->channels[i] =
1299 mv_xor_channel_add(msp, pdev, cd->hw_id, 1299 mv_xor_channel_add(xordev, pdev, cd->hw_id,
1300 cd->cap_mask, 1300 cd->cap_mask,
1301 cd->pool_size, irq); 1301 cd->pool_size, irq);
1302 if (IS_ERR(msp->channels[i])) { 1302 if (IS_ERR(xordev->channels[i])) {
1303 ret = PTR_ERR(msp->channels[i]); 1303 ret = PTR_ERR(xordev->channels[i]);
1304 goto err_channel_add; 1304 goto err_channel_add;
1305 } 1305 }
1306 } 1306 }
@@ -1310,27 +1310,27 @@ static int mv_xor_probe(struct platform_device *pdev)
1310 1310
1311err_channel_add: 1311err_channel_add:
1312 for (i = 0; i < MV_XOR_MAX_CHANNELS; i++) 1312 for (i = 0; i < MV_XOR_MAX_CHANNELS; i++)
1313 if (msp->channels[i]) 1313 if (xordev->channels[i])
1314 mv_xor_channel_remove(msp->channels[i]); 1314 mv_xor_channel_remove(xordev->channels[i]);
1315 1315
1316 clk_disable_unprepare(msp->clk); 1316 clk_disable_unprepare(xordev->clk);
1317 clk_put(msp->clk); 1317 clk_put(xordev->clk);
1318 return ret; 1318 return ret;
1319} 1319}
1320 1320
1321static int mv_xor_remove(struct platform_device *pdev) 1321static int mv_xor_remove(struct platform_device *pdev)
1322{ 1322{
1323 struct mv_xor_private *msp = platform_get_drvdata(pdev); 1323 struct mv_xor_device *xordev = platform_get_drvdata(pdev);
1324 int i; 1324 int i;
1325 1325
1326 for (i = 0; i < MV_XOR_MAX_CHANNELS; i++) { 1326 for (i = 0; i < MV_XOR_MAX_CHANNELS; i++) {
1327 if (msp->channels[i]) 1327 if (xordev->channels[i])
1328 mv_xor_channel_remove(msp->channels[i]); 1328 mv_xor_channel_remove(xordev->channels[i]);
1329 } 1329 }
1330 1330
1331 if (!IS_ERR(msp->clk)) { 1331 if (!IS_ERR(xordev->clk)) {
1332 clk_disable_unprepare(msp->clk); 1332 clk_disable_unprepare(xordev->clk);
1333 clk_put(msp->clk); 1333 clk_put(xordev->clk);
1334 } 1334 }
1335 1335
1336 return 0; 1336 return 0;
diff --git a/drivers/dma/mv_xor.h b/drivers/dma/mv_xor.h
index 16de1f62c950..cedeaa04f238 100644
--- a/drivers/dma/mv_xor.h
+++ b/drivers/dma/mv_xor.h
@@ -53,7 +53,7 @@
53#define WINDOW_REMAP_HIGH(w) (0x290 + ((w) << 2)) 53#define WINDOW_REMAP_HIGH(w) (0x290 + ((w) << 2))
54#define WINDOW_BAR_ENABLE(chan) (0x240 + ((chan) << 2)) 54#define WINDOW_BAR_ENABLE(chan) (0x240 + ((chan) << 2))
55 55
56struct mv_xor_private { 56struct mv_xor_device {
57 void __iomem *xor_base; 57 void __iomem *xor_base;
58 void __iomem *xor_high_base; 58 void __iomem *xor_high_base;
59 struct clk *clk; 59 struct clk *clk;
@@ -87,7 +87,7 @@ struct mv_xor_chan {
87 void *dma_desc_pool_virt; 87 void *dma_desc_pool_virt;
88 size_t pool_size; 88 size_t pool_size;
89 struct dma_device dmadev; 89 struct dma_device dmadev;
90 struct mv_xor_private *shared; 90 struct mv_xor_device *shared;
91 struct dma_chan dmachan; 91 struct dma_chan dmachan;
92 struct mv_xor_desc_slot *last_used; 92 struct mv_xor_desc_slot *last_used;
93 struct list_head all_slots; 93 struct list_head all_slots;