Alessandro Zummo | a7918f3 | 2005-11-10 14:05:04 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * arch/arm/mach-ixp4xx/nslu2-setup.c |
| 3 | * |
| 4 | * NSLU2 board-setup |
| 5 | * |
| 6 | * based ixdp425-setup.c: |
| 7 | * Copyright (C) 2003-2004 MontaVista Software, Inc. |
| 8 | * |
| 9 | * Author: Mark Rakes <mrakes at mac.com> |
| 10 | * Maintainers: http://www.nslu2-linux.org/ |
| 11 | * |
| 12 | * Fixed missing init_time in MACHINE_START kas11 10/22/04 |
| 13 | * Changed to conform to new style __init ixdp425 kas11 10/22/04 |
| 14 | */ |
| 15 | |
| 16 | #include <linux/kernel.h> |
| 17 | #include <linux/serial.h> |
| 18 | #include <linux/serial_8250.h> |
| 19 | |
| 20 | #include <asm/mach-types.h> |
| 21 | #include <asm/mach/arch.h> |
| 22 | #include <asm/mach/flash.h> |
| 23 | |
| 24 | static struct flash_platform_data nslu2_flash_data = { |
| 25 | .map_name = "cfi_probe", |
| 26 | .width = 2, |
| 27 | }; |
| 28 | |
| 29 | static struct resource nslu2_flash_resource = { |
| 30 | .start = NSLU2_FLASH_BASE, |
| 31 | .end = NSLU2_FLASH_BASE + NSLU2_FLASH_SIZE, |
| 32 | .flags = IORESOURCE_MEM, |
| 33 | }; |
| 34 | |
| 35 | static struct platform_device nslu2_flash = { |
| 36 | .name = "IXP4XX-Flash", |
| 37 | .id = 0, |
| 38 | .dev.platform_data = &nslu2_flash_data, |
| 39 | .num_resources = 1, |
| 40 | .resource = &nslu2_flash_resource, |
| 41 | }; |
| 42 | |
| 43 | static struct ixp4xx_i2c_pins nslu2_i2c_gpio_pins = { |
| 44 | .sda_pin = NSLU2_SDA_PIN, |
| 45 | .scl_pin = NSLU2_SCL_PIN, |
| 46 | }; |
| 47 | |
| 48 | static struct platform_device nslu2_i2c_controller = { |
| 49 | .name = "IXP4XX-I2C", |
| 50 | .id = 0, |
| 51 | .dev.platform_data = &nslu2_i2c_gpio_pins, |
| 52 | .num_resources = 0, |
| 53 | }; |
| 54 | |
| 55 | static struct resource nslu2_uart_resources[] = { |
| 56 | { |
| 57 | .start = IXP4XX_UART1_BASE_PHYS, |
| 58 | .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, |
| 59 | .flags = IORESOURCE_MEM, |
| 60 | }, |
| 61 | { |
| 62 | .start = IXP4XX_UART2_BASE_PHYS, |
| 63 | .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, |
| 64 | .flags = IORESOURCE_MEM, |
| 65 | } |
| 66 | }; |
| 67 | |
| 68 | static struct plat_serial8250_port nslu2_uart_data[] = { |
| 69 | { |
| 70 | .mapbase = IXP4XX_UART1_BASE_PHYS, |
| 71 | .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, |
| 72 | .irq = IRQ_IXP4XX_UART1, |
| 73 | .flags = UPF_BOOT_AUTOCONF, |
| 74 | .iotype = UPIO_MEM, |
| 75 | .regshift = 2, |
| 76 | .uartclk = IXP4XX_UART_XTAL, |
| 77 | }, |
| 78 | { |
| 79 | .mapbase = IXP4XX_UART2_BASE_PHYS, |
| 80 | .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, |
| 81 | .irq = IRQ_IXP4XX_UART2, |
| 82 | .flags = UPF_BOOT_AUTOCONF, |
| 83 | .iotype = UPIO_MEM, |
| 84 | .regshift = 2, |
| 85 | .uartclk = IXP4XX_UART_XTAL, |
| 86 | }, |
| 87 | { } |
| 88 | }; |
| 89 | |
| 90 | static struct platform_device nslu2_uart = { |
| 91 | .name = "serial8250", |
| 92 | .id = PLAT8250_DEV_PLATFORM, |
| 93 | .dev.platform_data = nslu2_uart_data, |
| 94 | .num_resources = 2, |
| 95 | .resource = nslu2_uart_resources, |
| 96 | }; |
| 97 | |
| 98 | static struct platform_device *nslu2_devices[] __initdata = { |
| 99 | &nslu2_i2c_controller, |
| 100 | &nslu2_flash, |
| 101 | &nslu2_uart, |
| 102 | }; |
| 103 | |
| 104 | static void nslu2_power_off(void) |
| 105 | { |
| 106 | /* This causes the box to drop the power and go dead. */ |
| 107 | |
| 108 | /* enable the pwr cntl gpio */ |
| 109 | gpio_line_config(NSLU2_PO_GPIO, IXP4XX_GPIO_OUT); |
| 110 | |
| 111 | /* do the deed */ |
| 112 | gpio_line_set(NSLU2_PO_GPIO, IXP4XX_GPIO_HIGH); |
| 113 | } |
| 114 | |
| 115 | static void __init nslu2_init(void) |
| 116 | { |
| 117 | ixp4xx_sys_init(); |
| 118 | |
| 119 | pm_power_off = nslu2_power_off; |
| 120 | |
| 121 | platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices)); |
| 122 | } |
| 123 | |
| 124 | MACHINE_START(NSLU2, "Linksys NSLU2") |
| 125 | /* Maintainer: www.nslu2-linux.org */ |
| 126 | .phys_ram = PHYS_OFFSET, |
| 127 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, |
| 128 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC, |
| 129 | .boot_params = 0x00000100, |
| 130 | .map_io = ixp4xx_map_io, |
| 131 | .init_irq = ixp4xx_init_irq, |
| 132 | .timer = &ixp4xx_timer, |
| 133 | .init_machine = nslu2_init, |
| 134 | MACHINE_END |