ARM: mxs: add saif device
authorDong Aisheng <b29396@freescale.com>
Wed, 20 Jul 2011 03:41:42 +0000 (11:41 +0800)
committerSascha Hauer <s.hauer@pengutronix.de>
Tue, 23 Aug 2011 06:56:13 +0000 (08:56 +0200)
Signed-off-by: Dong Aisheng <b29396@freescale.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
arch/arm/mach-mxs/Kconfig
arch/arm/mach-mxs/devices-mx28.h
arch/arm/mach-mxs/devices/Kconfig
arch/arm/mach-mxs/devices/Makefile
arch/arm/mach-mxs/devices/platform-mxs-saif.c [new file with mode: 0644]
arch/arm/mach-mxs/include/mach/devices-common.h
arch/arm/mach-mxs/mach-mx28evk.c

index 4cd0231ee539ead25f0728fa8572fc1070fa5e60..405c28d24e153b05ac1c883ddd9998e50cda031a 100644 (file)
@@ -48,6 +48,7 @@ config MACH_MX28EVK
        select MXS_HAVE_PLATFORM_FLEXCAN
        select MXS_HAVE_PLATFORM_MXS_MMC
        select MXS_HAVE_PLATFORM_MXSFB
+       select MXS_HAVE_PLATFORM_MXS_SAIF
        select MXS_OCOTP
        help
          Include support for MX28EVK platform. This includes specific
index 79b94523954ac7f9fce078980ef1885eea4a76a6..c0f21cef4b5d93bf539acf9a3fc0ff934354dcdf 100644 (file)
@@ -45,3 +45,6 @@ extern const struct mxs_mxs_mmc_data mx28_mxs_mmc_data[] __initconst;
 
 struct platform_device *__init mx28_add_mxsfb(
                const struct mxsfb_platform_data *pdata);
+
+extern const struct mxs_saif_data mx28_saif_data[] __initconst;
+#define mx28_add_saif(id)              mxs_add_saif(&mx28_saif_data[id])
index acf9eea124c0dcf7a785a63f775afd6ecf7e3600..b55437124fdaef7cd0015fef724cc693bd39547e 100644 (file)
@@ -23,3 +23,6 @@ config MXS_HAVE_PLATFORM_MXS_PWM
 
 config MXS_HAVE_PLATFORM_MXSFB
        bool
+
+config MXS_HAVE_PLATFORM_MXS_SAIF
+       bool
index 351915c683ffa0d749053012a68240541120abc6..d3e8cc3886290cab94bb7045edaa3db434db6637 100644 (file)
@@ -8,3 +8,4 @@ obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_MMC) += platform-mxs-mmc.o
 obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_PWM) += platform-mxs-pwm.o
 obj-y += platform-gpio-mxs.o
 obj-$(CONFIG_MXS_HAVE_PLATFORM_MXSFB) += platform-mxsfb.o
+obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_SAIF) += platform-mxs-saif.o
diff --git a/arch/arm/mach-mxs/devices/platform-mxs-saif.c b/arch/arm/mach-mxs/devices/platform-mxs-saif.c
new file mode 100644 (file)
index 0000000..1ec965e
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
+ *
+ * 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 <linux/compiler.h>
+#include <linux/err.h>
+#include <linux/init.h>
+
+#include <mach/mx23.h>
+#include <mach/mx28.h>
+#include <mach/devices-common.h>
+
+#define mxs_saif_data_entry_single(soc, _id)                           \
+       {                                                               \
+               .id = _id,                                              \
+               .iobase = soc ## _SAIF ## _id ## _BASE_ADDR,            \
+               .irq = soc ## _INT_SAIF ## _id,                         \
+               .dma = soc ## _DMA_SAIF ## _id,                         \
+               .dmairq = soc ## _INT_SAIF ## _id ##_DMA,               \
+       }
+
+#define mxs_saif_data_entry(soc, _id)                                  \
+       [_id] = mxs_saif_data_entry_single(soc, _id)
+
+#ifdef CONFIG_SOC_IMX28
+const struct mxs_saif_data mx28_saif_data[] __initconst = {
+       mxs_saif_data_entry(MX28, 0),
+       mxs_saif_data_entry(MX28, 1),
+};
+#endif
+
+struct platform_device *__init mxs_add_saif(const struct mxs_saif_data *data)
+{
+       struct resource res[] = {
+               {
+                       .start = data->iobase,
+                       .end = data->iobase + SZ_4K - 1,
+                       .flags = IORESOURCE_MEM,
+               }, {
+                       .start = data->irq,
+                       .end = data->irq,
+                       .flags = IORESOURCE_IRQ,
+               }, {
+                       .start = data->dma,
+                       .end = data->dma,
+                       .flags = IORESOURCE_DMA,
+               }, {
+                       .start = data->dmairq,
+                       .end = data->dmairq,
+                       .flags = IORESOURCE_IRQ,
+               },
+
+       };
+
+       return mxs_add_platform_device("mxs-saif", data->id, res,
+                                       ARRAY_SIZE(res), NULL, 0);
+}
index 812d7a813a780d8a0f75ea8170290a666b89ff41..a8080f44c03d9310d74b26d2965dba0862f006f1 100644 (file)
@@ -92,3 +92,15 @@ struct platform_device *__init mxs_add_mxs_mmc(
 /* pwm */
 struct platform_device *__init mxs_add_mxs_pwm(
                resource_size_t iobase, int id);
+
+/* saif */
+struct mxs_saif_data {
+       int id;
+       resource_size_t iobase;
+       resource_size_t irq;
+       resource_size_t dma;
+       resource_size_t dmairq;
+};
+
+struct platform_device *__init mxs_add_saif(
+               const struct mxs_saif_data *data);
index eaaf6ff289905501fffb048fb1aa0e3a4850b48d..1e5fda94d96caeaeffc2786738e6674a51ca52f9 100644 (file)
@@ -183,6 +183,18 @@ static const iomux_cfg_t mx28evk_pads[] __initconst = {
 
        /* led */
        MX28_PAD_AUART1_TX__GPIO_3_5 | MXS_PAD_CTRL,
+
+       /* saif0 & saif1 */
+       MX28_PAD_SAIF0_MCLK__SAIF0_MCLK |
+               (MXS_PAD_12MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
+       MX28_PAD_SAIF0_LRCLK__SAIF0_LRCLK |
+               (MXS_PAD_12MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
+       MX28_PAD_SAIF0_BITCLK__SAIF0_BITCLK |
+               (MXS_PAD_12MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
+       MX28_PAD_SAIF0_SDATA0__SAIF0_SDATA0 |
+               (MXS_PAD_12MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
+       MX28_PAD_SAIF1_SDATA0__SAIF1_SDATA0 |
+               (MXS_PAD_12MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
 };
 
 /* led */
@@ -392,6 +404,9 @@ static void __init mx28evk_init(void)
 
        mx28_add_mxsfb(&mx28evk_mxsfb_pdata);
 
+       mx28_add_saif(0);
+       mx28_add_saif(1);
+
        /* power on mmc slot by writing 0 to the gpio */
        ret = gpio_request_one(MX28EVK_MMC0_SLOT_POWER, GPIOF_OUT_INIT_LOW,
                               "mmc0-slot-power");