]>
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> | |
b2e63555 | 21 | #include <linux/gpio/machine.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 | ||
dc8ef8cd LW |
31 | #include "irqs.h" |
32 | ||
ec669696 KH |
33 | #define AVILA_SDA_PIN 7 |
34 | #define AVILA_SCL_PIN 6 | |
35 | ||
0f185971 MLJ |
36 | static struct flash_platform_data avila_flash_data = { |
37 | .map_name = "cfi_probe", | |
38 | .width = 2, | |
39 | }; | |
40 | ||
41 | static struct resource avila_flash_resource = { | |
42 | .flags = IORESOURCE_MEM, | |
43 | }; | |
44 | ||
45 | static struct platform_device avila_flash = { | |
46 | .name = "IXP4XX-Flash", | |
47 | .id = 0, | |
48 | .dev = { | |
49 | .platform_data = &avila_flash_data, | |
50 | }, | |
51 | .num_resources = 1, | |
52 | .resource = &avila_flash_resource, | |
53 | }; | |
54 | ||
b2e63555 | 55 | static struct gpiod_lookup_table avila_i2c_gpiod_table = { |
f59c303b | 56 | .dev_id = "i2c-gpio.0", |
b2e63555 LW |
57 | .table = { |
58 | GPIO_LOOKUP_IDX("IXP4XX_GPIO_CHIP", AVILA_SDA_PIN, | |
4d0ce62c | 59 | NULL, 0, GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), |
b2e63555 | 60 | GPIO_LOOKUP_IDX("IXP4XX_GPIO_CHIP", AVILA_SCL_PIN, |
4d0ce62c | 61 | NULL, 1, GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), |
b2e63555 | 62 | }, |
0f185971 MLJ |
63 | }; |
64 | ||
5a4a2387 MLJ |
65 | static struct platform_device avila_i2c_gpio = { |
66 | .name = "i2c-gpio", | |
0f185971 | 67 | .id = 0, |
5a4a2387 | 68 | .dev = { |
b2e63555 | 69 | .platform_data = NULL, |
0f185971 | 70 | }, |
0f185971 MLJ |
71 | }; |
72 | ||
73 | static struct resource avila_uart_resources[] = { | |
74 | { | |
75 | .start = IXP4XX_UART1_BASE_PHYS, | |
76 | .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, | |
77 | .flags = IORESOURCE_MEM | |
78 | }, | |
79 | { | |
80 | .start = IXP4XX_UART2_BASE_PHYS, | |
81 | .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, | |
82 | .flags = IORESOURCE_MEM | |
83 | } | |
84 | }; | |
85 | ||
86 | static struct plat_serial8250_port avila_uart_data[] = { | |
87 | { | |
88 | .mapbase = IXP4XX_UART1_BASE_PHYS, | |
89 | .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, | |
90 | .irq = IRQ_IXP4XX_UART1, | |
91 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, | |
92 | .iotype = UPIO_MEM, | |
93 | .regshift = 2, | |
94 | .uartclk = IXP4XX_UART_XTAL, | |
95 | }, | |
96 | { | |
97 | .mapbase = IXP4XX_UART2_BASE_PHYS, | |
98 | .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, | |
99 | .irq = IRQ_IXP4XX_UART2, | |
100 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, | |
101 | .iotype = UPIO_MEM, | |
102 | .regshift = 2, | |
103 | .uartclk = IXP4XX_UART_XTAL, | |
104 | }, | |
105 | { }, | |
106 | }; | |
107 | ||
108 | static struct platform_device avila_uart = { | |
109 | .name = "serial8250", | |
110 | .id = PLAT8250_DEV_PLATFORM, | |
111 | .dev.platform_data = avila_uart_data, | |
112 | .num_resources = 2, | |
113 | .resource = avila_uart_resources | |
114 | }; | |
115 | ||
946acb1c MLJ |
116 | static struct resource avila_pata_resources[] = { |
117 | { | |
118 | .flags = IORESOURCE_MEM | |
119 | }, | |
120 | { | |
121 | .flags = IORESOURCE_MEM, | |
122 | }, | |
123 | { | |
124 | .name = "intrq", | |
125 | .start = IRQ_IXP4XX_GPIO12, | |
126 | .end = IRQ_IXP4XX_GPIO12, | |
127 | .flags = IORESOURCE_IRQ, | |
128 | }, | |
129 | }; | |
130 | ||
131 | static struct ixp4xx_pata_data avila_pata_data = { | |
132 | .cs0_bits = 0xbfff0043, | |
133 | .cs1_bits = 0xbfff0043, | |
134 | }; | |
135 | ||
136 | static struct platform_device avila_pata = { | |
137 | .name = "pata_ixp4xx_cf", | |
138 | .id = 0, | |
139 | .dev.platform_data = &avila_pata_data, | |
140 | .num_resources = ARRAY_SIZE(avila_pata_resources), | |
141 | .resource = avila_pata_resources, | |
142 | }; | |
143 | ||
0f185971 | 144 | static struct platform_device *avila_devices[] __initdata = { |
5a4a2387 | 145 | &avila_i2c_gpio, |
0f185971 MLJ |
146 | &avila_flash, |
147 | &avila_uart | |
148 | }; | |
149 | ||
150 | static void __init avila_init(void) | |
151 | { | |
152 | ixp4xx_sys_init(); | |
153 | ||
154 | avila_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); | |
155 | avila_flash_resource.end = | |
156 | IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; | |
157 | ||
b2e63555 LW |
158 | gpiod_add_lookup_table(&avila_i2c_gpiod_table); |
159 | ||
0f185971 | 160 | platform_add_devices(avila_devices, ARRAY_SIZE(avila_devices)); |
946acb1c MLJ |
161 | |
162 | avila_pata_resources[0].start = IXP4XX_EXP_BUS_BASE(1); | |
163 | avila_pata_resources[0].end = IXP4XX_EXP_BUS_END(1); | |
164 | ||
165 | avila_pata_resources[1].start = IXP4XX_EXP_BUS_BASE(2); | |
166 | avila_pata_resources[1].end = IXP4XX_EXP_BUS_END(2); | |
167 | ||
168 | avila_pata_data.cs0_cfg = IXP4XX_EXP_CS1; | |
169 | avila_pata_data.cs1_cfg = IXP4XX_EXP_CS2; | |
170 | ||
171 | platform_device_register(&avila_pata); | |
172 | ||
0f185971 MLJ |
173 | } |
174 | ||
175 | MACHINE_START(AVILA, "Gateworks Avila Network Platform") | |
176 | /* Maintainer: Deepak Saxena <dsaxena@plexity.net> */ | |
0f185971 | 177 | .map_io = ixp4xx_map_io, |
f449588c | 178 | .init_early = ixp4xx_init_early, |
0f185971 | 179 | .init_irq = ixp4xx_init_irq, |
6bb27d73 | 180 | .init_time = ixp4xx_timer_init, |
e022c729 | 181 | .atag_offset = 0x100, |
0f185971 | 182 | .init_machine = avila_init, |
7553ee77 NP |
183 | #if defined(CONFIG_PCI) |
184 | .dma_zone_size = SZ_64M, | |
185 | #endif | |
d1b860fb | 186 | .restart = ixp4xx_restart, |
0f185971 MLJ |
187 | MACHINE_END |
188 | ||
189 | /* | |
190 | * Loft is functionally equivalent to Avila except that it has a | |
191 | * different number for the maximum PCI devices. The MACHINE | |
192 | * structure below is identical to Avila except for the comment. | |
193 | */ | |
194 | #ifdef CONFIG_MACH_LOFT | |
195 | MACHINE_START(LOFT, "Giant Shoulder Inc Loft board") | |
196 | /* Maintainer: Tom Billman <kernel@giantshoulderinc.com> */ | |
0f185971 | 197 | .map_io = ixp4xx_map_io, |
f449588c | 198 | .init_early = ixp4xx_init_early, |
0f185971 | 199 | .init_irq = ixp4xx_init_irq, |
6bb27d73 | 200 | .init_time = ixp4xx_timer_init, |
e022c729 | 201 | .atag_offset = 0x100, |
0f185971 | 202 | .init_machine = avila_init, |
7553ee77 NP |
203 | #if defined(CONFIG_PCI) |
204 | .dma_zone_size = SZ_64M, | |
205 | #endif | |
d1b860fb | 206 | .restart = ixp4xx_restart, |
0f185971 MLJ |
207 | MACHINE_END |
208 | #endif | |
209 |