]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/linux/nslu2-kernel/2.6.12/nslu2-setup.c
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / linux / nslu2-kernel / 2.6.12 / nslu2-setup.c
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/init.h>
18 #include <linux/device.h>
19 #include <linux/serial.h>
20 #include <linux/tty.h>
21 #include <linux/serial_8250.h>
22
23 #include <asm/types.h>
24 #include <asm/setup.h>
25 #include <asm/memory.h>
26 #include <asm/hardware.h>
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 void __init nslu2_map_io(void) 
33 {
34         ixp4xx_map_io();
35 }
36
37 static struct flash_platform_data nslu2_flash_data = {
38         .map_name       = "cfi_probe",
39         .width          = 2,
40 };
41
42 static struct resource nslu2_flash_resource = {
43         .start          = NSLU2_FLASH_BASE,
44         .end            = NSLU2_FLASH_BASE + NSLU2_FLASH_SIZE,
45         .flags          = IORESOURCE_MEM,
46 };
47
48 static struct platform_device nslu2_flash = {
49         .name           = "IXP4XX-Flash",
50         .id             = 0,
51         .dev            = {
52                 .platform_data = &nslu2_flash_data,
53         },
54         .num_resources  = 1,
55         .resource       = &nslu2_flash_resource,
56 };
57
58 static struct ixp4xx_i2c_pins nslu2_i2c_gpio_pins = {
59         .sda_pin        = NSLU2_SDA_PIN,
60         .scl_pin        = NSLU2_SCL_PIN,
61 };
62
63 static struct platform_device nslu2_i2c_controller = {
64         .name           = "IXP4XX-I2C",
65         .id             = 0,
66         .dev            = {
67                 .platform_data = &nslu2_i2c_gpio_pins,
68         },
69         .num_resources  = 0
70 };
71
72 static struct resource nslu2_uart_resources[] = {
73         {
74                 .start          = IXP4XX_UART1_BASE_PHYS,
75                 .end            = IXP4XX_UART1_BASE_PHYS + 0x0fff,
76                 .flags          = IORESOURCE_MEM
77         },
78         {
79                 .start          = IXP4XX_UART2_BASE_PHYS,
80                 .end            = IXP4XX_UART2_BASE_PHYS + 0x0fff,
81                 .flags          = IORESOURCE_MEM
82         }
83 };
84
85 static struct plat_serial8250_port nslu2_uart_data[] = {
86         {
87                 .mapbase        = IXP4XX_UART1_BASE_PHYS,
88                 .membase        = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
89                 .irq            = IRQ_IXP4XX_UART1,
90                 .flags          = UPF_BOOT_AUTOCONF,
91                 .iotype         = UPIO_MEM,
92                 .regshift       = 2,
93                 .uartclk        = IXP4XX_UART_XTAL,
94         },
95         {
96                 .mapbase        = IXP4XX_UART2_BASE_PHYS,
97                 .membase        = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
98                 .irq            = IRQ_IXP4XX_UART2,
99                 .flags          = UPF_BOOT_AUTOCONF,
100                 .iotype         = UPIO_MEM,
101                 .regshift       = 2,
102                 .uartclk        = IXP4XX_UART_XTAL,
103         }
104 };
105
106 static struct platform_device nslu2_uart = {
107         .name                   = "serial8250",
108         .id                     = 0,
109         .dev.platform_data      = nslu2_uart_data,
110         .num_resources          = 2,
111         .resource               = nslu2_uart_resources
112 };
113
114 static struct platform_device *nslu2_devices[] __initdata = {
115         &nslu2_i2c_controller,
116         &nslu2_flash,
117         &nslu2_uart
118 };
119
120 static void n2_power_off(void)
121 {
122         /* This causes the box to drop the power and go dead. */
123 #define GPIO_PO_BM              0x0100  //b0000 0001 0000 0000
124         *IXP4XX_GPIO_GPOER &= ~GPIO_PO_BM;      // enable the pwr cntl gpio
125         *IXP4XX_GPIO_GPOUTR |= GPIO_PO_BM;      // do the deed
126 }
127
128 static void __init nslu2_init(void)
129 {
130         ixp4xx_sys_init();
131
132         pm_power_off = n2_power_off;
133         platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices));
134 }
135
136 MACHINE_START(NSLU2, "Linksys NSLU2")
137         MAINTAINER("www.nslu2-linux.org")
138                 BOOT_MEM(PHYS_OFFSET, IXP4XX_PERIPHERAL_BASE_PHYS, 
139                         IXP4XX_PERIPHERAL_BASE_VIRT)
140                 MAPIO(nslu2_map_io)
141                 INITIRQ(ixp4xx_init_irq)        //FIXME: all irq are off here
142                 .timer          = &ixp4xx_timer,
143                 // INITTIME(ixp4xx_init_time)   //this was missing in 2.6.7 code ...soft reboot needed?
144                 BOOT_PARAMS(0x0100)
145                 INIT_MACHINE(nslu2_init)
146 MACHINE_END
147