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>
22 static struct flash_platform_data dsmg600_flash_data
= {
23 .map_name
= "cfi_probe",
27 static struct resource dsmg600_flash_resource
= {
28 .flags
= IORESOURCE_MEM
,
31 static struct platform_device dsmg600_flash
= {
32 .name
= "IXP4XX-Flash",
34 .dev
.platform_data
= &dsmg600_flash_data
,
36 .resource
= &dsmg600_flash_resource
,
39 static struct ixp4xx_i2c_pins dsmg600_i2c_gpio_pins
= {
40 .sda_pin
= DSMG600_SDA_PIN
,
41 .scl_pin
= DSMG600_SCL_PIN
,
44 static struct platform_device dsmg600_i2c_controller
= {
47 .dev
.platform_data
= &dsmg600_i2c_gpio_pins
,
50 #ifdef CONFIG_LEDS_CLASS
51 static struct resource dsmg600_led_resources
[] = {
54 .start
= DSMG600_LED_PWR_GPIO
,
55 .end
= DSMG600_LED_PWR_GPIO
,
56 .flags
= IXP4XX_GPIO_HIGH
,
60 .start
= DSMG600_LED_WLAN_GPIO
,
61 .end
= DSMG600_LED_WLAN_GPIO
,
62 .flags
= IXP4XX_GPIO_LOW
,
66 static struct platform_device dsmg600_leds
= {
67 .name
= "IXP4XX-GPIO-LED",
69 .num_resources
= ARRAY_SIZE(dsmg600_led_resources
),
70 .resource
= dsmg600_led_resources
,
74 static struct resource dsmg600_uart_resources
[] = {
76 .start
= IXP4XX_UART1_BASE_PHYS
,
77 .end
= IXP4XX_UART1_BASE_PHYS
+ 0x0fff,
78 .flags
= IORESOURCE_MEM
,
81 .start
= IXP4XX_UART2_BASE_PHYS
,
82 .end
= IXP4XX_UART2_BASE_PHYS
+ 0x0fff,
83 .flags
= IORESOURCE_MEM
,
87 static struct plat_serial8250_port dsmg600_uart_data
[] = {
89 .mapbase
= IXP4XX_UART1_BASE_PHYS
,
90 .membase
= (char *)IXP4XX_UART1_BASE_VIRT
+ REG_OFFSET
,
91 .irq
= IRQ_IXP4XX_UART1
,
92 .flags
= UPF_BOOT_AUTOCONF
,
95 .uartclk
= IXP4XX_UART_XTAL
,
98 .mapbase
= IXP4XX_UART2_BASE_PHYS
,
99 .membase
= (char *)IXP4XX_UART2_BASE_VIRT
+ REG_OFFSET
,
100 .irq
= IRQ_IXP4XX_UART2
,
101 .flags
= UPF_BOOT_AUTOCONF
,
104 .uartclk
= IXP4XX_UART_XTAL
,
109 static struct platform_device dsmg600_uart
= {
110 .name
= "serial8250",
111 .id
= PLAT8250_DEV_PLATFORM
,
112 .dev
.platform_data
= dsmg600_uart_data
,
113 .num_resources
= ARRAY_SIZE(dsmg600_uart_resources
),
114 .resource
= dsmg600_uart_resources
,
117 static struct platform_device
*dsmg600_devices
[] __initdata
= {
118 &dsmg600_i2c_controller
,
122 static void dsmg600_power_off(void)
124 /* enable the pwr cntl gpio */
125 gpio_line_config(DSMG600_PO_GPIO
, IXP4XX_GPIO_OUT
);
128 gpio_line_set(DSMG600_PO_GPIO
, IXP4XX_GPIO_HIGH
);
131 static void __init
dsmg600_init(void)
135 /* Make sure that GPIO14 and GPIO15 are not used as clocks */
136 *IXP4XX_GPIO_GPCLKR
= 0;
138 dsmg600_flash_resource
.start
= IXP4XX_EXP_BUS_BASE(0);
139 dsmg600_flash_resource
.end
=
140 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size
- 1;
142 pm_power_off
= dsmg600_power_off
;
144 /* The UART is required on the DSM-G600 (Redboot cannot use the
145 * NIC) -- do it here so that it does *not* get removed if
146 * platform_add_devices fails!
148 (void)platform_device_register(&dsmg600_uart
);
150 platform_add_devices(dsmg600_devices
, ARRAY_SIZE(dsmg600_devices
));
152 #ifdef CONFIG_LEDS_CLASS
153 /* We don't care whether or not this works. */
154 (void)platform_device_register(&dsmg600_leds
);
158 static void __init
dsmg600_fixup(struct machine_desc
*desc
,
159 struct tag
*tags
, char **cmdline
, struct meminfo
*mi
)
161 /* The xtal on this machine is non-standard. */
162 ixp4xx_timer_freq
= DSMG600_FREQ
;
165 MACHINE_START(DSMG600
, "D-Link DSM-G600 RevA")
166 /* Maintainer: www.nslu2-linux.org */
167 .phys_io
= IXP4XX_PERIPHERAL_BASE_PHYS
,
168 .io_pg_offst
= ((IXP4XX_PERIPHERAL_BASE_VIRT
) >> 18) & 0xFFFC,
169 .boot_params
= 0x00000100,
170 .fixup
= dsmg600_fixup
,
171 .map_io
= ixp4xx_map_io
,
172 .init_irq
= ixp4xx_init_irq
,
173 .timer
= &ixp4xx_timer
,
174 .init_machine
= dsmg600_init
,