1 // SPDX-License-Identifier: GPL-2.0
3 * arch/arm/mach-ixp4xx/avila-setup.c
5 * Gateworks Avila board-setup
7 * Author: Michael-Luke Jones <mlj28@cam.ac.uk>
9 * Based on ixdp-setup.c
10 * Copyright (C) 2003-2005 MontaVista Software, Inc.
12 * Author: Deepak Saxena <dsaxena@plexity.net>
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>
21 #include <linux/gpio/machine.h>
22 #include <asm/types.h>
23 #include <asm/setup.h>
24 #include <asm/memory.h>
25 #include <mach/hardware.h>
26 #include <asm/mach-types.h>
28 #include <asm/mach/arch.h>
29 #include <asm/mach/flash.h>
31 #define AVILA_SDA_PIN 7
32 #define AVILA_SCL_PIN 6
34 static struct flash_platform_data avila_flash_data
= {
35 .map_name
= "cfi_probe",
39 static struct resource avila_flash_resource
= {
40 .flags
= IORESOURCE_MEM
,
43 static struct platform_device avila_flash
= {
44 .name
= "IXP4XX-Flash",
47 .platform_data
= &avila_flash_data
,
50 .resource
= &avila_flash_resource
,
53 static struct gpiod_lookup_table avila_i2c_gpiod_table
= {
54 .dev_id
= "i2c-gpio.0",
56 GPIO_LOOKUP_IDX("IXP4XX_GPIO_CHIP", AVILA_SDA_PIN
,
57 NULL
, 0, GPIO_ACTIVE_HIGH
| GPIO_OPEN_DRAIN
),
58 GPIO_LOOKUP_IDX("IXP4XX_GPIO_CHIP", AVILA_SCL_PIN
,
59 NULL
, 1, GPIO_ACTIVE_HIGH
| GPIO_OPEN_DRAIN
),
63 static struct platform_device avila_i2c_gpio
= {
67 .platform_data
= NULL
,
71 static struct resource avila_uart_resources
[] = {
73 .start
= IXP4XX_UART1_BASE_PHYS
,
74 .end
= IXP4XX_UART1_BASE_PHYS
+ 0x0fff,
75 .flags
= IORESOURCE_MEM
78 .start
= IXP4XX_UART2_BASE_PHYS
,
79 .end
= IXP4XX_UART2_BASE_PHYS
+ 0x0fff,
80 .flags
= IORESOURCE_MEM
84 static struct plat_serial8250_port avila_uart_data
[] = {
86 .mapbase
= IXP4XX_UART1_BASE_PHYS
,
87 .membase
= (char *)IXP4XX_UART1_BASE_VIRT
+ REG_OFFSET
,
88 .irq
= IRQ_IXP4XX_UART1
,
89 .flags
= UPF_BOOT_AUTOCONF
| UPF_SKIP_TEST
,
92 .uartclk
= IXP4XX_UART_XTAL
,
95 .mapbase
= IXP4XX_UART2_BASE_PHYS
,
96 .membase
= (char *)IXP4XX_UART2_BASE_VIRT
+ REG_OFFSET
,
97 .irq
= IRQ_IXP4XX_UART2
,
98 .flags
= UPF_BOOT_AUTOCONF
| UPF_SKIP_TEST
,
101 .uartclk
= IXP4XX_UART_XTAL
,
106 static struct platform_device avila_uart
= {
107 .name
= "serial8250",
108 .id
= PLAT8250_DEV_PLATFORM
,
109 .dev
.platform_data
= avila_uart_data
,
111 .resource
= avila_uart_resources
114 static struct resource avila_pata_resources
[] = {
116 .flags
= IORESOURCE_MEM
119 .flags
= IORESOURCE_MEM
,
123 .start
= IRQ_IXP4XX_GPIO12
,
124 .end
= IRQ_IXP4XX_GPIO12
,
125 .flags
= IORESOURCE_IRQ
,
129 static struct ixp4xx_pata_data avila_pata_data
= {
130 .cs0_bits
= 0xbfff0043,
131 .cs1_bits
= 0xbfff0043,
134 static struct platform_device avila_pata
= {
135 .name
= "pata_ixp4xx_cf",
137 .dev
.platform_data
= &avila_pata_data
,
138 .num_resources
= ARRAY_SIZE(avila_pata_resources
),
139 .resource
= avila_pata_resources
,
142 static struct platform_device
*avila_devices
[] __initdata
= {
148 static void __init
avila_init(void)
152 avila_flash_resource
.start
= IXP4XX_EXP_BUS_BASE(0);
153 avila_flash_resource
.end
=
154 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size
- 1;
156 gpiod_add_lookup_table(&avila_i2c_gpiod_table
);
158 platform_add_devices(avila_devices
, ARRAY_SIZE(avila_devices
));
160 avila_pata_resources
[0].start
= IXP4XX_EXP_BUS_BASE(1);
161 avila_pata_resources
[0].end
= IXP4XX_EXP_BUS_END(1);
163 avila_pata_resources
[1].start
= IXP4XX_EXP_BUS_BASE(2);
164 avila_pata_resources
[1].end
= IXP4XX_EXP_BUS_END(2);
166 avila_pata_data
.cs0_cfg
= IXP4XX_EXP_CS1
;
167 avila_pata_data
.cs1_cfg
= IXP4XX_EXP_CS2
;
169 platform_device_register(&avila_pata
);
173 MACHINE_START(AVILA
, "Gateworks Avila Network Platform")
174 /* Maintainer: Deepak Saxena <dsaxena@plexity.net> */
175 .map_io
= ixp4xx_map_io
,
176 .init_early
= ixp4xx_init_early
,
177 .init_irq
= ixp4xx_init_irq
,
178 .init_time
= ixp4xx_timer_init
,
179 .atag_offset
= 0x100,
180 .init_machine
= avila_init
,
181 #if defined(CONFIG_PCI)
182 .dma_zone_size
= SZ_64M
,
184 .restart
= ixp4xx_restart
,
188 * Loft is functionally equivalent to Avila except that it has a
189 * different number for the maximum PCI devices. The MACHINE
190 * structure below is identical to Avila except for the comment.
192 #ifdef CONFIG_MACH_LOFT
193 MACHINE_START(LOFT
, "Giant Shoulder Inc Loft board")
194 /* Maintainer: Tom Billman <kernel@giantshoulderinc.com> */
195 .map_io
= ixp4xx_map_io
,
196 .init_early
= ixp4xx_init_early
,
197 .init_irq
= ixp4xx_init_irq
,
198 .init_time
= ixp4xx_timer_init
,
199 .atag_offset
= 0x100,
200 .init_machine
= avila_init
,
201 #if defined(CONFIG_PCI)
202 .dma_zone_size
= SZ_64M
,
204 .restart
= ixp4xx_restart
,