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>
17 #include <linux/i2c-gpio.h>
19 #include <asm/mach-types.h>
20 #include <asm/mach/arch.h>
21 #include <asm/mach/flash.h>
22 #include <asm/mach/time.h>
24 static struct flash_platform_data dsmg600_flash_data = {
25 .map_name = "cfi_probe",
29 static struct resource dsmg600_flash_resource = {
30 .flags = IORESOURCE_MEM,
33 static struct platform_device dsmg600_flash = {
34 .name = "IXP4XX-Flash",
36 .dev.platform_data = &dsmg600_flash_data,
38 .resource = &dsmg600_flash_resource,
41 static struct i2c_gpio_platform_data dsmg600_i2c_gpio_data = {
42 .sda_pin = DSMG600_SDA_PIN,
43 .scl_pin = DSMG600_SCL_PIN,
46 static struct platform_device dsmg600_i2c_gpio = {
50 .platform_data = &dsmg600_i2c_gpio_data,
54 #ifdef CONFIG_LEDS_CLASS
55 static struct resource dsmg600_led_resources[] = {
58 .start = DSMG600_LED_PWR_GPIO,
59 .end = DSMG600_LED_PWR_GPIO,
60 .flags = IXP4XX_GPIO_HIGH,
64 .start = DSMG600_LED_WLAN_GPIO,
65 .end = DSMG600_LED_WLAN_GPIO,
66 .flags = IXP4XX_GPIO_LOW,
70 static struct platform_device dsmg600_leds = {
71 .name = "IXP4XX-GPIO-LED",
73 .num_resources = ARRAY_SIZE(dsmg600_led_resources),
74 .resource = dsmg600_led_resources,
78 static struct resource dsmg600_uart_resources[] = {
80 .start = IXP4XX_UART1_BASE_PHYS,
81 .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
82 .flags = IORESOURCE_MEM,
85 .start = IXP4XX_UART2_BASE_PHYS,
86 .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
87 .flags = IORESOURCE_MEM,
91 static struct plat_serial8250_port dsmg600_uart_data[] = {
93 .mapbase = IXP4XX_UART1_BASE_PHYS,
94 .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
95 .irq = IRQ_IXP4XX_UART1,
96 .flags = UPF_BOOT_AUTOCONF,
99 .uartclk = IXP4XX_UART_XTAL,
102 .mapbase = IXP4XX_UART2_BASE_PHYS,
103 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
104 .irq = IRQ_IXP4XX_UART2,
105 .flags = UPF_BOOT_AUTOCONF,
108 .uartclk = IXP4XX_UART_XTAL,
113 static struct platform_device dsmg600_uart = {
114 .name = "serial8250",
115 .id = PLAT8250_DEV_PLATFORM,
116 .dev.platform_data = dsmg600_uart_data,
117 .num_resources = ARRAY_SIZE(dsmg600_uart_resources),
118 .resource = dsmg600_uart_resources,
121 static struct platform_device *dsmg600_devices[] __initdata = {
126 static void dsmg600_power_off(void)
128 /* enable the pwr cntl gpio */
129 gpio_line_config(DSMG600_PO_GPIO, IXP4XX_GPIO_OUT);
132 gpio_line_set(DSMG600_PO_GPIO, IXP4XX_GPIO_HIGH);
135 static void __init dsmg600_timer_init(void)
137 /* The xtal on this machine is non-standard. */
138 ixp4xx_timer_freq = DSMG600_FREQ;
140 /* Call standard timer_init function. */
144 static struct sys_timer dsmg600_timer = {
145 .init = dsmg600_timer_init,
148 static void __init dsmg600_init(void)
152 /* Make sure that GPIO14 and GPIO15 are not used as clocks */
153 *IXP4XX_GPIO_GPCLKR = 0;
155 dsmg600_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
156 dsmg600_flash_resource.end =
157 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
159 pm_power_off = dsmg600_power_off;
161 /* The UART is required on the DSM-G600 (Redboot cannot use the
162 * NIC) -- do it here so that it does *not* get removed if
163 * platform_add_devices fails!
165 (void)platform_device_register(&dsmg600_uart);
167 platform_add_devices(dsmg600_devices, ARRAY_SIZE(dsmg600_devices));
169 #ifdef CONFIG_LEDS_CLASS
170 /* We don't care whether or not this works. */
171 (void)platform_device_register(&dsmg600_leds);
175 MACHINE_START(DSMG600, "D-Link DSM-G600 RevA")
176 /* Maintainer: www.nslu2-linux.org */
177 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
178 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC,
179 .boot_params = 0x00000100,
180 .map_io = ixp4xx_map_io,
181 .init_irq = ixp4xx_init_irq,
182 .timer = &dsmg600_timer,
183 .init_machine = dsmg600_init,