ARM: imx: dynamically allocate imx-ssi devices
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 25 Aug 2010 15:37:45 +0000 (17:37 +0200)
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Mon, 27 Sep 2010 13:46:38 +0000 (15:46 +0200)
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
27 files changed:
arch/arm/mach-imx/Kconfig
arch/arm/mach-imx/devices-imx21.h
arch/arm/mach-imx/devices-imx27.h
arch/arm/mach-imx/devices.c
arch/arm/mach-imx/devices.h
arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
arch/arm/mach-imx/mach-pca100.c
arch/arm/mach-mx25/Kconfig
arch/arm/mach-mx25/devices-imx25.h
arch/arm/mach-mx25/devices.c
arch/arm/mach-mx25/devices.h
arch/arm/mach-mx25/eukrea_mbimxsd-baseboard.c
arch/arm/mach-mx3/Kconfig
arch/arm/mach-mx3/devices-imx31.h
arch/arm/mach-mx3/devices-imx35.h
arch/arm/mach-mx3/devices.c
arch/arm/mach-mx3/devices.h
arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c
arch/arm/mach-mx3/mach-mx31ads.c
arch/arm/mach-mx3/mach-pcm043.c
arch/arm/plat-mxc/devices/Kconfig
arch/arm/plat-mxc/devices/Makefile
arch/arm/plat-mxc/devices/platform-imx-ssi.c [new file with mode: 0644]
arch/arm/plat-mxc/include/mach/devices-common.h
arch/arm/plat-mxc/include/mach/mx25.h
arch/arm/plat-mxc/include/mach/mx31.h
arch/arm/plat-mxc/include/mach/mx35.h

index 19ed16d0017eb3b6cf60767ae47b7de2d9da8e74..9b45f1f523fa92c17f07b49e6d0f016a7ba927db 100644 (file)
@@ -146,8 +146,8 @@ choice
        default MACH_EUKREA_MBIMX27_BASEBOARD
 
 config MACH_EUKREA_MBIMX27_BASEBOARD
-       prompt "Eukrea MBIMX27 development board"
-       bool
+       bool "Eukrea MBIMX27 development board"
+       select IMX_HAVE_PLATFORM_IMX_SSI
        select IMX_HAVE_PLATFORM_IMX_UART
        select IMX_HAVE_PLATFORM_SPI_IMX
        help
@@ -182,6 +182,7 @@ config MACH_IMX27LITE
 config MACH_PCA100
        bool "Phytec phyCARD-s (pca100)"
        select IMX_HAVE_PLATFORM_IMX_I2C
+       select IMX_HAVE_PLATFORM_IMX_SSI
        select IMX_HAVE_PLATFORM_IMX_UART
        select IMX_HAVE_PLATFORM_MXC_NAND
        select IMX_HAVE_PLATFORM_SPI_IMX
index f75b5e4d0ed53ed8fee9283011109992c77fd659..24868c36d824bb59f19406441e9a9e44e57ea07b 100644 (file)
 #define imx21_add_i2c_imx(pdata)       \
        imx_add_imx_i2c(0, MX2x_I2C_BASE_ADDR, SZ_4K, MX2x_INT_I2C, pdata)
 
+extern const struct imx_imx_ssi_data imx21_imx_ssi_data[] __initconst;
+#define imx21_add_imx_ssi(id, pdata)   \
+       imx_add_imx_ssi(&imx21_imx_ssi_data[id], pdata)
+
 extern const struct imx_imx_uart_1irq_data imx21_imx_uart_data[] __initconst;
 #define imx21_add_imx_uart(id, pdata)  \
        imx_add_imx_uart_1irq(&imx21_imx_uart_data[id], pdata)
index bf9dab3a0858030fcbf9ba1abb575b3f602e7119..2972e6912af4e05822a7ce33f24deec428c22bb0 100644 (file)
 #define imx27_add_i2c_imx1(pdata)      \
        imx_add_imx_i2c(1, MX27_I2C2_BASE_ADDR, SZ_4K, MX27_INT_I2C2, pdata)
 
+extern const struct imx_imx_ssi_data imx27_imx_ssi_data[] __initconst;
+#define imx27_add_imx_ssi(id, pdata)    \
+       imx_add_imx_ssi(&imx27_imx_ssi_data[id], pdata)
+
 extern const struct imx_imx_uart_1irq_data imx27_imx_uart_data[] __initconst;
 #define imx27_add_imx_uart(id, pdata)  \
        imx_add_imx_uart_1irq(&imx27_imx_uart_data[id], pdata)
index 9c271a752b84da4e0380bf9fed2c86a5658a9640..423fa05dabd0ff531089ae276d96693e83eb5635 100644 (file)
@@ -480,41 +480,6 @@ struct platform_device mxc_usbh2 = {
 };
 #endif
 
-#define DEFINE_IMX_SSI_DMARES(_name, ssin, suffix)                     \
-       {                                                               \
-               .name = _name,                                          \
-               .start = MX2x_DMA_REQ_SSI ## ssin ## _ ## suffix,       \
-               .end = MX2x_DMA_REQ_SSI ## ssin ## _ ## suffix,         \
-               .flags = IORESOURCE_DMA,                                \
-       }
-
-#define DEFINE_IMX_SSI_DEVICE(n, ssin, baseaddr, irq)                  \
-       static struct resource imx_ssi_resources ## n[] = {             \
-               {                                                       \
-                       .start = MX2x_SSI ## ssin ## _BASE_ADDR,        \
-                       .end = MX2x_SSI ## ssin ## _BASE_ADDR + 0x6f,   \
-                       .flags = IORESOURCE_MEM,                        \
-               }, {                                                    \
-                       .start = MX2x_INT_SSI1,                         \
-                       .end = MX2x_INT_SSI1,                           \
-                       .flags = IORESOURCE_IRQ,                        \
-               },                                                      \
-               DEFINE_IMX_SSI_DMARES("tx0", ssin, TX0),                \
-               DEFINE_IMX_SSI_DMARES("rx0", ssin, RX0),                \
-               DEFINE_IMX_SSI_DMARES("tx1", ssin, TX1),                \
-               DEFINE_IMX_SSI_DMARES("rx1", ssin, RX1),                \
-       };                                                              \
-                                                                       \
-       struct platform_device imx_ssi_device ## n = {                  \
-               .name = "imx-ssi",                                      \
-               .id = n,                                                \
-               .num_resources = ARRAY_SIZE(imx_ssi_resources ## n),    \
-               .resource = imx_ssi_resources ## n,                     \
-       }
-
-DEFINE_IMX_SSI_DEVICE(0, 1, MX2x_SSI1_BASE_ADDR, MX2x_INT_SSI1);
-DEFINE_IMX_SSI_DEVICE(1, 2, MX2x_SSI1_BASE_ADDR, MX2x_INT_SSI1);
-
 /* GPIO port description */
 #define DEFINE_MXC_GPIO_PORT_IRQ(SOC, n, _irq)                         \
        {                                                               \
index efd4527506a5e661da74c95e9d756c0674ca3d33..57d4b1cac039850f409c289a777ff333d4b784b9 100644 (file)
@@ -26,7 +26,5 @@ extern struct platform_device mxc_otg_host;
 extern struct platform_device mxc_usbh1;
 extern struct platform_device mxc_usbh2;
 extern struct platform_device mx21_usbhc_device;
-extern struct platform_device imx_ssi_device0;
-extern struct platform_device imx_ssi_device1;
 extern struct platform_device imx_kpp_device;
 #endif
index 4edc5f43920109011d6e8f8fd64234e3fe3cb992..cb433aeec9390522c48ff54faa0f8df91df72e08 100644 (file)
@@ -36,7 +36,6 @@
 #include <mach/hardware.h>
 #include <mach/mmc.h>
 #include <mach/spi.h>
-#include <mach/ssi.h>
 #include <mach/audmux.h>
 
 #include "devices-imx27.h"
@@ -311,7 +310,8 @@ static struct imxmmc_platform_data sdhc_pdata = {
        .dat3_card_detect = 1,
 };
 
-struct imx_ssi_platform_data eukrea_mbimx27_ssi_pdata = {
+static const
+struct imx_ssi_platform_data eukrea_mbimx27_ssi_pdata __initconst = {
        .flags = IMX_SSI_DMA | IMX_SSI_USE_I2S_SLAVE,
 };
 
@@ -357,7 +357,7 @@ void __init eukrea_mbimx27_baseboard_init(void)
        i2c_register_board_info(0, eukrea_mbimx27_i2c_devices,
                                ARRAY_SIZE(eukrea_mbimx27_i2c_devices));
 
-       mxc_register_device(&imx_ssi_device0, &eukrea_mbimx27_ssi_pdata);
+       imx27_add_imx_ssi(0, &eukrea_mbimx27_ssi_pdata);
 
 #if defined(CONFIG_TOUCHSCREEN_ADS7846) \
        || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
index 23c9e1f37b9c022bee669908e7aeca791de3b4b4..93e0d66e37dc2b74356acf45db89ef3232e182e8 100644 (file)
@@ -38,7 +38,6 @@
 #include <mach/iomux-mx27.h>
 #include <asm/mach/time.h>
 #include <mach/audmux.h>
-#include <mach/ssi.h>
 #include <mach/mxc_nand.h>
 #include <mach/irqs.h>
 #include <mach/mmc.h>
@@ -252,7 +251,7 @@ static void pca100_ac97_cold_reset(struct snd_ac97 *ac97)
        msleep(2);
 }
 
-static struct imx_ssi_platform_data pca100_ssi_pdata = {
+static const struct imx_ssi_platform_data pca100_ssi_pdata __initconst = {
        .ac97_reset             = pca100_ac97_cold_reset,
        .ac97_warm_reset        = pca100_ac97_warm_reset,
        .flags                  = IMX_SSI_USE_AC97,
@@ -389,7 +388,7 @@ static void __init pca100_init(void)
        if (ret)
                printk(KERN_ERR "pca100: Failed to setup pins (%d)\n", ret);
 
-       mxc_register_device(&imx_ssi_device0, &pca100_ssi_pdata);
+       imx27_add_imx_ssi(0, &pca100_ssi_pdata);
 
        imx27_add_imx_uart0(&uart_pdata);
 
index c71a7bc19284bf64b14f939f3094bfc501631240..326bb648f46615f96eb2c6604f09184b9465a025 100644 (file)
@@ -20,8 +20,8 @@ choice
        default MACH_EUKREA_MBIMXSD25_BASEBOARD
 
 config MACH_EUKREA_MBIMXSD25_BASEBOARD
-       prompt "Eukrea MBIMXSD development board"
-       bool
+       bool "Eukrea MBIMXSD development board"
+       select IMX_HAVE_PLATFORM_IMX_SSI
        help
          This adds board specific devices that can be found on Eukrea's
          MBIMXSD evaluation board.
index 439400b5d275ffac55fe7ad7e89d3c4f93ac34fa..bf93facef3d0fa0a452d9649786872169c12e4b8 100644 (file)
 #define imx25_add_imx_i2c2(pdata)      \
        imx_add_imx_i2c(2, MX25_I2C3_BASE_ADDR, SZ_16K, MX25_INT_I2C3, pdata)
 
+extern const struct imx_imx_ssi_data imx25_imx_ssi_data[] __initconst;
+#define imx25_add_imx_ssi(id, pdata)   \
+       imx_add_imx_ssi(&imx25_imx_ssi_data[id], pdata)
+
 extern const struct imx_imx_uart_1irq_data imx25_imx_uart_data[] __initconst;
 #define imx25_add_imx_uart(id, pdata)  \
        imx_add_imx_uart_1irq(&imx25_imx_uart_data[id], pdata)
index 3468eb15b2367fd1a4c197bf76d3b59af4b3372a..bc19e8cc26dfe9ca37b1f916380da2b391e89ffd 100644 (file)
@@ -305,44 +305,6 @@ struct platform_device mx25_kpp_device = {
        .resource       = mx25_kpp_resources,
 };
 
-static struct resource imx_ssi_resources0[] = {
-       {
-               .start  = MX25_SSI1_BASE_ADDR,
-               .end    = MX25_SSI1_BASE_ADDR + 0x3fff,
-               .flags  = IORESOURCE_MEM,
-       }, {
-               .start  = MX25_INT_SSI1,
-               .end    = MX25_INT_SSI1,
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-static struct resource imx_ssi_resources1[] = {
-       {
-               .start  = MX25_SSI2_BASE_ADDR,
-               .end    = MX25_SSI2_BASE_ADDR + 0x3fff,
-               .flags  = IORESOURCE_MEM
-       }, {
-               .start  = MX25_INT_SSI2,
-               .end    = MX25_INT_SSI2,
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-struct platform_device imx_ssi_device0 = {
-       .name = "imx-ssi",
-       .id = 0,
-       .num_resources = ARRAY_SIZE(imx_ssi_resources0),
-       .resource = imx_ssi_resources0,
-};
-
-struct platform_device imx_ssi_device1 = {
-       .name = "imx-ssi",
-       .id = 1,
-       .num_resources = ARRAY_SIZE(imx_ssi_resources1),
-       .resource = imx_ssi_resources1,
-};
-
 static struct resource mx25_csi_resources[] = {
        {
                .start  = MX25_CSI_BASE_ADDR,
index 4aceb68e35a77003e11505dfb3eca338006263fb..f6e6d3a5f6403f8923e4ca321df53669b6cb93a6 100644 (file)
@@ -11,6 +11,4 @@ extern struct platform_device mx25_rtc_device;
 extern struct platform_device mx25_fb_device;
 extern struct platform_device mxc_wdt;
 extern struct platform_device mx25_kpp_device;
-extern struct platform_device imx_ssi_device0;
-extern struct platform_device imx_ssi_device1;
 extern struct platform_device mx25_csi_device;
index 4aaadc753d3e6ff4e60b88c17e62e5b3c0cfb812..2062dd93095543eca8f1e9a08e57449f87ece9c7 100644 (file)
@@ -34,7 +34,6 @@
 #include <mach/mx25.h>
 #include <mach/imx-uart.h>
 #include <mach/imxfb.h>
-#include <mach/ssi.h>
 #include <mach/audmux.h>
 
 #include "devices-imx25.h"
@@ -205,7 +204,8 @@ static struct i2c_board_info eukrea_mbimxsd_i2c_devices[] = {
        },
 };
 
-struct imx_ssi_platform_data eukrea_mbimxsd_ssi_pdata = {
+static const
+struct imx_ssi_platform_data eukrea_mbimxsd_ssi_pdata __initconst = {
        .flags = IMX_SSI_SYN | IMX_SSI_NET | IMX_SSI_USE_I2S_SLAVE,
 };
 
@@ -239,7 +239,7 @@ void __init eukrea_mbimxsd25_baseboard_init(void)
 
        imx25_add_imx_uart1(&uart_pdata);
        mxc_register_device(&mx25_fb_device, &eukrea_mximxsd_fb_pdata);
-       mxc_register_device(&imx_ssi_device0, &eukrea_mbimxsd_ssi_pdata);
+       imx25_add_imx_ssi(0, &eukrea_mbimxsd_ssi_pdata);
 
        gpio_request(GPIO_LED1, "LED1");
        gpio_direction_output(GPIO_LED1, 1);
index 5cee1a5c4bd2ddfee9644742c602579bdd2ace53..d762bf8e539bcfebb2762f5008ab9ec607264c27 100644 (file)
@@ -17,6 +17,7 @@ config MACH_MX31ADS
        bool "Support MX31ADS platforms"
        select ARCH_MX31
        select IMX_HAVE_PLATFORM_IMX_I2C
+       select IMX_HAVE_PLATFORM_IMX_SSI
        select IMX_HAVE_PLATFORM_IMX_UART
        default y
        help
@@ -118,6 +119,7 @@ config MACH_PCM043
        bool "Support Phytec pcm043 (i.MX35) platforms"
        select ARCH_MX35
        select IMX_HAVE_PLATFORM_IMX_I2C
+       select IMX_HAVE_PLATFORM_IMX_SSI
        select IMX_HAVE_PLATFORM_IMX_UART
        select IMX_HAVE_PLATFORM_MXC_NAND
        select IMX_HAVE_PLATFORM_FLEXCAN
@@ -172,8 +174,8 @@ choice
        default MACH_EUKREA_MBIMXSD35_BASEBOARD
 
 config MACH_EUKREA_MBIMXSD35_BASEBOARD
-       prompt "Eukrea MBIMXSD development board"
-       bool
+       bool "Eukrea MBIMXSD development board"
+       select IMX_HAVE_PLATFORM_IMX_SSI
        help
          This adds board specific devices that can be found on Eukrea's
          MBIMXSD evaluation board.
index a8c5f1bfce3bea3c39902b0d0a6cc464fe66caa4..b8568a1af81d85625a26d3257c98978c2ce6e86b 100644 (file)
 #define imx31_add_imx_i2c2(pdata)      \
        imx_add_imx_i2c(2, MX31_I2C3_BASE_ADDR, SZ_4K, MX31_INT_I2C3, pdata)
 
+extern const struct imx_imx_ssi_data imx31_imx_ssi_data[] __initconst;
+#define imx31_add_imx_ssi(id, pdata)    \
+       imx_add_imx_ssi(&imx31_imx_ssi_data[id], pdata)
+
 extern const struct imx_imx_uart_1irq_data imx31_imx_uart_data[] __initconst;
 #define imx31_add_imx_uart(id, pdata)  \
        imx_add_imx_uart_1irq(&imx31_imx_uart_data[id], pdata)
index 6a76b4d72e49ceaaee7529f9860f473f5f32b2a3..813e570fd3ba0a280cdac5ed7a470e25e7cc4d9c 100644 (file)
 #define imx35_add_imx_i2c2(pdata)      \
        imx_add_imx_i2c(2, MX35_I2C3_BASE_ADDR, SZ_4K, MX35_INT_I2C3, pdata)
 
+extern const struct imx_imx_ssi_data imx35_imx_ssi_data[] __initconst;
+#define imx35_add_imx_ssi(id, pdata)    \
+       imx_add_imx_ssi(&imx35_imx_ssi_data[id], pdata)
+
 extern const struct imx_imx_uart_1irq_data imx35_imx_uart_data[] __initconst;
 #define imx35_add_imx_uart(id, pdata)  \
        imx_add_imx_uart_1irq(&imx35_imx_uart_data[id], pdata)
index a4fd1a26fc91982d200d76c7a152eb5c62610a7b..87a9a21457b9df838540fcdc02f3c6e9bae8ac57 100644 (file)
@@ -302,44 +302,6 @@ struct platform_device mxc_fec_device = {
 };
 #endif
 
-static struct resource imx_ssi_resources0[] = {
-       {
-               .start  = SSI1_BASE_ADDR,
-               .end    = SSI1_BASE_ADDR + 0xfff,
-               .flags  = IORESOURCE_MEM,
-       }, {
-               .start  = MX31_INT_SSI1,
-               .end    = MX31_INT_SSI1,
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-static struct resource imx_ssi_resources1[] = {
-       {
-               .start  = SSI2_BASE_ADDR,
-               .end    = SSI2_BASE_ADDR + 0xfff,
-               .flags  = IORESOURCE_MEM
-       }, {
-               .start  = MX31_INT_SSI2,
-               .end    = MX31_INT_SSI2,
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-struct platform_device imx_ssi_device0 = {
-       .name = "imx-ssi",
-       .id = 0,
-       .num_resources = ARRAY_SIZE(imx_ssi_resources0),
-       .resource = imx_ssi_resources0,
-};
-
-struct platform_device imx_ssi_device1 = {
-       .name = "imx-ssi",
-       .id = 1,
-       .num_resources = ARRAY_SIZE(imx_ssi_resources1),
-       .resource = imx_ssi_resources1,
-};
-
 static struct resource imx_wdt_resources[] = {
        {
                .flags = IORESOURCE_MEM,
@@ -410,10 +372,6 @@ static int __init mx3_devices_init(void)
                mxc_usbh1_resources[0].end = MX35_OTG_BASE_ADDR + 0x5ff;
                mxc_usbh1_resources[1].start = MXC_INT_USBHS;
                mxc_usbh1_resources[1].end = MXC_INT_USBHS;
-               imx_ssi_resources0[1].start = MX35_INT_SSI1;
-               imx_ssi_resources0[1].end = MX35_INT_SSI1;
-               imx_ssi_resources1[1].start = MX35_INT_SSI2;
-               imx_ssi_resources1[1].end = MX35_INT_SSI2;
                imx_wdt_resources[0].start = MX35_WDOG_BASE_ADDR;
                imx_wdt_resources[0].end = MX35_WDOG_BASE_ADDR + 0x3fff;
        }
index e5535234839f5e1ae8159d0513e8bf9c0952d7c7..2a69465bc54212bab3c9d0a6bb54d0f2aaf6db48 100644 (file)
@@ -10,9 +10,6 @@ extern struct platform_device mxc_otg_host;
 extern struct platform_device mxc_usbh1;
 extern struct platform_device mxc_usbh2;
 extern struct platform_device mxc_rnga_device;
-extern struct platform_device imx_ssi_device0;
-extern struct platform_device imx_ssi_device1;
-extern struct platform_device imx_ssi_device1;
 extern struct platform_device imx_wdt_device0;
 extern struct platform_device imx_rtc_device0;
 extern struct platform_device imx_kpp_device;
index f8f15e3ac7a0e82a6cde9f6bd021c85a546bbae7..cb667b6f17ae3b7da79a61143f07a325f0d0999b 100644 (file)
@@ -43,7 +43,6 @@
 #include <mach/ipu.h>
 #include <mach/mx3fb.h>
 #include <mach/audmux.h>
-#include <mach/ssi.h>
 
 #include "devices-imx35.h"
 #include "devices.h"
@@ -206,7 +205,8 @@ static struct i2c_board_info eukrea_mbimxsd_i2c_devices[] = {
        },
 };
 
-struct imx_ssi_platform_data eukrea_mbimxsd_ssi_pdata = {
+static const
+struct imx_ssi_platform_data eukrea_mbimxsd_ssi_pdata __initconst = {
        .flags = IMX_SSI_SYN | IMX_SSI_NET | IMX_SSI_USE_I2S_SLAVE,
 };
 
@@ -242,7 +242,7 @@ void __init eukrea_mbimxsd35_baseboard_init(void)
        mxc_register_device(&mx3_ipu, &mx3_ipu_data);
        mxc_register_device(&mx3_fb, &mx3fb_pdata);
 
-       mxc_register_device(&imx_ssi_device0, &eukrea_mbimxsd_ssi_pdata);
+       imx35_add_imx_ssi(0, &eukrea_mbimxsd_ssi_pdata);
 
        gpio_request(GPIO_LED1, "LED1");
        gpio_direction_output(GPIO_LED1, 1);
index 94b3e7c4240408451aa08446c9b991ad179be699..96cedc4a47f5d6bc333001565de8dac569f9b301 100644 (file)
@@ -517,7 +517,7 @@ static unsigned int ssi_pins[] = {
 
 static void mxc_init_audio(void)
 {
-       mxc_register_device(&imx_ssi_device0, NULL);
+       imx31_add_imx_ssi(0, NULL);
        mxc_iomux_setup_multiple_pins(ssi_pins, ARRAY_SIZE(ssi_pins), "ssi");
 }
 
index 28886f0e62f97de762c015e5d9db2fdf4f84f400..dcc216bb395216907921083e83690d4ef0a8372f 100644 (file)
@@ -42,7 +42,6 @@
 #include <mach/mxc_ehci.h>
 #include <mach/ulpi.h>
 #include <mach/audmux.h>
-#include <mach/ssi.h>
 
 #include "devices-imx35.h"
 #include "devices.h"
@@ -293,7 +292,7 @@ err1:
        mdelay(1);
 }
 
-static struct imx_ssi_platform_data pcm043_ssi_pdata = {
+static const struct imx_ssi_platform_data pcm043_ssi_pdata __initconst = {
        .ac97_reset = pcm043_ac97_cold_reset,
        .ac97_warm_reset = pcm043_ac97_warm_reset,
        .flags = IMX_SSI_USE_AC97,
@@ -361,7 +360,7 @@ static void __init mxc_board_init(void)
 
        imx35_add_imx_uart0(&uart_pdata);
        imx35_add_mxc_nand(&pcm037_nand_board_info);
-       mxc_register_device(&imx_ssi_device0, &pcm043_ssi_pdata);
+       imx35_add_imx_ssi(0, &pcm043_ssi_pdata);
 
        imx35_add_imx_uart1(&uart_pdata);
 
index 9ab784b776f9192a33feaff37ff21be99b0a3691..d736c3d4e29252d695151937b3e3b7589fcd5ca0 100644 (file)
@@ -5,6 +5,9 @@ config IMX_HAVE_PLATFORM_FLEXCAN
 config IMX_HAVE_PLATFORM_IMX_I2C
        bool
 
+config IMX_HAVE_PLATFORM_IMX_SSI
+       bool
+
 config IMX_HAVE_PLATFORM_IMX_UART
        bool
 
index 2062ab4d094d0a236ddf701d69be052f0bec722e..ac773837937406b2b243e788c5a72486d6ffc902 100644 (file)
@@ -1,5 +1,6 @@
 obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o
+obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) +=  platform-spi_imx.o
diff --git a/arch/arm/plat-mxc/devices/platform-imx-ssi.c b/arch/arm/plat-mxc/devices/platform-imx-ssi.c
new file mode 100644 (file)
index 0000000..1535bc9
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2010 Pengutronix
+ * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License version 2 as published by the
+ * Free Software Foundation.
+ */
+#include <mach/hardware.h>
+#include <mach/devices-common.h>
+
+#define imx_imx_ssi_data_entry(soc, _id, _hwid, _size)                 \
+       [_id] = {                                                       \
+               .id = _id,                                              \
+               .iobase = soc ## _SSI ## _hwid ## _BASE_ADDR,           \
+               .iosize = _size,                                        \
+               .irq = soc ## _INT_SSI ## _hwid,                        \
+               .dmatx0 = soc ## _DMA_REQ_SSI ## _hwid ## _TX0,         \
+               .dmarx0 = soc ## _DMA_REQ_SSI ## _hwid ## _RX0,         \
+               .dmatx1 = soc ## _DMA_REQ_SSI ## _hwid ## _TX1,         \
+               .dmarx1 = soc ## _DMA_REQ_SSI ## _hwid ## _RX1,         \
+       }
+
+#ifdef CONFIG_SOC_IMX21
+const struct imx_imx_ssi_data imx21_imx_ssi_data[] __initconst = {
+#define imx21_imx_ssi_data_entry(_id, _hwid)                           \
+       imx_imx_ssi_data_entry(MX21, _id, _hwid, SZ_4K)
+       imx21_imx_ssi_data_entry(0, 1),
+       imx21_imx_ssi_data_entry(1, 2),
+};
+#endif /* ifdef CONFIG_SOC_IMX21 */
+
+#ifdef CONFIG_ARCH_MX25
+const struct imx_imx_ssi_data imx25_imx_ssi_data[] __initconst = {
+#define imx25_imx_ssi_data_entry(_id, _hwid)                           \
+       imx_imx_ssi_data_entry(MX25, _id, _hwid, SZ_4K)
+       imx25_imx_ssi_data_entry(0, 1),
+       imx25_imx_ssi_data_entry(1, 2),
+};
+#endif /* ifdef CONFIG_ARCH_MX25 */
+
+#ifdef CONFIG_SOC_IMX27
+const struct imx_imx_ssi_data imx27_imx_ssi_data[] __initconst = {
+#define imx27_imx_ssi_data_entry(_id, _hwid)                           \
+       imx_imx_ssi_data_entry(MX27, _id, _hwid, SZ_4K)
+       imx27_imx_ssi_data_entry(0, 1),
+       imx27_imx_ssi_data_entry(1, 2),
+};
+#endif /* ifdef CONFIG_SOC_IMX27 */
+
+#ifdef CONFIG_ARCH_MX31
+const struct imx_imx_ssi_data imx31_imx_ssi_data[] __initconst = {
+#define imx31_imx_ssi_data_entry(_id, _hwid)                           \
+       imx_imx_ssi_data_entry(MX31, _id, _hwid, SZ_4K)
+       imx31_imx_ssi_data_entry(0, 1),
+       imx31_imx_ssi_data_entry(1, 2),
+};
+#endif /* ifdef CONFIG_ARCH_MX31 */
+
+#ifdef CONFIG_ARCH_MX35
+const struct imx_imx_ssi_data imx35_imx_ssi_data[] __initconst = {
+#define imx35_imx_ssi_data_entry(_id, _hwid)                           \
+       imx_imx_ssi_data_entry(MX35, _id, _hwid, SZ_4K)
+       imx35_imx_ssi_data_entry(0, 1),
+       imx35_imx_ssi_data_entry(1, 2),
+};
+#endif /* ifdef CONFIG_ARCH_MX35 */
+
+struct platform_device *__init imx_add_imx_ssi(
+               const struct imx_imx_ssi_data *data,
+               const struct imx_ssi_platform_data *pdata)
+{
+       struct resource res[] = {
+               {
+                       .start = data->iobase,
+                       .end = data->iobase + data->iosize - 1,
+                       .flags = IORESOURCE_MEM,
+               }, {
+                       .start = data->irq,
+                       .end = data->irq,
+                       .flags = IORESOURCE_IRQ,
+               },
+#define DMARES(_name) {                                                        \
+       .name = #_name,                                                 \
+       .start = data->dma ## _name,                                    \
+       .end = data->dma ## _name,                                      \
+       .flags = IORESOURCE_DMA,                                        \
+}
+               DMARES(tx0),
+               DMARES(rx0),
+               DMARES(tx1),
+               DMARES(rx1),
+       };
+
+       return imx_add_platform_device("imx-ssi", data->id,
+                       res, ARRAY_SIZE(res),
+                       pdata, sizeof(*pdata));
+}
index 12bdc7d027c76789e88d8f89f6bde6c6be1cb0d5..84bfe44ec2cd4cbb1f0866596568d2e68b62381d 100644 (file)
@@ -25,6 +25,21 @@ struct platform_device *__init imx_add_imx_i2c(int id,
                resource_size_t iobase, resource_size_t iosize, int irq,
                const struct imxi2c_platform_data *pdata);
 
+#include <mach/ssi.h>
+struct imx_imx_ssi_data {
+       int id;
+       resource_size_t iobase;
+       resource_size_t iosize;
+       resource_size_t irq;
+       resource_size_t dmatx0;
+       resource_size_t dmarx0;
+       resource_size_t dmatx1;
+       resource_size_t dmarx1;
+};
+struct platform_device *__init imx_add_imx_ssi(
+               const struct imx_imx_ssi_data *data,
+               const struct imx_ssi_platform_data *pdata);
+
 #include <mach/imx-uart.h>
 struct imx_imx_uart_3irq_data {
        int id;
index 4a6f800990f83a826e687ae6a8d8776def7a3689..8f809eb084dfb8258d71c0b87fa74a6449c32ca6 100644 (file)
 #define MX25_INT_UART1         45
 #define MX25_INT_FEC           57
 
+#define MX25_DMA_REQ_SSI2_RX1  22
+#define MX25_DMA_REQ_SSI2_TX1  23
+#define MX25_DMA_REQ_SSI2_RX0  24
+#define MX25_DMA_REQ_SSI2_TX0  25
+#define MX25_DMA_REQ_SSI1_RX1  26
+#define MX25_DMA_REQ_SSI1_TX1  27
+#define MX25_DMA_REQ_SSI1_RX0  28
+#define MX25_DMA_REQ_SSI1_TX0  29
+
 #endif /* ifndef __MACH_MX25_H__ */
index afee3ab9d62e2aef32a366f21c82350a562dab22..eb8bbc7eedfaca806913971278c66e3be86cceaa 100644 (file)
@@ -197,6 +197,15 @@ static inline void mx31_setup_weimcs(size_t cs,
 #define MX31_INT_EXT_WDOG      62
 #define MX31_INT_EXT_TV                63
 
+#define MX31_DMA_REQ_SSI2_RX1  22
+#define MX31_DMA_REQ_SSI2_TX1  23
+#define MX31_DMA_REQ_SSI2_RX0  24
+#define MX31_DMA_REQ_SSI2_TX0  25
+#define MX31_DMA_REQ_SSI1_RX1  26
+#define MX31_DMA_REQ_SSI1_TX1  27
+#define MX31_DMA_REQ_SSI1_RX0  28
+#define MX31_DMA_REQ_SSI1_TX0  29
+
 #define MX31_PROD_SIGNATURE            0x1     /* For MX31 */
 
 /* silicon revisions specific to i.MX31 */
index af3038c12e39c03b16d00855e5f5f40b75ba9b97..867b8c0ca105db9b81e990d0f12f3d2bd69ae597 100644 (file)
 #define MX35_INT_EXT_WDOG      62
 #define MX35_INT_EXT_TV                63
 
+#define MX35_DMA_REQ_SSI2_RX1   22
+#define MX35_DMA_REQ_SSI2_TX1   23
+#define MX35_DMA_REQ_SSI2_RX0   24
+#define MX35_DMA_REQ_SSI2_TX0   25
+#define MX35_DMA_REQ_SSI1_RX1   26
+#define MX35_DMA_REQ_SSI1_TX1   27
+#define MX35_DMA_REQ_SSI1_RX0   28
+#define MX35_DMA_REQ_SSI1_TX0   29
+
 #define MX35_PROD_SIGNATURE            0x1     /* For MX31 */
 
 /* silicon revisions specific to i.MX31 */