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