]> git.ipfire.org Git - thirdparty/linux.git/blame - arch/arm/mach-ixp4xx/avila-setup.c
i2c: gpio: Convert to use descriptors
[thirdparty/linux.git] / arch / arm / mach-ixp4xx / avila-setup.c
CommitLineData
0f185971
MLJ
1/*
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>
b2e63555 20#include <linux/gpio/machine.h>
0f185971
MLJ
21#include <asm/types.h>
22#include <asm/setup.h>
23#include <asm/memory.h>
a09e64fb 24#include <mach/hardware.h>
0f185971
MLJ
25#include <asm/mach-types.h>
26#include <asm/irq.h>
27#include <asm/mach/arch.h>
28#include <asm/mach/flash.h>
29
ec669696
KH
30#define AVILA_SDA_PIN 7
31#define AVILA_SCL_PIN 6
32
0f185971
MLJ
33static 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
b2e63555
LW
52static 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 },
0f185971
MLJ
60};
61
5a4a2387
MLJ
62static struct platform_device avila_i2c_gpio = {
63 .name = "i2c-gpio",
0f185971 64 .id = 0,
5a4a2387 65 .dev = {
b2e63555 66 .platform_data = NULL,
0f185971 67 },
0f185971
MLJ
68};
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
946acb1c
MLJ
113static 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
0f185971 141static struct platform_device *avila_devices[] __initdata = {
5a4a2387 142 &avila_i2c_gpio,
0f185971
MLJ
143 &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
b2e63555
LW
155 gpiod_add_lookup_table(&avila_i2c_gpiod_table);
156
0f185971 157 platform_add_devices(avila_devices, ARRAY_SIZE(avila_devices));
946acb1c
MLJ
158
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
0f185971
MLJ
170}
171
172MACHINE_START(AVILA, "Gateworks Avila Network Platform")
173 /* Maintainer: Deepak Saxena <dsaxena@plexity.net> */
0f185971 174 .map_io = ixp4xx_map_io,
f449588c 175 .init_early = ixp4xx_init_early,
0f185971 176 .init_irq = ixp4xx_init_irq,
6bb27d73 177 .init_time = ixp4xx_timer_init,
e022c729 178 .atag_offset = 0x100,
0f185971 179 .init_machine = avila_init,
7553ee77
NP
180#if defined(CONFIG_PCI)
181 .dma_zone_size = SZ_64M,
182#endif
d1b860fb 183 .restart = ixp4xx_restart,
0f185971
MLJ
184MACHINE_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> */
0f185971 194 .map_io = ixp4xx_map_io,
f449588c 195 .init_early = ixp4xx_init_early,
0f185971 196 .init_irq = ixp4xx_init_irq,
6bb27d73 197 .init_time = ixp4xx_timer_init,
e022c729 198 .atag_offset = 0x100,
0f185971 199 .init_machine = avila_init,
7553ee77
NP
200#if defined(CONFIG_PCI)
201 .dma_zone_size = SZ_64M,
202#endif
d1b860fb 203 .restart = ixp4xx_restart,
0f185971
MLJ
204MACHINE_END
205#endif
206