Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
[sfrench/cifs-2.6.git] / arch / arm / mach-omap2 / devices.c
index 2dbb265bedd4e914c6ceac472dbe9a0b8bddbf0b..c5cf1ba08a6f525732c9e76b4e5b109a1b495aca 100644 (file)
@@ -25,6 +25,7 @@
 #include <plat/control.h>
 #include <plat/tc.h>
 #include <plat/board.h>
+#include <plat/mcbsp.h>
 #include <mach/gpio.h>
 #include <plat/mmc.h>
 #include <plat/dma.h>
@@ -235,6 +236,43 @@ static inline void omap_init_mbox(void) { }
 
 static inline void omap_init_sti(void) {}
 
+#if defined(CONFIG_SND_SOC) || defined(CONFIG_SND_SOC_MODULE)
+
+static struct platform_device omap_pcm = {
+       .name   = "omap-pcm-audio",
+       .id     = -1,
+};
+
+/*
+ * OMAP2420 has 2 McBSP ports
+ * OMAP2430 has 5 McBSP ports
+ * OMAP3 has 5 McBSP ports
+ * OMAP4 has 4 McBSP ports
+ */
+OMAP_MCBSP_PLATFORM_DEVICE(1);
+OMAP_MCBSP_PLATFORM_DEVICE(2);
+OMAP_MCBSP_PLATFORM_DEVICE(3);
+OMAP_MCBSP_PLATFORM_DEVICE(4);
+OMAP_MCBSP_PLATFORM_DEVICE(5);
+
+static void omap_init_audio(void)
+{
+       platform_device_register(&omap_mcbsp1);
+       platform_device_register(&omap_mcbsp2);
+       if (cpu_is_omap243x() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
+               platform_device_register(&omap_mcbsp3);
+               platform_device_register(&omap_mcbsp4);
+       }
+       if (cpu_is_omap243x() || cpu_is_omap34xx())
+               platform_device_register(&omap_mcbsp5);
+
+       platform_device_register(&omap_pcm);
+}
+
+#else
+static inline void omap_init_audio(void) {}
+#endif
+
 #if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE)
 
 #include <plat/mcspi.h>
@@ -498,6 +536,76 @@ static void omap_init_sham(void)
 static inline void omap_init_sham(void) { }
 #endif
 
+#if defined(CONFIG_CRYPTO_DEV_OMAP_AES) || defined(CONFIG_CRYPTO_DEV_OMAP_AES_MODULE)
+
+#ifdef CONFIG_ARCH_OMAP24XX
+static struct resource omap2_aes_resources[] = {
+       {
+               .start  = OMAP24XX_SEC_AES_BASE,
+               .end    = OMAP24XX_SEC_AES_BASE + 0x4C,
+               .flags  = IORESOURCE_MEM,
+       },
+       {
+               .start  = OMAP24XX_DMA_AES_TX,
+               .flags  = IORESOURCE_DMA,
+       },
+       {
+               .start  = OMAP24XX_DMA_AES_RX,
+               .flags  = IORESOURCE_DMA,
+       }
+};
+static int omap2_aes_resources_sz = ARRAY_SIZE(omap2_aes_resources);
+#else
+#define omap2_aes_resources            NULL
+#define omap2_aes_resources_sz         0
+#endif
+
+#ifdef CONFIG_ARCH_OMAP34XX
+static struct resource omap3_aes_resources[] = {
+       {
+               .start  = OMAP34XX_SEC_AES_BASE,
+               .end    = OMAP34XX_SEC_AES_BASE + 0x4C,
+               .flags  = IORESOURCE_MEM,
+       },
+       {
+               .start  = OMAP34XX_DMA_AES2_TX,
+               .flags  = IORESOURCE_DMA,
+       },
+       {
+               .start  = OMAP34XX_DMA_AES2_RX,
+               .flags  = IORESOURCE_DMA,
+       }
+};
+static int omap3_aes_resources_sz = ARRAY_SIZE(omap3_aes_resources);
+#else
+#define omap3_aes_resources            NULL
+#define omap3_aes_resources_sz         0
+#endif
+
+static struct platform_device aes_device = {
+       .name           = "omap-aes",
+       .id             = -1,
+};
+
+static void omap_init_aes(void)
+{
+       if (cpu_is_omap24xx()) {
+               aes_device.resource = omap2_aes_resources;
+               aes_device.num_resources = omap2_aes_resources_sz;
+       } else if (cpu_is_omap34xx()) {
+               aes_device.resource = omap3_aes_resources;
+               aes_device.num_resources = omap3_aes_resources_sz;
+       } else {
+               pr_err("%s: platform not supported\n", __func__);
+               return;
+       }
+       platform_device_register(&aes_device);
+}
+
+#else
+static inline void omap_init_aes(void) { }
+#endif
+
 /*-------------------------------------------------------------------------*/
 
 #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
@@ -847,6 +955,7 @@ static int __init omap2_init_devices(void)
         * in alphabetical order so they're easier to sort through.
         */
        omap_hsmmc_reset();
+       omap_init_audio();
        omap_init_camera();
        omap_init_mbox();
        omap_init_mcspi();
@@ -854,6 +963,7 @@ static int __init omap2_init_devices(void)
        omap_hdq_init();
        omap_init_sti();
        omap_init_sham();
+       omap_init_aes();
        omap_init_vout();
 
        return 0;