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> |
| 21 | |
| 22 | #include <asm/types.h> |
| 23 | #include <asm/setup.h> |
| 24 | #include <asm/memory.h> |
| 25 | #include <asm/hardware.h> |
| 26 | #include <asm/mach-types.h> |
| 27 | #include <asm/irq.h> |
| 28 | #include <asm/mach/arch.h> |
| 29 | #include <asm/mach/flash.h> |
| 30 | |
| 31 | static struct flash_platform_data avila_flash_data = { |
| 32 | .map_name = "cfi_probe", |
| 33 | .width = 2, |
| 34 | }; |
| 35 | |
| 36 | static struct resource avila_flash_resource = { |
| 37 | .flags = IORESOURCE_MEM, |
| 38 | }; |
| 39 | |
| 40 | static struct platform_device avila_flash = { |
| 41 | .name = "IXP4XX-Flash", |
| 42 | .id = 0, |
| 43 | .dev = { |
| 44 | .platform_data = &avila_flash_data, |
| 45 | }, |
| 46 | .num_resources = 1, |
| 47 | .resource = &avila_flash_resource, |
| 48 | }; |
| 49 | |
| 50 | static struct ixp4xx_i2c_pins avila_i2c_gpio_pins = { |
| 51 | .sda_pin = AVILA_SDA_PIN, |
| 52 | .scl_pin = AVILA_SCL_PIN, |
| 53 | }; |
| 54 | |
| 55 | static struct platform_device avila_i2c_controller = { |
| 56 | .name = "IXP4XX-I2C", |
| 57 | .id = 0, |
| 58 | .dev = { |
| 59 | .platform_data = &avila_i2c_gpio_pins, |
| 60 | }, |
| 61 | .num_resources = 0 |
| 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 | |
| 107 | static struct platform_device *avila_devices[] __initdata = { |
| 108 | &avila_i2c_controller, |
| 109 | &avila_flash, |
| 110 | &avila_uart |
| 111 | }; |
| 112 | |
| 113 | static void __init avila_init(void) |
| 114 | { |
| 115 | ixp4xx_sys_init(); |
| 116 | |
| 117 | avila_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); |
| 118 | avila_flash_resource.end = |
| 119 | IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; |
| 120 | |
| 121 | platform_add_devices(avila_devices, ARRAY_SIZE(avila_devices)); |
| 122 | } |
| 123 | |
| 124 | MACHINE_START(AVILA, "Gateworks Avila Network Platform") |
| 125 | /* Maintainer: Deepak Saxena <dsaxena@plexity.net> */ |
| 126 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, |
| 127 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, |
| 128 | .map_io = ixp4xx_map_io, |
| 129 | .init_irq = ixp4xx_init_irq, |
| 130 | .timer = &ixp4xx_timer, |
| 131 | .boot_params = 0x0100, |
| 132 | .init_machine = avila_init, |
| 133 | MACHINE_END |
| 134 | |
| 135 | /* |
| 136 | * Loft is functionally equivalent to Avila except that it has a |
| 137 | * different number for the maximum PCI devices. The MACHINE |
| 138 | * structure below is identical to Avila except for the comment. |
| 139 | */ |
| 140 | #ifdef CONFIG_MACH_LOFT |
| 141 | MACHINE_START(LOFT, "Giant Shoulder Inc Loft board") |
| 142 | /* Maintainer: Tom Billman <kernel@giantshoulderinc.com> */ |
| 143 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, |
| 144 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, |
| 145 | .map_io = ixp4xx_map_io, |
| 146 | .init_irq = ixp4xx_init_irq, |
| 147 | .timer = &ixp4xx_timer, |
| 148 | .boot_params = 0x0100, |
| 149 | .init_machine = avila_init, |
| 150 | MACHINE_END |
| 151 | #endif |
| 152 | |