blob: 6e558a76457d154a5aa38d0c816b720b062cdc82 [file] [log] [blame]
Michael-Luke Jones0f185972006-12-16 23:04:05 +01001/*
2 * arch/arm/mach-ixp4xx/avila-setup.c
3 *
4 * Gateworks Avila board-setup
5 *
6 * Author: Michael-Luke Jones <mlj28@cam.ac.uk>
7 *
8 * Based on ixdp-setup.c
9 * Copyright (C) 2003-2005 MontaVista Software, Inc.
10 *
11 * Author: Deepak Saxena <dsaxena@plexity.net>
12 */
13
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/device.h>
17#include <linux/serial.h>
18#include <linux/tty.h>
19#include <linux/serial_8250.h>
20#include <linux/slab.h>
Michael-Luke Jones5a4a2382008-01-27 18:14:46 +010021#include <linux/i2c-gpio.h>
Michael-Luke Jones0f185972006-12-16 23:04:05 +010022#include <asm/types.h>
23#include <asm/setup.h>
24#include <asm/memory.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010025#include <mach/hardware.h>
Michael-Luke Jones0f185972006-12-16 23:04:05 +010026#include <asm/mach-types.h>
27#include <asm/irq.h>
28#include <asm/mach/arch.h>
29#include <asm/mach/flash.h>
30
Krzysztof HaƂasaec669692009-11-16 15:39:11 +010031#define AVILA_SDA_PIN 7
32#define AVILA_SCL_PIN 6
33
Michael-Luke Jones0f185972006-12-16 23:04:05 +010034static struct flash_platform_data avila_flash_data = {
35 .map_name = "cfi_probe",
36 .width = 2,
37};
38
39static struct resource avila_flash_resource = {
40 .flags = IORESOURCE_MEM,
41};
42
43static struct platform_device avila_flash = {
44 .name = "IXP4XX-Flash",
45 .id = 0,
46 .dev = {
47 .platform_data = &avila_flash_data,
48 },
49 .num_resources = 1,
50 .resource = &avila_flash_resource,
51};
52
Michael-Luke Jones5a4a2382008-01-27 18:14:46 +010053static struct i2c_gpio_platform_data avila_i2c_gpio_data = {
Michael-Luke Jones0f185972006-12-16 23:04:05 +010054 .sda_pin = AVILA_SDA_PIN,
55 .scl_pin = AVILA_SCL_PIN,
56};
57
Michael-Luke Jones5a4a2382008-01-27 18:14:46 +010058static struct platform_device avila_i2c_gpio = {
59 .name = "i2c-gpio",
Michael-Luke Jones0f185972006-12-16 23:04:05 +010060 .id = 0,
Michael-Luke Jones5a4a2382008-01-27 18:14:46 +010061 .dev = {
62 .platform_data = &avila_i2c_gpio_data,
Michael-Luke Jones0f185972006-12-16 23:04:05 +010063 },
Michael-Luke Jones0f185972006-12-16 23:04:05 +010064};
65
66static struct resource avila_uart_resources[] = {
67 {
68 .start = IXP4XX_UART1_BASE_PHYS,
69 .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
70 .flags = IORESOURCE_MEM
71 },
72 {
73 .start = IXP4XX_UART2_BASE_PHYS,
74 .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
75 .flags = IORESOURCE_MEM
76 }
77};
78
79static struct plat_serial8250_port avila_uart_data[] = {
80 {
81 .mapbase = IXP4XX_UART1_BASE_PHYS,
82 .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
83 .irq = IRQ_IXP4XX_UART1,
84 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
85 .iotype = UPIO_MEM,
86 .regshift = 2,
87 .uartclk = IXP4XX_UART_XTAL,
88 },
89 {
90 .mapbase = IXP4XX_UART2_BASE_PHYS,
91 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
92 .irq = IRQ_IXP4XX_UART2,
93 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
94 .iotype = UPIO_MEM,
95 .regshift = 2,
96 .uartclk = IXP4XX_UART_XTAL,
97 },
98 { },
99};
100
101static struct platform_device avila_uart = {
102 .name = "serial8250",
103 .id = PLAT8250_DEV_PLATFORM,
104 .dev.platform_data = avila_uart_data,
105 .num_resources = 2,
106 .resource = avila_uart_resources
107};
108
Michael-Luke Jones946acb12006-12-16 23:02:00 +0100109static struct resource avila_pata_resources[] = {
110 {
111 .flags = IORESOURCE_MEM
112 },
113 {
114 .flags = IORESOURCE_MEM,
115 },
116 {
117 .name = "intrq",
118 .start = IRQ_IXP4XX_GPIO12,
119 .end = IRQ_IXP4XX_GPIO12,
120 .flags = IORESOURCE_IRQ,
121 },
122};
123
124static struct ixp4xx_pata_data avila_pata_data = {
125 .cs0_bits = 0xbfff0043,
126 .cs1_bits = 0xbfff0043,
127};
128
129static struct platform_device avila_pata = {
130 .name = "pata_ixp4xx_cf",
131 .id = 0,
132 .dev.platform_data = &avila_pata_data,
133 .num_resources = ARRAY_SIZE(avila_pata_resources),
134 .resource = avila_pata_resources,
135};
136
Michael-Luke Jones0f185972006-12-16 23:04:05 +0100137static struct platform_device *avila_devices[] __initdata = {
Michael-Luke Jones5a4a2382008-01-27 18:14:46 +0100138 &avila_i2c_gpio,
Michael-Luke Jones0f185972006-12-16 23:04:05 +0100139 &avila_flash,
140 &avila_uart
141};
142
143static void __init avila_init(void)
144{
145 ixp4xx_sys_init();
146
147 avila_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
148 avila_flash_resource.end =
149 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
150
151 platform_add_devices(avila_devices, ARRAY_SIZE(avila_devices));
Michael-Luke Jones946acb12006-12-16 23:02:00 +0100152
153 avila_pata_resources[0].start = IXP4XX_EXP_BUS_BASE(1);
154 avila_pata_resources[0].end = IXP4XX_EXP_BUS_END(1);
155
156 avila_pata_resources[1].start = IXP4XX_EXP_BUS_BASE(2);
157 avila_pata_resources[1].end = IXP4XX_EXP_BUS_END(2);
158
159 avila_pata_data.cs0_cfg = IXP4XX_EXP_CS1;
160 avila_pata_data.cs1_cfg = IXP4XX_EXP_CS2;
161
162 platform_device_register(&avila_pata);
163
Michael-Luke Jones0f185972006-12-16 23:04:05 +0100164}
165
166MACHINE_START(AVILA, "Gateworks Avila Network Platform")
167 /* Maintainer: Deepak Saxena <dsaxena@plexity.net> */
168 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
169 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
170 .map_io = ixp4xx_map_io,
171 .init_irq = ixp4xx_init_irq,
172 .timer = &ixp4xx_timer,
173 .boot_params = 0x0100,
174 .init_machine = avila_init,
175MACHINE_END
176
177 /*
178 * Loft is functionally equivalent to Avila except that it has a
179 * different number for the maximum PCI devices. The MACHINE
180 * structure below is identical to Avila except for the comment.
181 */
182#ifdef CONFIG_MACH_LOFT
183MACHINE_START(LOFT, "Giant Shoulder Inc Loft board")
184 /* Maintainer: Tom Billman <kernel@giantshoulderinc.com> */
185 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
186 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
187 .map_io = ixp4xx_map_io,
188 .init_irq = ixp4xx_init_irq,
189 .timer = &ixp4xx_timer,
190 .boot_params = 0x0100,
191 .init_machine = avila_init,
192MACHINE_END
193#endif
194