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/leds.h>
18 #include <linux/i2c.h>
19 #include <linux/i2c-gpio.h>
21 #include <asm/mach-types.h>
22 #include <asm/mach/arch.h>
23 #include <asm/mach/flash.h>
24 #include <asm/mach/time.h>
26 static struct flash_platform_data dsmg600_flash_data
= {
27 .map_name
= "cfi_probe",
31 static struct resource dsmg600_flash_resource
= {
32 .flags
= IORESOURCE_MEM
,
35 static struct platform_device dsmg600_flash
= {
36 .name
= "IXP4XX-Flash",
38 .dev
.platform_data
= &dsmg600_flash_data
,
40 .resource
= &dsmg600_flash_resource
,
43 static struct i2c_gpio_platform_data dsmg600_i2c_gpio_data
= {
44 .sda_pin
= DSMG600_SDA_PIN
,
45 .scl_pin
= DSMG600_SCL_PIN
,
48 static struct platform_device dsmg600_i2c_gpio
= {
52 .platform_data
= &dsmg600_i2c_gpio_data
,
56 static struct i2c_board_info __initdata dsmg600_i2c_board_info
[] = {
58 I2C_BOARD_INFO("rtc-pcf8563", 0x51),
62 static struct gpio_led dsmg600_led_pins
[] = {
65 .gpio
= DSMG600_LED_PWR_GPIO
,
69 .gpio
= DSMG600_LED_WLAN_GPIO
,
74 static struct gpio_led_platform_data dsmg600_led_data
= {
75 .num_leds
= ARRAY_SIZE(dsmg600_led_pins
),
76 .leds
= dsmg600_led_pins
,
79 static struct platform_device dsmg600_leds
= {
82 .dev
.platform_data
= &dsmg600_led_data
,
85 static struct resource dsmg600_uart_resources
[] = {
87 .start
= IXP4XX_UART1_BASE_PHYS
,
88 .end
= IXP4XX_UART1_BASE_PHYS
+ 0x0fff,
89 .flags
= IORESOURCE_MEM
,
92 .start
= IXP4XX_UART2_BASE_PHYS
,
93 .end
= IXP4XX_UART2_BASE_PHYS
+ 0x0fff,
94 .flags
= IORESOURCE_MEM
,
98 static struct plat_serial8250_port dsmg600_uart_data
[] = {
100 .mapbase
= IXP4XX_UART1_BASE_PHYS
,
101 .membase
= (char *)IXP4XX_UART1_BASE_VIRT
+ REG_OFFSET
,
102 .irq
= IRQ_IXP4XX_UART1
,
103 .flags
= UPF_BOOT_AUTOCONF
,
106 .uartclk
= IXP4XX_UART_XTAL
,
109 .mapbase
= IXP4XX_UART2_BASE_PHYS
,
110 .membase
= (char *)IXP4XX_UART2_BASE_VIRT
+ REG_OFFSET
,
111 .irq
= IRQ_IXP4XX_UART2
,
112 .flags
= UPF_BOOT_AUTOCONF
,
115 .uartclk
= IXP4XX_UART_XTAL
,
120 static struct platform_device dsmg600_uart
= {
121 .name
= "serial8250",
122 .id
= PLAT8250_DEV_PLATFORM
,
123 .dev
.platform_data
= dsmg600_uart_data
,
124 .num_resources
= ARRAY_SIZE(dsmg600_uart_resources
),
125 .resource
= dsmg600_uart_resources
,
128 static struct platform_device
*dsmg600_devices
[] __initdata
= {
134 static void dsmg600_power_off(void)
136 /* enable the pwr cntl gpio */
137 gpio_line_config(DSMG600_PO_GPIO
, IXP4XX_GPIO_OUT
);
140 gpio_line_set(DSMG600_PO_GPIO
, IXP4XX_GPIO_HIGH
);
143 static void __init
dsmg600_timer_init(void)
145 /* The xtal on this machine is non-standard. */
146 ixp4xx_timer_freq
= DSMG600_FREQ
;
148 /* Call standard timer_init function. */
152 static struct sys_timer dsmg600_timer
= {
153 .init
= dsmg600_timer_init
,
156 static void __init
dsmg600_init(void)
160 /* Make sure that GPIO14 and GPIO15 are not used as clocks */
161 *IXP4XX_GPIO_GPCLKR
= 0;
163 dsmg600_flash_resource
.start
= IXP4XX_EXP_BUS_BASE(0);
164 dsmg600_flash_resource
.end
=
165 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size
- 1;
167 pm_power_off
= dsmg600_power_off
;
169 i2c_register_board_info(0, dsmg600_i2c_board_info
,
170 ARRAY_SIZE(dsmg600_i2c_board_info
));
172 /* The UART is required on the DSM-G600 (Redboot cannot use the
173 * NIC) -- do it here so that it does *not* get removed if
174 * platform_add_devices fails!
176 (void)platform_device_register(&dsmg600_uart
);
178 platform_add_devices(dsmg600_devices
, ARRAY_SIZE(dsmg600_devices
));
181 MACHINE_START(DSMG600
, "D-Link DSM-G600 RevA")
182 /* Maintainer: www.nslu2-linux.org */
183 .phys_io
= IXP4XX_PERIPHERAL_BASE_PHYS
,
184 .io_pg_offst
= ((IXP4XX_PERIPHERAL_BASE_VIRT
) >> 18) & 0xFFFC,
185 .boot_params
= 0x00000100,
186 .map_io
= ixp4xx_map_io
,
187 .init_irq
= ixp4xx_init_irq
,
188 .timer
= &dsmg600_timer
,
189 .init_machine
= dsmg600_init
,