imx: define per SOC ..._PHYS_OFFSET and use these in favour of PHYS_OFFSET
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / arm / mach-mx3 / mach-kzm_arm11_01.c
blobf085d5d1a6de7c560d42fba0809b29d73a04a6e9
1 /*
2 * KZM-ARM11-01 support
3 * Copyright (C) 2009 Yoichi Yuasa <yuasa@linux-mips.org>
5 * based on code for MX31ADS,
6 * Copyright (C) 2000 Deep Blue Solutions Ltd
7 * Copyright (C) 2002 Shane Nay (shane@minirl.com)
8 * Copyright 2005-2007 Freescale Semiconductor, Inc. All Rights Reserved.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include <linux/gpio.h>
26 #include <linux/init.h>
27 #include <linux/platform_device.h>
28 #include <linux/serial_8250.h>
29 #include <linux/smsc911x.h>
30 #include <linux/types.h>
32 #include <asm/irq.h>
33 #include <asm/mach-types.h>
34 #include <asm/setup.h>
35 #include <asm/mach/arch.h>
36 #include <asm/mach/irq.h>
37 #include <asm/mach/map.h>
38 #include <asm/mach/time.h>
40 #include <mach/board-kzmarm11.h>
41 #include <mach/clock.h>
42 #include <mach/common.h>
43 #include <mach/imx-uart.h>
44 #include <mach/iomux-mx3.h>
45 #include <mach/memory.h>
47 #include "devices.h"
49 #define KZM_ARM11_IO_ADDRESS(x) ( \
50 IMX_IO_ADDRESS(x, MX31_CS4) ?: \
51 IMX_IO_ADDRESS(x, MX31_CS5) ?: \
52 MX31_IO_ADDRESS(x))
54 #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
56 * KZM-ARM11-01 has an external UART on FPGA
58 static struct plat_serial8250_port serial_platform_data[] = {
60 .membase = KZM_ARM11_IO_ADDRESS(KZM_ARM11_16550),
61 .mapbase = KZM_ARM11_16550,
62 .irq = IOMUX_TO_IRQ(MX31_PIN_GPIO1_1),
63 .irqflags = IRQ_TYPE_EDGE_RISING,
64 .uartclk = 14745600,
65 .regshift = 0,
66 .iotype = UPIO_MEM,
67 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
68 UPF_BUGGY_UART,
70 {},
73 static struct resource serial8250_resources[] = {
75 .start = KZM_ARM11_16550,
76 .end = KZM_ARM11_16550 + 0x10,
77 .flags = IORESOURCE_MEM,
80 .start = IOMUX_TO_IRQ(MX31_PIN_GPIO1_1),
81 .end = IOMUX_TO_IRQ(MX31_PIN_GPIO1_1),
82 .flags = IORESOURCE_IRQ,
86 static struct platform_device serial_device = {
87 .name = "serial8250",
88 .id = PLAT8250_DEV_PLATFORM,
89 .dev = {
90 .platform_data = serial_platform_data,
92 .num_resources = ARRAY_SIZE(serial8250_resources),
93 .resource = serial8250_resources,
96 static int __init kzm_init_ext_uart(void)
98 u8 tmp;
101 * GPIO 1-1: external UART interrupt line
103 mxc_iomux_mode(IOMUX_MODE(MX31_PIN_GPIO1_1, IOMUX_CONFIG_GPIO));
104 gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_1), "ext-uart-int");
105 gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_1));
108 * Unmask UART interrupt
110 tmp = __raw_readb(KZM_ARM11_IO_ADDRESS(KZM_ARM11_CTL1));
111 tmp |= 0x2;
112 __raw_writeb(tmp, KZM_ARM11_IO_ADDRESS(KZM_ARM11_CTL1));
114 return platform_device_register(&serial_device);
116 #else
117 static inline int kzm_init_ext_uart(void)
119 return 0;
121 #endif
124 * SMSC LAN9118
126 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
127 static struct smsc911x_platform_config kzm_smsc9118_config = {
128 .phy_interface = PHY_INTERFACE_MODE_MII,
129 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
130 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
131 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
134 static struct resource kzm_smsc9118_resources[] = {
136 .start = MX31_CS5_BASE_ADDR,
137 .end = MX31_CS5_BASE_ADDR + SZ_128K - 1,
138 .flags = IORESOURCE_MEM,
141 .start = IOMUX_TO_IRQ(MX31_PIN_GPIO1_2),
142 .end = IOMUX_TO_IRQ(MX31_PIN_GPIO1_2),
143 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
147 static struct platform_device kzm_smsc9118_device = {
148 .name = "smsc911x",
149 .id = -1,
150 .num_resources = ARRAY_SIZE(kzm_smsc9118_resources),
151 .resource = kzm_smsc9118_resources,
152 .dev = {
153 .platform_data = &kzm_smsc9118_config,
157 static int __init kzm_init_smsc9118(void)
160 * GPIO 1-2: SMSC9118 interrupt line
162 mxc_iomux_mode(IOMUX_MODE(MX31_PIN_GPIO1_2, IOMUX_CONFIG_GPIO));
163 gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_2), "smsc9118-int");
164 gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_2));
166 return platform_device_register(&kzm_smsc9118_device);
168 #else
169 static inline int kzm_init_smsc9118(void)
171 return 0;
173 #endif
175 #if defined(CONFIG_SERIAL_IMX) || defined(CONFIG_SERIAL_IMX_MODULE)
176 static struct imxuart_platform_data uart_pdata = {
177 .flags = IMXUART_HAVE_RTSCTS,
180 static void __init kzm_init_imx_uart(void)
182 mxc_register_device(&mxc_uart_device0, &uart_pdata);
184 mxc_register_device(&mxc_uart_device1, &uart_pdata);
186 #else
187 static inline void kzm_init_imx_uart(void)
190 #endif
192 static int kzm_pins[] __initdata = {
193 MX31_PIN_CTS1__CTS1,
194 MX31_PIN_RTS1__RTS1,
195 MX31_PIN_TXD1__TXD1,
196 MX31_PIN_RXD1__RXD1,
197 MX31_PIN_DCD_DCE1__DCD_DCE1,
198 MX31_PIN_RI_DCE1__RI_DCE1,
199 MX31_PIN_DSR_DCE1__DSR_DCE1,
200 MX31_PIN_DTR_DCE1__DTR_DCE1,
201 MX31_PIN_CTS2__CTS2,
202 MX31_PIN_RTS2__RTS2,
203 MX31_PIN_TXD2__TXD2,
204 MX31_PIN_RXD2__RXD2,
205 MX31_PIN_DCD_DTE1__DCD_DTE2,
206 MX31_PIN_RI_DTE1__RI_DTE2,
207 MX31_PIN_DSR_DTE1__DSR_DTE2,
208 MX31_PIN_DTR_DTE1__DTR_DTE2,
212 * Board specific initialization.
214 static void __init kzm_board_init(void)
216 mxc_iomux_setup_multiple_pins(kzm_pins,
217 ARRAY_SIZE(kzm_pins), "kzm");
218 kzm_init_ext_uart();
219 kzm_init_smsc9118();
220 kzm_init_imx_uart();
222 pr_info("Clock input source is 26MHz\n");
226 * This structure defines static mappings for the kzm-arm11-01 board.
228 static struct map_desc kzm_io_desc[] __initdata = {
230 .virtual = MX31_CS4_BASE_ADDR_VIRT,
231 .pfn = __phys_to_pfn(MX31_CS4_BASE_ADDR),
232 .length = MX31_CS4_SIZE,
233 .type = MT_DEVICE
236 .virtual = MX31_CS5_BASE_ADDR_VIRT,
237 .pfn = __phys_to_pfn(MX31_CS5_BASE_ADDR),
238 .length = MX31_CS5_SIZE,
239 .type = MT_DEVICE
244 * Set up static virtual mappings.
246 static void __init kzm_map_io(void)
248 mx31_map_io();
249 iotable_init(kzm_io_desc, ARRAY_SIZE(kzm_io_desc));
252 static void __init kzm_timer_init(void)
254 mx31_clocks_init(26000000);
257 static struct sys_timer kzm_timer = {
258 .init = kzm_timer_init,
262 * The following uses standard kernel macros define in arch.h in order to
263 * initialize __mach_desc_KZM_ARM11_01 data structure.
265 MACHINE_START(KZM_ARM11_01, "Kyoto Microcomputer Co., Ltd. KZM-ARM11-01")
266 .phys_io = MX31_AIPS1_BASE_ADDR,
267 .io_pg_offst = (MX31_AIPS1_BASE_ADDR_VIRT >> 18) & 0xfffc,
268 .boot_params = MX3x_PHYS_OFFSET + 0x100,
269 .map_io = kzm_map_io,
270 .init_irq = mx31_init_irq,
271 .init_machine = kzm_board_init,
272 .timer = &kzm_timer,
273 MACHINE_END