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