Re: [PATCH 13/15] mmc: sdhci-acpi: Add 64-bit DMA support

Adrian Hunter
2014-10-21T10:46:48Z

On 21/10/14 12:33, Arnd Bergmann wrote:
> On Tuesday 21 October 2014 12:26:23 Adrian Hunter wrote:
>> + return 0;
>> +
>> + if (host->flags & SDHCI_USE_64_BIT_DMA) {
>> + if (host->quirks2 & SDHCI_QUIRK2_BROKEN_64_BIT_DMA) {
>> + host->flags &= ~SDHCI_USE_64_BIT_DMA;
>> + } else {
>> + err = dma_coerce_mask_and_coherent(dev,
>> + DMA_BIT_MASK(64));
>> + if (err)
>> + dev_warn(dev, "Failed to set 64-bit DMA mask\n");
>> + }
>> + }
>> +
>> + if (err)
>> + err = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32));
>> +
>> + c->dma_setup = !err;
>>
>
> Never use dma_coerce_mask_and_coherent(), it will ignore limitations of
> the upstream bus. Use dma_set_mask_and_coherent instead. If it fails,
> I think you need to clear the SDHCI_USE_64_BIT_DMA flag.

The sdhci-acpi device is a platform devices created by acpi. dev->dma_mask
is NULL so dma_set_mask_and_coherent will always fail
unless I add:

if (!dev->dma_mask)
dev->dma_mask = &dev->coherent_dma_mask;