2 * arch/arm/mach-ixp4xx/nas100d-setup.c
6 * based ixdp425-setup.c:
7 * Copyright (C) 2003-2004 MontaVista Software, Inc.
9 * Author: Alessandro Zummo <a.zummo@towertech.it>
10 * Author: Rod Whitby <rod@whitby.id.au>
11 * Maintainers: http://www.nslu2-linux.org/
15 #include <linux/if_ether.h>
16 #include <linux/kernel.h>
17 #include <linux/serial.h>
18 #include <linux/serial_8250.h>
19 #include <linux/leds.h>
20 #include <linux/i2c.h>
21 #include <linux/i2c-gpio.h>
23 #include <asm/mach-types.h>
24 #include <asm/mach/arch.h>
25 #include <asm/mach/flash.h>
28 static struct flash_platform_data nas100d_flash_data = {
29 .map_name = "cfi_probe",
33 static struct resource nas100d_flash_resource = {
34 .flags = IORESOURCE_MEM,
37 static struct platform_device nas100d_flash = {
38 .name = "IXP4XX-Flash",
40 .dev.platform_data = &nas100d_flash_data,
42 .resource = &nas100d_flash_resource,
45 static struct i2c_board_info __initdata nas100d_i2c_board_info [] = {
47 I2C_BOARD_INFO("rtc-pcf8563", 0x51),
51 static struct gpio_led nas100d_led_pins[] = {
53 .name = "wlan", /* green led */
54 .gpio = NAS100D_LED_WLAN_GPIO,
58 .name = "power", /* blue power led (off=flashing) */
59 .gpio = NAS100D_LED_PWR_GPIO,
63 .name = "disk", /* yellow led */
64 .gpio = NAS100D_LED_DISK_GPIO,
69 static struct gpio_led_platform_data nas100d_led_data = {
70 .num_leds = ARRAY_SIZE(nas100d_led_pins),
71 .leds = nas100d_led_pins,
74 static struct platform_device nas100d_leds = {
77 .dev.platform_data = &nas100d_led_data,
80 static struct i2c_gpio_platform_data nas100d_i2c_gpio_data = {
81 .sda_pin = NAS100D_SDA_PIN,
82 .scl_pin = NAS100D_SCL_PIN,
85 static struct platform_device nas100d_i2c_gpio = {
89 .platform_data = &nas100d_i2c_gpio_data,
93 static struct resource nas100d_uart_resources[] = {
95 .start = IXP4XX_UART1_BASE_PHYS,
96 .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
97 .flags = IORESOURCE_MEM,
100 .start = IXP4XX_UART2_BASE_PHYS,
101 .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
102 .flags = IORESOURCE_MEM,
106 static struct plat_serial8250_port nas100d_uart_data[] = {
108 .mapbase = IXP4XX_UART1_BASE_PHYS,
109 .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
110 .irq = IRQ_IXP4XX_UART1,
111 .flags = UPF_BOOT_AUTOCONF,
114 .uartclk = IXP4XX_UART_XTAL,
117 .mapbase = IXP4XX_UART2_BASE_PHYS,
118 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
119 .irq = IRQ_IXP4XX_UART2,
120 .flags = UPF_BOOT_AUTOCONF,
123 .uartclk = IXP4XX_UART_XTAL,
128 static struct platform_device nas100d_uart = {
129 .name = "serial8250",
130 .id = PLAT8250_DEV_PLATFORM,
131 .dev.platform_data = nas100d_uart_data,
133 .resource = nas100d_uart_resources,
136 /* Built-in 10/100 Ethernet MAC interfaces */
137 static struct eth_plat_info nas100d_plat_eth[] = {
145 static struct platform_device nas100d_eth[] = {
147 .name = "ixp4xx_eth",
148 .id = IXP4XX_ETH_NPEB,
149 .dev.platform_data = nas100d_plat_eth,
153 static struct platform_device *nas100d_devices[] __initdata = {
160 static void nas100d_power_off(void)
162 /* This causes the box to drop the power and go dead. */
164 /* enable the pwr cntl gpio */
165 gpio_line_config(NAS100D_PO_GPIO, IXP4XX_GPIO_OUT);
168 gpio_line_set(NAS100D_PO_GPIO, IXP4XX_GPIO_HIGH);
171 static void __init nas100d_init(void)
173 DECLARE_MAC_BUF(mac_buf);
179 /* gpio 14 and 15 are _not_ clocks */
180 *IXP4XX_GPIO_GPCLKR = 0;
182 nas100d_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
183 nas100d_flash_resource.end =
184 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
186 pm_power_off = nas100d_power_off;
188 i2c_register_board_info(0, nas100d_i2c_board_info,
189 ARRAY_SIZE(nas100d_i2c_board_info));
192 * This is only useful on a modified machine, but it is valuable
193 * to have it first in order to see debug messages, and so that
194 * it does *not* get removed if platform_add_devices fails!
196 (void)platform_device_register(&nas100d_uart);
198 platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices));
201 * Map in a portion of the flash and read the MAC address.
202 * Since it is stored in BE in the flash itself, we need to
203 * byteswap it if we're in LE mode.
205 f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x1000000);
207 for (i = 0; i < 6; i++)
209 nas100d_plat_eth[0].hwaddr[i] = readb(f + 0xFC0FD8 + i);
211 nas100d_plat_eth[0].hwaddr[i] = readb(f + 0xFC0FD8 + (i^3));
215 printk(KERN_INFO "NAS100D: Using MAC address %s for port 0\n",
216 print_mac(mac_buf, nas100d_plat_eth[0].hwaddr));
220 MACHINE_START(NAS100D, "Iomega NAS 100d")
221 /* Maintainer: www.nslu2-linux.org */
222 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
223 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC,
224 .boot_params = 0x00000100,
225 .map_io = ixp4xx_map_io,
226 .init_irq = ixp4xx_init_irq,
227 .timer = &ixp4xx_timer,
228 .init_machine = nas100d_init,