m68k: Set up dma mask for platform devices
A message that is not in the archive (sent off-list or not yet received): S1751284AbeEMBAx/[email protected]
Hi Finn,
Quoted 4 lines · Finn Thain
This avoids a WARNING splat when loading the macsonic or macmace driver. Please see commit
205e1b7f51e4("dma-mapping: warn when there is nocoherent_dma_mask").
Quoted 8 lines
This implementation of
arch_setup_pdev_archdata()differs from the one inarch/powerpcin that this one avoids clobbering an existing dma mask. For example, this approach preserves the mask set by the initializer for structplatform_devicemcf_fec0.Note that either approach would make that initializer redundant and commit
f61e64310b75("m68k: set dma and coherent masks for platform FEC ethernets") could be reverted.
Seems reasonable to me. I would be happy to do this and the back out commit f61e64310b75 ("m68k: set dma and coherent masks for platform FEC ethernets").
Regards
Greg
Quoted 30 lines
--- arch/m68k/kernel/dma.c | 10 ++++++++++ 1 file changed, 10 insertions(+)arch/m68k/kernel/dma.c +10
-0@@ -9,6 +9,7 @@#include <linux/dma-mapping.h> #include <linux/device.h> #include <linux/kernel.h> +#include <linux/platform_device.h> #include <linux/scatterlist.h> #include <linux/slab.h> #include <linux/vmalloc.h> @@ -165,3 +166,12 @@ const struct dma_map_ops m68k_dma_ops = { .sync_sg_for_device = m68k_dma_sync_sg_for_device, };EXPORT_SYMBOL (m68k_dma_ops); + +void arch_setup_pdev_archdata (struct platform_device *pdev) +{ +if (pdev->dev.coherent_dma_mask ==DMA_MASK_NONE && + pdev->dev.dma_mask ==NULL ) { + pdev->dev.coherent_dma_mask =DMA_BIT_MASK (32 ); + pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; + } +}