Linux 5.6.13
[linux/fpc-iii.git] / arch / arm / mach-ixp4xx / avila-setup.c
blob1981b33109cb3e5415bf98f95ba9e9a1666d15c8
1 // SPDX-License-Identifier: GPL-2.0
2 /*
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>
27 #include <asm/irq.h>
28 #include <asm/mach/arch.h>
29 #include <asm/mach/flash.h>
31 #include "irqs.h"
33 #define AVILA_SDA_PIN 7
34 #define AVILA_SCL_PIN 6
36 static struct flash_platform_data avila_flash_data = {
37 .map_name = "cfi_probe",
38 .width = 2,
41 static struct resource avila_flash_resource = {
42 .flags = IORESOURCE_MEM,
45 static struct platform_device avila_flash = {
46 .name = "IXP4XX-Flash",
47 .id = 0,
48 .dev = {
49 .platform_data = &avila_flash_data,
51 .num_resources = 1,
52 .resource = &avila_flash_resource,
55 static struct gpiod_lookup_table avila_i2c_gpiod_table = {
56 .dev_id = "i2c-gpio.0",
57 .table = {
58 GPIO_LOOKUP_IDX("IXP4XX_GPIO_CHIP", AVILA_SDA_PIN,
59 NULL, 0, GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
60 GPIO_LOOKUP_IDX("IXP4XX_GPIO_CHIP", AVILA_SCL_PIN,
61 NULL, 1, GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
65 static struct platform_device avila_i2c_gpio = {
66 .name = "i2c-gpio",
67 .id = 0,
68 .dev = {
69 .platform_data = NULL,
73 static struct resource avila_uart_resources[] = {
75 .start = IXP4XX_UART1_BASE_PHYS,
76 .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
77 .flags = IORESOURCE_MEM
80 .start = IXP4XX_UART2_BASE_PHYS,
81 .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
82 .flags = IORESOURCE_MEM
86 static struct plat_serial8250_port avila_uart_data[] = {
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,
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,
105 { },
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
116 static struct resource avila_pata_resources[] = {
118 .flags = IORESOURCE_MEM
121 .flags = IORESOURCE_MEM,
124 .name = "intrq",
125 .start = IRQ_IXP4XX_GPIO12,
126 .end = IRQ_IXP4XX_GPIO12,
127 .flags = IORESOURCE_IRQ,
131 static struct ixp4xx_pata_data avila_pata_data = {
132 .cs0_bits = 0xbfff0043,
133 .cs1_bits = 0xbfff0043,
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,
144 static struct platform_device *avila_devices[] __initdata = {
145 &avila_i2c_gpio,
146 &avila_flash,
147 &avila_uart
150 static void __init avila_init(void)
152 ixp4xx_sys_init();
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;
158 gpiod_add_lookup_table(&avila_i2c_gpiod_table);
160 platform_add_devices(avila_devices, ARRAY_SIZE(avila_devices));
162 avila_pata_resources[0].start = IXP4XX_EXP_BUS_BASE(1);
163 avila_pata_resources[0].end = IXP4XX_EXP_BUS_END(1);
165 avila_pata_resources[1].start = IXP4XX_EXP_BUS_BASE(2);
166 avila_pata_resources[1].end = IXP4XX_EXP_BUS_END(2);
168 avila_pata_data.cs0_cfg = IXP4XX_EXP_CS1;
169 avila_pata_data.cs1_cfg = IXP4XX_EXP_CS2;
171 platform_device_register(&avila_pata);
175 MACHINE_START(AVILA, "Gateworks Avila Network Platform")
176 /* Maintainer: Deepak Saxena <dsaxena@plexity.net> */
177 .map_io = ixp4xx_map_io,
178 .init_early = ixp4xx_init_early,
179 .init_irq = ixp4xx_init_irq,
180 .init_time = ixp4xx_timer_init,
181 .atag_offset = 0x100,
182 .init_machine = avila_init,
183 #if defined(CONFIG_PCI)
184 .dma_zone_size = SZ_64M,
185 #endif
186 .restart = ixp4xx_restart,
187 MACHINE_END
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.
194 #ifdef CONFIG_MACH_LOFT
195 MACHINE_START(LOFT, "Giant Shoulder Inc Loft board")
196 /* Maintainer: Tom Billman <kernel@giantshoulderinc.com> */
197 .map_io = ixp4xx_map_io,
198 .init_early = ixp4xx_init_early,
199 .init_irq = ixp4xx_init_irq,
200 .init_time = ixp4xx_timer_init,
201 .atag_offset = 0x100,
202 .init_machine = avila_init,
203 #if defined(CONFIG_PCI)
204 .dma_zone_size = SZ_64M,
205 #endif
206 .restart = ixp4xx_restart,
207 MACHINE_END
208 #endif