diff options
author | Simon Guinot <sguinot@lacie.com> | 2010-09-19 09:33:59 -0400 |
---|---|---|
committer | Nicolas Pitre <nico@fluxnic.net> | 2010-09-19 22:43:45 -0400 |
commit | b51d92da4ebb52b61fdc99c911171562673e88ef (patch) | |
tree | 09b08f200c2d7dceabb050780783b654748e312b /arch/arm/mach-kirkwood/netxbig_v2-setup.c | |
parent | 84712e9aa43862ded44e47acfaa93612a7eeaf7c (diff) |
[ARM] Kirkwood: remove duplicated code in LaCie setup files
Signed-off-by: Simon Guinot <sguinot@lacie.com>
Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Diffstat (limited to 'arch/arm/mach-kirkwood/netxbig_v2-setup.c')
-rw-r--r-- | arch/arm/mach-kirkwood/netxbig_v2-setup.c | 119 |
1 files changed, 9 insertions, 110 deletions
diff --git a/arch/arm/mach-kirkwood/netxbig_v2-setup.c b/arch/arm/mach-kirkwood/netxbig_v2-setup.c index 2bd14c5079de..aec528d6081f 100644 --- a/arch/arm/mach-kirkwood/netxbig_v2-setup.c +++ b/arch/arm/mach-kirkwood/netxbig_v2-setup.c | |||
@@ -23,55 +23,18 @@ | |||
23 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/platform_device.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> | 26 | #include <linux/ata_platform.h> |
30 | #include <linux/mv643xx_eth.h> | 27 | #include <linux/mv643xx_eth.h> |
31 | #include <linux/i2c.h> | ||
32 | #include <linux/i2c/at24.h> | ||
33 | #include <linux/input.h> | 28 | #include <linux/input.h> |
34 | #include <linux/gpio.h> | 29 | #include <linux/gpio.h> |
35 | #include <linux/gpio_keys.h> | 30 | #include <linux/gpio_keys.h> |
36 | #include <linux/leds.h> | 31 | #include <linux/leds.h> |
37 | #include <asm/mach-types.h> | 32 | #include <asm/mach-types.h> |
38 | #include <asm/mach/arch.h> | 33 | #include <asm/mach/arch.h> |
39 | #include <asm/mach/time.h> | ||
40 | #include <mach/kirkwood.h> | 34 | #include <mach/kirkwood.h> |
41 | #include <plat/time.h> | ||
42 | #include "common.h" | 35 | #include "common.h" |
43 | #include "mpp.h" | 36 | #include "mpp.h" |
44 | 37 | #include "lacie_v2-common.h" | |
45 | /***************************************************************************** | ||
46 | * 512KB SPI Flash on Boot Device (MACRONIX MX25L4005) | ||
47 | ****************************************************************************/ | ||
48 | |||
49 | static struct mtd_partition netxbig_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 netxbig_v2_flash = { | ||
59 | .type = "mx25l4005a", | ||
60 | .name = "spi_flash", | ||
61 | .parts = netxbig_v2_flash_parts, | ||
62 | .nr_parts = ARRAY_SIZE(netxbig_v2_flash_parts), | ||
63 | }; | ||
64 | |||
65 | static struct spi_board_info __initdata netxbig_v2_spi_slave_info[] = { | ||
66 | { | ||
67 | .modalias = "m25p80", | ||
68 | .platform_data = &netxbig_v2_flash, | ||
69 | .irq = -1, | ||
70 | .max_speed_hz = 20000000, | ||
71 | .bus_num = 0, | ||
72 | .chip_select = 0, | ||
73 | }, | ||
74 | }; | ||
75 | 38 | ||
76 | /***************************************************************************** | 39 | /***************************************************************************** |
77 | * Ethernet | 40 | * Ethernet |
@@ -86,27 +49,6 @@ static struct mv643xx_eth_platform_data netxbig_v2_ge01_data = { | |||
86 | }; | 49 | }; |
87 | 50 | ||
88 | /***************************************************************************** | 51 | /***************************************************************************** |
89 | * I2C devices | ||
90 | ****************************************************************************/ | ||
91 | |||
92 | static struct at24_platform_data at24c04 = { | ||
93 | .byte_len = SZ_4K / 8, | ||
94 | .page_size = 16, | ||
95 | }; | ||
96 | |||
97 | /* | ||
98 | * i2c addr | chip | description | ||
99 | * 0x50 | HT24LC04 | eeprom (512B) | ||
100 | */ | ||
101 | |||
102 | static struct i2c_board_info __initdata netxbig_v2_i2c_info[] = { | ||
103 | { | ||
104 | I2C_BOARD_INFO("24c04", 0x50), | ||
105 | .platform_data = &at24c04, | ||
106 | } | ||
107 | }; | ||
108 | |||
109 | /***************************************************************************** | ||
110 | * SATA | 52 | * SATA |
111 | ****************************************************************************/ | 53 | ****************************************************************************/ |
112 | 54 | ||
@@ -114,34 +56,6 @@ static struct mv_sata_platform_data netxbig_v2_sata_data = { | |||
114 | .n_ports = 2, | 56 | .n_ports = 2, |
115 | }; | 57 | }; |
116 | 58 | ||
117 | static int __initdata netxbig_v2_gpio_hdd_power[] = { 16, 17, 41, 42, 43 }; | ||
118 | |||
119 | static void __init netxbig_v2_sata_power_init(void) | ||
120 | { | ||
121 | int i; | ||
122 | int err; | ||
123 | int hdd_nb; | ||
124 | |||
125 | if (machine_is_net2big_v2()) | ||
126 | hdd_nb = 2; | ||
127 | else | ||
128 | hdd_nb = 5; | ||
129 | |||
130 | /* Power up all hard disks. */ | ||
131 | for (i = 0; i < hdd_nb; i++) { | ||
132 | err = gpio_request(netxbig_v2_gpio_hdd_power[i], NULL); | ||
133 | if (err == 0) { | ||
134 | err = gpio_direction_output( | ||
135 | netxbig_v2_gpio_hdd_power[i], 1); | ||
136 | /* Free the HDD power GPIOs. This allow user-space to | ||
137 | * configure them via the gpiolib sysfs interface. */ | ||
138 | gpio_free(netxbig_v2_gpio_hdd_power[i]); | ||
139 | } | ||
140 | if (err) | ||
141 | pr_err("netxbig_v2: failed to power up HDD%d\n", i + 1); | ||
142 | } | ||
143 | } | ||
144 | |||
145 | /***************************************************************************** | 59 | /***************************************************************************** |
146 | * GPIO keys | 60 | * GPIO keys |
147 | ****************************************************************************/ | 61 | ****************************************************************************/ |
@@ -246,20 +160,6 @@ static struct platform_device netxbig_v2_gpio_buttons = { | |||
246 | */ | 160 | */ |
247 | 161 | ||
248 | /***************************************************************************** | 162 | /***************************************************************************** |
249 | * Timer | ||
250 | ****************************************************************************/ | ||
251 | |||
252 | static void netxbig_v2_timer_init(void) | ||
253 | { | ||
254 | kirkwood_tclk = 166666667; | ||
255 | orion_time_init(IRQ_KIRKWOOD_BRIDGE, kirkwood_tclk); | ||
256 | } | ||
257 | |||
258 | struct sys_timer netxbig_v2_timer = { | ||
259 | .init = netxbig_v2_timer_init, | ||
260 | }; | ||
261 | |||
262 | /***************************************************************************** | ||
263 | * General Setup | 163 | * General Setup |
264 | ****************************************************************************/ | 164 | ****************************************************************************/ |
265 | 165 | ||
@@ -366,7 +266,10 @@ static void __init netxbig_v2_init(void) | |||
366 | else | 266 | else |
367 | kirkwood_mpp_conf(net5big_v2_mpp_config); | 267 | kirkwood_mpp_conf(net5big_v2_mpp_config); |
368 | 268 | ||
369 | netxbig_v2_sata_power_init(); | 269 | if (machine_is_net2big_v2()) |
270 | lacie_v2_hdd_power_init(2); | ||
271 | else | ||
272 | lacie_v2_hdd_power_init(5); | ||
370 | 273 | ||
371 | kirkwood_ehci_init(); | 274 | kirkwood_ehci_init(); |
372 | kirkwood_ge00_init(&netxbig_v2_ge00_data); | 275 | kirkwood_ge00_init(&netxbig_v2_ge00_data); |
@@ -374,12 +277,8 @@ static void __init netxbig_v2_init(void) | |||
374 | kirkwood_ge01_init(&netxbig_v2_ge01_data); | 277 | kirkwood_ge01_init(&netxbig_v2_ge01_data); |
375 | kirkwood_sata_init(&netxbig_v2_sata_data); | 278 | kirkwood_sata_init(&netxbig_v2_sata_data); |
376 | kirkwood_uart0_init(); | 279 | kirkwood_uart0_init(); |
377 | spi_register_board_info(netxbig_v2_spi_slave_info, | 280 | lacie_v2_register_flash(); |
378 | ARRAY_SIZE(netxbig_v2_spi_slave_info)); | 281 | lacie_v2_register_i2c_devices(); |
379 | kirkwood_spi_init(); | ||
380 | kirkwood_i2c_init(); | ||
381 | i2c_register_board_info(0, netxbig_v2_i2c_info, | ||
382 | ARRAY_SIZE(netxbig_v2_i2c_info)); | ||
383 | 282 | ||
384 | platform_device_register(&netxbig_v2_gpio_buttons); | 283 | platform_device_register(&netxbig_v2_gpio_buttons); |
385 | 284 | ||
@@ -398,7 +297,7 @@ MACHINE_START(NET2BIG_V2, "LaCie 2Big Network v2") | |||
398 | .init_machine = netxbig_v2_init, | 297 | .init_machine = netxbig_v2_init, |
399 | .map_io = kirkwood_map_io, | 298 | .map_io = kirkwood_map_io, |
400 | .init_irq = kirkwood_init_irq, | 299 | .init_irq = kirkwood_init_irq, |
401 | .timer = &netxbig_v2_timer, | 300 | .timer = &lacie_v2_timer, |
402 | MACHINE_END | 301 | MACHINE_END |
403 | #endif | 302 | #endif |
404 | 303 | ||
@@ -410,6 +309,6 @@ MACHINE_START(NET5BIG_V2, "LaCie 5Big Network v2") | |||
410 | .init_machine = netxbig_v2_init, | 309 | .init_machine = netxbig_v2_init, |
411 | .map_io = kirkwood_map_io, | 310 | .map_io = kirkwood_map_io, |
412 | .init_irq = kirkwood_init_irq, | 311 | .init_irq = kirkwood_init_irq, |
413 | .timer = &netxbig_v2_timer, | 312 | .timer = &lacie_v2_timer, |
414 | MACHINE_END | 313 | MACHINE_END |
415 | #endif | 314 | #endif |