aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/mv_xor.c45
-rw-r--r--drivers/dma/mv_xor.h8
2 files changed, 50 insertions, 3 deletions
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index f7b99193e884..6ed3162cccc9 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -1292,7 +1292,9 @@ static int mv_xor_shared_probe(struct platform_device *pdev)
1292{ 1292{
1293 const struct mbus_dram_target_info *dram; 1293 const struct mbus_dram_target_info *dram;
1294 struct mv_xor_shared_private *msp; 1294 struct mv_xor_shared_private *msp;
1295 struct mv_xor_shared_platform_data *pdata = pdev->dev.platform_data;
1295 struct resource *res; 1296 struct resource *res;
1297 int i, ret;
1296 1298
1297 dev_notice(&pdev->dev, "Marvell shared XOR driver\n"); 1299 dev_notice(&pdev->dev, "Marvell shared XOR driver\n");
1298 1300
@@ -1334,12 +1336,55 @@ static int mv_xor_shared_probe(struct platform_device *pdev)
1334 if (!IS_ERR(msp->clk)) 1336 if (!IS_ERR(msp->clk))
1335 clk_prepare_enable(msp->clk); 1337 clk_prepare_enable(msp->clk);
1336 1338
1339 if (pdata && pdata->channels) {
1340 for (i = 0; i < MV_XOR_MAX_CHANNELS; i++) {
1341 struct mv_xor_platform_data *cd;
1342 int irq;
1343
1344 cd = &pdata->channels[i];
1345 if (!cd) {
1346 ret = -ENODEV;
1347 goto err_channel_add;
1348 }
1349
1350 irq = platform_get_irq(pdev, i);
1351 if (irq < 0) {
1352 ret = irq;
1353 goto err_channel_add;
1354 }
1355
1356 msp->channels[i] =
1357 mv_xor_channel_add(msp, pdev, cd->hw_id,
1358 cd->cap_mask,
1359 cd->pool_size, irq);
1360 if (IS_ERR(msp->channels[i])) {
1361 ret = PTR_ERR(msp->channels[i]);
1362 goto err_channel_add;
1363 }
1364 }
1365 }
1366
1337 return 0; 1367 return 0;
1368
1369err_channel_add:
1370 for (i = 0; i < MV_XOR_MAX_CHANNELS; i++)
1371 if (msp->channels[i])
1372 mv_xor_channel_remove(msp->channels[i]);
1373
1374 clk_disable_unprepare(msp->clk);
1375 clk_put(msp->clk);
1376 return ret;
1338} 1377}
1339 1378
1340static int mv_xor_shared_remove(struct platform_device *pdev) 1379static int mv_xor_shared_remove(struct platform_device *pdev)
1341{ 1380{
1342 struct mv_xor_shared_private *msp = platform_get_drvdata(pdev); 1381 struct mv_xor_shared_private *msp = platform_get_drvdata(pdev);
1382 int i;
1383
1384 for (i = 0; i < MV_XOR_MAX_CHANNELS; i++) {
1385 if (msp->channels[i])
1386 mv_xor_channel_remove(msp->channels[i]);
1387 }
1343 1388
1344 if (!IS_ERR(msp->clk)) { 1389 if (!IS_ERR(msp->clk)) {
1345 clk_disable_unprepare(msp->clk); 1390 clk_disable_unprepare(msp->clk);
diff --git a/drivers/dma/mv_xor.h b/drivers/dma/mv_xor.h
index a0641aebbdef..686575f6b9f5 100644
--- a/drivers/dma/mv_xor.h
+++ b/drivers/dma/mv_xor.h
@@ -26,6 +26,7 @@
26#define USE_TIMER 26#define USE_TIMER
27#define MV_XOR_SLOT_SIZE 64 27#define MV_XOR_SLOT_SIZE 64
28#define MV_XOR_THRESHOLD 1 28#define MV_XOR_THRESHOLD 1
29#define MV_XOR_MAX_CHANNELS 2
29 30
30#define XOR_OPERATION_MODE_XOR 0 31#define XOR_OPERATION_MODE_XOR 0
31#define XOR_OPERATION_MODE_MEMCPY 2 32#define XOR_OPERATION_MODE_MEMCPY 2
@@ -53,9 +54,10 @@
53#define WINDOW_BAR_ENABLE(chan) (0x240 + ((chan) << 2)) 54#define WINDOW_BAR_ENABLE(chan) (0x240 + ((chan) << 2))
54 55
55struct mv_xor_shared_private { 56struct mv_xor_shared_private {
56 void __iomem *xor_base; 57 void __iomem *xor_base;
57 void __iomem *xor_high_base; 58 void __iomem *xor_high_base;
58 struct clk *clk; 59 struct clk *clk;
60 struct mv_xor_device *channels[MV_XOR_MAX_CHANNELS];
59}; 61};
60 62
61 63