blob: 72122b5e7f285f09c14e08fd66aa7c56906227c9 [file] [log] [blame]
Michael-Luke Jones0f185972006-12-16 23:04:05 +01001/*
2 * arch/arm/mach-ixp4xx/avila-setup.c
3 *
4 * Gateworks Avila board-setup
5 *
6 * Author: Michael-Luke Jones <mlj28@cam.ac.uk>
7 *
8 * Based on ixdp-setup.c
9 * Copyright (C) 2003-2005 MontaVista Software, Inc.
10 *
11 * Author: Deepak Saxena <dsaxena@plexity.net>
12 */
13
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/device.h>
17#include <linux/serial.h>
18#include <linux/tty.h>
19#include <linux/serial_8250.h>
Linus Walleijb2e63552017-09-10 01:30:46 +020020#include <linux/gpio/machine.h>
Michael-Luke Jones0f185972006-12-16 23:04:05 +010021#include <asm/types.h>
22#include <asm/setup.h>
23#include <asm/memory.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010024#include <mach/hardware.h>
Michael-Luke Jones0f185972006-12-16 23:04:05 +010025#include <asm/mach-types.h>
26#include <asm/irq.h>
27#include <asm/mach/arch.h>
28#include <asm/mach/flash.h>
29
Krzysztof HaƂasaec669692009-11-16 15:39:11 +010030#define AVILA_SDA_PIN 7
31#define AVILA_SCL_PIN 6
32
Michael-Luke Jones0f185972006-12-16 23:04:05 +010033static struct flash_platform_data avila_flash_data = {
34 .map_name = "cfi_probe",
35 .width = 2,
36};
37
38static struct resource avila_flash_resource = {
39 .flags = IORESOURCE_MEM,
40};
41
42static struct platform_device avila_flash = {
43 .name = "IXP4XX-Flash",
44 .id = 0,
45 .dev = {
46 .platform_data = &avila_flash_data,
47 },
48 .num_resources = 1,
49 .resource = &avila_flash_resource,
50};
51
Linus Walleijb2e63552017-09-10 01:30:46 +020052static struct gpiod_lookup_table avila_i2c_gpiod_table = {
53 .dev_id = "i2c-gpio",
54 .table = {
55 GPIO_LOOKUP_IDX("IXP4XX_GPIO_CHIP", AVILA_SDA_PIN,
56 NULL, 0, GPIO_ACTIVE_HIGH),
57 GPIO_LOOKUP_IDX("IXP4XX_GPIO_CHIP", AVILA_SCL_PIN,
58 NULL, 1, GPIO_ACTIVE_HIGH),
59 },
Michael-Luke Jones0f185972006-12-16 23:04:05 +010060};
61
Michael-Luke Jones5a4a2382008-01-27 18:14:46 +010062static struct platform_device avila_i2c_gpio = {
63 .name = "i2c-gpio",
Michael-Luke Jones0f185972006-12-16 23:04:05 +010064 .id = 0,
Michael-Luke Jones5a4a2382008-01-27 18:14:46 +010065 .dev = {
Linus Walleijb2e63552017-09-10 01:30:46 +020066 .platform_data = NULL,
Michael-Luke Jones0f185972006-12-16 23:04:05 +010067 },
Michael-Luke Jones0f185972006-12-16 23:04:05 +010068};
69
70static struct resource avila_uart_resources[] = {
71 {
72 .start = IXP4XX_UART1_BASE_PHYS,
73 .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
74 .flags = IORESOURCE_MEM
75 },
76 {
77 .start = IXP4XX_UART2_BASE_PHYS,
78 .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
79 .flags = IORESOURCE_MEM
80 }
81};
82
83static struct plat_serial8250_port avila_uart_data[] = {
84 {
85 .mapbase = IXP4XX_UART1_BASE_PHYS,
86 .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
87 .irq = IRQ_IXP4XX_UART1,
88 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
89 .iotype = UPIO_MEM,
90 .regshift = 2,
91 .uartclk = IXP4XX_UART_XTAL,
92 },
93 {
94 .mapbase = IXP4XX_UART2_BASE_PHYS,
95 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
96 .irq = IRQ_IXP4XX_UART2,
97 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
98 .iotype = UPIO_MEM,
99 .regshift = 2,
100 .uartclk = IXP4XX_UART_XTAL,
101 },
102 { },
103};
104
105static struct platform_device avila_uart = {
106 .name = "serial8250",
107 .id = PLAT8250_DEV_PLATFORM,
108 .dev.platform_data = avila_uart_data,
109 .num_resources = 2,
110 .resource = avila_uart_resources
111};
112
Michael-Luke Jones946acb12006-12-16 23:02:00 +0100113static struct resource avila_pata_resources[] = {
114 {
115 .flags = IORESOURCE_MEM
116 },
117 {
118 .flags = IORESOURCE_MEM,
119 },
120 {
121 .name = "intrq",
122 .start = IRQ_IXP4XX_GPIO12,
123 .end = IRQ_IXP4XX_GPIO12,
124 .flags = IORESOURCE_IRQ,
125 },
126};
127
128static struct ixp4xx_pata_data avila_pata_data = {
129 .cs0_bits = 0xbfff0043,
130 .cs1_bits = 0xbfff0043,
131};
132
133static struct platform_device avila_pata = {
134 .name = "pata_ixp4xx_cf",
135 .id = 0,
136 .dev.platform_data = &avila_pata_data,
137 .num_resources = ARRAY_SIZE(avila_pata_resources),
138 .resource = avila_pata_resources,
139};
140
Michael-Luke Jones0f185972006-12-16 23:04:05 +0100141static struct platform_device *avila_devices[] __initdata = {
Michael-Luke Jones5a4a2382008-01-27 18:14:46 +0100142 &avila_i2c_gpio,
Michael-Luke Jones0f185972006-12-16 23:04:05 +0100143 &avila_flash,
144 &avila_uart
145};
146
147static void __init avila_init(void)
148{
149 ixp4xx_sys_init();
150
151 avila_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
152 avila_flash_resource.end =
153 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
154
Linus Walleijb2e63552017-09-10 01:30:46 +0200155 gpiod_add_lookup_table(&avila_i2c_gpiod_table);
156
Michael-Luke Jones0f185972006-12-16 23:04:05 +0100157 platform_add_devices(avila_devices, ARRAY_SIZE(avila_devices));
Michael-Luke Jones946acb12006-12-16 23:02:00 +0100158
159 avila_pata_resources[0].start = IXP4XX_EXP_BUS_BASE(1);
160 avila_pata_resources[0].end = IXP4XX_EXP_BUS_END(1);
161
162 avila_pata_resources[1].start = IXP4XX_EXP_BUS_BASE(2);
163 avila_pata_resources[1].end = IXP4XX_EXP_BUS_END(2);
164
165 avila_pata_data.cs0_cfg = IXP4XX_EXP_CS1;
166 avila_pata_data.cs1_cfg = IXP4XX_EXP_CS2;
167
168 platform_device_register(&avila_pata);
169
Michael-Luke Jones0f185972006-12-16 23:04:05 +0100170}
171
172MACHINE_START(AVILA, "Gateworks Avila Network Platform")
173 /* Maintainer: Deepak Saxena <dsaxena@plexity.net> */
Michael-Luke Jones0f185972006-12-16 23:04:05 +0100174 .map_io = ixp4xx_map_io,
Rob Herringf4495882012-03-06 15:01:53 -0600175 .init_early = ixp4xx_init_early,
Michael-Luke Jones0f185972006-12-16 23:04:05 +0100176 .init_irq = ixp4xx_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700177 .init_time = ixp4xx_timer_init,
Nicolas Pitree022c722011-07-05 22:38:13 -0400178 .atag_offset = 0x100,
Michael-Luke Jones0f185972006-12-16 23:04:05 +0100179 .init_machine = avila_init,
Nicolas Pitre7553ee72011-07-05 22:28:09 -0400180#if defined(CONFIG_PCI)
181 .dma_zone_size = SZ_64M,
182#endif
Russell Kingd1b860f2011-11-05 12:10:55 +0000183 .restart = ixp4xx_restart,
Michael-Luke Jones0f185972006-12-16 23:04:05 +0100184MACHINE_END
185
186 /*
187 * Loft is functionally equivalent to Avila except that it has a
188 * different number for the maximum PCI devices. The MACHINE
189 * structure below is identical to Avila except for the comment.
190 */
191#ifdef CONFIG_MACH_LOFT
192MACHINE_START(LOFT, "Giant Shoulder Inc Loft board")
193 /* Maintainer: Tom Billman <kernel@giantshoulderinc.com> */
Michael-Luke Jones0f185972006-12-16 23:04:05 +0100194 .map_io = ixp4xx_map_io,
Rob Herringf4495882012-03-06 15:01:53 -0600195 .init_early = ixp4xx_init_early,
Michael-Luke Jones0f185972006-12-16 23:04:05 +0100196 .init_irq = ixp4xx_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700197 .init_time = ixp4xx_timer_init,
Nicolas Pitree022c722011-07-05 22:38:13 -0400198 .atag_offset = 0x100,
Michael-Luke Jones0f185972006-12-16 23:04:05 +0100199 .init_machine = avila_init,
Nicolas Pitre7553ee72011-07-05 22:28:09 -0400200#if defined(CONFIG_PCI)
201 .dma_zone_size = SZ_64M,
202#endif
Russell Kingd1b860f2011-11-05 12:10:55 +0000203 .restart = ixp4xx_restart,
Michael-Luke Jones0f185972006-12-16 23:04:05 +0100204MACHINE_END
205#endif
206