Michael-Luke Jones | 0f18597 | 2006-12-16 23:04:05 +0100 | [diff] [blame] | 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> |
| 20 | #include <linux/slab.h> |
Michael-Luke Jones | 5a4a238 | 2008-01-27 18:14:46 +0100 | [diff] [blame] | 21 | #include <linux/i2c-gpio.h> |
Michael-Luke Jones | 0f18597 | 2006-12-16 23:04:05 +0100 | [diff] [blame] | 22 | #include <asm/types.h> |
| 23 | #include <asm/setup.h> |
| 24 | #include <asm/memory.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 25 | #include <mach/hardware.h> |
Michael-Luke Jones | 0f18597 | 2006-12-16 23:04:05 +0100 | [diff] [blame] | 26 | #include <asm/mach-types.h> |
| 27 | #include <asm/irq.h> |
| 28 | #include <asm/mach/arch.h> |
| 29 | #include <asm/mach/flash.h> |
| 30 | |
Krzysztof HaĆasa | ec66969 | 2009-11-16 15:39:11 +0100 | [diff] [blame] | 31 | #define AVILA_SDA_PIN 7 |
| 32 | #define AVILA_SCL_PIN 6 |
| 33 | |
Michael-Luke Jones | 0f18597 | 2006-12-16 23:04:05 +0100 | [diff] [blame] | 34 | static struct flash_platform_data avila_flash_data = { |
| 35 | .map_name = "cfi_probe", |
| 36 | .width = 2, |
| 37 | }; |
| 38 | |
| 39 | static struct resource avila_flash_resource = { |
| 40 | .flags = IORESOURCE_MEM, |
| 41 | }; |
| 42 | |
| 43 | static struct platform_device avila_flash = { |
| 44 | .name = "IXP4XX-Flash", |
| 45 | .id = 0, |
| 46 | .dev = { |
| 47 | .platform_data = &avila_flash_data, |
| 48 | }, |
| 49 | .num_resources = 1, |
| 50 | .resource = &avila_flash_resource, |
| 51 | }; |
| 52 | |
Michael-Luke Jones | 5a4a238 | 2008-01-27 18:14:46 +0100 | [diff] [blame] | 53 | static struct i2c_gpio_platform_data avila_i2c_gpio_data = { |
Michael-Luke Jones | 0f18597 | 2006-12-16 23:04:05 +0100 | [diff] [blame] | 54 | .sda_pin = AVILA_SDA_PIN, |
| 55 | .scl_pin = AVILA_SCL_PIN, |
| 56 | }; |
| 57 | |
Michael-Luke Jones | 5a4a238 | 2008-01-27 18:14:46 +0100 | [diff] [blame] | 58 | static struct platform_device avila_i2c_gpio = { |
| 59 | .name = "i2c-gpio", |
Michael-Luke Jones | 0f18597 | 2006-12-16 23:04:05 +0100 | [diff] [blame] | 60 | .id = 0, |
Michael-Luke Jones | 5a4a238 | 2008-01-27 18:14:46 +0100 | [diff] [blame] | 61 | .dev = { |
| 62 | .platform_data = &avila_i2c_gpio_data, |
Michael-Luke Jones | 0f18597 | 2006-12-16 23:04:05 +0100 | [diff] [blame] | 63 | }, |
Michael-Luke Jones | 0f18597 | 2006-12-16 23:04:05 +0100 | [diff] [blame] | 64 | }; |
| 65 | |
| 66 | static struct resource avila_uart_resources[] = { |
| 67 | { |
| 68 | .start = IXP4XX_UART1_BASE_PHYS, |
| 69 | .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, |
| 70 | .flags = IORESOURCE_MEM |
| 71 | }, |
| 72 | { |
| 73 | .start = IXP4XX_UART2_BASE_PHYS, |
| 74 | .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, |
| 75 | .flags = IORESOURCE_MEM |
| 76 | } |
| 77 | }; |
| 78 | |
| 79 | static struct plat_serial8250_port avila_uart_data[] = { |
| 80 | { |
| 81 | .mapbase = IXP4XX_UART1_BASE_PHYS, |
| 82 | .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, |
| 83 | .irq = IRQ_IXP4XX_UART1, |
| 84 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, |
| 85 | .iotype = UPIO_MEM, |
| 86 | .regshift = 2, |
| 87 | .uartclk = IXP4XX_UART_XTAL, |
| 88 | }, |
| 89 | { |
| 90 | .mapbase = IXP4XX_UART2_BASE_PHYS, |
| 91 | .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, |
| 92 | .irq = IRQ_IXP4XX_UART2, |
| 93 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, |
| 94 | .iotype = UPIO_MEM, |
| 95 | .regshift = 2, |
| 96 | .uartclk = IXP4XX_UART_XTAL, |
| 97 | }, |
| 98 | { }, |
| 99 | }; |
| 100 | |
| 101 | static struct platform_device avila_uart = { |
| 102 | .name = "serial8250", |
| 103 | .id = PLAT8250_DEV_PLATFORM, |
| 104 | .dev.platform_data = avila_uart_data, |
| 105 | .num_resources = 2, |
| 106 | .resource = avila_uart_resources |
| 107 | }; |
| 108 | |
Michael-Luke Jones | 946acb1 | 2006-12-16 23:02:00 +0100 | [diff] [blame] | 109 | static struct resource avila_pata_resources[] = { |
| 110 | { |
| 111 | .flags = IORESOURCE_MEM |
| 112 | }, |
| 113 | { |
| 114 | .flags = IORESOURCE_MEM, |
| 115 | }, |
| 116 | { |
| 117 | .name = "intrq", |
| 118 | .start = IRQ_IXP4XX_GPIO12, |
| 119 | .end = IRQ_IXP4XX_GPIO12, |
| 120 | .flags = IORESOURCE_IRQ, |
| 121 | }, |
| 122 | }; |
| 123 | |
| 124 | static struct ixp4xx_pata_data avila_pata_data = { |
| 125 | .cs0_bits = 0xbfff0043, |
| 126 | .cs1_bits = 0xbfff0043, |
| 127 | }; |
| 128 | |
| 129 | static struct platform_device avila_pata = { |
| 130 | .name = "pata_ixp4xx_cf", |
| 131 | .id = 0, |
| 132 | .dev.platform_data = &avila_pata_data, |
| 133 | .num_resources = ARRAY_SIZE(avila_pata_resources), |
| 134 | .resource = avila_pata_resources, |
| 135 | }; |
| 136 | |
Michael-Luke Jones | 0f18597 | 2006-12-16 23:04:05 +0100 | [diff] [blame] | 137 | static struct platform_device *avila_devices[] __initdata = { |
Michael-Luke Jones | 5a4a238 | 2008-01-27 18:14:46 +0100 | [diff] [blame] | 138 | &avila_i2c_gpio, |
Michael-Luke Jones | 0f18597 | 2006-12-16 23:04:05 +0100 | [diff] [blame] | 139 | &avila_flash, |
| 140 | &avila_uart |
| 141 | }; |
| 142 | |
| 143 | static void __init avila_init(void) |
| 144 | { |
| 145 | ixp4xx_sys_init(); |
| 146 | |
| 147 | avila_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); |
| 148 | avila_flash_resource.end = |
| 149 | IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; |
| 150 | |
| 151 | platform_add_devices(avila_devices, ARRAY_SIZE(avila_devices)); |
Michael-Luke Jones | 946acb1 | 2006-12-16 23:02:00 +0100 | [diff] [blame] | 152 | |
| 153 | avila_pata_resources[0].start = IXP4XX_EXP_BUS_BASE(1); |
| 154 | avila_pata_resources[0].end = IXP4XX_EXP_BUS_END(1); |
| 155 | |
| 156 | avila_pata_resources[1].start = IXP4XX_EXP_BUS_BASE(2); |
| 157 | avila_pata_resources[1].end = IXP4XX_EXP_BUS_END(2); |
| 158 | |
| 159 | avila_pata_data.cs0_cfg = IXP4XX_EXP_CS1; |
| 160 | avila_pata_data.cs1_cfg = IXP4XX_EXP_CS2; |
| 161 | |
| 162 | platform_device_register(&avila_pata); |
| 163 | |
Michael-Luke Jones | 0f18597 | 2006-12-16 23:04:05 +0100 | [diff] [blame] | 164 | } |
| 165 | |
| 166 | MACHINE_START(AVILA, "Gateworks Avila Network Platform") |
| 167 | /* Maintainer: Deepak Saxena <dsaxena@plexity.net> */ |
| 168 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, |
| 169 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, |
| 170 | .map_io = ixp4xx_map_io, |
| 171 | .init_irq = ixp4xx_init_irq, |
| 172 | .timer = &ixp4xx_timer, |
| 173 | .boot_params = 0x0100, |
| 174 | .init_machine = avila_init, |
| 175 | MACHINE_END |
| 176 | |
| 177 | /* |
| 178 | * Loft is functionally equivalent to Avila except that it has a |
| 179 | * different number for the maximum PCI devices. The MACHINE |
| 180 | * structure below is identical to Avila except for the comment. |
| 181 | */ |
| 182 | #ifdef CONFIG_MACH_LOFT |
| 183 | MACHINE_START(LOFT, "Giant Shoulder Inc Loft board") |
| 184 | /* Maintainer: Tom Billman <kernel@giantshoulderinc.com> */ |
| 185 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, |
| 186 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, |
| 187 | .map_io = ixp4xx_map_io, |
| 188 | .init_irq = ixp4xx_init_irq, |
| 189 | .timer = &ixp4xx_timer, |
| 190 | .boot_params = 0x0100, |
| 191 | .init_machine = avila_init, |
| 192 | MACHINE_END |
| 193 | #endif |
| 194 | |