blob: 25c21d6665ec5fafcc55bdacdb1d537902ee91b1 [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
32#include <asm/types.h>
33#include <asm/setup.h>
34#include <asm/memory.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010035#include <mach/hardware.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070036#include <asm/irq.h>
37#include <asm/mach-types.h>
38#include <asm/mach/arch.h>
39#include <asm/mach/flash.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010040#include <mach/gtwx5715.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070041
42/*
43 * Xscale UART registers are 32 bits wide with only the least
44 * significant 8 bits having any meaning. From a configuration
45 * perspective, this means 2 things...
46 *
47 * Setting .regshift = 2 so that the standard 16550 registers
48 * line up on every 4th byte.
49 *
50 * Shifting the register start virtual address +3 bytes when
51 * compiled big-endian. Since register writes are done on a
52 * single byte basis, if the shift isn't done the driver will
53 * write the value into the most significant byte of the register,
54 * which is ignored, instead of the least significant.
55 */
56
57#ifdef __ARMEB__
58#define REG_OFFSET 3
59#else
60#define REG_OFFSET 0
61#endif
62
63/*
64 * Only the second or "console" uart is connected on the gtwx5715.
65 */
66
67static struct resource gtwx5715_uart_resources[] = {
68 {
69 .start = IXP4XX_UART2_BASE_PHYS,
70 .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
71 .flags = IORESOURCE_MEM,
72 },
73 {
74 .start = IRQ_IXP4XX_UART2,
75 .end = IRQ_IXP4XX_UART2,
76 .flags = IORESOURCE_IRQ,
77 },
78 { },
79};
80
81
82static struct plat_serial8250_port gtwx5715_uart_platform_data[] = {
83 {
84 .mapbase = IXP4XX_UART2_BASE_PHYS,
85 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
86 .irq = IRQ_IXP4XX_UART2,
Deepak Saxena8c741ed2005-08-03 19:58:21 +010087 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
Linus Torvalds1da177e2005-04-16 15:20:36 -070088 .iotype = UPIO_MEM,
89 .regshift = 2,
90 .uartclk = IXP4XX_UART_XTAL,
91 },
92 { },
93};
94
95static struct platform_device gtwx5715_uart_device = {
96 .name = "serial8250",
Russell King6df29de2005-09-08 16:04:41 +010097 .id = PLAT8250_DEV_PLATFORM,
Linus Torvalds1da177e2005-04-16 15:20:36 -070098 .dev = {
99 .platform_data = gtwx5715_uart_platform_data,
100 },
101 .num_resources = 2,
102 .resource = gtwx5715_uart_resources,
103};
104
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105static struct flash_platform_data gtwx5715_flash_data = {
106 .map_name = "cfi_probe",
107 .width = 2,
108};
109
Martin Michlmayr4c756f42006-08-06 09:59:26 +0100110static struct resource gtwx5715_flash_resource = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111 .flags = IORESOURCE_MEM,
Martin Michlmayr4c756f42006-08-06 09:59:26 +0100112};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700113
114static struct platform_device gtwx5715_flash = {
115 .name = "IXP4XX-Flash",
116 .id = 0,
117 .dev = {
118 .platform_data = &gtwx5715_flash_data,
119 },
120 .num_resources = 1,
121 .resource = &gtwx5715_flash_resource,
122};
123
124static struct platform_device *gtwx5715_devices[] __initdata = {
125 &gtwx5715_uart_device,
126 &gtwx5715_flash,
127};
128
129static void __init gtwx5715_init(void)
130{
Deepak Saxena54e269e2006-01-05 20:59:29 +0000131 ixp4xx_sys_init();
132
Deepak Saxena54e269e2006-01-05 20:59:29 +0000133 gtwx5715_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
134 gtwx5715_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_8M - 1;
135
Linus Torvalds1da177e2005-04-16 15:20:36 -0700136 platform_add_devices(gtwx5715_devices, ARRAY_SIZE(gtwx5715_devices));
137}
138
139
140MACHINE_START(GTWX5715, "Gemtek GTWX5715 (Linksys WRV54G)")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100141 /* Maintainer: George Joseph */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100142 .phys_io = IXP4XX_UART2_BASE_PHYS,
143 .io_pg_offst = ((IXP4XX_UART2_BASE_VIRT) >> 18) & 0xfffc,
Deepak Saxenae605ecd2005-08-29 22:46:29 +0100144 .map_io = ixp4xx_map_io,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100145 .init_irq = ixp4xx_init_irq,
146 .timer = &ixp4xx_timer,
147 .boot_params = 0x0100,
148 .init_machine = gtwx5715_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700149MACHINE_END
150
151