Commit 4f82f028 authored by Vaibhav Bedia's avatar Vaibhav Bedia Committed by Mark Brown

ASoC: Davinci: Replace usage of IO_ADDRESS with ioremap()

This patch modifies the Davinci i2s and mcasp drivers to make use of
ioremap() instead of IO_ADDRESS()
Signed-off-by: default avatarVaibhav Bedia <vaibhav.bedia@ti.com>
Acked-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent eef6d7b8
...@@ -694,20 +694,25 @@ static int davinci_i2s_probe(struct platform_device *pdev) ...@@ -694,20 +694,25 @@ static int davinci_i2s_probe(struct platform_device *pdev)
} }
clk_enable(dev->clk); clk_enable(dev->clk);
dev->base = (void __iomem *)IO_ADDRESS(mem->start); dev->base = ioremap(mem->start, resource_size(mem));
if (!dev->base) {
dev_err(&pdev->dev, "ioremap failed\n");
ret = -ENOMEM;
goto err_release_clk;
}
dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK].dma_addr = dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK].dma_addr =
(dma_addr_t)(io_v2p(dev->base) + DAVINCI_MCBSP_DXR_REG); (dma_addr_t)(mem->start + DAVINCI_MCBSP_DXR_REG);
dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].dma_addr = dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].dma_addr =
(dma_addr_t)(io_v2p(dev->base) + DAVINCI_MCBSP_DRR_REG); (dma_addr_t)(mem->start + DAVINCI_MCBSP_DRR_REG);
/* first TX, then RX */ /* first TX, then RX */
res = platform_get_resource(pdev, IORESOURCE_DMA, 0); res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
if (!res) { if (!res) {
dev_err(&pdev->dev, "no DMA resource\n"); dev_err(&pdev->dev, "no DMA resource\n");
ret = -ENXIO; ret = -ENXIO;
goto err_release_clk; goto err_iounmap;
} }
dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK].channel = res->start; dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK].channel = res->start;
...@@ -715,7 +720,7 @@ static int davinci_i2s_probe(struct platform_device *pdev) ...@@ -715,7 +720,7 @@ static int davinci_i2s_probe(struct platform_device *pdev)
if (!res) { if (!res) {
dev_err(&pdev->dev, "no DMA resource\n"); dev_err(&pdev->dev, "no DMA resource\n");
ret = -ENXIO; ret = -ENXIO;
goto err_release_clk; goto err_iounmap;
} }
dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].channel = res->start; dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].channel = res->start;
dev->dev = &pdev->dev; dev->dev = &pdev->dev;
...@@ -724,10 +729,12 @@ static int davinci_i2s_probe(struct platform_device *pdev) ...@@ -724,10 +729,12 @@ static int davinci_i2s_probe(struct platform_device *pdev)
ret = snd_soc_register_dai(&pdev->dev, &davinci_i2s_dai); ret = snd_soc_register_dai(&pdev->dev, &davinci_i2s_dai);
if (ret != 0) if (ret != 0)
goto err_release_clk; goto err_iounmap;
return 0; return 0;
err_iounmap:
iounmap(dev->base);
err_release_clk: err_release_clk:
clk_disable(dev->clk); clk_disable(dev->clk);
clk_put(dev->clk); clk_put(dev->clk);
......
...@@ -885,7 +885,13 @@ static int davinci_mcasp_probe(struct platform_device *pdev) ...@@ -885,7 +885,13 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
clk_enable(dev->clk); clk_enable(dev->clk);
dev->clk_active = 1; dev->clk_active = 1;
dev->base = (void __iomem *)IO_ADDRESS(mem->start); dev->base = ioremap(mem->start, resource_size(mem));
if (!dev->base) {
dev_err(&pdev->dev, "ioremap failed\n");
ret = -ENOMEM;
goto err_release_clk;
}
dev->op_mode = pdata->op_mode; dev->op_mode = pdata->op_mode;
dev->tdm_slots = pdata->tdm_slots; dev->tdm_slots = pdata->tdm_slots;
dev->num_serializer = pdata->num_serializer; dev->num_serializer = pdata->num_serializer;
...@@ -899,14 +905,14 @@ static int davinci_mcasp_probe(struct platform_device *pdev) ...@@ -899,14 +905,14 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
dma_data->asp_chan_q = pdata->asp_chan_q; dma_data->asp_chan_q = pdata->asp_chan_q;
dma_data->ram_chan_q = pdata->ram_chan_q; dma_data->ram_chan_q = pdata->ram_chan_q;
dma_data->dma_addr = (dma_addr_t) (pdata->tx_dma_offset + dma_data->dma_addr = (dma_addr_t) (pdata->tx_dma_offset +
io_v2p(dev->base)); mem->start);
/* first TX, then RX */ /* first TX, then RX */
res = platform_get_resource(pdev, IORESOURCE_DMA, 0); res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
if (!res) { if (!res) {
dev_err(&pdev->dev, "no DMA resource\n"); dev_err(&pdev->dev, "no DMA resource\n");
ret = -ENODEV; ret = -ENODEV;
goto err_release_clk; goto err_iounmap;
} }
dma_data->channel = res->start; dma_data->channel = res->start;
...@@ -915,13 +921,13 @@ static int davinci_mcasp_probe(struct platform_device *pdev) ...@@ -915,13 +921,13 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
dma_data->asp_chan_q = pdata->asp_chan_q; dma_data->asp_chan_q = pdata->asp_chan_q;
dma_data->ram_chan_q = pdata->ram_chan_q; dma_data->ram_chan_q = pdata->ram_chan_q;
dma_data->dma_addr = (dma_addr_t)(pdata->rx_dma_offset + dma_data->dma_addr = (dma_addr_t)(pdata->rx_dma_offset +
io_v2p(dev->base)); mem->start);
res = platform_get_resource(pdev, IORESOURCE_DMA, 1); res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
if (!res) { if (!res) {
dev_err(&pdev->dev, "no DMA resource\n"); dev_err(&pdev->dev, "no DMA resource\n");
ret = -ENODEV; ret = -ENODEV;
goto err_release_clk; goto err_iounmap;
} }
dma_data->channel = res->start; dma_data->channel = res->start;
...@@ -929,9 +935,11 @@ static int davinci_mcasp_probe(struct platform_device *pdev) ...@@ -929,9 +935,11 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
ret = snd_soc_register_dai(&pdev->dev, &davinci_mcasp_dai[pdata->op_mode]); ret = snd_soc_register_dai(&pdev->dev, &davinci_mcasp_dai[pdata->op_mode]);
if (ret != 0) if (ret != 0)
goto err_release_clk; goto err_iounmap;
return 0; return 0;
err_iounmap:
iounmap(dev->base);
err_release_clk: err_release_clk:
clk_disable(dev->clk); clk_disable(dev->clk);
clk_put(dev->clk); clk_put(dev->clk);
......
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