diff options
author | Simon Guinot <sguinot@lacie.com> | 2010-02-08 13:08:34 -0500 |
---|---|---|
committer | Nicolas Pitre <nico@fluxnic.net> | 2010-05-03 17:03:18 -0400 |
commit | 57475b1a47b3e891ce087ca3c6fc93f5a446a244 (patch) | |
tree | 46a4c03171ffde72121c6be560854f9732c22eff /arch/arm | |
parent | 3e05ec1b93cd839fa1d1a9961b155b0dbc9a4055 (diff) |
[ARM] Kirkwood: merge net2big_v2 and net5big_v2 board setups
Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-kirkwood/Makefile | 4 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/net2big_v2-setup.c | 334 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/netxbig_v2-setup.c (renamed from arch/arm/mach-kirkwood/net5big_v2-setup.c) | 176 |
3 files changed, 120 insertions, 394 deletions
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile index bbb8dd3fa211..c0cd5d362002 100644 --- a/arch/arm/mach-kirkwood/Makefile +++ b/arch/arm/mach-kirkwood/Makefile | |||
@@ -12,7 +12,7 @@ obj-$(CONFIG_MACH_TS41X) += ts41x-setup.o tsx1x-common.o | |||
12 | obj-$(CONFIG_MACH_OPENRD) += openrd-setup.o | 12 | obj-$(CONFIG_MACH_OPENRD) += openrd-setup.o |
13 | obj-$(CONFIG_MACH_NETSPACE_V2) += netspace_v2-setup.o | 13 | obj-$(CONFIG_MACH_NETSPACE_V2) += netspace_v2-setup.o |
14 | obj-$(CONFIG_MACH_INETSPACE_V2) += netspace_v2-setup.o | 14 | obj-$(CONFIG_MACH_INETSPACE_V2) += netspace_v2-setup.o |
15 | obj-$(CONFIG_MACH_NET2BIG_V2) += net2big_v2-setup.o | 15 | obj-$(CONFIG_MACH_NET2BIG_V2) += netxbig_v2-setup.o |
16 | obj-$(CONFIG_MACH_NET5BIG_V2) += net5big_v2-setup.o | 16 | obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o |
17 | 17 | ||
18 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o | 18 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o |
diff --git a/arch/arm/mach-kirkwood/net2big_v2-setup.c b/arch/arm/mach-kirkwood/net2big_v2-setup.c deleted file mode 100644 index 359bb19e366c..000000000000 --- a/arch/arm/mach-kirkwood/net2big_v2-setup.c +++ /dev/null | |||
@@ -1,334 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-kirkwood/net2big_v2-setup.c | ||
3 | * | ||
4 | * LaCie 2Big Network v2 board setup | ||
5 | * | ||
6 | * Copyright (C) 2010 Simon Guinot <sguinot@lacie.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | |||
23 | #include <linux/kernel.h> | ||
24 | #include <linux/init.h> | ||
25 | #include <linux/platform_device.h> | ||
26 | #include <linux/mtd/physmap.h> | ||
27 | #include <linux/spi/flash.h> | ||
28 | #include <linux/spi/spi.h> | ||
29 | #include <linux/ata_platform.h> | ||
30 | #include <linux/mv643xx_eth.h> | ||
31 | #include <linux/i2c.h> | ||
32 | #include <linux/i2c/at24.h> | ||
33 | #include <linux/input.h> | ||
34 | #include <linux/gpio.h> | ||
35 | #include <linux/gpio_keys.h> | ||
36 | #include <linux/leds.h> | ||
37 | #include <asm/mach-types.h> | ||
38 | #include <asm/mach/arch.h> | ||
39 | #include <asm/mach/time.h> | ||
40 | #include <mach/kirkwood.h> | ||
41 | #include <plat/time.h> | ||
42 | #include "common.h" | ||
43 | #include "mpp.h" | ||
44 | |||
45 | /***************************************************************************** | ||
46 | * 512KB SPI Flash on Boot Device (MACRONIX MX25L4005) | ||
47 | ****************************************************************************/ | ||
48 | |||
49 | static struct mtd_partition net2big_v2_flash_parts[] = { | ||
50 | { | ||
51 | .name = "u-boot", | ||
52 | .size = MTDPART_SIZ_FULL, | ||
53 | .offset = 0, | ||
54 | .mask_flags = MTD_WRITEABLE, /* force read-only */ | ||
55 | }, | ||
56 | }; | ||
57 | |||
58 | static const struct flash_platform_data net2big_v2_flash = { | ||
59 | .type = "mx25l4005a", | ||
60 | .name = "spi_flash", | ||
61 | .parts = net2big_v2_flash_parts, | ||
62 | .nr_parts = ARRAY_SIZE(net2big_v2_flash_parts), | ||
63 | }; | ||
64 | |||
65 | static struct spi_board_info __initdata net2big_v2_spi_slave_info[] = { | ||
66 | { | ||
67 | .modalias = "m25p80", | ||
68 | .platform_data = &net2big_v2_flash, | ||
69 | .irq = -1, | ||
70 | .max_speed_hz = 20000000, | ||
71 | .bus_num = 0, | ||
72 | .chip_select = 0, | ||
73 | }, | ||
74 | }; | ||
75 | |||
76 | /***************************************************************************** | ||
77 | * Ethernet | ||
78 | ****************************************************************************/ | ||
79 | |||
80 | static struct mv643xx_eth_platform_data net2big_v2_ge00_data = { | ||
81 | .phy_addr = MV643XX_ETH_PHY_ADDR(8), | ||
82 | }; | ||
83 | |||
84 | /***************************************************************************** | ||
85 | * I2C devices | ||
86 | ****************************************************************************/ | ||
87 | |||
88 | static struct at24_platform_data at24c04 = { | ||
89 | .byte_len = SZ_4K / 8, | ||
90 | .page_size = 16, | ||
91 | }; | ||
92 | |||
93 | /* | ||
94 | * i2c addr | chip | description | ||
95 | * 0x50 | HT24LC04 | eeprom (512B) | ||
96 | */ | ||
97 | |||
98 | static struct i2c_board_info __initdata net2big_v2_i2c_info[] = { | ||
99 | { | ||
100 | I2C_BOARD_INFO("24c04", 0x50), | ||
101 | .platform_data = &at24c04, | ||
102 | } | ||
103 | }; | ||
104 | |||
105 | /***************************************************************************** | ||
106 | * SATA | ||
107 | ****************************************************************************/ | ||
108 | |||
109 | static struct mv_sata_platform_data net2big_v2_sata_data = { | ||
110 | .n_ports = 2, | ||
111 | }; | ||
112 | |||
113 | static int __initdata net2big_v2_gpio_hdd_power[] = { 16, 17 }; | ||
114 | |||
115 | static void __init net2big_v2_sata_power_init(void) | ||
116 | { | ||
117 | int i; | ||
118 | int err; | ||
119 | |||
120 | /* Power up all hard disks. */ | ||
121 | for (i = 0; i < ARRAY_SIZE(net2big_v2_gpio_hdd_power); i++) { | ||
122 | err = gpio_request(net2big_v2_gpio_hdd_power[i], NULL); | ||
123 | if (err == 0) { | ||
124 | err = gpio_direction_output( | ||
125 | net2big_v2_gpio_hdd_power[i], 1); | ||
126 | /* Free the HDD power GPIOs. This allow user-space to | ||
127 | * configure them via the gpiolib sysfs interface. */ | ||
128 | gpio_free(net2big_v2_gpio_hdd_power[i]); | ||
129 | } | ||
130 | if (err) | ||
131 | pr_err("net2big_v2: failed to power-up HDD%d\n", i + 1); | ||
132 | } | ||
133 | } | ||
134 | |||
135 | /***************************************************************************** | ||
136 | * GPIO keys | ||
137 | ****************************************************************************/ | ||
138 | |||
139 | #define NET2BIG_V2_GPIO_SWITCH_POWER_ON 13 | ||
140 | #define NET2BIG_V2_GPIO_SWITCH_POWER_OFF 15 | ||
141 | #define NET2BIG_V2_GPIO_FUNC_BUTTON 34 | ||
142 | |||
143 | #define NET2BIG_V2_SWITCH_POWER_ON 0x1 | ||
144 | #define NET2BIG_V2_SWITCH_POWER_OFF 0x2 | ||
145 | |||
146 | static struct gpio_keys_button net2big_v2_buttons[] = { | ||
147 | [0] = { | ||
148 | .type = EV_SW, | ||
149 | .code = NET2BIG_V2_SWITCH_POWER_ON, | ||
150 | .gpio = NET2BIG_V2_GPIO_SWITCH_POWER_ON, | ||
151 | .desc = "Back power switch (on|auto)", | ||
152 | .active_low = 1, | ||
153 | }, | ||
154 | [1] = { | ||
155 | .type = EV_SW, | ||
156 | .code = NET2BIG_V2_SWITCH_POWER_OFF, | ||
157 | .gpio = NET2BIG_V2_GPIO_SWITCH_POWER_OFF, | ||
158 | .desc = "Back power switch (auto|off)", | ||
159 | .active_low = 1, | ||
160 | }, | ||
161 | [2] = { | ||
162 | .code = KEY_OPTION, | ||
163 | .gpio = NET2BIG_V2_GPIO_FUNC_BUTTON, | ||
164 | .desc = "Function button", | ||
165 | .active_low = 1, | ||
166 | }, | ||
167 | }; | ||
168 | |||
169 | static struct gpio_keys_platform_data net2big_v2_button_data = { | ||
170 | .buttons = net2big_v2_buttons, | ||
171 | .nbuttons = ARRAY_SIZE(net2big_v2_buttons), | ||
172 | }; | ||
173 | |||
174 | static struct platform_device net2big_v2_gpio_buttons = { | ||
175 | .name = "gpio-keys", | ||
176 | .id = -1, | ||
177 | .dev = { | ||
178 | .platform_data = &net2big_v2_button_data, | ||
179 | }, | ||
180 | }; | ||
181 | |||
182 | /***************************************************************************** | ||
183 | * GPIO LEDs | ||
184 | ****************************************************************************/ | ||
185 | |||
186 | /* | ||
187 | * The LEDs are controlled by a CPLD and can be configured through a GPIO | ||
188 | * extension bus: | ||
189 | * | ||
190 | * - address register : bit [0-2] -> GPIO [47-49] | ||
191 | * - data register : bit [0-2] -> GPIO [44-46] | ||
192 | * - enable register : GPIO 29 | ||
193 | * | ||
194 | * Address register selection: | ||
195 | * | ||
196 | * addr | register | ||
197 | * ---------------------------- | ||
198 | * 0 | front LED | ||
199 | * 1 | front LED brightness | ||
200 | * 2 | HDD LED brightness | ||
201 | * 3 | HDD1 LED | ||
202 | * 4 | HDD2 LED | ||
203 | * | ||
204 | * Data register configuration: | ||
205 | * | ||
206 | * data | LED brightness | ||
207 | * ------------------------------------------------- | ||
208 | * 0 | min (off) | ||
209 | * - | - | ||
210 | * 7 | max | ||
211 | * | ||
212 | * data | front LED mode | ||
213 | * ------------------------------------------------- | ||
214 | * 0 | fix off | ||
215 | * 1 | fix blue on | ||
216 | * 2 | fix red on | ||
217 | * 3 | blink blue on=1 sec and blue off=1 sec | ||
218 | * 4 | blink red on=1 sec and red off=1 sec | ||
219 | * 5 | blink blue on=2.5 sec and red on=0.5 sec | ||
220 | * 6 | blink blue on=1 sec and red on=1 sec | ||
221 | * 7 | blink blue on=0.5 sec and blue off=2.5 sec | ||
222 | * | ||
223 | * data | HDD LED mode | ||
224 | * ------------------------------------------------- | ||
225 | * 0 | fix blue on | ||
226 | * 1 | SATA activity blink | ||
227 | * 2 | fix red on | ||
228 | * 3 | blink blue on=1 sec and blue off=1 sec | ||
229 | * 4 | blink red on=1 sec and red off=1 sec | ||
230 | * 5 | blink blue on=2.5 sec and red on=0.5 sec | ||
231 | * 6 | blink blue on=1 sec and red on=1 sec | ||
232 | * 7 | blink blue on=0.5 sec and blue off=2.5 sec | ||
233 | */ | ||
234 | |||
235 | /***************************************************************************** | ||
236 | * Timer | ||
237 | ****************************************************************************/ | ||
238 | |||
239 | static void net2big_v2_timer_init(void) | ||
240 | { | ||
241 | kirkwood_tclk = 166666667; | ||
242 | orion_time_init(IRQ_KIRKWOOD_BRIDGE, kirkwood_tclk); | ||
243 | } | ||
244 | |||
245 | struct sys_timer net2big_v2_timer = { | ||
246 | .init = net2big_v2_timer_init, | ||
247 | }; | ||
248 | |||
249 | /***************************************************************************** | ||
250 | * General Setup | ||
251 | ****************************************************************************/ | ||
252 | |||
253 | static unsigned int net2big_v2_mpp_config[] __initdata = { | ||
254 | MPP0_SPI_SCn, | ||
255 | MPP1_SPI_MOSI, | ||
256 | MPP2_SPI_SCK, | ||
257 | MPP3_SPI_MISO, | ||
258 | MPP6_SYSRST_OUTn, | ||
259 | MPP7_GPO, /* Request power-off */ | ||
260 | MPP8_TW_SDA, | ||
261 | MPP9_TW_SCK, | ||
262 | MPP10_UART0_TXD, | ||
263 | MPP11_UART0_RXD, | ||
264 | MPP13_GPIO, /* Rear power switch (on|auto) */ | ||
265 | MPP14_GPIO, /* USB fuse alarm */ | ||
266 | MPP15_GPIO, /* Rear power switch (auto|off) */ | ||
267 | MPP16_GPIO, /* SATA HDD1 power */ | ||
268 | MPP17_GPIO, /* SATA HDD2 power */ | ||
269 | MPP20_SATA1_ACTn, | ||
270 | MPP21_SATA0_ACTn, | ||
271 | MPP24_GPIO, /* USB mode select */ | ||
272 | MPP26_GPIO, /* USB device vbus */ | ||
273 | MPP28_GPIO, /* USB enable host vbus */ | ||
274 | MPP29_GPIO, /* GPIO extension ALE */ | ||
275 | MPP34_GPIO, /* Rear Push button */ | ||
276 | MPP35_GPIO, /* Inhibit switch power-off */ | ||
277 | MPP36_GPIO, /* SATA HDD1 presence */ | ||
278 | MPP37_GPIO, /* SATA HDD2 presence */ | ||
279 | MPP40_GPIO, /* eSATA presence */ | ||
280 | MPP44_GPIO, /* GPIO extension (data 0) */ | ||
281 | MPP45_GPIO, /* GPIO extension (data 1) */ | ||
282 | MPP46_GPIO, /* GPIO extension (data 2) */ | ||
283 | MPP47_GPIO, /* GPIO extension (addr 0) */ | ||
284 | MPP48_GPIO, /* GPIO extension (addr 1) */ | ||
285 | MPP49_GPIO, /* GPIO extension (addr 2) */ | ||
286 | 0 | ||
287 | }; | ||
288 | |||
289 | #define NET2BIG_V2_GPIO_POWER_OFF 7 | ||
290 | |||
291 | static void net2big_v2_power_off(void) | ||
292 | { | ||
293 | gpio_set_value(NET2BIG_V2_GPIO_POWER_OFF, 1); | ||
294 | } | ||
295 | |||
296 | static void __init net2big_v2_init(void) | ||
297 | { | ||
298 | /* | ||
299 | * Basic setup. Needs to be called early. | ||
300 | */ | ||
301 | kirkwood_init(); | ||
302 | kirkwood_mpp_conf(net2big_v2_mpp_config); | ||
303 | |||
304 | net2big_v2_sata_power_init(); | ||
305 | |||
306 | kirkwood_ehci_init(); | ||
307 | kirkwood_ge00_init(&net2big_v2_ge00_data); | ||
308 | kirkwood_sata_init(&net2big_v2_sata_data); | ||
309 | kirkwood_uart0_init(); | ||
310 | spi_register_board_info(net2big_v2_spi_slave_info, | ||
311 | ARRAY_SIZE(net2big_v2_spi_slave_info)); | ||
312 | kirkwood_spi_init(); | ||
313 | kirkwood_i2c_init(); | ||
314 | i2c_register_board_info(0, net2big_v2_i2c_info, | ||
315 | ARRAY_SIZE(net2big_v2_i2c_info)); | ||
316 | |||
317 | platform_device_register(&net2big_v2_gpio_buttons); | ||
318 | |||
319 | if (gpio_request(NET2BIG_V2_GPIO_POWER_OFF, "power-off") == 0 && | ||
320 | gpio_direction_output(NET2BIG_V2_GPIO_POWER_OFF, 0) == 0) | ||
321 | pm_power_off = net2big_v2_power_off; | ||
322 | else | ||
323 | pr_err("net2big_v2: failed to configure power-off GPIO\n"); | ||
324 | } | ||
325 | |||
326 | MACHINE_START(NET2BIG_V2, "LaCie 2Big Network v2") | ||
327 | .phys_io = KIRKWOOD_REGS_PHYS_BASE, | ||
328 | .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc, | ||
329 | .boot_params = 0x00000100, | ||
330 | .init_machine = net2big_v2_init, | ||
331 | .map_io = kirkwood_map_io, | ||
332 | .init_irq = kirkwood_init_irq, | ||
333 | .timer = &net2big_v2_timer, | ||
334 | MACHINE_END | ||
diff --git a/arch/arm/mach-kirkwood/net5big_v2-setup.c b/arch/arm/mach-kirkwood/netxbig_v2-setup.c index f0617ecc8a29..8a2bb0228e4f 100644 --- a/arch/arm/mach-kirkwood/net5big_v2-setup.c +++ b/arch/arm/mach-kirkwood/netxbig_v2-setup.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * arch/arm/mach-kirkwood/net5big_v2-setup.c | 2 | * arch/arm/mach-kirkwood/netxbig_v2-setup.c |
3 | * | 3 | * |
4 | * LaCie 5Big Network v2 board setup | 4 | * LaCie 2Big and 5Big Network v2 board setup |
5 | * | 5 | * |
6 | * Copyright (C) 2010 Simon Guinot <sguinot@lacie.com> | 6 | * Copyright (C) 2010 Simon Guinot <sguinot@lacie.com> |
7 | * | 7 | * |
@@ -46,7 +46,7 @@ | |||
46 | * 512KB SPI Flash on Boot Device (MACRONIX MX25L4005) | 46 | * 512KB SPI Flash on Boot Device (MACRONIX MX25L4005) |
47 | ****************************************************************************/ | 47 | ****************************************************************************/ |
48 | 48 | ||
49 | static struct mtd_partition net5big_v2_flash_parts[] = { | 49 | static struct mtd_partition netxbig_v2_flash_parts[] = { |
50 | { | 50 | { |
51 | .name = "u-boot", | 51 | .name = "u-boot", |
52 | .size = MTDPART_SIZ_FULL, | 52 | .size = MTDPART_SIZ_FULL, |
@@ -55,17 +55,17 @@ static struct mtd_partition net5big_v2_flash_parts[] = { | |||
55 | }, | 55 | }, |
56 | }; | 56 | }; |
57 | 57 | ||
58 | static const struct flash_platform_data net5big_v2_flash = { | 58 | static const struct flash_platform_data netxbig_v2_flash = { |
59 | .type = "mx25l4005a", | 59 | .type = "mx25l4005a", |
60 | .name = "spi_flash", | 60 | .name = "spi_flash", |
61 | .parts = net5big_v2_flash_parts, | 61 | .parts = netxbig_v2_flash_parts, |
62 | .nr_parts = ARRAY_SIZE(net5big_v2_flash_parts), | 62 | .nr_parts = ARRAY_SIZE(netxbig_v2_flash_parts), |
63 | }; | 63 | }; |
64 | 64 | ||
65 | static struct spi_board_info __initdata net5big_v2_spi_slave_info[] = { | 65 | static struct spi_board_info __initdata netxbig_v2_spi_slave_info[] = { |
66 | { | 66 | { |
67 | .modalias = "m25p80", | 67 | .modalias = "m25p80", |
68 | .platform_data = &net5big_v2_flash, | 68 | .platform_data = &netxbig_v2_flash, |
69 | .irq = -1, | 69 | .irq = -1, |
70 | .max_speed_hz = 20000000, | 70 | .max_speed_hz = 20000000, |
71 | .bus_num = 0, | 71 | .bus_num = 0, |
@@ -77,11 +77,11 @@ static struct spi_board_info __initdata net5big_v2_spi_slave_info[] = { | |||
77 | * Ethernet | 77 | * Ethernet |
78 | ****************************************************************************/ | 78 | ****************************************************************************/ |
79 | 79 | ||
80 | static struct mv643xx_eth_platform_data net5big_v2_ge00_data = { | 80 | static struct mv643xx_eth_platform_data netxbig_v2_ge00_data = { |
81 | .phy_addr = MV643XX_ETH_PHY_ADDR(8), | 81 | .phy_addr = MV643XX_ETH_PHY_ADDR(8), |
82 | }; | 82 | }; |
83 | 83 | ||
84 | static struct mv643xx_eth_platform_data net5big_v2_ge01_data = { | 84 | static struct mv643xx_eth_platform_data netxbig_v2_ge01_data = { |
85 | .phy_addr = MV643XX_ETH_PHY_ADDR(0), | 85 | .phy_addr = MV643XX_ETH_PHY_ADDR(0), |
86 | }; | 86 | }; |
87 | 87 | ||
@@ -99,7 +99,7 @@ static struct at24_platform_data at24c04 = { | |||
99 | * 0x50 | HT24LC04 | eeprom (512B) | 99 | * 0x50 | HT24LC04 | eeprom (512B) |
100 | */ | 100 | */ |
101 | 101 | ||
102 | static struct i2c_board_info __initdata net5big_v2_i2c_info[] = { | 102 | static struct i2c_board_info __initdata netxbig_v2_i2c_info[] = { |
103 | { | 103 | { |
104 | I2C_BOARD_INFO("24c04", 0x50), | 104 | I2C_BOARD_INFO("24c04", 0x50), |
105 | .platform_data = &at24c04, | 105 | .platform_data = &at24c04, |
@@ -110,29 +110,35 @@ static struct i2c_board_info __initdata net5big_v2_i2c_info[] = { | |||
110 | * SATA | 110 | * SATA |
111 | ****************************************************************************/ | 111 | ****************************************************************************/ |
112 | 112 | ||
113 | static struct mv_sata_platform_data net5big_v2_sata_data = { | 113 | static struct mv_sata_platform_data netxbig_v2_sata_data = { |
114 | .n_ports = 2, | 114 | .n_ports = 2, |
115 | }; | 115 | }; |
116 | 116 | ||
117 | static int __initdata net5big_v2_gpio_hdd_power[] = { 16, 17, 41, 42, 43 }; | 117 | static int __initdata netxbig_v2_gpio_hdd_power[] = { 16, 17, 41, 42, 43 }; |
118 | 118 | ||
119 | static void __init net5big_v2_sata_power_init(void) | 119 | static void __init netxbig_v2_sata_power_init(void) |
120 | { | 120 | { |
121 | int i; | 121 | int i; |
122 | int err; | 122 | int err; |
123 | int hdd_nb; | ||
124 | |||
125 | if (machine_is_net2big_v2()) | ||
126 | hdd_nb = 2; | ||
127 | else | ||
128 | hdd_nb = 5; | ||
123 | 129 | ||
124 | /* Power up all hard disks. */ | 130 | /* Power up all hard disks. */ |
125 | for (i = 0; i < ARRAY_SIZE(net5big_v2_gpio_hdd_power); i++) { | 131 | for (i = 0; i < hdd_nb; i++) { |
126 | err = gpio_request(net5big_v2_gpio_hdd_power[i], NULL); | 132 | err = gpio_request(netxbig_v2_gpio_hdd_power[i], NULL); |
127 | if (err == 0) { | 133 | if (err == 0) { |
128 | err = gpio_direction_output( | 134 | err = gpio_direction_output( |
129 | net5big_v2_gpio_hdd_power[i], 1); | 135 | netxbig_v2_gpio_hdd_power[i], 1); |
130 | /* Free the HDD power GPIOs. This allow user-space to | 136 | /* Free the HDD power GPIOs. This allow user-space to |
131 | * configure them via the gpiolib sysfs interface. */ | 137 | * configure them via the gpiolib sysfs interface. */ |
132 | gpio_free(net5big_v2_gpio_hdd_power[i]); | 138 | gpio_free(netxbig_v2_gpio_hdd_power[i]); |
133 | } | 139 | } |
134 | if (err) | 140 | if (err) |
135 | pr_err("net5big_v2: failed to power up HDD%d\n", i + 1); | 141 | pr_err("netxbig_v2: failed to power up HDD%d\n", i + 1); |
136 | } | 142 | } |
137 | } | 143 | } |
138 | 144 | ||
@@ -140,46 +146,46 @@ static void __init net5big_v2_sata_power_init(void) | |||
140 | * GPIO keys | 146 | * GPIO keys |
141 | ****************************************************************************/ | 147 | ****************************************************************************/ |
142 | 148 | ||
143 | #define NET5BIG_V2_GPIO_SWITCH_POWER_ON 13 | 149 | #define NETXBIG_V2_GPIO_SWITCH_POWER_ON 13 |
144 | #define NET5BIG_V2_GPIO_SWITCH_POWER_OFF 15 | 150 | #define NETXBIG_V2_GPIO_SWITCH_POWER_OFF 15 |
145 | #define NET5BIG_V2_GPIO_FUNC_BUTTON 34 | 151 | #define NETXBIG_V2_GPIO_FUNC_BUTTON 34 |
146 | 152 | ||
147 | #define NET5BIG_V2_SWITCH_POWER_ON 0x1 | 153 | #define NETXBIG_V2_SWITCH_POWER_ON 0x1 |
148 | #define NET5BIG_V2_SWITCH_POWER_OFF 0x2 | 154 | #define NETXBIG_V2_SWITCH_POWER_OFF 0x2 |
149 | 155 | ||
150 | static struct gpio_keys_button net5big_v2_buttons[] = { | 156 | static struct gpio_keys_button netxbig_v2_buttons[] = { |
151 | [0] = { | 157 | [0] = { |
152 | .type = EV_SW, | 158 | .type = EV_SW, |
153 | .code = NET5BIG_V2_SWITCH_POWER_ON, | 159 | .code = NETXBIG_V2_SWITCH_POWER_ON, |
154 | .gpio = NET5BIG_V2_GPIO_SWITCH_POWER_ON, | 160 | .gpio = NETXBIG_V2_GPIO_SWITCH_POWER_ON, |
155 | .desc = "Back power switch (on|auto)", | 161 | .desc = "Back power switch (on|auto)", |
156 | .active_low = 1, | 162 | .active_low = 1, |
157 | }, | 163 | }, |
158 | [1] = { | 164 | [1] = { |
159 | .type = EV_SW, | 165 | .type = EV_SW, |
160 | .code = NET5BIG_V2_SWITCH_POWER_OFF, | 166 | .code = NETXBIG_V2_SWITCH_POWER_OFF, |
161 | .gpio = NET5BIG_V2_GPIO_SWITCH_POWER_OFF, | 167 | .gpio = NETXBIG_V2_GPIO_SWITCH_POWER_OFF, |
162 | .desc = "Back power switch (auto|off)", | 168 | .desc = "Back power switch (auto|off)", |
163 | .active_low = 1, | 169 | .active_low = 1, |
164 | }, | 170 | }, |
165 | [2] = { | 171 | [2] = { |
166 | .code = KEY_OPTION, | 172 | .code = KEY_OPTION, |
167 | .gpio = NET5BIG_V2_GPIO_FUNC_BUTTON, | 173 | .gpio = NETXBIG_V2_GPIO_FUNC_BUTTON, |
168 | .desc = "Function button", | 174 | .desc = "Function button", |
169 | .active_low = 1, | 175 | .active_low = 1, |
170 | }, | 176 | }, |
171 | }; | 177 | }; |
172 | 178 | ||
173 | static struct gpio_keys_platform_data net5big_v2_button_data = { | 179 | static struct gpio_keys_platform_data netxbig_v2_button_data = { |
174 | .buttons = net5big_v2_buttons, | 180 | .buttons = netxbig_v2_buttons, |
175 | .nbuttons = ARRAY_SIZE(net5big_v2_buttons), | 181 | .nbuttons = ARRAY_SIZE(netxbig_v2_buttons), |
176 | }; | 182 | }; |
177 | 183 | ||
178 | static struct platform_device net5big_v2_gpio_buttons = { | 184 | static struct platform_device netxbig_v2_gpio_buttons = { |
179 | .name = "gpio-keys", | 185 | .name = "gpio-keys", |
180 | .id = -1, | 186 | .id = -1, |
181 | .dev = { | 187 | .dev = { |
182 | .platform_data = &net5big_v2_button_data, | 188 | .platform_data = &netxbig_v2_button_data, |
183 | }, | 189 | }, |
184 | }; | 190 | }; |
185 | 191 | ||
@@ -243,20 +249,56 @@ static struct platform_device net5big_v2_gpio_buttons = { | |||
243 | * Timer | 249 | * Timer |
244 | ****************************************************************************/ | 250 | ****************************************************************************/ |
245 | 251 | ||
246 | static void net5big_v2_timer_init(void) | 252 | static void netxbig_v2_timer_init(void) |
247 | { | 253 | { |
248 | kirkwood_tclk = 166666667; | 254 | kirkwood_tclk = 166666667; |
249 | orion_time_init(IRQ_KIRKWOOD_BRIDGE, kirkwood_tclk); | 255 | orion_time_init(IRQ_KIRKWOOD_BRIDGE, kirkwood_tclk); |
250 | } | 256 | } |
251 | 257 | ||
252 | struct sys_timer net5big_v2_timer = { | 258 | struct sys_timer netxbig_v2_timer = { |
253 | .init = net5big_v2_timer_init, | 259 | .init = netxbig_v2_timer_init, |
254 | }; | 260 | }; |
255 | 261 | ||
256 | /***************************************************************************** | 262 | /***************************************************************************** |
257 | * General Setup | 263 | * General Setup |
258 | ****************************************************************************/ | 264 | ****************************************************************************/ |
259 | 265 | ||
266 | static unsigned int net2big_v2_mpp_config[] __initdata = { | ||
267 | MPP0_SPI_SCn, | ||
268 | MPP1_SPI_MOSI, | ||
269 | MPP2_SPI_SCK, | ||
270 | MPP3_SPI_MISO, | ||
271 | MPP6_SYSRST_OUTn, | ||
272 | MPP7_GPO, /* Request power-off */ | ||
273 | MPP8_TW_SDA, | ||
274 | MPP9_TW_SCK, | ||
275 | MPP10_UART0_TXD, | ||
276 | MPP11_UART0_RXD, | ||
277 | MPP13_GPIO, /* Rear power switch (on|auto) */ | ||
278 | MPP14_GPIO, /* USB fuse alarm */ | ||
279 | MPP15_GPIO, /* Rear power switch (auto|off) */ | ||
280 | MPP16_GPIO, /* SATA HDD1 power */ | ||
281 | MPP17_GPIO, /* SATA HDD2 power */ | ||
282 | MPP20_SATA1_ACTn, | ||
283 | MPP21_SATA0_ACTn, | ||
284 | MPP24_GPIO, /* USB mode select */ | ||
285 | MPP26_GPIO, /* USB device vbus */ | ||
286 | MPP28_GPIO, /* USB enable host vbus */ | ||
287 | MPP29_GPIO, /* CPLD extension ALE */ | ||
288 | MPP34_GPIO, /* Rear Push button */ | ||
289 | MPP35_GPIO, /* Inhibit switch power-off */ | ||
290 | MPP36_GPIO, /* SATA HDD1 presence */ | ||
291 | MPP37_GPIO, /* SATA HDD2 presence */ | ||
292 | MPP40_GPIO, /* eSATA presence */ | ||
293 | MPP44_GPIO, /* CPLD extension (data 0) */ | ||
294 | MPP45_GPIO, /* CPLD extension (data 1) */ | ||
295 | MPP46_GPIO, /* CPLD extension (data 2) */ | ||
296 | MPP47_GPIO, /* CPLD extension (addr 0) */ | ||
297 | MPP48_GPIO, /* CPLD extension (addr 1) */ | ||
298 | MPP49_GPIO, /* CPLD extension (addr 2) */ | ||
299 | 0 | ||
300 | }; | ||
301 | |||
260 | static unsigned int net5big_v2_mpp_config[] __initdata = { | 302 | static unsigned int net5big_v2_mpp_config[] __initdata = { |
261 | MPP0_SPI_SCn, | 303 | MPP0_SPI_SCn, |
262 | MPP1_SPI_MOSI, | 304 | MPP1_SPI_MOSI, |
@@ -306,50 +348,68 @@ static unsigned int net5big_v2_mpp_config[] __initdata = { | |||
306 | 0 | 348 | 0 |
307 | }; | 349 | }; |
308 | 350 | ||
309 | #define NET5BIG_V2_GPIO_POWER_OFF 7 | 351 | #define NETXBIG_V2_GPIO_POWER_OFF 7 |
310 | 352 | ||
311 | static void net5big_v2_power_off(void) | 353 | static void netxbig_v2_power_off(void) |
312 | { | 354 | { |
313 | gpio_set_value(NET5BIG_V2_GPIO_POWER_OFF, 1); | 355 | gpio_set_value(NETXBIG_V2_GPIO_POWER_OFF, 1); |
314 | } | 356 | } |
315 | 357 | ||
316 | static void __init net5big_v2_init(void) | 358 | static void __init netxbig_v2_init(void) |
317 | { | 359 | { |
318 | /* | 360 | /* |
319 | * Basic setup. Needs to be called early. | 361 | * Basic setup. Needs to be called early. |
320 | */ | 362 | */ |
321 | kirkwood_init(); | 363 | kirkwood_init(); |
322 | kirkwood_mpp_conf(net5big_v2_mpp_config); | 364 | if (machine_is_net2big_v2()) |
365 | kirkwood_mpp_conf(net2big_v2_mpp_config); | ||
366 | else | ||
367 | kirkwood_mpp_conf(net5big_v2_mpp_config); | ||
323 | 368 | ||
324 | net5big_v2_sata_power_init(); | 369 | netxbig_v2_sata_power_init(); |
325 | 370 | ||
326 | kirkwood_ehci_init(); | 371 | kirkwood_ehci_init(); |
327 | kirkwood_ge00_init(&net5big_v2_ge00_data); | 372 | kirkwood_ge00_init(&netxbig_v2_ge00_data); |
328 | kirkwood_ge01_init(&net5big_v2_ge01_data); | 373 | if (machine_is_net5big_v2()) |
329 | kirkwood_sata_init(&net5big_v2_sata_data); | 374 | kirkwood_ge01_init(&netxbig_v2_ge01_data); |
375 | kirkwood_sata_init(&netxbig_v2_sata_data); | ||
330 | kirkwood_uart0_init(); | 376 | kirkwood_uart0_init(); |
331 | spi_register_board_info(net5big_v2_spi_slave_info, | 377 | spi_register_board_info(netxbig_v2_spi_slave_info, |
332 | ARRAY_SIZE(net5big_v2_spi_slave_info)); | 378 | ARRAY_SIZE(netxbig_v2_spi_slave_info)); |
333 | kirkwood_spi_init(); | 379 | kirkwood_spi_init(); |
334 | kirkwood_i2c_init(); | 380 | kirkwood_i2c_init(); |
335 | i2c_register_board_info(0, net5big_v2_i2c_info, | 381 | i2c_register_board_info(0, netxbig_v2_i2c_info, |
336 | ARRAY_SIZE(net5big_v2_i2c_info)); | 382 | ARRAY_SIZE(netxbig_v2_i2c_info)); |
337 | 383 | ||
338 | platform_device_register(&net5big_v2_gpio_buttons); | 384 | platform_device_register(&netxbig_v2_gpio_buttons); |
339 | 385 | ||
340 | if (gpio_request(NET5BIG_V2_GPIO_POWER_OFF, "power-off") == 0 && | 386 | if (gpio_request(NETXBIG_V2_GPIO_POWER_OFF, "power-off") == 0 && |
341 | gpio_direction_output(NET5BIG_V2_GPIO_POWER_OFF, 0) == 0) | 387 | gpio_direction_output(NETXBIG_V2_GPIO_POWER_OFF, 0) == 0) |
342 | pm_power_off = net5big_v2_power_off; | 388 | pm_power_off = netxbig_v2_power_off; |
343 | else | 389 | else |
344 | pr_err("net5big_v2: failed to configure power-off GPIO\n"); | 390 | pr_err("netxbig_v2: failed to configure power-off GPIO\n"); |
345 | } | 391 | } |
346 | 392 | ||
393 | #ifdef CONFIG_MACH_NET2BIG_V2 | ||
394 | MACHINE_START(NET2BIG_V2, "LaCie 2Big Network v2") | ||
395 | .phys_io = KIRKWOOD_REGS_PHYS_BASE, | ||
396 | .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc, | ||
397 | .boot_params = 0x00000100, | ||
398 | .init_machine = netxbig_v2_init, | ||
399 | .map_io = kirkwood_map_io, | ||
400 | .init_irq = kirkwood_init_irq, | ||
401 | .timer = &netxbig_v2_timer, | ||
402 | MACHINE_END | ||
403 | #endif | ||
404 | |||
405 | #ifdef CONFIG_MACH_NET5BIG_V2 | ||
347 | MACHINE_START(NET5BIG_V2, "LaCie 5Big Network v2") | 406 | MACHINE_START(NET5BIG_V2, "LaCie 5Big Network v2") |
348 | .phys_io = KIRKWOOD_REGS_PHYS_BASE, | 407 | .phys_io = KIRKWOOD_REGS_PHYS_BASE, |
349 | .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc, | 408 | .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc, |
350 | .boot_params = 0x00000100, | 409 | .boot_params = 0x00000100, |
351 | .init_machine = net5big_v2_init, | 410 | .init_machine = netxbig_v2_init, |
352 | .map_io = kirkwood_map_io, | 411 | .map_io = kirkwood_map_io, |
353 | .init_irq = kirkwood_init_irq, | 412 | .init_irq = kirkwood_init_irq, |
354 | .timer = &net5big_v2_timer, | 413 | .timer = &netxbig_v2_timer, |
355 | MACHINE_END | 414 | MACHINE_END |
415 | #endif | ||