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>
29 #include <linux/usb/otg.h>
30 #include <linux/usb/ulpi.h>
32 #include <asm/mach-types.h>
33 #include <asm/mach/arch.h>
34 #include <asm/mach/time.h>
35 #include <asm/mach/map.h>
37 #include <mach/eukrea-baseboards.h>
38 #include <mach/common.h>
39 #include <mach/hardware.h>
40 #include <mach/iomux-mx27.h>
41 #include <mach/mxc_nand.h>
42 #include <mach/ulpi.h>
44 #include "devices-imx27.h"
47 static const int eukrea_cpuimx27_pins
[] __initconst
= {
54 #if defined(MACH_EUKREA_CPUIMX27_USEUART4)
83 #if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2)
91 #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
93 GPIO_PORTB
| 22 | GPIO_GPIO
| GPIO_IN
,
94 GPIO_PORTB
| 23 | GPIO_GPIO
| GPIO_IN
,
95 GPIO_PORTB
| 27 | GPIO_GPIO
| GPIO_IN
,
96 GPIO_PORTB
| 30 | GPIO_GPIO
| GPIO_IN
,
102 PC10_PF_USBOTG_DATA2
,
103 PC11_PF_USBOTG_DATA1
,
104 PC12_PF_USBOTG_DATA4
,
105 PC13_PF_USBOTG_DATA3
,
110 PE25_PF_USBOTG_DATA7
,
126 static struct physmap_flash_data eukrea_cpuimx27_flash_data
= {
130 static struct resource eukrea_cpuimx27_flash_resource
= {
133 .flags
= IORESOURCE_MEM
,
136 static struct platform_device eukrea_cpuimx27_nor_mtd_device
= {
137 .name
= "physmap-flash",
140 .platform_data
= &eukrea_cpuimx27_flash_data
,
143 .resource
= &eukrea_cpuimx27_flash_resource
,
146 static const struct imxuart_platform_data uart_pdata __initconst
= {
147 .flags
= IMXUART_HAVE_RTSCTS
,
150 static const struct mxc_nand_platform_data
151 cpuimx27_nand_board_info __initconst
= {
156 static struct platform_device
*platform_devices
[] __initdata
= {
157 &eukrea_cpuimx27_nor_mtd_device
,
160 static const struct imxi2c_platform_data cpuimx27_i2c1_data __initconst
= {
164 static struct i2c_board_info eukrea_cpuimx27_i2c_devices
[] = {
166 I2C_BOARD_INFO("pcf8563", 0x51),
170 #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
171 static struct plat_serial8250_port serial_platform_data
[] = {
173 .mapbase
= (unsigned long)(MX27_CS3_BASE_ADDR
+ 0x200000),
174 .irq
= IRQ_GPIOB(23),
178 .flags
= UPF_BOOT_AUTOCONF
| UPF_SKIP_TEST
| UPF_IOREMAP
,
180 .mapbase
= (unsigned long)(MX27_CS3_BASE_ADDR
+ 0x400000),
181 .irq
= IRQ_GPIOB(22),
185 .flags
= UPF_BOOT_AUTOCONF
| UPF_SKIP_TEST
| UPF_IOREMAP
,
187 .mapbase
= (unsigned long)(MX27_CS3_BASE_ADDR
+ 0x800000),
188 .irq
= IRQ_GPIOB(27),
192 .flags
= UPF_BOOT_AUTOCONF
| UPF_SKIP_TEST
| UPF_IOREMAP
,
194 .mapbase
= (unsigned long)(MX27_CS3_BASE_ADDR
+ 0x1000000),
195 .irq
= IRQ_GPIOB(30),
199 .flags
= UPF_BOOT_AUTOCONF
| UPF_SKIP_TEST
| UPF_IOREMAP
,
204 static struct platform_device serial_device
= {
205 .name
= "serial8250",
208 .platform_data
= serial_platform_data
,
213 #if defined(CONFIG_USB_ULPI)
214 static struct mxc_usbh_platform_data otg_pdata __initdata
= {
215 .portsc
= MXC_EHCI_MODE_ULPI
,
216 .flags
= MXC_EHCI_INTERFACE_DIFF_UNI
,
219 static struct mxc_usbh_platform_data usbh2_pdata __initdata
= {
220 .portsc
= MXC_EHCI_MODE_ULPI
,
221 .flags
= MXC_EHCI_INTERFACE_DIFF_UNI
,
225 static const struct fsl_usb2_platform_data otg_device_pdata __initconst
= {
226 .operating_mode
= FSL_USB2_DR_DEVICE
,
227 .phy_mode
= FSL_USB2_PHY_ULPI
,
230 static int otg_mode_host
;
232 static int __init
eukrea_cpuimx27_otg_mode(char *options
)
234 if (!strcmp(options
, "host"))
236 else if (!strcmp(options
, "device"))
239 pr_info("otg_mode neither \"host\" nor \"device\". "
240 "Defaulting to device\n");
243 __setup("otg_mode=", eukrea_cpuimx27_otg_mode
);
245 static void __init
eukrea_cpuimx27_init(void)
247 mxc_gpio_setup_multiple_pins(eukrea_cpuimx27_pins
,
248 ARRAY_SIZE(eukrea_cpuimx27_pins
), "CPUIMX27");
250 imx27_add_imx_uart0(&uart_pdata
);
252 imx27_add_mxc_nand(&cpuimx27_nand_board_info
);
254 i2c_register_board_info(0, eukrea_cpuimx27_i2c_devices
,
255 ARRAY_SIZE(eukrea_cpuimx27_i2c_devices
));
257 imx27_add_imx_i2c(0, &cpuimx27_i2c1_data
);
260 platform_add_devices(platform_devices
, ARRAY_SIZE(platform_devices
));
261 imx27_add_imx2_wdt(NULL
);
262 imx27_add_mxc_w1(NULL
);
264 #if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2)
265 /* SDHC2 can be used for Wifi */
266 imx27_add_mxc_mmc(1, NULL
);
268 #if defined(MACH_EUKREA_CPUIMX27_USEUART4)
269 /* in which case UART4 is also used for Bluetooth */
270 imx27_add_imx_uart3(&uart_pdata
);
273 #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
274 platform_device_register(&serial_device
);
277 #if defined(CONFIG_USB_ULPI)
279 otg_pdata
.otg
= otg_ulpi_create(&mxc_ulpi_access_ops
,
280 ULPI_OTG_DRVVBUS
| ULPI_OTG_DRVVBUS_EXT
);
282 imx27_add_mxc_ehci_otg(&otg_pdata
);
285 usbh2_pdata
.otg
= otg_ulpi_create(&mxc_ulpi_access_ops
,
286 ULPI_OTG_DRVVBUS
| ULPI_OTG_DRVVBUS_EXT
);
288 imx27_add_mxc_ehci_hs(2, &usbh2_pdata
);
291 imx27_add_fsl_usb2_udc(&otg_device_pdata
);
293 #ifdef CONFIG_MACH_EUKREA_MBIMX27_BASEBOARD
294 eukrea_mbimx27_baseboard_init();
298 static void __init
eukrea_cpuimx27_timer_init(void)
300 mx27_clocks_init(26000000);
303 static struct sys_timer eukrea_cpuimx27_timer
= {
304 .init
= eukrea_cpuimx27_timer_init
,
307 MACHINE_START(CPUIMX27
, "EUKREA CPUIMX27")
308 .boot_params
= MX27_PHYS_OFFSET
+ 0x100,
309 .map_io
= mx27_map_io
,
310 .init_irq
= mx27_init_irq
,
311 .init_machine
= eukrea_cpuimx27_init
,
312 .timer
= &eukrea_cpuimx27_timer
,