aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2013-01-09 03:17:01 -0500
committerVinod Koul <vinod.koul@intel.com>2013-01-09 09:30:34 -0500
commit123de543414bce42da9729071962d4a9512612c8 (patch)
treec29ba393677ad8255b41b47e11f2d1c8650f0d7d /drivers/dma
parentf2ad6992546674e5915a34a1bc36dcdd8fb29bd2 (diff)
dw_dmac: absence of pdata isn't critical when autocfg is set
The patch allows to probe the device when platform data is absent and hardware auto configuration is enabled. In that case the default platform data is used where the channel allocation order is set to ascending, channel priority is set to ascending, and private property is set to true. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/dw_dmac.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index 476e9c8fb6ca..c0c9370ddd3f 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -1600,13 +1600,6 @@ static int dw_probe(struct platform_device *pdev)
1600 int err; 1600 int err;
1601 int i; 1601 int i;
1602 1602
1603 pdata = dev_get_platdata(&pdev->dev);
1604 if (!pdata)
1605 pdata = dw_dma_parse_dt(pdev);
1606
1607 if (!pdata || pdata->nr_channels > DW_DMA_MAX_NR_CHANNELS)
1608 return -EINVAL;
1609
1610 io = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1603 io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1611 if (!io) 1604 if (!io)
1612 return -EINVAL; 1605 return -EINVAL;
@@ -1622,6 +1615,22 @@ static int dw_probe(struct platform_device *pdev)
1622 dw_params = dma_read_byaddr(regs, DW_PARAMS); 1615 dw_params = dma_read_byaddr(regs, DW_PARAMS);
1623 autocfg = dw_params >> DW_PARAMS_EN & 0x1; 1616 autocfg = dw_params >> DW_PARAMS_EN & 0x1;
1624 1617
1618 pdata = dev_get_platdata(&pdev->dev);
1619 if (!pdata)
1620 pdata = dw_dma_parse_dt(pdev);
1621
1622 if (!pdata && autocfg) {
1623 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
1624 if (!pdata)
1625 return -ENOMEM;
1626
1627 /* Fill platform data with the default values */
1628 pdata->is_private = true;
1629 pdata->chan_allocation_order = CHAN_ALLOCATION_ASCENDING;
1630 pdata->chan_priority = CHAN_PRIORITY_ASCENDING;
1631 } else if (!pdata || pdata->nr_channels > DW_DMA_MAX_NR_CHANNELS)
1632 return -EINVAL;
1633
1625 if (autocfg) 1634 if (autocfg)
1626 nr_channels = (dw_params >> DW_PARAMS_NR_CHAN & 0x7) + 1; 1635 nr_channels = (dw_params >> DW_PARAMS_NR_CHAN & 0x7) + 1;
1627 else 1636 else