blob: 0bc7185cb6f7282e7447ffe091ea9783f108c206 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * arch/arm/mach-ixp4xx/gtwx5715-setup.c
3 *
Simon Arlott6cbdc8c2007-05-11 20:40:30 +01004 * Gemtek GTWX5715 (Linksys WRV54G) board setup
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 *
6 * Copyright (C) 2004 George T. Joseph
7 * Derived from Coyote
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 *
23 */
24
25#include <linux/init.h>
26#include <linux/device.h>
27#include <linux/serial.h>
28#include <linux/tty.h>
29#include <linux/serial_8250.h>
Deepak Saxena54e269e2006-01-05 20:59:29 +000030#include <linux/slab.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070031#include <asm/types.h>
32#include <asm/setup.h>
33#include <asm/memory.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010034#include <mach/hardware.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070035#include <asm/irq.h>
36#include <asm/mach-types.h>
37#include <asm/mach/arch.h>
38#include <asm/mach/flash.h>
Krzysztof HaƂasaa8b7b342009-11-16 23:24:57 +010039
40/* GPIO 5,6,7 and 12 are hard wired to the Kendin KS8995M Switch
41 and operate as an SPI type interface. The details of the interface
42 are available on Kendin/Micrel's web site. */
43
44#define GTWX5715_KSSPI_SELECT 5
45#define GTWX5715_KSSPI_TXD 6
46#define GTWX5715_KSSPI_CLOCK 7
47#define GTWX5715_KSSPI_RXD 12
48
49/* The "reset" button is wired to GPIO 3.
50 The GPIO is brought "low" when the button is pushed. */
51
52#define GTWX5715_BUTTON_GPIO 3
53
54/* Board Label Front Label
55 LED1 Power
56 LED2 Wireless-G
57 LED3 not populated but could be
58 LED4 Internet
59 LED5 - LED8 Controlled by KS8995M Switch
60 LED9 DMZ */
61
62#define GTWX5715_LED1_GPIO 2
63#define GTWX5715_LED2_GPIO 9
64#define GTWX5715_LED3_GPIO 8
65#define GTWX5715_LED4_GPIO 1
66#define GTWX5715_LED9_GPIO 4
Linus Torvalds1da177e2005-04-16 15:20:36 -070067
68/*
69 * Xscale UART registers are 32 bits wide with only the least
70 * significant 8 bits having any meaning. From a configuration
71 * perspective, this means 2 things...
72 *
73 * Setting .regshift = 2 so that the standard 16550 registers
74 * line up on every 4th byte.
75 *
76 * Shifting the register start virtual address +3 bytes when
77 * compiled big-endian. Since register writes are done on a
78 * single byte basis, if the shift isn't done the driver will
79 * write the value into the most significant byte of the register,
80 * which is ignored, instead of the least significant.
81 */
82
83#ifdef __ARMEB__
84#define REG_OFFSET 3
85#else
86#define REG_OFFSET 0
87#endif
88
89/*
90 * Only the second or "console" uart is connected on the gtwx5715.
91 */
92
93static struct resource gtwx5715_uart_resources[] = {
94 {
95 .start = IXP4XX_UART2_BASE_PHYS,
96 .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
97 .flags = IORESOURCE_MEM,
98 },
99 {
100 .start = IRQ_IXP4XX_UART2,
101 .end = IRQ_IXP4XX_UART2,
102 .flags = IORESOURCE_IRQ,
103 },
104 { },
105};
106
107
108static struct plat_serial8250_port gtwx5715_uart_platform_data[] = {
109 {
110 .mapbase = IXP4XX_UART2_BASE_PHYS,
111 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
112 .irq = IRQ_IXP4XX_UART2,
Deepak Saxena8c741ed2005-08-03 19:58:21 +0100113 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114 .iotype = UPIO_MEM,
115 .regshift = 2,
116 .uartclk = IXP4XX_UART_XTAL,
117 },
118 { },
119};
120
121static struct platform_device gtwx5715_uart_device = {
122 .name = "serial8250",
Russell King6df29de2005-09-08 16:04:41 +0100123 .id = PLAT8250_DEV_PLATFORM,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124 .dev = {
125 .platform_data = gtwx5715_uart_platform_data,
126 },
127 .num_resources = 2,
128 .resource = gtwx5715_uart_resources,
129};
130
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131static struct flash_platform_data gtwx5715_flash_data = {
132 .map_name = "cfi_probe",
133 .width = 2,
134};
135
Martin Michlmayr4c756f42006-08-06 09:59:26 +0100136static struct resource gtwx5715_flash_resource = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137 .flags = IORESOURCE_MEM,
Martin Michlmayr4c756f42006-08-06 09:59:26 +0100138};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700139
140static struct platform_device gtwx5715_flash = {
141 .name = "IXP4XX-Flash",
142 .id = 0,
143 .dev = {
144 .platform_data = &gtwx5715_flash_data,
145 },
146 .num_resources = 1,
147 .resource = &gtwx5715_flash_resource,
148};
149
150static struct platform_device *gtwx5715_devices[] __initdata = {
151 &gtwx5715_uart_device,
152 &gtwx5715_flash,
153};
154
155static void __init gtwx5715_init(void)
156{
Deepak Saxena54e269e2006-01-05 20:59:29 +0000157 ixp4xx_sys_init();
158
Deepak Saxena54e269e2006-01-05 20:59:29 +0000159 gtwx5715_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
160 gtwx5715_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_8M - 1;
161
Linus Torvalds1da177e2005-04-16 15:20:36 -0700162 platform_add_devices(gtwx5715_devices, ARRAY_SIZE(gtwx5715_devices));
163}
164
165
166MACHINE_START(GTWX5715, "Gemtek GTWX5715 (Linksys WRV54G)")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100167 /* Maintainer: George Joseph */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100168 .phys_io = IXP4XX_UART2_BASE_PHYS,
169 .io_pg_offst = ((IXP4XX_UART2_BASE_VIRT) >> 18) & 0xfffc,
Deepak Saxenae605ecd2005-08-29 22:46:29 +0100170 .map_io = ixp4xx_map_io,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100171 .init_irq = ixp4xx_init_irq,
172 .timer = &ixp4xx_timer,
173 .boot_params = 0x0100,
174 .init_machine = gtwx5715_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700175MACHINE_END
176
177