]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | // SPDX-License-Identifier: GPL-2.0 |
0f185971 MLJ |
2 | /* |
3 | * arch/arm/mach-ixp4xx/avila-setup.c | |
4 | * | |
5 | * Gateworks Avila board-setup | |
6 | * | |
7 | * Author: Michael-Luke Jones <mlj28@cam.ac.uk> | |
8 | * | |
9 | * Based on ixdp-setup.c | |
10 | * Copyright (C) 2003-2005 MontaVista Software, Inc. | |
11 | * | |
12 | * Author: Deepak Saxena <dsaxena@plexity.net> | |
13 | */ | |
14 | ||
15 | #include <linux/kernel.h> | |
16 | #include <linux/init.h> | |
17 | #include <linux/device.h> | |
18 | #include <linux/serial.h> | |
19 | #include <linux/tty.h> | |
20 | #include <linux/serial_8250.h> | |
5a4a2387 | 21 | #include <linux/i2c-gpio.h> |
0f185971 MLJ |
22 | #include <asm/types.h> |
23 | #include <asm/setup.h> | |
24 | #include <asm/memory.h> | |
a09e64fb | 25 | #include <mach/hardware.h> |
0f185971 MLJ |
26 | #include <asm/mach-types.h> |
27 | #include <asm/irq.h> | |
28 | #include <asm/mach/arch.h> | |
29 | #include <asm/mach/flash.h> | |
30 | ||
ec669696 KH |
31 | #define AVILA_SDA_PIN 7 |
32 | #define AVILA_SCL_PIN 6 | |
33 | ||
0f185971 MLJ |
34 | static struct flash_platform_data avila_flash_data = { |
35 | .map_name = "cfi_probe", | |
36 | .width = 2, | |
37 | }; | |
38 | ||
39 | static struct resource avila_flash_resource = { | |
40 | .flags = IORESOURCE_MEM, | |
41 | }; | |
42 | ||
43 | static 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 | ||
5a4a2387 | 53 | static struct i2c_gpio_platform_data avila_i2c_gpio_data = { |
0f185971 MLJ |
54 | .sda_pin = AVILA_SDA_PIN, |
55 | .scl_pin = AVILA_SCL_PIN, | |
56 | }; | |
57 | ||
5a4a2387 MLJ |
58 | static struct platform_device avila_i2c_gpio = { |
59 | .name = "i2c-gpio", | |
0f185971 | 60 | .id = 0, |
5a4a2387 MLJ |
61 | .dev = { |
62 | .platform_data = &avila_i2c_gpio_data, | |
0f185971 | 63 | }, |
0f185971 MLJ |
64 | }; |
65 | ||
66 | static 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 | ||
79 | static 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 | ||
101 | static 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 | ||
946acb1c MLJ |
109 | static 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 | ||
124 | static struct ixp4xx_pata_data avila_pata_data = { | |
125 | .cs0_bits = 0xbfff0043, | |
126 | .cs1_bits = 0xbfff0043, | |
127 | }; | |
128 | ||
129 | static 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 | ||
0f185971 | 137 | static struct platform_device *avila_devices[] __initdata = { |
5a4a2387 | 138 | &avila_i2c_gpio, |
0f185971 MLJ |
139 | &avila_flash, |
140 | &avila_uart | |
141 | }; | |
142 | ||
143 | static 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)); | |
946acb1c MLJ |
152 | |
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 | ||
0f185971 MLJ |
164 | } |
165 | ||
166 | MACHINE_START(AVILA, "Gateworks Avila Network Platform") | |
167 | /* Maintainer: Deepak Saxena <dsaxena@plexity.net> */ | |
0f185971 | 168 | .map_io = ixp4xx_map_io, |
f449588c | 169 | .init_early = ixp4xx_init_early, |
0f185971 | 170 | .init_irq = ixp4xx_init_irq, |
6bb27d73 | 171 | .init_time = ixp4xx_timer_init, |
e022c729 | 172 | .atag_offset = 0x100, |
0f185971 | 173 | .init_machine = avila_init, |
7553ee77 NP |
174 | #if defined(CONFIG_PCI) |
175 | .dma_zone_size = SZ_64M, | |
176 | #endif | |
d1b860fb | 177 | .restart = ixp4xx_restart, |
0f185971 MLJ |
178 | MACHINE_END |
179 | ||
180 | /* | |
181 | * Loft is functionally equivalent to Avila except that it has a | |
182 | * different number for the maximum PCI devices. The MACHINE | |
183 | * structure below is identical to Avila except for the comment. | |
184 | */ | |
185 | #ifdef CONFIG_MACH_LOFT | |
186 | MACHINE_START(LOFT, "Giant Shoulder Inc Loft board") | |
187 | /* Maintainer: Tom Billman <kernel@giantshoulderinc.com> */ | |
0f185971 | 188 | .map_io = ixp4xx_map_io, |
f449588c | 189 | .init_early = ixp4xx_init_early, |
0f185971 | 190 | .init_irq = ixp4xx_init_irq, |
6bb27d73 | 191 | .init_time = ixp4xx_timer_init, |
e022c729 | 192 | .atag_offset = 0x100, |
0f185971 | 193 | .init_machine = avila_init, |
7553ee77 NP |
194 | #if defined(CONFIG_PCI) |
195 | .dma_zone_size = SZ_64M, | |
196 | #endif | |
d1b860fb | 197 | .restart = ixp4xx_restart, |
0f185971 MLJ |
198 | MACHINE_END |
199 | #endif | |
200 |