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> | |
a9a424ce | 17 | #include <linux/i2c.h> |
5a4a2387 | 18 | #include <linux/i2c-gpio.h> |
28bd3a0d MLJ |
19 | |
20 | #include <asm/mach-types.h> | |
21 | #include <asm/mach/arch.h> | |
22 | #include <asm/mach/flash.h> | |
435c5da0 | 23 | #include <asm/mach/time.h> |
28bd3a0d MLJ |
24 | |
25 | static struct flash_platform_data dsmg600_flash_data = { | |
26 | .map_name = "cfi_probe", | |
27 | .width = 2, | |
28 | }; | |
29 | ||
30 | static struct resource dsmg600_flash_resource = { | |
31 | .flags = IORESOURCE_MEM, | |
32 | }; | |
33 | ||
34 | static struct platform_device dsmg600_flash = { | |
35 | .name = "IXP4XX-Flash", | |
36 | .id = 0, | |
37 | .dev.platform_data = &dsmg600_flash_data, | |
38 | .num_resources = 1, | |
39 | .resource = &dsmg600_flash_resource, | |
40 | }; | |
41 | ||
5a4a2387 | 42 | static struct i2c_gpio_platform_data dsmg600_i2c_gpio_data = { |
28bd3a0d MLJ |
43 | .sda_pin = DSMG600_SDA_PIN, |
44 | .scl_pin = DSMG600_SCL_PIN, | |
45 | }; | |
46 | ||
5a4a2387 MLJ |
47 | static struct platform_device dsmg600_i2c_gpio = { |
48 | .name = "i2c-gpio", | |
28bd3a0d | 49 | .id = 0, |
5a4a2387 MLJ |
50 | .dev = { |
51 | .platform_data = &dsmg600_i2c_gpio_data, | |
52 | }, | |
28bd3a0d MLJ |
53 | }; |
54 | ||
a9a424ce RW |
55 | static struct i2c_board_info __initdata dsmg600_i2c_board_info [] = { |
56 | { | |
57 | I2C_BOARD_INFO("rtc-pcf8563", 0x51), | |
58 | }, | |
59 | }; | |
60 | ||
28bd3a0d MLJ |
61 | #ifdef CONFIG_LEDS_CLASS |
62 | static struct resource dsmg600_led_resources[] = { | |
63 | { | |
64 | .name = "power", | |
65 | .start = DSMG600_LED_PWR_GPIO, | |
66 | .end = DSMG600_LED_PWR_GPIO, | |
67 | .flags = IXP4XX_GPIO_HIGH, | |
68 | }, | |
69 | { | |
70 | .name = "wlan", | |
71 | .start = DSMG600_LED_WLAN_GPIO, | |
72 | .end = DSMG600_LED_WLAN_GPIO, | |
73 | .flags = IXP4XX_GPIO_LOW, | |
74 | }, | |
75 | }; | |
76 | ||
77 | static struct platform_device dsmg600_leds = { | |
78 | .name = "IXP4XX-GPIO-LED", | |
79 | .id = -1, | |
80 | .num_resources = ARRAY_SIZE(dsmg600_led_resources), | |
81 | .resource = dsmg600_led_resources, | |
82 | }; | |
83 | #endif | |
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 MLJ |
130 | &dsmg600_flash, |
131 | }; | |
132 | ||
133 | static void dsmg600_power_off(void) | |
134 | { | |
135 | /* enable the pwr cntl gpio */ | |
136 | gpio_line_config(DSMG600_PO_GPIO, IXP4XX_GPIO_OUT); | |
137 | ||
138 | /* poweroff */ | |
139 | gpio_line_set(DSMG600_PO_GPIO, IXP4XX_GPIO_HIGH); | |
140 | } | |
141 | ||
435c5da0 MLJ |
142 | static void __init dsmg600_timer_init(void) |
143 | { | |
144 | /* The xtal on this machine is non-standard. */ | |
145 | ixp4xx_timer_freq = DSMG600_FREQ; | |
146 | ||
147 | /* Call standard timer_init function. */ | |
148 | ixp4xx_timer_init(); | |
149 | } | |
150 | ||
151 | static struct sys_timer dsmg600_timer = { | |
152 | .init = dsmg600_timer_init, | |
153 | }; | |
154 | ||
28bd3a0d MLJ |
155 | static void __init dsmg600_init(void) |
156 | { | |
157 | ixp4xx_sys_init(); | |
158 | ||
159 | /* Make sure that GPIO14 and GPIO15 are not used as clocks */ | |
160 | *IXP4XX_GPIO_GPCLKR = 0; | |
161 | ||
162 | dsmg600_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); | |
163 | dsmg600_flash_resource.end = | |
164 | IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; | |
165 | ||
166 | pm_power_off = dsmg600_power_off; | |
167 | ||
a9a424ce RW |
168 | i2c_register_board_info(0, dsmg600_i2c_board_info, |
169 | ARRAY_SIZE(dsmg600_i2c_board_info)); | |
170 | ||
28bd3a0d MLJ |
171 | /* The UART is required on the DSM-G600 (Redboot cannot use the |
172 | * NIC) -- do it here so that it does *not* get removed if | |
173 | * platform_add_devices fails! | |
174 | */ | |
175 | (void)platform_device_register(&dsmg600_uart); | |
176 | ||
177 | platform_add_devices(dsmg600_devices, ARRAY_SIZE(dsmg600_devices)); | |
178 | ||
179 | #ifdef CONFIG_LEDS_CLASS | |
180 | /* We don't care whether or not this works. */ | |
181 | (void)platform_device_register(&dsmg600_leds); | |
182 | #endif | |
183 | } | |
184 | ||
28bd3a0d MLJ |
185 | MACHINE_START(DSMG600, "D-Link DSM-G600 RevA") |
186 | /* Maintainer: www.nslu2-linux.org */ | |
187 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, | |
188 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC, | |
189 | .boot_params = 0x00000100, | |
28bd3a0d MLJ |
190 | .map_io = ixp4xx_map_io, |
191 | .init_irq = ixp4xx_init_irq, | |
435c5da0 | 192 | .timer = &dsmg600_timer, |
28bd3a0d MLJ |
193 | .init_machine = dsmg600_init, |
194 | MACHINE_END |