aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/fsl
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 17:55:21 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 17:55:21 -0500
commit8ceafbfa91ffbdbb2afaea5c24ccb519ffb8b587 (patch)
tree98c9ea93362536f1ddd73175b13b7847583350df /sound/soc/fsl
parent42a2d923cc349583ebf6fdd52a7d35e1c2f7e6bd (diff)
parent26ba47b18318abe7dadbe9294a611c0e932651d8 (diff)
Merge branch 'for-linus-dma-masks' of git://git.linaro.org/people/rmk/linux-arm
Pull DMA mask updates from Russell King: "This series cleans up the handling of DMA masks in a lot of drivers, fixing some bugs as we go. Some of the more serious errors include: - drivers which only set their coherent DMA mask if the attempt to set the streaming mask fails. - drivers which test for a NULL dma mask pointer, and then set the dma mask pointer to a location in their module .data section - which will cause problems if the module is reloaded. To counter these, I have introduced two helper functions: - dma_set_mask_and_coherent() takes care of setting both the streaming and coherent masks at the same time, with the correct error handling as specified by the API. - dma_coerce_mask_and_coherent() which resolves the problem of drivers forcefully setting DMA masks. This is more a marker for future work to further clean these locations up - the code which creates the devices really should be initialising these, but to fix that in one go along with this change could potentially be very disruptive. The last thing this series does is prise away some of Linux's addition to "DMA addresses are physical addresses and RAM always starts at zero". We have ARM LPAE systems where all system memory is above 4GB physical, hence having DMA masks interpreted by (eg) the block layers as describing physical addresses in the range 0..DMAMASK fails on these platforms. Santosh Shilimkar addresses this in this series; the patches were copied to the appropriate people multiple times but were ignored. Fixing this also gets rid of some ARM weirdness in the setup of the max*pfn variables, and brings ARM into line with every other Linux architecture as far as those go" * 'for-linus-dma-masks' of git://git.linaro.org/people/rmk/linux-arm: (52 commits) ARM: 7805/1: mm: change max*pfn to include the physical offset of memory ARM: 7797/1: mmc: Use dma_max_pfn(dev) helper for bounce_limit calculations ARM: 7796/1: scsi: Use dma_max_pfn(dev) helper for bounce_limit calculations ARM: 7795/1: mm: dma-mapping: Add dma_max_pfn(dev) helper function ARM: 7794/1: block: Rename parameter dma_mask to max_addr for blk_queue_bounce_limit() ARM: DMA-API: better handing of DMA masks for coherent allocations ARM: 7857/1: dma: imx-sdma: setup dma mask DMA-API: firmware/google/gsmi.c: avoid direct access to DMA masks DMA-API: dcdbas: update DMA mask handing DMA-API: dma: edma.c: no need to explicitly initialize DMA masks DMA-API: usb: musb: use platform_device_register_full() to avoid directly messing with dma masks DMA-API: crypto: remove last references to 'static struct device *dev' DMA-API: crypto: fix ixp4xx crypto platform device support DMA-API: others: use dma_set_coherent_mask() DMA-API: staging: use dma_set_coherent_mask() DMA-API: usb: use new dma_coerce_mask_and_coherent() DMA-API: usb: use dma_set_coherent_mask() DMA-API: parport: parport_pc.c: use dma_coerce_mask_and_coherent() DMA-API: net: octeon: use dma_coerce_mask_and_coherent() DMA-API: net: nxp/lpc_eth: use dma_coerce_mask_and_coherent() ...
Diffstat (limited to 'sound/soc/fsl')
-rw-r--r--sound/soc/fsl/fsl_dma.c9
-rw-r--r--sound/soc/fsl/imx-pcm-fiq.c12
-rw-r--r--sound/soc/fsl/mpc5200_dma.c10
3 files changed, 12 insertions, 19 deletions
diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
index d1b111e7fc07..fb9bb9eb5ca3 100644
--- a/sound/soc/fsl/fsl_dma.c
+++ b/sound/soc/fsl/fsl_dma.c
@@ -300,14 +300,11 @@ static int fsl_dma_new(struct snd_soc_pcm_runtime *rtd)
300{ 300{
301 struct snd_card *card = rtd->card->snd_card; 301 struct snd_card *card = rtd->card->snd_card;
302 struct snd_pcm *pcm = rtd->pcm; 302 struct snd_pcm *pcm = rtd->pcm;
303 static u64 fsl_dma_dmamask = DMA_BIT_MASK(36);
304 int ret; 303 int ret;
305 304
306 if (!card->dev->dma_mask) 305 ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(36));
307 card->dev->dma_mask = &fsl_dma_dmamask; 306 if (ret)
308 307 return ret;
309 if (!card->dev->coherent_dma_mask)
310 card->dev->coherent_dma_mask = fsl_dma_dmamask;
311 308
312 /* Some codecs have separate DAIs for playback and capture, so we 309 /* Some codecs have separate DAIs for playback and capture, so we
313 * should allocate a DMA buffer only for the streams that are valid. 310 * should allocate a DMA buffer only for the streams that are valid.
diff --git a/sound/soc/fsl/imx-pcm-fiq.c b/sound/soc/fsl/imx-pcm-fiq.c
index 10e330514ed8..41740e488820 100644
--- a/sound/soc/fsl/imx-pcm-fiq.c
+++ b/sound/soc/fsl/imx-pcm-fiq.c
@@ -254,18 +254,16 @@ static int imx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream)
254 return 0; 254 return 0;
255} 255}
256 256
257static u64 imx_pcm_dmamask = DMA_BIT_MASK(32);
258
259static int imx_pcm_new(struct snd_soc_pcm_runtime *rtd) 257static int imx_pcm_new(struct snd_soc_pcm_runtime *rtd)
260{ 258{
261 struct snd_card *card = rtd->card->snd_card; 259 struct snd_card *card = rtd->card->snd_card;
262 struct snd_pcm *pcm = rtd->pcm; 260 struct snd_pcm *pcm = rtd->pcm;
263 int ret = 0; 261 int ret;
262
263 ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32));
264 if (ret)
265 return ret;
264 266
265 if (!card->dev->dma_mask)
266 card->dev->dma_mask = &imx_pcm_dmamask;
267 if (!card->dev->coherent_dma_mask)
268 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
269 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { 267 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
270 ret = imx_pcm_preallocate_dma_buffer(pcm, 268 ret = imx_pcm_preallocate_dma_buffer(pcm,
271 SNDRV_PCM_STREAM_PLAYBACK); 269 SNDRV_PCM_STREAM_PLAYBACK);
diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c
index 161e5055ce94..71bf2f248cd4 100644
--- a/sound/soc/fsl/mpc5200_dma.c
+++ b/sound/soc/fsl/mpc5200_dma.c
@@ -301,7 +301,6 @@ static struct snd_pcm_ops psc_dma_ops = {
301 .hw_params = psc_dma_hw_params, 301 .hw_params = psc_dma_hw_params,
302}; 302};
303 303
304static u64 psc_dma_dmamask = DMA_BIT_MASK(32);
305static int psc_dma_new(struct snd_soc_pcm_runtime *rtd) 304static int psc_dma_new(struct snd_soc_pcm_runtime *rtd)
306{ 305{
307 struct snd_card *card = rtd->card->snd_card; 306 struct snd_card *card = rtd->card->snd_card;
@@ -309,15 +308,14 @@ static int psc_dma_new(struct snd_soc_pcm_runtime *rtd)
309 struct snd_pcm *pcm = rtd->pcm; 308 struct snd_pcm *pcm = rtd->pcm;
310 struct psc_dma *psc_dma = snd_soc_dai_get_drvdata(rtd->cpu_dai); 309 struct psc_dma *psc_dma = snd_soc_dai_get_drvdata(rtd->cpu_dai);
311 size_t size = psc_dma_hardware.buffer_bytes_max; 310 size_t size = psc_dma_hardware.buffer_bytes_max;
312 int rc = 0; 311 int rc;
313 312
314 dev_dbg(rtd->platform->dev, "psc_dma_new(card=%p, dai=%p, pcm=%p)\n", 313 dev_dbg(rtd->platform->dev, "psc_dma_new(card=%p, dai=%p, pcm=%p)\n",
315 card, dai, pcm); 314 card, dai, pcm);
316 315
317 if (!card->dev->dma_mask) 316 rc = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32));
318 card->dev->dma_mask = &psc_dma_dmamask; 317 if (rc)
319 if (!card->dev->coherent_dma_mask) 318 return rc;
320 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
321 319
322 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { 320 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
323 rc = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, pcm->card->dev, 321 rc = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, pcm->card->dev,