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>
34 * Phytec's phyCORE-i.MX27 comes with 32MiB flash,
37 static struct physmap_flash_data pcm038_flash_data
= {
41 static struct resource pcm038_flash_resource
= {
44 .flags
= IORESOURCE_MEM
,
47 static struct platform_device pcm038_nor_mtd_device
= {
48 .name
= "physmap-flash",
51 .platform_data
= &pcm038_flash_data
,
54 .resource
= &pcm038_flash_resource
,
57 static int mxc_uart0_pins
[] = {
64 static int uart_mxc_port0_init(struct platform_device
*pdev
)
66 return mxc_gpio_setup_multiple_pins(mxc_uart0_pins
,
67 ARRAY_SIZE(mxc_uart0_pins
),
68 MXC_GPIO_ALLOC_MODE_NORMAL
, "UART0");
71 static int uart_mxc_port0_exit(struct platform_device
*pdev
)
73 return mxc_gpio_setup_multiple_pins(mxc_uart0_pins
,
74 ARRAY_SIZE(mxc_uart0_pins
),
75 MXC_GPIO_ALLOC_MODE_RELEASE
, "UART0");
78 static int mxc_uart1_pins
[] = {
85 static int uart_mxc_port1_init(struct platform_device
*pdev
)
87 return mxc_gpio_setup_multiple_pins(mxc_uart1_pins
,
88 ARRAY_SIZE(mxc_uart1_pins
),
89 MXC_GPIO_ALLOC_MODE_NORMAL
, "UART1");
92 static int uart_mxc_port1_exit(struct platform_device
*pdev
)
94 return mxc_gpio_setup_multiple_pins(mxc_uart1_pins
,
95 ARRAY_SIZE(mxc_uart1_pins
),
96 MXC_GPIO_ALLOC_MODE_RELEASE
, "UART1");
99 static int mxc_uart2_pins
[] = { PE10_PF_UART3_CTS
,
104 static int uart_mxc_port2_init(struct platform_device
*pdev
)
106 return mxc_gpio_setup_multiple_pins(mxc_uart2_pins
,
107 ARRAY_SIZE(mxc_uart2_pins
),
108 MXC_GPIO_ALLOC_MODE_NORMAL
, "UART2");
111 static int uart_mxc_port2_exit(struct platform_device
*pdev
)
113 return mxc_gpio_setup_multiple_pins(mxc_uart2_pins
,
114 ARRAY_SIZE(mxc_uart2_pins
),
115 MXC_GPIO_ALLOC_MODE_RELEASE
, "UART2");
118 static struct imxuart_platform_data uart_pdata
[] = {
120 .init
= uart_mxc_port0_init
,
121 .exit
= uart_mxc_port0_exit
,
122 .flags
= IMXUART_HAVE_RTSCTS
,
124 .init
= uart_mxc_port1_init
,
125 .exit
= uart_mxc_port1_exit
,
126 .flags
= IMXUART_HAVE_RTSCTS
,
128 .init
= uart_mxc_port2_init
,
129 .exit
= uart_mxc_port2_exit
,
130 .flags
= IMXUART_HAVE_RTSCTS
,
134 static int mxc_fec_pins
[] = {
146 PD11_AOUT_FEC_TX_CLK
,
155 static void gpio_fec_active(void)
157 mxc_gpio_setup_multiple_pins(mxc_fec_pins
,
158 ARRAY_SIZE(mxc_fec_pins
),
159 MXC_GPIO_ALLOC_MODE_NORMAL
, "FEC");
162 static void gpio_fec_inactive(void)
164 mxc_gpio_setup_multiple_pins(mxc_fec_pins
,
165 ARRAY_SIZE(mxc_fec_pins
),
166 MXC_GPIO_ALLOC_MODE_RELEASE
, "FEC");
169 static struct platform_device
*platform_devices
[] __initdata
= {
170 &pcm038_nor_mtd_device
,
173 static void __init
pcm038_init(void)
177 mxc_register_device(&mxc_uart_device0
, &uart_pdata
[0]);
178 mxc_register_device(&mxc_uart_device1
, &uart_pdata
[1]);
179 mxc_register_device(&mxc_uart_device2
, &uart_pdata
[2]);
181 platform_add_devices(platform_devices
, ARRAY_SIZE(platform_devices
));
183 #ifdef CONFIG_MACH_PCM970_BASEBOARD
184 pcm970_baseboard_init();
188 static void __init
pcm038_timer_init(void)
190 mxc_clocks_init(26000000);
191 mxc_timer_init("gpt_clk.0");
194 struct sys_timer pcm038_timer
= {
195 .init
= pcm038_timer_init
,
198 MACHINE_START(PCM038
, "phyCORE-i.MX27")
199 .phys_io
= AIPI_BASE_ADDR
,
200 .io_pg_offst
= ((AIPI_BASE_ADDR_VIRT
) >> 18) & 0xfffc,
201 .boot_params
= PHYS_OFFSET
+ 0x100,
202 .map_io
= mxc_map_io
,
203 .init_irq
= mxc_init_irq
,
204 .init_machine
= pcm038_init
,
205 .timer
= &pcm038_timer
,