Merge branch 'fix/misc' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
[sfrench/cifs-2.6.git] / arch / arm / mach-davinci / dm644x.c
index fb5449b3c97bdc777a5dfeb7a5cc955a2ae8b491..d6e0fa5a8d8af4c2166c37c8e704225a5204980b 100644 (file)
@@ -27,6 +27,7 @@
 #include <mach/time.h>
 #include <mach/serial.h>
 #include <mach/common.h>
+#include <mach/asp.h>
 
 #include "clock.h"
 #include "mux.h"
@@ -303,7 +304,7 @@ struct davinci_clk dm644x_clks[] = {
        CLK("davinci_emac.1", NULL, &emac_clk),
        CLK("i2c_davinci.1", NULL, &i2c_clk),
        CLK("palm_bk3710", NULL, &ide_clk),
-       CLK("soc-audio.0", NULL, &asp_clk),
+       CLK("davinci-asp", NULL, &asp_clk),
        CLK("davinci_mmc.0", NULL, &mmcsd_clk),
        CLK(NULL, "spi", &spi_clk),
        CLK(NULL, "gpio", &gpio_clk),
@@ -484,17 +485,38 @@ static const s8 dma_chan_dm644x_no_event[] = {
        -1
 };
 
-static struct edma_soc_info dm644x_edma_info = {
-       .n_channel      = 64,
-       .n_region       = 4,
-       .n_slot         = 128,
-       .n_tc           = 2,
-       .noevent        = dma_chan_dm644x_no_event,
+static const s8
+queue_tc_mapping[][2] = {
+       /* {event queue no, TC no} */
+       {0, 0},
+       {1, 1},
+       {-1, -1},
+};
+
+static const s8
+queue_priority_mapping[][2] = {
+       /* {event queue no, Priority} */
+       {0, 3},
+       {1, 7},
+       {-1, -1},
+};
+
+static struct edma_soc_info dm644x_edma_info[] = {
+       {
+               .n_channel              = 64,
+               .n_region               = 4,
+               .n_slot                 = 128,
+               .n_tc                   = 2,
+               .n_cc                   = 1,
+               .noevent                = dma_chan_dm644x_no_event,
+               .queue_tc_mapping       = queue_tc_mapping,
+               .queue_priority_mapping = queue_priority_mapping,
+       },
 };
 
 static struct resource edma_resources[] = {
        {
-               .name   = "edma_cc",
+               .name   = "edma_cc0",
                .start  = 0x01c00000,
                .end    = 0x01c00000 + SZ_64K - 1,
                .flags  = IORESOURCE_MEM,
@@ -512,10 +534,12 @@ static struct resource edma_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        {
+               .name   = "edma0",
                .start  = IRQ_CCINT0,
                .flags  = IORESOURCE_IRQ,
        },
        {
+               .name   = "edma0_err",
                .start  = IRQ_CCERRINT,
                .flags  = IORESOURCE_IRQ,
        },
@@ -524,12 +548,91 @@ static struct resource edma_resources[] = {
 
 static struct platform_device dm644x_edma_device = {
        .name                   = "edma",
-       .id                     = -1,
-       .dev.platform_data      = &dm644x_edma_info,
+       .id                     = 0,
+       .dev.platform_data      = dm644x_edma_info,
        .num_resources          = ARRAY_SIZE(edma_resources),
        .resource               = edma_resources,
 };
 
+/* DM6446 EVM uses ASP0; line-out is a pair of RCA jacks */
+static struct resource dm644x_asp_resources[] = {
+       {
+               .start  = DAVINCI_ASP0_BASE,
+               .end    = DAVINCI_ASP0_BASE + SZ_8K - 1,
+               .flags  = IORESOURCE_MEM,
+       },
+       {
+               .start  = DAVINCI_DMA_ASP0_TX,
+               .end    = DAVINCI_DMA_ASP0_TX,
+               .flags  = IORESOURCE_DMA,
+       },
+       {
+               .start  = DAVINCI_DMA_ASP0_RX,
+               .end    = DAVINCI_DMA_ASP0_RX,
+               .flags  = IORESOURCE_DMA,
+       },
+};
+
+static struct platform_device dm644x_asp_device = {
+       .name           = "davinci-asp",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(dm644x_asp_resources),
+       .resource       = dm644x_asp_resources,
+};
+
+static struct resource dm644x_vpss_resources[] = {
+       {
+               /* VPSS Base address */
+               .name           = "vpss",
+               .start          = 0x01c73400,
+               .end            = 0x01c73400 + 0xff,
+               .flags          = IORESOURCE_MEM,
+       },
+};
+
+static struct platform_device dm644x_vpss_device = {
+       .name                   = "vpss",
+       .id                     = -1,
+       .dev.platform_data      = "dm644x_vpss",
+       .num_resources          = ARRAY_SIZE(dm644x_vpss_resources),
+       .resource               = dm644x_vpss_resources,
+};
+
+static struct resource vpfe_resources[] = {
+       {
+               .start          = IRQ_VDINT0,
+               .end            = IRQ_VDINT0,
+               .flags          = IORESOURCE_IRQ,
+       },
+       {
+               .start          = IRQ_VDINT1,
+               .end            = IRQ_VDINT1,
+               .flags          = IORESOURCE_IRQ,
+       },
+       {
+               .start          = 0x01c70400,
+               .end            = 0x01c70400 + 0xff,
+               .flags          = IORESOURCE_MEM,
+       },
+};
+
+static u64 vpfe_capture_dma_mask = DMA_BIT_MASK(32);
+static struct platform_device vpfe_capture_dev = {
+       .name           = CAPTURE_DRV_NAME,
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(vpfe_resources),
+       .resource       = vpfe_resources,
+       .dev = {
+               .dma_mask               = &vpfe_capture_dma_mask,
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+       },
+};
+
+void dm644x_set_vpfe_config(struct vpfe_config *cfg)
+{
+       vpfe_capture_dev.dev.platform_data = cfg;
+}
+
 /*----------------------------------------------------------------------*/
 
 static struct map_desc dm644x_io_desc[] = {
@@ -557,6 +660,13 @@ static struct davinci_id dm644x_ids[] = {
                .cpu_id         = DAVINCI_CPU_ID_DM6446,
                .name           = "dm6446",
        },
+       {
+               .variant        = 0x1,
+               .part_no        = 0xb700,
+               .manufacturer   = 0x017,
+               .cpu_id         = DAVINCI_CPU_ID_DM6446,
+               .name           = "dm6446a",
+       },
 };
 
 static void __iomem *dm644x_psc_bases[] = {
@@ -630,7 +740,6 @@ static struct davinci_soc_info davinci_soc_info_dm644x = {
        .intc_irq_prios         = dm644x_default_priorities,
        .intc_irq_num           = DAVINCI_N_AINTC_IRQ,
        .timer_info             = &dm644x_timer_info,
-       .wdt_base               = IO_ADDRESS(DAVINCI_WDOG_BASE),
        .gpio_base              = IO_ADDRESS(DAVINCI_GPIO_BASE),
        .gpio_num               = 71,
        .gpio_irq               = IRQ_GPIOBNK0,
@@ -640,6 +749,13 @@ static struct davinci_soc_info davinci_soc_info_dm644x = {
        .sram_len               = SZ_16K,
 };
 
+void __init dm644x_init_asp(struct snd_platform_data *pdata)
+{
+       davinci_cfg_reg(DM644X_MCBSP);
+       dm644x_asp_device.dev.platform_data = pdata;
+       platform_device_register(&dm644x_asp_device);
+}
+
 void __init dm644x_init(void)
 {
        davinci_common_init(&davinci_soc_info_dm644x);
@@ -652,6 +768,9 @@ static int __init dm644x_init_devices(void)
 
        platform_device_register(&dm644x_edma_device);
        platform_device_register(&dm644x_emac_device);
+       platform_device_register(&dm644x_vpss_device);
+       platform_device_register(&vpfe_capture_dev);
+
        return 0;
 }
 postcore_initcall(dm644x_init_devices);