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>
38 #include <mach/iomux-mx27.h>
39 #include <mach/mxc_nand.h>
41 #include "devices-imx27.h"
44 static int eukrea_cpuimx27_pins[] = {
84 #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
86 GPIO_PORTD | 22 | GPIO_GPIO | GPIO_IN,
87 GPIO_PORTD | 23 | GPIO_GPIO | GPIO_IN,
88 GPIO_PORTD | 27 | GPIO_GPIO | GPIO_IN,
89 GPIO_PORTD | 30 | GPIO_GPIO | GPIO_IN,
93 static struct physmap_flash_data eukrea_cpuimx27_flash_data = {
97 static struct resource eukrea_cpuimx27_flash_resource = {
100 .flags = IORESOURCE_MEM,
103 static struct platform_device eukrea_cpuimx27_nor_mtd_device = {
104 .name = "physmap-flash",
107 .platform_data = &eukrea_cpuimx27_flash_data,
110 .resource = &eukrea_cpuimx27_flash_resource,
113 static const struct imxuart_platform_data uart_pdata __initconst = {
114 .flags = IMXUART_HAVE_RTSCTS,
117 static const struct mxc_nand_platform_data
118 cpuimx27_nand_board_info __initconst = {
123 static struct platform_device *platform_devices[] __initdata = {
124 &eukrea_cpuimx27_nor_mtd_device,
128 static const struct imxi2c_platform_data cpuimx27_i2c1_data __initconst = {
132 static struct i2c_board_info eukrea_cpuimx27_i2c_devices[] = {
134 I2C_BOARD_INFO("pcf8563", 0x51),
138 #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
139 static struct plat_serial8250_port serial_platform_data[] = {
141 .mapbase = (unsigned long)(MX27_CS3_BASE_ADDR + 0x200000),
142 .irq = IRQ_GPIOB(23),
146 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
148 .mapbase = (unsigned long)(MX27_CS3_BASE_ADDR + 0x400000),
149 .irq = IRQ_GPIOB(22),
153 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
155 .mapbase = (unsigned long)(MX27_CS3_BASE_ADDR + 0x800000),
156 .irq = IRQ_GPIOB(27),
160 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
162 .mapbase = (unsigned long)(MX27_CS3_BASE_ADDR + 0x1000000),
163 .irq = IRQ_GPIOB(30),
167 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
172 static struct platform_device serial_device = {
173 .name = "serial8250",
176 .platform_data = serial_platform_data,
181 static void __init eukrea_cpuimx27_init(void)
183 mxc_gpio_setup_multiple_pins(eukrea_cpuimx27_pins,
184 ARRAY_SIZE(eukrea_cpuimx27_pins), "CPUIMX27");
186 imx27_add_imx_uart0(&uart_pdata);
188 imx27_add_mxc_nand(&cpuimx27_nand_board_info);
190 i2c_register_board_info(0, eukrea_cpuimx27_i2c_devices,
191 ARRAY_SIZE(eukrea_cpuimx27_i2c_devices));
193 imx27_add_i2c_imx1(&cpuimx27_i2c1_data);
195 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
197 #if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2)
198 /* SDHC2 can be used for Wifi */
199 mxc_register_device(&mxc_sdhc_device1, NULL);
200 /* in which case UART4 is also used for Bluetooth */
201 imx27_add_imx_uart3(&uart_pdata);
204 #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
205 platform_device_register(&serial_device);
208 #ifdef CONFIG_MACH_EUKREA_MBIMX27_BASEBOARD
209 eukrea_mbimx27_baseboard_init();
213 static void __init eukrea_cpuimx27_timer_init(void)
215 mx27_clocks_init(26000000);
218 static struct sys_timer eukrea_cpuimx27_timer = {
219 .init = eukrea_cpuimx27_timer_init,
222 MACHINE_START(CPUIMX27, "EUKREA CPUIMX27")
223 .phys_io = MX27_AIPI_BASE_ADDR,
224 .io_pg_offst = ((MX27_AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc,
225 .boot_params = MX27_PHYS_OFFSET + 0x100,
226 .map_io = mx27_map_io,
227 .init_irq = mx27_init_irq,
228 .init_machine = eukrea_cpuimx27_init,
229 .timer = &eukrea_cpuimx27_timer,