2 * Copyright (C) 2009 Eric Benard - eric@eukrea.com
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)
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.
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,
23 #include <linux/i2c.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>
30 #include <asm/mach-types.h>
31 #include <asm/mach/arch.h>
32 #include <asm/mach/time.h>
33 #include <asm/mach/map.h>
35 #include <mach/board-eukrea_cpuimx27.h>
36 #include <mach/common.h>
37 #include <mach/hardware.h>
39 #include <mach/iomux.h>
40 #include <mach/imx-uart.h>
41 #include <mach/mxc_nand.h>
45 static int eukrea_cpuimx27_pins
[] = {
85 #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
87 GPIO_PORTD
| 22 | GPIO_GPIO
| GPIO_IN
,
88 GPIO_PORTD
| 23 | GPIO_GPIO
| GPIO_IN
,
89 GPIO_PORTD
| 27 | GPIO_GPIO
| GPIO_IN
,
90 GPIO_PORTD
| 30 | GPIO_GPIO
| GPIO_IN
,
94 static struct physmap_flash_data eukrea_cpuimx27_flash_data
= {
98 static struct resource eukrea_cpuimx27_flash_resource
= {
101 .flags
= IORESOURCE_MEM
,
104 static struct platform_device eukrea_cpuimx27_nor_mtd_device
= {
105 .name
= "physmap-flash",
108 .platform_data
= &eukrea_cpuimx27_flash_data
,
111 .resource
= &eukrea_cpuimx27_flash_resource
,
114 static struct imxuart_platform_data uart_pdata
[] = {
116 .flags
= IMXUART_HAVE_RTSCTS
,
118 .flags
= IMXUART_HAVE_RTSCTS
,
122 static struct mxc_nand_platform_data eukrea_cpuimx27_nand_board_info
= {
127 static struct platform_device
*platform_devices
[] __initdata
= {
128 &eukrea_cpuimx27_nor_mtd_device
,
132 static struct imxi2c_platform_data eukrea_cpuimx27_i2c_1_data
= {
136 static struct i2c_board_info eukrea_cpuimx27_i2c_devices
[] = {
138 I2C_BOARD_INFO("pcf8563", 0x51),
142 #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
143 static struct plat_serial8250_port serial_platform_data
[] = {
145 .mapbase
= (unsigned long)(CS3_BASE_ADDR
+ 0x200000),
146 .irq
= IRQ_GPIOB(23),
150 .flags
= UPF_BOOT_AUTOCONF
| UPF_SKIP_TEST
| UPF_IOREMAP
,
152 .mapbase
= (unsigned long)(CS3_BASE_ADDR
+ 0x400000),
153 .irq
= IRQ_GPIOB(22),
157 .flags
= UPF_BOOT_AUTOCONF
| UPF_SKIP_TEST
| UPF_IOREMAP
,
159 .mapbase
= (unsigned long)(CS3_BASE_ADDR
+ 0x800000),
160 .irq
= IRQ_GPIOB(27),
164 .flags
= UPF_BOOT_AUTOCONF
| UPF_SKIP_TEST
| UPF_IOREMAP
,
166 .mapbase
= (unsigned long)(CS3_BASE_ADDR
+ 0x1000000),
167 .irq
= IRQ_GPIOB(30),
171 .flags
= UPF_BOOT_AUTOCONF
| UPF_SKIP_TEST
| UPF_IOREMAP
,
176 static struct platform_device serial_device
= {
177 .name
= "serial8250",
180 .platform_data
= serial_platform_data
,
185 static void __init
eukrea_cpuimx27_init(void)
187 mxc_gpio_setup_multiple_pins(eukrea_cpuimx27_pins
,
188 ARRAY_SIZE(eukrea_cpuimx27_pins
), "CPUIMX27");
190 mxc_register_device(&mxc_uart_device0
, &uart_pdata
[0]);
192 mxc_register_device(&mxc_nand_device
, &eukrea_cpuimx27_nand_board_info
);
194 i2c_register_board_info(0, eukrea_cpuimx27_i2c_devices
,
195 ARRAY_SIZE(eukrea_cpuimx27_i2c_devices
));
197 mxc_register_device(&mxc_i2c_device0
, &eukrea_cpuimx27_i2c_1_data
);
199 platform_add_devices(platform_devices
, ARRAY_SIZE(platform_devices
));
201 #if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2)
202 /* SDHC2 can be used for Wifi */
203 mxc_register_device(&mxc_sdhc_device1
, NULL
);
204 /* in which case UART4 is also used for Bluetooth */
205 mxc_register_device(&mxc_uart_device3
, &uart_pdata
[1]);
208 #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
209 platform_device_register(&serial_device
);
212 #ifdef CONFIG_MACH_EUKREA_MBIMX27_BASEBOARD
213 eukrea_mbimx27_baseboard_init();
217 static void __init
eukrea_cpuimx27_timer_init(void)
219 mx27_clocks_init(26000000);
222 static struct sys_timer eukrea_cpuimx27_timer
= {
223 .init
= eukrea_cpuimx27_timer_init
,
226 MACHINE_START(CPUIMX27
, "EUKREA CPUIMX27")
227 .phys_io
= AIPI_BASE_ADDR
,
228 .io_pg_offst
= ((AIPI_BASE_ADDR_VIRT
) >> 18) & 0xfffc,
229 .boot_params
= PHYS_OFFSET
+ 0x100,
230 .map_io
= mx27_map_io
,
231 .init_irq
= mx27_init_irq
,
232 .init_machine
= eukrea_cpuimx27_init
,
233 .timer
= &eukrea_cpuimx27_timer
,