4 * Copyright (C) 2006 Tower Technologies
5 * Author: Alessandro Zummo <a.zummo@towertech.it>
7 * based ixdp425-setup.c:
8 * Copyright (C) 2003-2004 MontaVista Software, Inc.
10 * Author: Alessandro Zummo <a.zummo@towertech.it>
11 * Maintainers: http://www.nslu2-linux.org/
14 #include <linux/kernel.h>
15 #include <linux/serial.h>
16 #include <linux/serial_8250.h>
18 #include <asm/mach-types.h>
19 #include <asm/mach/arch.h>
20 #include <asm/mach/flash.h>
21 #include <asm/mach/time.h>
23 static struct flash_platform_data dsmg600_flash_data = {
24 .map_name = "cfi_probe",
28 static struct resource dsmg600_flash_resource = {
29 .flags = IORESOURCE_MEM,
32 static struct platform_device dsmg600_flash = {
33 .name = "IXP4XX-Flash",
35 .dev.platform_data = &dsmg600_flash_data,
37 .resource = &dsmg600_flash_resource,
40 static struct ixp4xx_i2c_pins dsmg600_i2c_gpio_pins = {
41 .sda_pin = DSMG600_SDA_PIN,
42 .scl_pin = DSMG600_SCL_PIN,
45 static struct platform_device dsmg600_i2c_controller = {
48 .dev.platform_data = &dsmg600_i2c_gpio_pins,
51 #ifdef CONFIG_LEDS_CLASS
52 static struct resource dsmg600_led_resources[] = {
55 .start = DSMG600_LED_PWR_GPIO,
56 .end = DSMG600_LED_PWR_GPIO,
57 .flags = IXP4XX_GPIO_HIGH,
61 .start = DSMG600_LED_WLAN_GPIO,
62 .end = DSMG600_LED_WLAN_GPIO,
63 .flags = IXP4XX_GPIO_LOW,
67 static struct platform_device dsmg600_leds = {
68 .name = "IXP4XX-GPIO-LED",
70 .num_resources = ARRAY_SIZE(dsmg600_led_resources),
71 .resource = dsmg600_led_resources,
75 static struct resource dsmg600_uart_resources[] = {
77 .start = IXP4XX_UART1_BASE_PHYS,
78 .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
79 .flags = IORESOURCE_MEM,
82 .start = IXP4XX_UART2_BASE_PHYS,
83 .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
84 .flags = IORESOURCE_MEM,
88 static struct plat_serial8250_port dsmg600_uart_data[] = {
90 .mapbase = IXP4XX_UART1_BASE_PHYS,
91 .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
92 .irq = IRQ_IXP4XX_UART1,
93 .flags = UPF_BOOT_AUTOCONF,
96 .uartclk = IXP4XX_UART_XTAL,
99 .mapbase = IXP4XX_UART2_BASE_PHYS,
100 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
101 .irq = IRQ_IXP4XX_UART2,
102 .flags = UPF_BOOT_AUTOCONF,
105 .uartclk = IXP4XX_UART_XTAL,
110 static struct platform_device dsmg600_uart = {
111 .name = "serial8250",
112 .id = PLAT8250_DEV_PLATFORM,
113 .dev.platform_data = dsmg600_uart_data,
114 .num_resources = ARRAY_SIZE(dsmg600_uart_resources),
115 .resource = dsmg600_uart_resources,
118 static struct platform_device *dsmg600_devices[] __initdata = {
119 &dsmg600_i2c_controller,
123 static void dsmg600_power_off(void)
125 /* enable the pwr cntl gpio */
126 gpio_line_config(DSMG600_PO_GPIO, IXP4XX_GPIO_OUT);
129 gpio_line_set(DSMG600_PO_GPIO, IXP4XX_GPIO_HIGH);
132 static void __init dsmg600_timer_init(void)
134 /* The xtal on this machine is non-standard. */
135 ixp4xx_timer_freq = DSMG600_FREQ;
137 /* Call standard timer_init function. */
141 static struct sys_timer dsmg600_timer = {
142 .init = dsmg600_timer_init,
145 static void __init dsmg600_init(void)
149 /* Make sure that GPIO14 and GPIO15 are not used as clocks */
150 *IXP4XX_GPIO_GPCLKR = 0;
152 dsmg600_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
153 dsmg600_flash_resource.end =
154 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
156 pm_power_off = dsmg600_power_off;
158 /* The UART is required on the DSM-G600 (Redboot cannot use the
159 * NIC) -- do it here so that it does *not* get removed if
160 * platform_add_devices fails!
162 (void)platform_device_register(&dsmg600_uart);
164 platform_add_devices(dsmg600_devices, ARRAY_SIZE(dsmg600_devices));
166 #ifdef CONFIG_LEDS_CLASS
167 /* We don't care whether or not this works. */
168 (void)platform_device_register(&dsmg600_leds);
172 MACHINE_START(DSMG600, "D-Link DSM-G600 RevA")
173 /* Maintainer: www.nslu2-linux.org */
174 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
175 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC,
176 .boot_params = 0x00000100,
177 .map_io = ixp4xx_map_io,
178 .init_irq = ixp4xx_init_irq,
179 .timer = &dsmg600_timer,
180 .init_machine = dsmg600_init,