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