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 <linux/platform_data/pata_ixp4xx_cf.h>
23 #include <asm/types.h>
24 #include <asm/setup.h>
25 #include <asm/memory.h>
26 #include <mach/hardware.h>
27 #include <asm/mach-types.h>
29 #include <asm/mach/arch.h>
30 #include <asm/mach/flash.h>
34 #define AVILA_SDA_PIN 7
35 #define AVILA_SCL_PIN 6
37 static struct flash_platform_data avila_flash_data = {
38 .map_name = "cfi_probe",
42 static struct resource avila_flash_resource = {
43 .flags = IORESOURCE_MEM,
46 static struct platform_device avila_flash = {
47 .name = "IXP4XX-Flash",
50 .platform_data = &avila_flash_data,
53 .resource = &avila_flash_resource,
56 static struct gpiod_lookup_table avila_i2c_gpiod_table = {
57 .dev_id = "i2c-gpio.0",
59 GPIO_LOOKUP_IDX("IXP4XX_GPIO_CHIP", AVILA_SDA_PIN,
60 NULL, 0, GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
61 GPIO_LOOKUP_IDX("IXP4XX_GPIO_CHIP", AVILA_SCL_PIN,
62 NULL, 1, GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
66 static struct platform_device avila_i2c_gpio = {
70 .platform_data = NULL,
74 static struct resource avila_uart_resources[] = {
76 .start = IXP4XX_UART1_BASE_PHYS,
77 .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
78 .flags = IORESOURCE_MEM
81 .start = IXP4XX_UART2_BASE_PHYS,
82 .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
83 .flags = IORESOURCE_MEM
87 static struct plat_serial8250_port avila_uart_data[] = {
89 .mapbase = IXP4XX_UART1_BASE_PHYS,
90 .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
91 .irq = IRQ_IXP4XX_UART1,
92 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
95 .uartclk = IXP4XX_UART_XTAL,
98 .mapbase = IXP4XX_UART2_BASE_PHYS,
99 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
100 .irq = IRQ_IXP4XX_UART2,
101 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
104 .uartclk = IXP4XX_UART_XTAL,
109 static struct platform_device avila_uart = {
110 .name = "serial8250",
111 .id = PLAT8250_DEV_PLATFORM,
112 .dev.platform_data = avila_uart_data,
114 .resource = avila_uart_resources
117 static struct resource avila_pata_resources[] = {
119 .flags = IORESOURCE_MEM
122 .flags = IORESOURCE_MEM,
126 .start = IRQ_IXP4XX_GPIO12,
127 .end = IRQ_IXP4XX_GPIO12,
128 .flags = IORESOURCE_IRQ,
132 static struct ixp4xx_pata_data avila_pata_data = {
133 .cs0_bits = 0xbfff0043,
134 .cs1_bits = 0xbfff0043,
137 static struct platform_device avila_pata = {
138 .name = "pata_ixp4xx_cf",
140 .dev.platform_data = &avila_pata_data,
141 .num_resources = ARRAY_SIZE(avila_pata_resources),
142 .resource = avila_pata_resources,
145 static struct platform_device *avila_devices[] __initdata = {
151 static void __init avila_init(void)
155 avila_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
156 avila_flash_resource.end =
157 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
159 gpiod_add_lookup_table(&avila_i2c_gpiod_table);
161 platform_add_devices(avila_devices, ARRAY_SIZE(avila_devices));
163 avila_pata_resources[0].start = IXP4XX_EXP_BUS_BASE(1);
164 avila_pata_resources[0].end = IXP4XX_EXP_BUS_END(1);
166 avila_pata_resources[1].start = IXP4XX_EXP_BUS_BASE(2);
167 avila_pata_resources[1].end = IXP4XX_EXP_BUS_END(2);
169 avila_pata_data.cs0_cfg = IXP4XX_EXP_CS1;
170 avila_pata_data.cs1_cfg = IXP4XX_EXP_CS2;
172 platform_device_register(&avila_pata);
176 MACHINE_START(AVILA, "Gateworks Avila Network Platform")
177 /* Maintainer: Deepak Saxena <dsaxena@plexity.net> */
178 .map_io = ixp4xx_map_io,
179 .init_early = ixp4xx_init_early,
180 .init_irq = ixp4xx_init_irq,
181 .init_time = ixp4xx_timer_init,
182 .atag_offset = 0x100,
183 .init_machine = avila_init,
184 #if defined(CONFIG_PCI)
185 .dma_zone_size = SZ_64M,
187 .restart = ixp4xx_restart,
191 * Loft is functionally equivalent to Avila except that it has a
192 * different number for the maximum PCI devices. The MACHINE
193 * structure below is identical to Avila except for the comment.
195 #ifdef CONFIG_MACH_LOFT
196 MACHINE_START(LOFT, "Giant Shoulder Inc Loft board")
197 /* Maintainer: Tom Billman <kernel@giantshoulderinc.com> */
198 .map_io = ixp4xx_map_io,
199 .init_early = ixp4xx_init_early,
200 .init_irq = ixp4xx_init_irq,
201 .init_time = ixp4xx_timer_init,
202 .atag_offset = 0x100,
203 .init_machine = avila_init,
204 #if defined(CONFIG_PCI)
205 .dma_zone_size = SZ_64M,
207 .restart = ixp4xx_restart,