2 * Copyright 2007 Robert Schwebel <r.schwebel@pengutronix.de>, Pengutronix
3 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20 #include <linux/platform_device.h>
21 #include <linux/mtd/physmap.h>
22 #include <asm/mach/arch.h>
23 #include <asm/mach-types.h>
24 #include <mach/common.h>
25 #include <mach/hardware.h>
26 #include <mach/iomux-mx1-mx2.h>
27 #include <asm/mach/time.h>
28 #include <mach/imx-uart.h>
29 #include <mach/board-pcm038.h>
32 * Phytec's phyCORE-i.MX27 comes with 32MiB flash,
35 static struct physmap_flash_data pcm038_flash_data = {
39 static struct resource pcm038_flash_resource = {
42 .flags = IORESOURCE_MEM,
45 static struct platform_device pcm038_nor_mtd_device = {
46 .name = "physmap-flash",
49 .platform_data = &pcm038_flash_data,
52 .resource = &pcm038_flash_resource,
55 static int mxc_uart0_pins[] = {
62 static int uart_mxc_port0_init(struct platform_device *pdev)
64 return mxc_gpio_setup_multiple_pins(mxc_uart0_pins,
65 ARRAY_SIZE(mxc_uart0_pins),
66 MXC_GPIO_ALLOC_MODE_NORMAL, "UART0");
69 static int uart_mxc_port0_exit(struct platform_device *pdev)
71 return mxc_gpio_setup_multiple_pins(mxc_uart0_pins,
72 ARRAY_SIZE(mxc_uart0_pins),
73 MXC_GPIO_ALLOC_MODE_RELEASE, "UART0");
76 static int mxc_uart1_pins[] = {
83 static int uart_mxc_port1_init(struct platform_device *pdev)
85 return mxc_gpio_setup_multiple_pins(mxc_uart1_pins,
86 ARRAY_SIZE(mxc_uart1_pins),
87 MXC_GPIO_ALLOC_MODE_NORMAL, "UART1");
90 static int uart_mxc_port1_exit(struct platform_device *pdev)
92 return mxc_gpio_setup_multiple_pins(mxc_uart1_pins,
93 ARRAY_SIZE(mxc_uart1_pins),
94 MXC_GPIO_ALLOC_MODE_RELEASE, "UART1");
97 static int mxc_uart2_pins[] = { PE10_PF_UART3_CTS,
102 static int uart_mxc_port2_init(struct platform_device *pdev)
104 return mxc_gpio_setup_multiple_pins(mxc_uart2_pins,
105 ARRAY_SIZE(mxc_uart2_pins),
106 MXC_GPIO_ALLOC_MODE_NORMAL, "UART2");
109 static int uart_mxc_port2_exit(struct platform_device *pdev)
111 return mxc_gpio_setup_multiple_pins(mxc_uart2_pins,
112 ARRAY_SIZE(mxc_uart2_pins),
113 MXC_GPIO_ALLOC_MODE_RELEASE, "UART2");
116 static struct imxuart_platform_data uart_pdata[] = {
118 .init = uart_mxc_port0_init,
119 .exit = uart_mxc_port0_exit,
120 .flags = IMXUART_HAVE_RTSCTS,
122 .init = uart_mxc_port1_init,
123 .exit = uart_mxc_port1_exit,
124 .flags = IMXUART_HAVE_RTSCTS,
126 .init = uart_mxc_port2_init,
127 .exit = uart_mxc_port2_exit,
128 .flags = IMXUART_HAVE_RTSCTS,
132 static int mxc_fec_pins[] = {
144 PD11_AOUT_FEC_TX_CLK,
153 static void gpio_fec_active(void)
155 mxc_gpio_setup_multiple_pins(mxc_fec_pins,
156 ARRAY_SIZE(mxc_fec_pins),
157 MXC_GPIO_ALLOC_MODE_NORMAL, "FEC");
160 static void gpio_fec_inactive(void)
162 mxc_gpio_setup_multiple_pins(mxc_fec_pins,
163 ARRAY_SIZE(mxc_fec_pins),
164 MXC_GPIO_ALLOC_MODE_RELEASE, "FEC");
167 static struct platform_device *platform_devices[] __initdata = {
168 &pcm038_nor_mtd_device,
171 static void __init pcm038_init(void)
176 for (i = 0; i < 3; i++)
177 imx_init_uart(i, &uart_pdata[i]);
179 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
181 #ifdef CONFIG_MACH_PCM970_BASEBOARD
182 pcm970_baseboard_init();
186 static void __init pcm038_timer_init(void)
188 mxc_clocks_init(26000000);
189 mxc_timer_init("gpt_clk.0");
192 struct sys_timer pcm038_timer = {
193 .init = pcm038_timer_init,
196 MACHINE_START(PCM038, "phyCORE-i.MX27")
197 .phys_io = AIPI_BASE_ADDR,
198 .io_pg_offst = ((AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc,
199 .boot_params = PHYS_OFFSET + 0x100,
200 .map_io = mxc_map_io,
201 .init_irq = mxc_init_irq,
202 .init_machine = pcm038_init,
203 .timer = &pcm038_timer,