aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mx3/kzmarm11.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-mx3/kzmarm11.c')
-rw-r--r--arch/arm/mach-mx3/kzmarm11.c268
1 files changed, 268 insertions, 0 deletions
diff --git a/arch/arm/mach-mx3/kzmarm11.c b/arch/arm/mach-mx3/kzmarm11.c
new file mode 100644
index 000000000000..6fa99ce3008a
--- /dev/null
+++ b/arch/arm/mach-mx3/kzmarm11.c
@@ -0,0 +1,268 @@
1/*
2 * KZM-ARM11-01 support
3 * Copyright (C) 2009 Yoichi Yuasa <yuasa@linux-mips.org>
4 *
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.
9 *
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.
14 *
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.
19 *
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
23 */
24
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>
31
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>
39
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>
46
47#include "devices.h"
48
49#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
50/*
51 * KZM-ARM11-01 has an external UART on FPGA
52 */
53static struct plat_serial8250_port serial_platform_data[] = {
54 {
55 .membase = IO_ADDRESS(KZM_ARM11_16550),
56 .mapbase = KZM_ARM11_16550,
57 .irq = IOMUX_TO_IRQ(MX31_PIN_GPIO1_1),
58 .irqflags = IRQ_TYPE_EDGE_RISING,
59 .uartclk = 14745600,
60 .regshift = 0,
61 .iotype = UPIO_MEM,
62 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
63 UPF_BUGGY_UART,
64 },
65 {},
66};
67
68static struct resource serial8250_resources[] = {
69 {
70 .start = KZM_ARM11_16550,
71 .end = KZM_ARM11_16550 + 0x10,
72 .flags = IORESOURCE_MEM,
73 },
74 {
75 .start = IOMUX_TO_IRQ(MX31_PIN_GPIO1_1),
76 .end = IOMUX_TO_IRQ(MX31_PIN_GPIO1_1),
77 .flags = IORESOURCE_IRQ,
78 },
79};
80
81static struct platform_device serial_device = {
82 .name = "serial8250",
83 .id = PLAT8250_DEV_PLATFORM,
84 .dev = {
85 .platform_data = serial_platform_data,
86 },
87 .num_resources = ARRAY_SIZE(serial8250_resources),
88 .resource = serial8250_resources,
89};
90
91static int __init kzm_init_ext_uart(void)
92{
93 u8 tmp;
94
95 /*
96 * GPIO 1-1: external UART interrupt line
97 */
98 mxc_iomux_mode(IOMUX_MODE(MX31_PIN_GPIO1_1, IOMUX_CONFIG_GPIO));
99 gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_1), "ext-uart-int");
100 gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_1));
101
102 /*
103 * Unmask UART interrupt
104 */
105 tmp = __raw_readb(IO_ADDRESS(KZM_ARM11_CTL1));
106 tmp |= 0x2;
107 __raw_writeb(tmp, IO_ADDRESS(KZM_ARM11_CTL1));
108
109 return platform_device_register(&serial_device);
110}
111#else
112static inline int kzm_init_ext_uart(void)
113{
114 return 0;
115}
116#endif
117
118/*
119 * SMSC LAN9118
120 */
121#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
122static struct smsc911x_platform_config kzm_smsc9118_config = {
123 .phy_interface = PHY_INTERFACE_MODE_MII,
124 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
125 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
126 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
127};
128
129static struct resource kzm_smsc9118_resources[] = {
130 {
131 .start = CS5_BASE_ADDR,
132 .end = CS5_BASE_ADDR + SZ_128K - 1,
133 .flags = IORESOURCE_MEM,
134 },
135 {
136 .start = IOMUX_TO_IRQ(MX31_PIN_GPIO1_2),
137 .end = IOMUX_TO_IRQ(MX31_PIN_GPIO1_2),
138 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
139 },
140};
141
142static struct platform_device kzm_smsc9118_device = {
143 .name = "smsc911x",
144 .id = -1,
145 .num_resources = ARRAY_SIZE(kzm_smsc9118_resources),
146 .resource = kzm_smsc9118_resources,
147 .dev = {
148 .platform_data = &kzm_smsc9118_config,
149 },
150};
151
152static int __init kzm_init_smsc9118(void)
153{
154 /*
155 * GPIO 1-2: SMSC9118 interrupt line
156 */
157 mxc_iomux_mode(IOMUX_MODE(MX31_PIN_GPIO1_2, IOMUX_CONFIG_GPIO));
158 gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_2), "smsc9118-int");
159 gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_2));
160
161 return platform_device_register(&kzm_smsc9118_device);
162}
163#else
164static inline int kzm_init_smsc9118(void)
165{
166 return 0;
167}
168#endif
169
170#if defined(CONFIG_SERIAL_IMX) || defined(CONFIG_SERIAL_IMX_MODULE)
171static struct imxuart_platform_data uart_pdata = {
172 .flags = IMXUART_HAVE_RTSCTS,
173};
174
175static void __init kzm_init_imx_uart(void)
176{
177 mxc_register_device(&mxc_uart_device0, &uart_pdata);
178
179 mxc_register_device(&mxc_uart_device1, &uart_pdata);
180}
181#else
182static inline void kzm_init_imx_uart(void)
183{
184}
185#endif
186
187static int kzm_pins[] __initdata = {
188 MX31_PIN_CTS1__CTS1,
189 MX31_PIN_RTS1__RTS1,
190 MX31_PIN_TXD1__TXD1,
191 MX31_PIN_RXD1__RXD1,
192 MX31_PIN_DCD_DCE1__DCD_DCE1,
193 MX31_PIN_RI_DCE1__RI_DCE1,
194 MX31_PIN_DSR_DCE1__DSR_DCE1,
195 MX31_PIN_DTR_DCE1__DTR_DCE1,
196 MX31_PIN_CTS2__CTS2,
197 MX31_PIN_RTS2__RTS2,
198 MX31_PIN_TXD2__TXD2,
199 MX31_PIN_RXD2__RXD2,
200 MX31_PIN_DCD_DTE1__DCD_DTE2,
201 MX31_PIN_RI_DTE1__RI_DTE2,
202 MX31_PIN_DSR_DTE1__DSR_DTE2,
203 MX31_PIN_DTR_DTE1__DTR_DTE2,
204};
205
206/*
207 * Board specific initialization.
208 */
209static void __init kzm_board_init(void)
210{
211 mxc_iomux_setup_multiple_pins(kzm_pins,
212 ARRAY_SIZE(kzm_pins), "kzm");
213 kzm_init_ext_uart();
214 kzm_init_smsc9118();
215 kzm_init_imx_uart();
216
217 pr_info("Clock input source is 26MHz\n");
218}
219
220/*
221 * This structure defines static mappings for the kzm-arm11-01 board.
222 */
223static struct map_desc kzm_io_desc[] __initdata = {
224 {
225 .virtual = CS4_BASE_ADDR_VIRT,
226 .pfn = __phys_to_pfn(CS4_BASE_ADDR),
227 .length = CS4_SIZE,
228 .type = MT_DEVICE
229 },
230 {
231 .virtual = CS5_BASE_ADDR_VIRT,
232 .pfn = __phys_to_pfn(CS5_BASE_ADDR),
233 .length = CS5_SIZE,
234 .type = MT_DEVICE
235 },
236};
237
238/*
239 * Set up static virtual mappings.
240 */
241static void __init kzm_map_io(void)
242{
243 mx31_map_io();
244 iotable_init(kzm_io_desc, ARRAY_SIZE(kzm_io_desc));
245}
246
247static void __init kzm_timer_init(void)
248{
249 mx31_clocks_init(26000000);
250}
251
252static struct sys_timer kzm_timer = {
253 .init = kzm_timer_init,
254};
255
256/*
257 * The following uses standard kernel macros define in arch.h in order to
258 * initialize __mach_desc_KZM_ARM11_01 data structure.
259 */
260MACHINE_START(KZM_ARM11_01, "Kyoto Microcomputer Co., Ltd. KZM-ARM11-01")
261 .phys_io = AIPS1_BASE_ADDR,
262 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
263 .boot_params = PHYS_OFFSET + 0x100,
264 .map_io = kzm_map_io,
265 .init_irq = mx31_init_irq,
266 .init_machine = kzm_board_init,
267 .timer = &kzm_timer,
268MACHINE_END