aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDong Aisheng <b29396@freescale.com>2011-07-19 23:41:42 -0400
committerSascha Hauer <s.hauer@pengutronix.de>2011-08-23 02:56:13 -0400
commitc8ebcac823bb0246c42168c277069356432efd34 (patch)
tree398581f4d38b1fef34a5cfce7f6e9418428471ce
parentcf66ea8e14b753f1c4d38322d3e52f8838528091 (diff)
ARM: mxs: add saif device
Signed-off-by: Dong Aisheng <b29396@freescale.com> Cc: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
-rw-r--r--arch/arm/mach-mxs/Kconfig1
-rw-r--r--arch/arm/mach-mxs/devices-mx28.h3
-rw-r--r--arch/arm/mach-mxs/devices/Kconfig3
-rw-r--r--arch/arm/mach-mxs/devices/Makefile1
-rw-r--r--arch/arm/mach-mxs/devices/platform-mxs-saif.c60
-rw-r--r--arch/arm/mach-mxs/include/mach/devices-common.h12
-rw-r--r--arch/arm/mach-mxs/mach-mx28evk.c15
7 files changed, 95 insertions, 0 deletions
diff --git a/arch/arm/mach-mxs/Kconfig b/arch/arm/mach-mxs/Kconfig
index 4cd0231ee539..405c28d24e15 100644
--- a/arch/arm/mach-mxs/Kconfig
+++ b/arch/arm/mach-mxs/Kconfig
@@ -48,6 +48,7 @@ config MACH_MX28EVK
48 select MXS_HAVE_PLATFORM_FLEXCAN 48 select MXS_HAVE_PLATFORM_FLEXCAN
49 select MXS_HAVE_PLATFORM_MXS_MMC 49 select MXS_HAVE_PLATFORM_MXS_MMC
50 select MXS_HAVE_PLATFORM_MXSFB 50 select MXS_HAVE_PLATFORM_MXSFB
51 select MXS_HAVE_PLATFORM_MXS_SAIF
51 select MXS_OCOTP 52 select MXS_OCOTP
52 help 53 help
53 Include support for MX28EVK platform. This includes specific 54 Include support for MX28EVK platform. This includes specific
diff --git a/arch/arm/mach-mxs/devices-mx28.h b/arch/arm/mach-mxs/devices-mx28.h
index 79b94523954a..c0f21cef4b5d 100644
--- a/arch/arm/mach-mxs/devices-mx28.h
+++ b/arch/arm/mach-mxs/devices-mx28.h
@@ -45,3 +45,6 @@ extern const struct mxs_mxs_mmc_data mx28_mxs_mmc_data[] __initconst;
45 45
46struct platform_device *__init mx28_add_mxsfb( 46struct platform_device *__init mx28_add_mxsfb(
47 const struct mxsfb_platform_data *pdata); 47 const struct mxsfb_platform_data *pdata);
48
49extern const struct mxs_saif_data mx28_saif_data[] __initconst;
50#define mx28_add_saif(id) mxs_add_saif(&mx28_saif_data[id])
diff --git a/arch/arm/mach-mxs/devices/Kconfig b/arch/arm/mach-mxs/devices/Kconfig
index acf9eea124c0..b55437124fda 100644
--- a/arch/arm/mach-mxs/devices/Kconfig
+++ b/arch/arm/mach-mxs/devices/Kconfig
@@ -23,3 +23,6 @@ config MXS_HAVE_PLATFORM_MXS_PWM
23 23
24config MXS_HAVE_PLATFORM_MXSFB 24config MXS_HAVE_PLATFORM_MXSFB
25 bool 25 bool
26
27config MXS_HAVE_PLATFORM_MXS_SAIF
28 bool
diff --git a/arch/arm/mach-mxs/devices/Makefile b/arch/arm/mach-mxs/devices/Makefile
index 351915c683ff..d3e8cc388629 100644
--- a/arch/arm/mach-mxs/devices/Makefile
+++ b/arch/arm/mach-mxs/devices/Makefile
@@ -8,3 +8,4 @@ obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_MMC) += platform-mxs-mmc.o
8obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_PWM) += platform-mxs-pwm.o 8obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_PWM) += platform-mxs-pwm.o
9obj-y += platform-gpio-mxs.o 9obj-y += platform-gpio-mxs.o
10obj-$(CONFIG_MXS_HAVE_PLATFORM_MXSFB) += platform-mxsfb.o 10obj-$(CONFIG_MXS_HAVE_PLATFORM_MXSFB) += platform-mxsfb.o
11obj-$(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
index 000000000000..1ec965e9fe92
--- /dev/null
+++ b/arch/arm/mach-mxs/devices/platform-mxs-saif.c
@@ -0,0 +1,60 @@
1/*
2 * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU General Public License version 2 as published by the
6 * Free Software Foundation.
7 */
8#include <linux/compiler.h>
9#include <linux/err.h>
10#include <linux/init.h>
11
12#include <mach/mx23.h>
13#include <mach/mx28.h>
14#include <mach/devices-common.h>
15
16#define mxs_saif_data_entry_single(soc, _id) \
17 { \
18 .id = _id, \
19 .iobase = soc ## _SAIF ## _id ## _BASE_ADDR, \
20 .irq = soc ## _INT_SAIF ## _id, \
21 .dma = soc ## _DMA_SAIF ## _id, \
22 .dmairq = soc ## _INT_SAIF ## _id ##_DMA, \
23 }
24
25#define mxs_saif_data_entry(soc, _id) \
26 [_id] = mxs_saif_data_entry_single(soc, _id)
27
28#ifdef CONFIG_SOC_IMX28
29const struct mxs_saif_data mx28_saif_data[] __initconst = {
30 mxs_saif_data_entry(MX28, 0),
31 mxs_saif_data_entry(MX28, 1),
32};
33#endif
34
35struct platform_device *__init mxs_add_saif(const struct mxs_saif_data *data)
36{
37 struct resource res[] = {
38 {
39 .start = data->iobase,
40 .end = data->iobase + SZ_4K - 1,
41 .flags = IORESOURCE_MEM,
42 }, {
43 .start = data->irq,
44 .end = data->irq,
45 .flags = IORESOURCE_IRQ,
46 }, {
47 .start = data->dma,
48 .end = data->dma,
49 .flags = IORESOURCE_DMA,
50 }, {
51 .start = data->dmairq,
52 .end = data->dmairq,
53 .flags = IORESOURCE_IRQ,
54 },
55
56 };
57
58 return mxs_add_platform_device("mxs-saif", data->id, res,
59 ARRAY_SIZE(res), NULL, 0);
60}
diff --git a/arch/arm/mach-mxs/include/mach/devices-common.h b/arch/arm/mach-mxs/include/mach/devices-common.h
index 812d7a813a78..a8080f44c03d 100644
--- a/arch/arm/mach-mxs/include/mach/devices-common.h
+++ b/arch/arm/mach-mxs/include/mach/devices-common.h
@@ -92,3 +92,15 @@ struct platform_device *__init mxs_add_mxs_mmc(
92/* pwm */ 92/* pwm */
93struct platform_device *__init mxs_add_mxs_pwm( 93struct platform_device *__init mxs_add_mxs_pwm(
94 resource_size_t iobase, int id); 94 resource_size_t iobase, int id);
95
96/* saif */
97struct mxs_saif_data {
98 int id;
99 resource_size_t iobase;
100 resource_size_t irq;
101 resource_size_t dma;
102 resource_size_t dmairq;
103};
104
105struct platform_device *__init mxs_add_saif(
106 const struct mxs_saif_data *data);
diff --git a/arch/arm/mach-mxs/mach-mx28evk.c b/arch/arm/mach-mxs/mach-mx28evk.c
index eaaf6ff28990..1e5fda94d96c 100644
--- a/arch/arm/mach-mxs/mach-mx28evk.c
+++ b/arch/arm/mach-mxs/mach-mx28evk.c
@@ -183,6 +183,18 @@ static const iomux_cfg_t mx28evk_pads[] __initconst = {
183 183
184 /* led */ 184 /* led */
185 MX28_PAD_AUART1_TX__GPIO_3_5 | MXS_PAD_CTRL, 185 MX28_PAD_AUART1_TX__GPIO_3_5 | MXS_PAD_CTRL,
186
187 /* saif0 & saif1 */
188 MX28_PAD_SAIF0_MCLK__SAIF0_MCLK |
189 (MXS_PAD_12MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
190 MX28_PAD_SAIF0_LRCLK__SAIF0_LRCLK |
191 (MXS_PAD_12MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
192 MX28_PAD_SAIF0_BITCLK__SAIF0_BITCLK |
193 (MXS_PAD_12MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
194 MX28_PAD_SAIF0_SDATA0__SAIF0_SDATA0 |
195 (MXS_PAD_12MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
196 MX28_PAD_SAIF1_SDATA0__SAIF1_SDATA0 |
197 (MXS_PAD_12MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
186}; 198};
187 199
188/* led */ 200/* led */
@@ -392,6 +404,9 @@ static void __init mx28evk_init(void)
392 404
393 mx28_add_mxsfb(&mx28evk_mxsfb_pdata); 405 mx28_add_mxsfb(&mx28evk_mxsfb_pdata);
394 406
407 mx28_add_saif(0);
408 mx28_add_saif(1);
409
395 /* power on mmc slot by writing 0 to the gpio */ 410 /* power on mmc slot by writing 0 to the gpio */
396 ret = gpio_request_one(MX28EVK_MMC0_SLOT_POWER, GPIOF_OUT_INIT_LOW, 411 ret = gpio_request_one(MX28EVK_MMC0_SLOT_POWER, GPIOF_OUT_INIT_LOW,
397 "mmc0-slot-power"); 412 "mmc0-slot-power");