Commit | Line | Data |
---|---|---|
28bd3a0d MLJ |
1 | /* |
2 | * DSM-G600 board-setup | |
3 | * | |
4 | * Copyright (C) 2006 Tower Technologies | |
5 | * Author: Alessandro Zummo <a.zummo@towertech.it> | |
6 | * | |
7 | * based ixdp425-setup.c: | |
8 | * Copyright (C) 2003-2004 MontaVista Software, Inc. | |
9 | * | |
10 | * Author: Alessandro Zummo <a.zummo@towertech.it> | |
11 | * Maintainers: http://www.nslu2-linux.org/ | |
12 | */ | |
13 | ||
14 | #include <linux/kernel.h> | |
15 | #include <linux/serial.h> | |
16 | #include <linux/serial_8250.h> | |
1208ebf2 | 17 | #include <linux/leds.h> |
a9a424ce | 18 | #include <linux/i2c.h> |
5a4a2387 | 19 | #include <linux/i2c-gpio.h> |
28bd3a0d MLJ |
20 | |
21 | #include <asm/mach-types.h> | |
22 | #include <asm/mach/arch.h> | |
23 | #include <asm/mach/flash.h> | |
435c5da0 | 24 | #include <asm/mach/time.h> |
28bd3a0d MLJ |
25 | |
26 | static struct flash_platform_data dsmg600_flash_data = { | |
27 | .map_name = "cfi_probe", | |
28 | .width = 2, | |
29 | }; | |
30 | ||
31 | static struct resource dsmg600_flash_resource = { | |
32 | .flags = IORESOURCE_MEM, | |
33 | }; | |
34 | ||
35 | static struct platform_device dsmg600_flash = { | |
36 | .name = "IXP4XX-Flash", | |
37 | .id = 0, | |
38 | .dev.platform_data = &dsmg600_flash_data, | |
39 | .num_resources = 1, | |
40 | .resource = &dsmg600_flash_resource, | |
41 | }; | |
42 | ||
5a4a2387 | 43 | static struct i2c_gpio_platform_data dsmg600_i2c_gpio_data = { |
28bd3a0d MLJ |
44 | .sda_pin = DSMG600_SDA_PIN, |
45 | .scl_pin = DSMG600_SCL_PIN, | |
46 | }; | |
47 | ||
5a4a2387 MLJ |
48 | static struct platform_device dsmg600_i2c_gpio = { |
49 | .name = "i2c-gpio", | |
28bd3a0d | 50 | .id = 0, |
5a4a2387 MLJ |
51 | .dev = { |
52 | .platform_data = &dsmg600_i2c_gpio_data, | |
53 | }, | |
28bd3a0d MLJ |
54 | }; |
55 | ||
a9a424ce RW |
56 | static struct i2c_board_info __initdata dsmg600_i2c_board_info [] = { |
57 | { | |
58 | I2C_BOARD_INFO("rtc-pcf8563", 0x51), | |
59 | }, | |
60 | }; | |
61 | ||
1208ebf2 | 62 | static struct gpio_led dsmg600_led_pins[] = { |
28bd3a0d | 63 | { |
1208ebf2 RW |
64 | .name = "power", |
65 | .gpio = DSMG600_LED_PWR_GPIO, | |
28bd3a0d MLJ |
66 | }, |
67 | { | |
1208ebf2 RW |
68 | .name = "wlan", |
69 | .gpio = DSMG600_LED_WLAN_GPIO, | |
70 | .active_low = true, | |
28bd3a0d MLJ |
71 | }, |
72 | }; | |
73 | ||
1208ebf2 RW |
74 | static struct gpio_led_platform_data dsmg600_led_data = { |
75 | .num_leds = ARRAY_SIZE(dsmg600_led_pins), | |
76 | .leds = dsmg600_led_pins, | |
77 | }; | |
78 | ||
28bd3a0d | 79 | static struct platform_device dsmg600_leds = { |
1208ebf2 RW |
80 | .name = "leds-gpio", |
81 | .id = -1, | |
82 | .dev.platform_data = &dsmg600_led_data, | |
28bd3a0d | 83 | }; |
28bd3a0d MLJ |
84 | |
85 | static struct resource dsmg600_uart_resources[] = { | |
86 | { | |
87 | .start = IXP4XX_UART1_BASE_PHYS, | |
88 | .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, | |
89 | .flags = IORESOURCE_MEM, | |
90 | }, | |
91 | { | |
92 | .start = IXP4XX_UART2_BASE_PHYS, | |
93 | .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, | |
94 | .flags = IORESOURCE_MEM, | |
95 | } | |
96 | }; | |
97 | ||
98 | static struct plat_serial8250_port dsmg600_uart_data[] = { | |
99 | { | |
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, | |
104 | .iotype = UPIO_MEM, | |
105 | .regshift = 2, | |
106 | .uartclk = IXP4XX_UART_XTAL, | |
107 | }, | |
108 | { | |
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, | |
113 | .iotype = UPIO_MEM, | |
114 | .regshift = 2, | |
115 | .uartclk = IXP4XX_UART_XTAL, | |
116 | }, | |
117 | { } | |
118 | }; | |
119 | ||
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, | |
126 | }; | |
127 | ||
128 | static struct platform_device *dsmg600_devices[] __initdata = { | |
5a4a2387 | 129 | &dsmg600_i2c_gpio, |
28bd3a0d | 130 | &dsmg600_flash, |
1208ebf2 | 131 | &dsmg600_leds, |
28bd3a0d MLJ |
132 | }; |
133 | ||
134 | static void dsmg600_power_off(void) | |
135 | { | |
136 | /* enable the pwr cntl gpio */ | |
137 | gpio_line_config(DSMG600_PO_GPIO, IXP4XX_GPIO_OUT); | |
138 | ||
139 | /* poweroff */ | |
140 | gpio_line_set(DSMG600_PO_GPIO, IXP4XX_GPIO_HIGH); | |
141 | } | |
142 | ||
435c5da0 MLJ |
143 | static void __init dsmg600_timer_init(void) |
144 | { | |
145 | /* The xtal on this machine is non-standard. */ | |
146 | ixp4xx_timer_freq = DSMG600_FREQ; | |
147 | ||
148 | /* Call standard timer_init function. */ | |
149 | ixp4xx_timer_init(); | |
150 | } | |
151 | ||
152 | static struct sys_timer dsmg600_timer = { | |
153 | .init = dsmg600_timer_init, | |
154 | }; | |
155 | ||
28bd3a0d MLJ |
156 | static void __init dsmg600_init(void) |
157 | { | |
158 | ixp4xx_sys_init(); | |
159 | ||
160 | /* Make sure that GPIO14 and GPIO15 are not used as clocks */ | |
161 | *IXP4XX_GPIO_GPCLKR = 0; | |
162 | ||
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; | |
166 | ||
167 | pm_power_off = dsmg600_power_off; | |
168 | ||
a9a424ce RW |
169 | i2c_register_board_info(0, dsmg600_i2c_board_info, |
170 | ARRAY_SIZE(dsmg600_i2c_board_info)); | |
171 | ||
28bd3a0d MLJ |
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! | |
175 | */ | |
176 | (void)platform_device_register(&dsmg600_uart); | |
177 | ||
178 | platform_add_devices(dsmg600_devices, ARRAY_SIZE(dsmg600_devices)); | |
28bd3a0d MLJ |
179 | } |
180 | ||
28bd3a0d MLJ |
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, | |
28bd3a0d MLJ |
186 | .map_io = ixp4xx_map_io, |
187 | .init_irq = ixp4xx_init_irq, | |
435c5da0 | 188 | .timer = &dsmg600_timer, |
28bd3a0d MLJ |
189 | .init_machine = dsmg600_init, |
190 | MACHINE_END |