Commit 3c814be9 authored by Vinod Koul's avatar Vinod Koul

Merge branch 'topic/dw' into for-linus

parents 877d8425 1222934e
...@@ -1493,6 +1493,13 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata) ...@@ -1493,6 +1493,13 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata)
dw->regs = chip->regs; dw->regs = chip->regs;
chip->dw = dw; chip->dw = dw;
dw->clk = devm_clk_get(chip->dev, "hclk");
if (IS_ERR(dw->clk))
return PTR_ERR(dw->clk);
err = clk_prepare_enable(dw->clk);
if (err)
return err;
dw_params = dma_read_byaddr(chip->regs, DW_PARAMS); dw_params = dma_read_byaddr(chip->regs, DW_PARAMS);
autocfg = dw_params >> DW_PARAMS_EN & 0x1; autocfg = dw_params >> DW_PARAMS_EN & 0x1;
...@@ -1500,15 +1507,19 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata) ...@@ -1500,15 +1507,19 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata)
if (!pdata && autocfg) { if (!pdata && autocfg) {
pdata = devm_kzalloc(chip->dev, sizeof(*pdata), GFP_KERNEL); pdata = devm_kzalloc(chip->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata) if (!pdata) {
return -ENOMEM; err = -ENOMEM;
goto err_pdata;
}
/* Fill platform data with the default values */ /* Fill platform data with the default values */
pdata->is_private = true; pdata->is_private = true;
pdata->chan_allocation_order = CHAN_ALLOCATION_ASCENDING; pdata->chan_allocation_order = CHAN_ALLOCATION_ASCENDING;
pdata->chan_priority = CHAN_PRIORITY_ASCENDING; pdata->chan_priority = CHAN_PRIORITY_ASCENDING;
} else if (!pdata || pdata->nr_channels > DW_DMA_MAX_NR_CHANNELS) } else if (!pdata || pdata->nr_channels > DW_DMA_MAX_NR_CHANNELS) {
return -EINVAL; err = -EINVAL;
goto err_pdata;
}
if (autocfg) if (autocfg)
nr_channels = (dw_params >> DW_PARAMS_NR_CHAN & 0x7) + 1; nr_channels = (dw_params >> DW_PARAMS_NR_CHAN & 0x7) + 1;
...@@ -1517,13 +1528,10 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata) ...@@ -1517,13 +1528,10 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata)
dw->chan = devm_kcalloc(chip->dev, nr_channels, sizeof(*dw->chan), dw->chan = devm_kcalloc(chip->dev, nr_channels, sizeof(*dw->chan),
GFP_KERNEL); GFP_KERNEL);
if (!dw->chan) if (!dw->chan) {
return -ENOMEM; err = -ENOMEM;
goto err_pdata;
dw->clk = devm_clk_get(chip->dev, "hclk"); }
if (IS_ERR(dw->clk))
return PTR_ERR(dw->clk);
clk_prepare_enable(dw->clk);
/* Get hardware configuration parameters */ /* Get hardware configuration parameters */
if (autocfg) { if (autocfg) {
...@@ -1548,21 +1556,22 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata) ...@@ -1548,21 +1556,22 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata)
/* Disable BLOCK interrupts as well */ /* Disable BLOCK interrupts as well */
channel_clear_bit(dw, MASK.BLOCK, dw->all_chan_mask); channel_clear_bit(dw, MASK.BLOCK, dw->all_chan_mask);
err = devm_request_irq(chip->dev, chip->irq, dw_dma_interrupt,
IRQF_SHARED, "dw_dmac", dw);
if (err)
return err;
/* Create a pool of consistent memory blocks for hardware descriptors */ /* Create a pool of consistent memory blocks for hardware descriptors */
dw->desc_pool = dmam_pool_create("dw_dmac_desc_pool", chip->dev, dw->desc_pool = dmam_pool_create("dw_dmac_desc_pool", chip->dev,
sizeof(struct dw_desc), 4, 0); sizeof(struct dw_desc), 4, 0);
if (!dw->desc_pool) { if (!dw->desc_pool) {
dev_err(chip->dev, "No memory for descriptors dma pool\n"); dev_err(chip->dev, "No memory for descriptors dma pool\n");
return -ENOMEM; err = -ENOMEM;
goto err_pdata;
} }
tasklet_init(&dw->tasklet, dw_dma_tasklet, (unsigned long)dw); tasklet_init(&dw->tasklet, dw_dma_tasklet, (unsigned long)dw);
err = request_irq(chip->irq, dw_dma_interrupt, IRQF_SHARED,
"dw_dmac", dw);
if (err)
goto err_pdata;
INIT_LIST_HEAD(&dw->dma.channels); INIT_LIST_HEAD(&dw->dma.channels);
for (i = 0; i < nr_channels; i++) { for (i = 0; i < nr_channels; i++) {
struct dw_dma_chan *dwc = &dw->chan[i]; struct dw_dma_chan *dwc = &dw->chan[i];
...@@ -1650,12 +1659,20 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata) ...@@ -1650,12 +1659,20 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata)
dma_writel(dw, CFG, DW_CFG_DMA_EN); dma_writel(dw, CFG, DW_CFG_DMA_EN);
err = dma_async_device_register(&dw->dma);
if (err)
goto err_dma_register;
dev_info(chip->dev, "DesignWare DMA Controller, %d channels\n", dev_info(chip->dev, "DesignWare DMA Controller, %d channels\n",
nr_channels); nr_channels);
dma_async_device_register(&dw->dma);
return 0; return 0;
err_dma_register:
free_irq(chip->irq, dw);
err_pdata:
clk_disable_unprepare(dw->clk);
return err;
} }
EXPORT_SYMBOL_GPL(dw_dma_probe); EXPORT_SYMBOL_GPL(dw_dma_probe);
...@@ -1667,6 +1684,7 @@ int dw_dma_remove(struct dw_dma_chip *chip) ...@@ -1667,6 +1684,7 @@ int dw_dma_remove(struct dw_dma_chip *chip)
dw_dma_off(dw); dw_dma_off(dw);
dma_async_device_unregister(&dw->dma); dma_async_device_unregister(&dw->dma);
free_irq(chip->irq, dw);
tasklet_kill(&dw->tasklet); tasklet_kill(&dw->tasklet);
list_for_each_entry_safe(dwc, _dwc, &dw->dma.channels, list_for_each_entry_safe(dwc, _dwc, &dw->dma.channels,
...@@ -1675,6 +1693,8 @@ int dw_dma_remove(struct dw_dma_chip *chip) ...@@ -1675,6 +1693,8 @@ int dw_dma_remove(struct dw_dma_chip *chip)
channel_clear_bit(dw, CH_EN, dwc->mask); channel_clear_bit(dw, CH_EN, dwc->mask);
} }
clk_disable_unprepare(dw->clk);
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(dw_dma_remove); EXPORT_SYMBOL_GPL(dw_dma_remove);
......
...@@ -113,11 +113,9 @@ struct sa11x0_dma_phy { ...@@ -113,11 +113,9 @@ struct sa11x0_dma_phy {
struct sa11x0_dma_desc *txd_load; struct sa11x0_dma_desc *txd_load;
unsigned sg_done; unsigned sg_done;
struct sa11x0_dma_desc *txd_done; struct sa11x0_dma_desc *txd_done;
#ifdef CONFIG_PM_SLEEP
u32 dbs[2]; u32 dbs[2];
u32 dbt[2]; u32 dbt[2];
u32 dcsr; u32 dcsr;
#endif
}; };
struct sa11x0_dma_dev { struct sa11x0_dma_dev {
...@@ -984,7 +982,6 @@ static int sa11x0_dma_remove(struct platform_device *pdev) ...@@ -984,7 +982,6 @@ static int sa11x0_dma_remove(struct platform_device *pdev)
return 0; return 0;
} }
#ifdef CONFIG_PM_SLEEP
static int sa11x0_dma_suspend(struct device *dev) static int sa11x0_dma_suspend(struct device *dev)
{ {
struct sa11x0_dma_dev *d = dev_get_drvdata(dev); struct sa11x0_dma_dev *d = dev_get_drvdata(dev);
...@@ -1054,7 +1051,6 @@ static int sa11x0_dma_resume(struct device *dev) ...@@ -1054,7 +1051,6 @@ static int sa11x0_dma_resume(struct device *dev)
return 0; return 0;
} }
#endif
static const struct dev_pm_ops sa11x0_dma_pm_ops = { static const struct dev_pm_ops sa11x0_dma_pm_ops = {
.suspend_noirq = sa11x0_dma_suspend, .suspend_noirq = sa11x0_dma_suspend,
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
struct dma_chan; struct dma_chan;
#if defined(CONFIG_DMA_OMAP) || defined(CONFIG_DMA_OMAP_MODULE) #if defined(CONFIG_DMA_OMAP) || (defined(CONFIG_DMA_OMAP_MODULE) && defined(MODULE))
bool omap_dma_filter_fn(struct dma_chan *, void *); bool omap_dma_filter_fn(struct dma_chan *, void *);
#else #else
static inline bool omap_dma_filter_fn(struct dma_chan *c, void *d) static inline bool omap_dma_filter_fn(struct dma_chan *c, void *d)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment