[AVR32] Initialize dma_mask and dma_coherent_mask
authorDavid Brownell <david-b@pacbell.net>
Sat, 23 Jun 2007 02:17:57 +0000 (19:17 -0700)
committerHaavard Skinnemoen <hskinnemoen@atmel.com>
Sat, 23 Jun 2007 12:53:16 +0000 (14:53 +0200)
The current at32ap7000 platform devices aren't declared as supporting DMA,
so that layered drivers can't tell whether they need to manage DMA.

This patch makes all those platform devices report that they support DMA.
Most do, but in a few cases this is inappropriate.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
arch/avr32/mach-at32ap/at32ap7000.c

index 1d2bf347a1d653ede5edd54d2123897740018dae..4dda42d3f6d5fdd8c070cbc6d6d2a215d70395b0 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/fb.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
+#include <linux/dma-mapping.h>
 #include <linux/spi/spi.h>
 
 #include <asm/io.h>
                .flags          = IORESOURCE_IRQ,       \
        }
 
+/* REVISIT these assume *every* device supports DMA, but several
+ * don't ... tc, smc, pio, rtc, watchdog, pwm, ps2, and more.
+ */
 #define DEFINE_DEV(_name, _id)                                 \
+static u64 _name##_id##_dma_mask = DMA_32BIT_MASK;             \
 static struct platform_device _name##_id##_device = {          \
        .name           = #_name,                               \
        .id             = _id,                                  \
+       .dev            = {                                     \
+               .dma_mask = &_name##_id##_dma_mask,             \
+               .coherent_dma_mask = DMA_32BIT_MASK,            \
+       },                                                      \
        .resource       = _name##_id##_resource,                \
        .num_resources  = ARRAY_SIZE(_name##_id##_resource),    \
 }
 #define DEFINE_DEV_DATA(_name, _id)                            \
+static u64 _name##_id##_dma_mask = DMA_32BIT_MASK;             \
 static struct platform_device _name##_id##_device = {          \
        .name           = #_name,                               \
        .id             = _id,                                  \
        .dev            = {                                     \
+               .dma_mask = &_name##_id##_dma_mask,             \
                .platform_data  = &_name##_id##_data,           \
+               .coherent_dma_mask = DMA_32BIT_MASK,            \
        },                                                      \
        .resource       = _name##_id##_resource,                \
        .num_resources  = ARRAY_SIZE(_name##_id##_resource),    \