davinci: da8xx/omap-l1xx: Add EDMA platform data for da850/omap-l138
authorSudhakar Rajashekhara <sudhakar.raj@ti.com>
Wed, 6 Jan 2010 12:00:06 +0000 (17:30 +0530)
committerKevin Hilman <khilman@deeprootsystems.com>
Thu, 4 Feb 2010 21:30:04 +0000 (13:30 -0800)
Currently da850/omap-l138 supports only one channel controller
instance of EDMA though EDMA driver as such supports multiple
channel controller instances. This patch adds platform data
for the 2nd EDMA channel controller. As, the platform data
differ between da830/omap-l137 and da850/omap-l138, existing
code has been re-shuffled to accommodate this.

Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
arch/arm/mach-davinci/devices-da8xx.c

index ab12a8f0d75daf27be0a77091748f771f7134412..0a96791d3b0f6dd8238c4e0826f3f452b3905477 100644 (file)
 #include "clock.h"
 
 #define DA8XX_TPCC_BASE                        0x01c00000
+#define DA850_TPCC1_BASE               0x01e30000
 #define DA8XX_TPTC0_BASE               0x01c08000
 #define DA8XX_TPTC1_BASE               0x01c08400
+#define DA850_TPTC2_BASE               0x01e38000
 #define DA8XX_WDOG_BASE                        0x01c21000 /* DA8XX_TIMER64P1_BASE */
 #define DA8XX_I2C0_BASE                        0x01c22000
 #define DA8XX_RTC_BASE                 0x01C23000
@@ -97,7 +99,31 @@ static const s8 da8xx_queue_priority_mapping[][2] = {
        {-1, -1}
 };
 
-static struct edma_soc_info da8xx_edma_info[] = {
+static const s8 da850_queue_tc_mapping[][2] = {
+       /* {event queue no, TC no} */
+       {0, 0},
+       {-1, -1}
+};
+
+static const s8 da850_queue_priority_mapping[][2] = {
+       /* {event queue no, Priority} */
+       {0, 3},
+       {-1, -1}
+};
+
+static struct edma_soc_info da830_edma_info[] = {
+       {
+               .n_channel              = 32,
+               .n_region               = 4,
+               .n_slot                 = 128,
+               .n_tc                   = 2,
+               .n_cc                   = 1,
+               .queue_tc_mapping       = da8xx_queue_tc_mapping,
+               .queue_priority_mapping = da8xx_queue_priority_mapping,
+       },
+};
+
+static struct edma_soc_info da850_edma_info[] = {
        {
                .n_channel              = 32,
                .n_region               = 4,
@@ -107,9 +133,49 @@ static struct edma_soc_info da8xx_edma_info[] = {
                .queue_tc_mapping       = da8xx_queue_tc_mapping,
                .queue_priority_mapping = da8xx_queue_priority_mapping,
        },
+       {
+               .n_channel              = 32,
+               .n_region               = 4,
+               .n_slot                 = 128,
+               .n_tc                   = 1,
+               .n_cc                   = 1,
+               .queue_tc_mapping       = da850_queue_tc_mapping,
+               .queue_priority_mapping = da850_queue_priority_mapping,
+       },
+};
+
+static struct resource da830_edma_resources[] = {
+       {
+               .name   = "edma_cc0",
+               .start  = DA8XX_TPCC_BASE,
+               .end    = DA8XX_TPCC_BASE + SZ_32K - 1,
+               .flags  = IORESOURCE_MEM,
+       },
+       {
+               .name   = "edma_tc0",
+               .start  = DA8XX_TPTC0_BASE,
+               .end    = DA8XX_TPTC0_BASE + SZ_1K - 1,
+               .flags  = IORESOURCE_MEM,
+       },
+       {
+               .name   = "edma_tc1",
+               .start  = DA8XX_TPTC1_BASE,
+               .end    = DA8XX_TPTC1_BASE + SZ_1K - 1,
+               .flags  = IORESOURCE_MEM,
+       },
+       {
+               .name   = "edma0",
+               .start  = IRQ_DA8XX_CCINT0,
+               .flags  = IORESOURCE_IRQ,
+       },
+       {
+               .name   = "edma0_err",
+               .start  = IRQ_DA8XX_CCERRINT,
+               .flags  = IORESOURCE_IRQ,
+       },
 };
 
-static struct resource da8xx_edma_resources[] = {
+static struct resource da850_edma_resources[] = {
        {
                .name   = "edma_cc0",
                .start  = DA8XX_TPCC_BASE,
@@ -128,6 +194,18 @@ static struct resource da8xx_edma_resources[] = {
                .end    = DA8XX_TPTC1_BASE + SZ_1K - 1,
                .flags  = IORESOURCE_MEM,
        },
+       {
+               .name   = "edma_cc1",
+               .start  = DA850_TPCC1_BASE,
+               .end    = DA850_TPCC1_BASE + SZ_32K - 1,
+               .flags  = IORESOURCE_MEM,
+       },
+       {
+               .name   = "edma_tc2",
+               .start  = DA850_TPTC2_BASE,
+               .end    = DA850_TPTC2_BASE + SZ_1K - 1,
+               .flags  = IORESOURCE_MEM,
+       },
        {
                .name   = "edma0",
                .start  = IRQ_DA8XX_CCINT0,
@@ -138,21 +216,50 @@ static struct resource da8xx_edma_resources[] = {
                .start  = IRQ_DA8XX_CCERRINT,
                .flags  = IORESOURCE_IRQ,
        },
+       {
+               .name   = "edma1",
+               .start  = IRQ_DA850_CCINT1,
+               .flags  = IORESOURCE_IRQ,
+       },
+       {
+               .name   = "edma1_err",
+               .start  = IRQ_DA850_CCERRINT1,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device da830_edma_device = {
+       .name           = "edma",
+       .id             = -1,
+       .dev = {
+               .platform_data = da830_edma_info,
+       },
+       .num_resources  = ARRAY_SIZE(da830_edma_resources),
+       .resource       = da830_edma_resources,
 };
 
-static struct platform_device da8xx_edma_device = {
+static struct platform_device da850_edma_device = {
        .name           = "edma",
        .id             = -1,
        .dev = {
-               .platform_data  = da8xx_edma_info,
+               .platform_data = da850_edma_info,
        },
-       .num_resources  = ARRAY_SIZE(da8xx_edma_resources),
-       .resource       = da8xx_edma_resources,
+       .num_resources  = ARRAY_SIZE(da850_edma_resources),
+       .resource       = da850_edma_resources,
 };
 
 int __init da8xx_register_edma(void)
 {
-       return platform_device_register(&da8xx_edma_device);
+       struct platform_device *pdev;
+
+       if (cpu_is_davinci_da830())
+               pdev = &da830_edma_device;
+       else if (cpu_is_davinci_da850())
+               pdev = &da850_edma_device;
+       else
+               return -ENODEV;
+
+       return platform_device_register(pdev);
 }
 
 static struct resource da8xx_i2c_resources0[] = {