diff options
author | Ivo Clarysse <ivo.clarysse@gmail.com> | 2009-04-15 09:39:27 -0400 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2009-05-07 10:16:24 -0400 |
commit | 6b91edde09fadde2657b11b454b88ae89c5b4cae (patch) | |
tree | 9eca6ca9d3737b297a5a9b7c7efcaf7d4a6409f4 /arch/arm | |
parent | a8df0ee8d89dc1bdbec7415be620b159b5b0177b (diff) |
MXC: mx21ads base support
[PATCH v6] MXC: mx21ads base support
Base machine support for the Freescale i.MX21ADS
(M9328MX21ADSE) Application Development System.
Signed-off-by: Ivo Clarysse <ivo.clarysse@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-mx2/Kconfig | 7 | ||||
-rw-r--r-- | arch/arm/mach-mx2/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-mx2/mx21ads.c | 286 | ||||
-rw-r--r-- | arch/arm/plat-mxc/include/mach/board-mx21ads.h | 58 | ||||
-rw-r--r-- | arch/arm/plat-mxc/include/mach/debug-macro.S | 3 |
5 files changed, 355 insertions, 0 deletions
diff --git a/arch/arm/mach-mx2/Kconfig b/arch/arm/mach-mx2/Kconfig index 42a788842f49..7ce3712ab8ce 100644 --- a/arch/arm/mach-mx2/Kconfig +++ b/arch/arm/mach-mx2/Kconfig | |||
@@ -18,6 +18,13 @@ endchoice | |||
18 | 18 | ||
19 | comment "MX2 platforms:" | 19 | comment "MX2 platforms:" |
20 | 20 | ||
21 | config MACH_MX21ADS | ||
22 | bool "MX21ADS platform" | ||
23 | depends on MACH_MX21 | ||
24 | help | ||
25 | Include support for MX21ADS platform. This includes specific | ||
26 | configurations for the board and its peripherals. | ||
27 | |||
21 | config MACH_MX27ADS | 28 | config MACH_MX27ADS |
22 | bool "MX27ADS platform" | 29 | bool "MX27ADS platform" |
23 | depends on MACH_MX27 | 30 | depends on MACH_MX27 |
diff --git a/arch/arm/mach-mx2/Makefile b/arch/arm/mach-mx2/Makefile index 950649a91540..e583754febad 100644 --- a/arch/arm/mach-mx2/Makefile +++ b/arch/arm/mach-mx2/Makefile | |||
@@ -11,6 +11,7 @@ obj-$(CONFIG_MACH_MX21) += clock_imx21.o | |||
11 | obj-$(CONFIG_MACH_MX27) += cpu_imx27.o | 11 | obj-$(CONFIG_MACH_MX27) += cpu_imx27.o |
12 | obj-$(CONFIG_MACH_MX27) += clock_imx27.o | 12 | obj-$(CONFIG_MACH_MX27) += clock_imx27.o |
13 | 13 | ||
14 | obj-$(CONFIG_MACH_MX21ADS) += mx21ads.o | ||
14 | obj-$(CONFIG_MACH_MX27ADS) += mx27ads.o | 15 | obj-$(CONFIG_MACH_MX27ADS) += mx27ads.o |
15 | obj-$(CONFIG_MACH_PCM038) += pcm038.o | 16 | obj-$(CONFIG_MACH_PCM038) += pcm038.o |
16 | obj-$(CONFIG_MACH_PCM970_BASEBOARD) += pcm970-baseboard.o | 17 | obj-$(CONFIG_MACH_PCM970_BASEBOARD) += pcm970-baseboard.o |
diff --git a/arch/arm/mach-mx2/mx21ads.c b/arch/arm/mach-mx2/mx21ads.c new file mode 100644 index 000000000000..a5ee461cb405 --- /dev/null +++ b/arch/arm/mach-mx2/mx21ads.c | |||
@@ -0,0 +1,286 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000 Deep Blue Solutions Ltd | ||
3 | * Copyright (C) 2002 Shane Nay (shane@minirl.com) | ||
4 | * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | #include <linux/platform_device.h> | ||
22 | #include <linux/mtd/mtd.h> | ||
23 | #include <linux/mtd/physmap.h> | ||
24 | #include <linux/gpio.h> | ||
25 | #include <mach/common.h> | ||
26 | #include <mach/hardware.h> | ||
27 | #include <asm/mach-types.h> | ||
28 | #include <asm/mach/arch.h> | ||
29 | #include <asm/mach/time.h> | ||
30 | #include <asm/mach/map.h> | ||
31 | #include <mach/imx-uart.h> | ||
32 | #include <mach/imxfb.h> | ||
33 | #include <mach/iomux.h> | ||
34 | #include <mach/mxc_nand.h> | ||
35 | #include <mach/mmc.h> | ||
36 | #include <mach/board-mx21ads.h> | ||
37 | |||
38 | #include "devices.h" | ||
39 | |||
40 | static unsigned int mx21ads_pins[] = { | ||
41 | |||
42 | /* CS8900A */ | ||
43 | (GPIO_PORTE | GPIO_GPIO | GPIO_IN | 11), | ||
44 | |||
45 | /* UART1 */ | ||
46 | PE12_PF_UART1_TXD, | ||
47 | PE13_PF_UART1_RXD, | ||
48 | PE14_PF_UART1_CTS, | ||
49 | PE15_PF_UART1_RTS, | ||
50 | |||
51 | /* UART3 (IrDA) - only TXD and RXD */ | ||
52 | PE8_PF_UART3_TXD, | ||
53 | PE9_PF_UART3_RXD, | ||
54 | |||
55 | /* UART4 */ | ||
56 | PB26_AF_UART4_RTS, | ||
57 | PB28_AF_UART4_TXD, | ||
58 | PB29_AF_UART4_CTS, | ||
59 | PB31_AF_UART4_RXD, | ||
60 | |||
61 | /* LCDC */ | ||
62 | PA5_PF_LSCLK, | ||
63 | PA6_PF_LD0, | ||
64 | PA7_PF_LD1, | ||
65 | PA8_PF_LD2, | ||
66 | PA9_PF_LD3, | ||
67 | PA10_PF_LD4, | ||
68 | PA11_PF_LD5, | ||
69 | PA12_PF_LD6, | ||
70 | PA13_PF_LD7, | ||
71 | PA14_PF_LD8, | ||
72 | PA15_PF_LD9, | ||
73 | PA16_PF_LD10, | ||
74 | PA17_PF_LD11, | ||
75 | PA18_PF_LD12, | ||
76 | PA19_PF_LD13, | ||
77 | PA20_PF_LD14, | ||
78 | PA21_PF_LD15, | ||
79 | PA22_PF_LD16, | ||
80 | PA24_PF_REV, /* Sharp panel dedicated signal */ | ||
81 | PA25_PF_CLS, /* Sharp panel dedicated signal */ | ||
82 | PA26_PF_PS, /* Sharp panel dedicated signal */ | ||
83 | PA27_PF_SPL_SPR, /* Sharp panel dedicated signal */ | ||
84 | PA28_PF_HSYNC, | ||
85 | PA29_PF_VSYNC, | ||
86 | PA30_PF_CONTRAST, | ||
87 | PA31_PF_OE_ACD, | ||
88 | |||
89 | /* MMC/SDHC */ | ||
90 | PE18_PF_SD1_D0, | ||
91 | PE19_PF_SD1_D1, | ||
92 | PE20_PF_SD1_D2, | ||
93 | PE21_PF_SD1_D3, | ||
94 | PE22_PF_SD1_CMD, | ||
95 | PE23_PF_SD1_CLK, | ||
96 | |||
97 | /* NFC */ | ||
98 | PF0_PF_NRFB, | ||
99 | PF1_PF_NFCE, | ||
100 | PF2_PF_NFWP, | ||
101 | PF3_PF_NFCLE, | ||
102 | PF4_PF_NFALE, | ||
103 | PF5_PF_NFRE, | ||
104 | PF6_PF_NFWE, | ||
105 | PF7_PF_NFIO0, | ||
106 | PF8_PF_NFIO1, | ||
107 | PF9_PF_NFIO2, | ||
108 | PF10_PF_NFIO3, | ||
109 | PF11_PF_NFIO4, | ||
110 | PF12_PF_NFIO5, | ||
111 | PF13_PF_NFIO6, | ||
112 | PF14_PF_NFIO7, | ||
113 | }; | ||
114 | |||
115 | /* ADS's NOR flash: 2x AM29BDS128HE9VKI on 32-bit bus */ | ||
116 | static struct physmap_flash_data mx21ads_flash_data = { | ||
117 | .width = 4, | ||
118 | }; | ||
119 | |||
120 | static struct resource mx21ads_flash_resource = { | ||
121 | .start = CS0_BASE_ADDR, | ||
122 | .end = CS0_BASE_ADDR + 0x02000000 - 1, | ||
123 | .flags = IORESOURCE_MEM, | ||
124 | }; | ||
125 | |||
126 | static struct platform_device mx21ads_nor_mtd_device = { | ||
127 | .name = "physmap-flash", | ||
128 | .id = 0, | ||
129 | .dev = { | ||
130 | .platform_data = &mx21ads_flash_data, | ||
131 | }, | ||
132 | .num_resources = 1, | ||
133 | .resource = &mx21ads_flash_resource, | ||
134 | }; | ||
135 | |||
136 | static struct imxuart_platform_data uart_pdata = { | ||
137 | .flags = IMXUART_HAVE_RTSCTS, | ||
138 | }; | ||
139 | |||
140 | static struct imxuart_platform_data uart_norts_pdata = { | ||
141 | }; | ||
142 | |||
143 | |||
144 | static int mx21ads_fb_init(struct platform_device *pdev) | ||
145 | { | ||
146 | u16 tmp; | ||
147 | |||
148 | tmp = __raw_readw(MX21ADS_IO_REG); | ||
149 | tmp |= MX21ADS_IO_LCDON; | ||
150 | __raw_writew(tmp, MX21ADS_IO_REG); | ||
151 | return 0; | ||
152 | } | ||
153 | |||
154 | static void mx21ads_fb_exit(struct platform_device *pdev) | ||
155 | { | ||
156 | u16 tmp; | ||
157 | |||
158 | tmp = __raw_readw(MX21ADS_IO_REG); | ||
159 | tmp &= ~MX21ADS_IO_LCDON; | ||
160 | __raw_writew(tmp, MX21ADS_IO_REG); | ||
161 | } | ||
162 | |||
163 | /* | ||
164 | * Connected is a portrait Sharp-QVGA display | ||
165 | * of type: LQ035Q7DB02 | ||
166 | */ | ||
167 | static struct imx_fb_platform_data mx21ads_fb_data = { | ||
168 | .pixclock = 188679, /* in ps */ | ||
169 | .xres = 240, | ||
170 | .yres = 320, | ||
171 | |||
172 | .bpp = 16, | ||
173 | .hsync_len = 2, | ||
174 | .left_margin = 6, | ||
175 | .right_margin = 16, | ||
176 | |||
177 | .vsync_len = 1, | ||
178 | .upper_margin = 8, | ||
179 | .lower_margin = 10, | ||
180 | .fixed_screen_cpu = 0, | ||
181 | |||
182 | .pcr = 0xFB108BC7, | ||
183 | .pwmr = 0x00A901ff, | ||
184 | .lscr1 = 0x00120300, | ||
185 | .dmacr = 0x00020008, | ||
186 | |||
187 | .init = mx21ads_fb_init, | ||
188 | .exit = mx21ads_fb_exit, | ||
189 | }; | ||
190 | |||
191 | static int mx21ads_sdhc_get_ro(struct device *dev) | ||
192 | { | ||
193 | return (__raw_readw(MX21ADS_IO_REG) & MX21ADS_IO_SD_WP) ? 1 : 0; | ||
194 | } | ||
195 | |||
196 | static int mx21ads_sdhc_init(struct device *dev, irq_handler_t detect_irq, | ||
197 | void *data) | ||
198 | { | ||
199 | int ret; | ||
200 | |||
201 | ret = request_irq(IRQ_GPIOD(25), detect_irq, | ||
202 | IRQF_TRIGGER_FALLING, "mmc-detect", data); | ||
203 | if (ret) | ||
204 | goto out; | ||
205 | return 0; | ||
206 | out: | ||
207 | return ret; | ||
208 | } | ||
209 | |||
210 | static void mx21ads_sdhc_exit(struct device *dev, void *data) | ||
211 | { | ||
212 | free_irq(IRQ_GPIOD(25), data); | ||
213 | } | ||
214 | |||
215 | static struct imxmmc_platform_data mx21ads_sdhc_pdata = { | ||
216 | .ocr_avail = MMC_VDD_29_30 | MMC_VDD_30_31, /* 3.0V */ | ||
217 | .get_ro = mx21ads_sdhc_get_ro, | ||
218 | .init = mx21ads_sdhc_init, | ||
219 | .exit = mx21ads_sdhc_exit, | ||
220 | }; | ||
221 | |||
222 | static struct mxc_nand_platform_data mx21ads_nand_board_info = { | ||
223 | .width = 1, | ||
224 | .hw_ecc = 1, | ||
225 | }; | ||
226 | |||
227 | static struct map_desc mx21ads_io_desc[] __initdata = { | ||
228 | /* | ||
229 | * Memory-mapped I/O on MX21ADS Base board: | ||
230 | * - CS8900A Ethernet controller | ||
231 | * - ST16C2552CJ UART | ||
232 | * - CPU and Base board version | ||
233 | * - Base board I/O register | ||
234 | */ | ||
235 | { | ||
236 | .virtual = MX21ADS_MMIO_BASE_ADDR, | ||
237 | .pfn = __phys_to_pfn(CS1_BASE_ADDR), | ||
238 | .length = MX21ADS_MMIO_SIZE, | ||
239 | .type = MT_DEVICE, | ||
240 | }, | ||
241 | }; | ||
242 | |||
243 | static void __init mx21ads_map_io(void) | ||
244 | { | ||
245 | mx21_map_io(); | ||
246 | iotable_init(mx21ads_io_desc, ARRAY_SIZE(mx21ads_io_desc)); | ||
247 | } | ||
248 | |||
249 | static struct platform_device *platform_devices[] __initdata = { | ||
250 | &mx21ads_nor_mtd_device, | ||
251 | }; | ||
252 | |||
253 | static void __init mx21ads_board_init(void) | ||
254 | { | ||
255 | mxc_gpio_setup_multiple_pins(mx21ads_pins, ARRAY_SIZE(mx21ads_pins), | ||
256 | "mx21ads"); | ||
257 | |||
258 | mxc_register_device(&mxc_uart_device0, &uart_pdata); | ||
259 | mxc_register_device(&mxc_uart_device2, &uart_norts_pdata); | ||
260 | mxc_register_device(&mxc_uart_device3, &uart_pdata); | ||
261 | mxc_register_device(&mxc_fb_device, &mx21ads_fb_data); | ||
262 | mxc_register_device(&mxc_sdhc_device0, &mx21ads_sdhc_pdata); | ||
263 | mxc_register_device(&mxc_nand_device, &mx21ads_nand_board_info); | ||
264 | |||
265 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); | ||
266 | } | ||
267 | |||
268 | static void __init mx21ads_timer_init(void) | ||
269 | { | ||
270 | mx21_clocks_init(32768, 26000000); | ||
271 | } | ||
272 | |||
273 | static struct sys_timer mx21ads_timer = { | ||
274 | .init = mx21ads_timer_init, | ||
275 | }; | ||
276 | |||
277 | MACHINE_START(MX21ADS, "Freescale i.MX21ADS") | ||
278 | /* maintainer: Freescale Semiconductor, Inc. */ | ||
279 | .phys_io = AIPI_BASE_ADDR, | ||
280 | .io_pg_offst = ((AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc, | ||
281 | .boot_params = PHYS_OFFSET + 0x100, | ||
282 | .map_io = mx21ads_map_io, | ||
283 | .init_irq = mxc_init_irq, | ||
284 | .init_machine = mx21ads_board_init, | ||
285 | .timer = &mx21ads_timer, | ||
286 | MACHINE_END | ||
diff --git a/arch/arm/plat-mxc/include/mach/board-mx21ads.h b/arch/arm/plat-mxc/include/mach/board-mx21ads.h new file mode 100644 index 000000000000..06701df74c42 --- /dev/null +++ b/arch/arm/plat-mxc/include/mach/board-mx21ads.h | |||
@@ -0,0 +1,58 @@ | |||
1 | /* | ||
2 | * Copyright 2005-2007 Freescale Semiconductor, Inc. All Rights Reserved. | ||
3 | */ | ||
4 | |||
5 | /* | ||
6 | * The code contained herein is licensed under the GNU General Public | ||
7 | * License. You may obtain a copy of the GNU General Public License | ||
8 | * Version 2 or later at the following locations: | ||
9 | * | ||
10 | * http://www.opensource.org/licenses/gpl-license.html | ||
11 | * http://www.gnu.org/copyleft/gpl.html | ||
12 | */ | ||
13 | |||
14 | #ifndef __ASM_ARCH_MXC_BOARD_MX21ADS_H__ | ||
15 | #define __ASM_ARCH_MXC_BOARD_MX21ADS_H__ | ||
16 | |||
17 | /* | ||
18 | * MXC UART EVB board level configurations | ||
19 | */ | ||
20 | #define MXC_LL_UART_PADDR UART1_BASE_ADDR | ||
21 | #define MXC_LL_UART_VADDR AIPI_IO_ADDRESS(UART1_BASE_ADDR) | ||
22 | |||
23 | /* | ||
24 | * Memory-mapped I/O on MX21ADS base board | ||
25 | */ | ||
26 | #define MX21ADS_MMIO_BASE_ADDR 0xF5000000 | ||
27 | #define MX21ADS_MMIO_SIZE SZ_16M | ||
28 | |||
29 | #define MX21ADS_REG_ADDR(offset) (void __force __iomem *) \ | ||
30 | (MX21ADS_MMIO_BASE_ADDR + (offset)) | ||
31 | |||
32 | #define MX21ADS_CS8900A_IRQ IRQ_GPIOE(11) | ||
33 | #define MX21ADS_CS8900A_IOBASE_REG MX21ADS_REG_ADDR(0x000000) | ||
34 | #define MX21ADS_ST16C255_IOBASE_REG MX21ADS_REG_ADDR(0x200000) | ||
35 | #define MX21ADS_VERSION_REG MX21ADS_REG_ADDR(0x400000) | ||
36 | #define MX21ADS_IO_REG MX21ADS_REG_ADDR(0x800000) | ||
37 | |||
38 | /* MX21ADS_IO_REG bit definitions */ | ||
39 | #define MX21ADS_IO_SD_WP 0x0001 /* read */ | ||
40 | #define MX21ADS_IO_TP6 0x0001 /* write */ | ||
41 | #define MX21ADS_IO_SW_SEL 0x0002 /* read */ | ||
42 | #define MX21ADS_IO_TP7 0x0002 /* write */ | ||
43 | #define MX21ADS_IO_RESET_E_UART 0x0004 | ||
44 | #define MX21ADS_IO_RESET_BASE 0x0008 | ||
45 | #define MX21ADS_IO_CSI_CTL2 0x0010 | ||
46 | #define MX21ADS_IO_CSI_CTL1 0x0020 | ||
47 | #define MX21ADS_IO_CSI_CTL0 0x0040 | ||
48 | #define MX21ADS_IO_UART1_EN 0x0080 | ||
49 | #define MX21ADS_IO_UART4_EN 0x0100 | ||
50 | #define MX21ADS_IO_LCDON 0x0200 | ||
51 | #define MX21ADS_IO_IRDA_EN 0x0400 | ||
52 | #define MX21ADS_IO_IRDA_FIR_SEL 0x0800 | ||
53 | #define MX21ADS_IO_IRDA_MD0_B 0x1000 | ||
54 | #define MX21ADS_IO_IRDA_MD1 0x2000 | ||
55 | #define MX21ADS_IO_LED4_ON 0x4000 | ||
56 | #define MX21ADS_IO_LED3_ON 0x8000 | ||
57 | |||
58 | #endif /* __ASM_ARCH_MXC_BOARD_MX21ADS_H__ */ | ||
diff --git a/arch/arm/plat-mxc/include/mach/debug-macro.S b/arch/arm/plat-mxc/include/mach/debug-macro.S index 4e7c8d2ad029..cc7e89d42874 100644 --- a/arch/arm/plat-mxc/include/mach/debug-macro.S +++ b/arch/arm/plat-mxc/include/mach/debug-macro.S | |||
@@ -25,6 +25,9 @@ | |||
25 | #ifdef CONFIG_MACH_MX27ADS | 25 | #ifdef CONFIG_MACH_MX27ADS |
26 | #include <mach/board-mx27ads.h> | 26 | #include <mach/board-mx27ads.h> |
27 | #endif | 27 | #endif |
28 | #ifdef CONFIG_MACH_MX21ADS | ||
29 | #include <mach/board-mx21ads.h> | ||
30 | #endif | ||
28 | #ifdef CONFIG_MACH_PCM038 | 31 | #ifdef CONFIG_MACH_PCM038 |
29 | #include <mach/board-pcm038.h> | 32 | #include <mach/board-pcm038.h> |
30 | #endif | 33 | #endif |