Commit | Line | Data |
---|---|---|
af5b1df7 EB |
1 | /* |
2 | * Copyright (C) 2009 Eric Benard - eric@eukrea.com | |
3 | * | |
4 | * Based on pcm038.c which is : | |
5 | * Copyright 2007 Robert Schwebel <r.schwebel@pengutronix.de>, Pengutronix | |
6 | * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de) | |
7 | * | |
8 | * This program is free software; you can redistribute it and/or | |
9 | * modify it under the terms of the GNU General Public License | |
10 | * as published by the Free Software Foundation; either version 2 | |
11 | * of the License, or (at your option) any later version. | |
12 | * This program is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | * GNU General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public License | |
18 | * along with this program; if not, write to the Free Software | |
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
20 | * MA 02110-1301, USA. | |
21 | */ | |
22 | ||
23 | #include <linux/i2c.h> | |
24 | #include <linux/io.h> | |
25 | #include <linux/mtd/plat-ram.h> | |
26 | #include <linux/mtd/physmap.h> | |
27 | #include <linux/platform_device.h> | |
28 | #include <linux/serial_8250.h> | |
29 | ||
30 | #include <asm/mach-types.h> | |
31 | #include <asm/mach/arch.h> | |
32 | #include <asm/mach/time.h> | |
33 | #include <asm/mach/map.h> | |
34 | ||
35 | #include <mach/board-eukrea_cpuimx27.h> | |
36 | #include <mach/common.h> | |
37 | #include <mach/hardware.h> | |
38 | #include <mach/i2c.h> | |
e835d88e | 39 | #include <mach/iomux-mx27.h> |
af5b1df7 EB |
40 | #include <mach/imx-uart.h> |
41 | #include <mach/mxc_nand.h> | |
42 | ||
0e7a29a8 | 43 | #include "devices-imx27.h" |
af5b1df7 EB |
44 | #include "devices.h" |
45 | ||
46 | static int eukrea_cpuimx27_pins[] = { | |
47 | /* UART1 */ | |
48 | PE12_PF_UART1_TXD, | |
49 | PE13_PF_UART1_RXD, | |
50 | PE14_PF_UART1_CTS, | |
51 | PE15_PF_UART1_RTS, | |
52 | /* UART4 */ | |
53 | PB26_AF_UART4_RTS, | |
54 | PB28_AF_UART4_TXD, | |
55 | PB29_AF_UART4_CTS, | |
56 | PB31_AF_UART4_RXD, | |
57 | /* FEC */ | |
58 | PD0_AIN_FEC_TXD0, | |
59 | PD1_AIN_FEC_TXD1, | |
60 | PD2_AIN_FEC_TXD2, | |
61 | PD3_AIN_FEC_TXD3, | |
62 | PD4_AOUT_FEC_RX_ER, | |
63 | PD5_AOUT_FEC_RXD1, | |
64 | PD6_AOUT_FEC_RXD2, | |
65 | PD7_AOUT_FEC_RXD3, | |
66 | PD8_AF_FEC_MDIO, | |
67 | PD9_AIN_FEC_MDC, | |
68 | PD10_AOUT_FEC_CRS, | |
69 | PD11_AOUT_FEC_TX_CLK, | |
70 | PD12_AOUT_FEC_RXD0, | |
71 | PD13_AOUT_FEC_RX_DV, | |
72 | PD14_AOUT_FEC_RX_CLK, | |
73 | PD15_AOUT_FEC_COL, | |
74 | PD16_AIN_FEC_TX_ER, | |
75 | PF23_AIN_FEC_TX_EN, | |
76 | /* I2C1 */ | |
77 | PD17_PF_I2C_DATA, | |
78 | PD18_PF_I2C_CLK, | |
79 | /* SDHC2 */ | |
80 | PB4_PF_SD2_D0, | |
81 | PB5_PF_SD2_D1, | |
82 | PB6_PF_SD2_D2, | |
83 | PB7_PF_SD2_D3, | |
84 | PB8_PF_SD2_CMD, | |
85 | PB9_PF_SD2_CLK, | |
86 | #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE) | |
87 | /* Quad UART's IRQ */ | |
88 | GPIO_PORTD | 22 | GPIO_GPIO | GPIO_IN, | |
89 | GPIO_PORTD | 23 | GPIO_GPIO | GPIO_IN, | |
90 | GPIO_PORTD | 27 | GPIO_GPIO | GPIO_IN, | |
91 | GPIO_PORTD | 30 | GPIO_GPIO | GPIO_IN, | |
92 | #endif | |
93 | }; | |
94 | ||
95 | static struct physmap_flash_data eukrea_cpuimx27_flash_data = { | |
96 | .width = 2, | |
97 | }; | |
98 | ||
99 | static struct resource eukrea_cpuimx27_flash_resource = { | |
100 | .start = 0xc0000000, | |
101 | .end = 0xc3ffffff, | |
102 | .flags = IORESOURCE_MEM, | |
103 | }; | |
104 | ||
105 | static struct platform_device eukrea_cpuimx27_nor_mtd_device = { | |
106 | .name = "physmap-flash", | |
107 | .id = 0, | |
108 | .dev = { | |
109 | .platform_data = &eukrea_cpuimx27_flash_data, | |
110 | }, | |
111 | .num_resources = 1, | |
112 | .resource = &eukrea_cpuimx27_flash_resource, | |
113 | }; | |
114 | ||
115 | static struct imxuart_platform_data uart_pdata[] = { | |
116 | { | |
117 | .flags = IMXUART_HAVE_RTSCTS, | |
118 | }, { | |
119 | .flags = IMXUART_HAVE_RTSCTS, | |
120 | }, | |
121 | }; | |
122 | ||
0e7a29a8 UKK |
123 | static const struct mxc_nand_platform_data |
124 | cpuimx27_nand_board_info __initconst = { | |
af5b1df7 EB |
125 | .width = 1, |
126 | .hw_ecc = 1, | |
127 | }; | |
128 | ||
129 | static struct platform_device *platform_devices[] __initdata = { | |
130 | &eukrea_cpuimx27_nor_mtd_device, | |
131 | &mxc_fec_device, | |
132 | }; | |
133 | ||
134 | static struct imxi2c_platform_data eukrea_cpuimx27_i2c_1_data = { | |
135 | .bitrate = 100000, | |
136 | }; | |
137 | ||
138 | static struct i2c_board_info eukrea_cpuimx27_i2c_devices[] = { | |
139 | { | |
cf87a6e2 | 140 | I2C_BOARD_INFO("pcf8563", 0x51), |
af5b1df7 EB |
141 | }, |
142 | }; | |
143 | ||
144 | #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE) | |
145 | static struct plat_serial8250_port serial_platform_data[] = { | |
146 | { | |
3f35d1f5 | 147 | .mapbase = (unsigned long)(MX27_CS3_BASE_ADDR + 0x200000), |
af5b1df7 EB |
148 | .irq = IRQ_GPIOB(23), |
149 | .uartclk = 14745600, | |
150 | .regshift = 1, | |
151 | .iotype = UPIO_MEM, | |
152 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP, | |
153 | }, { | |
3f35d1f5 | 154 | .mapbase = (unsigned long)(MX27_CS3_BASE_ADDR + 0x400000), |
af5b1df7 EB |
155 | .irq = IRQ_GPIOB(22), |
156 | .uartclk = 14745600, | |
157 | .regshift = 1, | |
158 | .iotype = UPIO_MEM, | |
159 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP, | |
160 | }, { | |
3f35d1f5 | 161 | .mapbase = (unsigned long)(MX27_CS3_BASE_ADDR + 0x800000), |
af5b1df7 EB |
162 | .irq = IRQ_GPIOB(27), |
163 | .uartclk = 14745600, | |
164 | .regshift = 1, | |
165 | .iotype = UPIO_MEM, | |
166 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP, | |
167 | }, { | |
3f35d1f5 | 168 | .mapbase = (unsigned long)(MX27_CS3_BASE_ADDR + 0x1000000), |
af5b1df7 EB |
169 | .irq = IRQ_GPIOB(30), |
170 | .uartclk = 14745600, | |
171 | .regshift = 1, | |
172 | .iotype = UPIO_MEM, | |
173 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP, | |
174 | }, { | |
175 | } | |
176 | }; | |
177 | ||
178 | static struct platform_device serial_device = { | |
179 | .name = "serial8250", | |
180 | .id = 0, | |
181 | .dev = { | |
182 | .platform_data = serial_platform_data, | |
183 | }, | |
184 | }; | |
185 | #endif | |
186 | ||
187 | static void __init eukrea_cpuimx27_init(void) | |
188 | { | |
189 | mxc_gpio_setup_multiple_pins(eukrea_cpuimx27_pins, | |
190 | ARRAY_SIZE(eukrea_cpuimx27_pins), "CPUIMX27"); | |
191 | ||
551823e7 | 192 | mxc_register_device(&imx2x_uart_device0, &uart_pdata[0]); |
af5b1df7 | 193 | |
0e7a29a8 | 194 | imx27_add_mxc_nand(&cpuimx27_nand_board_info); |
af5b1df7 EB |
195 | |
196 | i2c_register_board_info(0, eukrea_cpuimx27_i2c_devices, | |
197 | ARRAY_SIZE(eukrea_cpuimx27_i2c_devices)); | |
198 | ||
199 | mxc_register_device(&mxc_i2c_device0, &eukrea_cpuimx27_i2c_1_data); | |
200 | ||
201 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); | |
202 | ||
203 | #if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2) | |
204 | /* SDHC2 can be used for Wifi */ | |
205 | mxc_register_device(&mxc_sdhc_device1, NULL); | |
206 | /* in which case UART4 is also used for Bluetooth */ | |
551823e7 | 207 | mxc_register_device(&imx2x_uart_device3, &uart_pdata[1]); |
af5b1df7 EB |
208 | #endif |
209 | ||
210 | #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE) | |
211 | platform_device_register(&serial_device); | |
212 | #endif | |
213 | ||
214 | #ifdef CONFIG_MACH_EUKREA_MBIMX27_BASEBOARD | |
215 | eukrea_mbimx27_baseboard_init(); | |
216 | #endif | |
217 | } | |
218 | ||
219 | static void __init eukrea_cpuimx27_timer_init(void) | |
220 | { | |
221 | mx27_clocks_init(26000000); | |
222 | } | |
223 | ||
224 | static struct sys_timer eukrea_cpuimx27_timer = { | |
225 | .init = eukrea_cpuimx27_timer_init, | |
226 | }; | |
227 | ||
228 | MACHINE_START(CPUIMX27, "EUKREA CPUIMX27") | |
3f35d1f5 UKK |
229 | .phys_io = MX27_AIPI_BASE_ADDR, |
230 | .io_pg_offst = ((MX27_AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc, | |
34101237 | 231 | .boot_params = MX27_PHYS_OFFSET + 0x100, |
af5b1df7 EB |
232 | .map_io = mx27_map_io, |
233 | .init_irq = mx27_init_irq, | |
234 | .init_machine = eukrea_cpuimx27_init, | |
235 | .timer = &eukrea_cpuimx27_timer, | |
236 | MACHINE_END |