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 | |
| 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>
| -rw-r--r-- | arch/arm/mach-kirkwood/Makefile | 12 | ||||
| -rw-r--r-- | arch/arm/mach-kirkwood/d2net_v2-setup.c | 102 | ||||
| -rw-r--r-- | arch/arm/mach-kirkwood/lacie_v2-common.c | 127 | ||||
| -rw-r--r-- | arch/arm/mach-kirkwood/lacie_v2-common.h | 18 | ||||
| -rw-r--r-- | arch/arm/mach-kirkwood/netspace_v2-setup.c | 122 | ||||
| -rw-r--r-- | arch/arm/mach-kirkwood/netxbig_v2-setup.c | 119 |
6 files changed, 175 insertions, 325 deletions
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile index b84de6a576db..5dcaa81a2ec3 100644 --- a/arch/arm/mach-kirkwood/Makefile +++ b/arch/arm/mach-kirkwood/Makefile | |||
| @@ -11,12 +11,12 @@ obj-$(CONFIG_MACH_DOCKSTAR) += dockstar-setup.o | |||
| 11 | obj-$(CONFIG_MACH_TS219) += ts219-setup.o tsx1x-common.o | 11 | obj-$(CONFIG_MACH_TS219) += ts219-setup.o tsx1x-common.o |
| 12 | obj-$(CONFIG_MACH_TS41X) += ts41x-setup.o tsx1x-common.o | 12 | obj-$(CONFIG_MACH_TS41X) += ts41x-setup.o tsx1x-common.o |
| 13 | obj-$(CONFIG_MACH_OPENRD) += openrd-setup.o | 13 | obj-$(CONFIG_MACH_OPENRD) += openrd-setup.o |
| 14 | obj-$(CONFIG_MACH_NETSPACE_V2) += netspace_v2-setup.o | 14 | obj-$(CONFIG_MACH_NETSPACE_V2) += netspace_v2-setup.o lacie_v2-common.o |
| 15 | obj-$(CONFIG_MACH_INETSPACE_V2) += netspace_v2-setup.o | 15 | obj-$(CONFIG_MACH_INETSPACE_V2) += netspace_v2-setup.o lacie_v2-common.o |
| 16 | obj-$(CONFIG_MACH_NETSPACE_MAX_V2) += netspace_v2-setup.o | 16 | obj-$(CONFIG_MACH_NETSPACE_MAX_V2) += netspace_v2-setup.o lacie_v2-common.o |
| 17 | obj-$(CONFIG_MACH_D2NET_V2) += d2net_v2-setup.o | 17 | obj-$(CONFIG_MACH_D2NET_V2) += d2net_v2-setup.o lacie_v2-common.o |
| 18 | obj-$(CONFIG_MACH_NET2BIG_V2) += netxbig_v2-setup.o | 18 | obj-$(CONFIG_MACH_NET2BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o |
| 19 | obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o | 19 | obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o |
| 20 | obj-$(CONFIG_MACH_T5325) += t5325-setup.o | 20 | obj-$(CONFIG_MACH_T5325) += t5325-setup.o |
| 21 | 21 | ||
| 22 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o | 22 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o |
diff --git a/arch/arm/mach-kirkwood/d2net_v2-setup.c b/arch/arm/mach-kirkwood/d2net_v2-setup.c index 310c6a0331f6..cd62d0f82a73 100644 --- a/arch/arm/mach-kirkwood/d2net_v2-setup.c +++ b/arch/arm/mach-kirkwood/d2net_v2-setup.c | |||
| @@ -23,56 +23,19 @@ | |||
| 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 <mach/leds-ns2.h> | 35 | #include <mach/leds-ns2.h> |
| 42 | #include <plat/time.h> | ||
| 43 | #include "common.h" | 36 | #include "common.h" |
| 44 | #include "mpp.h" | 37 | #include "mpp.h" |
| 45 | 38 | #include "lacie_v2-common.h" | |
| 46 | /***************************************************************************** | ||
| 47 | * 512KB SPI Flash on Boot Device | ||
| 48 | ****************************************************************************/ | ||
| 49 | |||
| 50 | static struct mtd_partition d2net_v2_flash_parts[] = { | ||
| 51 | { | ||
| 52 | .name = "u-boot", | ||
| 53 | .size = MTDPART_SIZ_FULL, | ||
| 54 | .offset = 0, | ||
| 55 | .mask_flags = MTD_WRITEABLE, | ||
| 56 | }, | ||
| 57 | }; | ||
| 58 | |||
| 59 | static const struct flash_platform_data d2net_v2_flash = { | ||
| 60 | .type = "mx25l4005a", | ||
| 61 | .name = "spi_flash", | ||
| 62 | .parts = d2net_v2_flash_parts, | ||
| 63 | .nr_parts = ARRAY_SIZE(d2net_v2_flash_parts), | ||
| 64 | }; | ||
| 65 | |||
| 66 | static struct spi_board_info __initdata d2net_v2_spi_slave_info[] = { | ||
| 67 | { | ||
| 68 | .modalias = "m25p80", | ||
| 69 | .platform_data = &d2net_v2_flash, | ||
| 70 | .irq = -1, | ||
| 71 | .max_speed_hz = 20000000, | ||
| 72 | .bus_num = 0, | ||
| 73 | .chip_select = 0, | ||
| 74 | }, | ||
| 75 | }; | ||
| 76 | 39 | ||
| 77 | /***************************************************************************** | 40 | /***************************************************************************** |
| 78 | * Ethernet | 41 | * Ethernet |
| @@ -83,27 +46,6 @@ static struct mv643xx_eth_platform_data d2net_v2_ge00_data = { | |||
| 83 | }; | 46 | }; |
| 84 | 47 | ||
| 85 | /***************************************************************************** | 48 | /***************************************************************************** |
| 86 | * I2C devices | ||
| 87 | ****************************************************************************/ | ||
| 88 | |||
| 89 | static struct at24_platform_data at24c04 = { | ||
| 90 | .byte_len = SZ_4K / 8, | ||
| 91 | .page_size = 16, | ||
| 92 | }; | ||
| 93 | |||
| 94 | /* | ||
| 95 | * i2c addr | chip | description | ||
| 96 | * 0x50 | HT24LC04 | eeprom (512B) | ||
| 97 | */ | ||
| 98 | |||
| 99 | static struct i2c_board_info __initdata d2net_v2_i2c_info[] = { | ||
| 100 | { | ||
| 101 | I2C_BOARD_INFO("24c04", 0x50), | ||
| 102 | .platform_data = &at24c04, | ||
| 103 | } | ||
| 104 | }; | ||
| 105 | |||
| 106 | /***************************************************************************** | ||
| 107 | * SATA | 49 | * SATA |
| 108 | ****************************************************************************/ | 50 | ****************************************************************************/ |
| 109 | 51 | ||
| @@ -111,22 +53,6 @@ static struct mv_sata_platform_data d2net_v2_sata_data = { | |||
| 111 | .n_ports = 2, | 53 | .n_ports = 2, |
| 112 | }; | 54 | }; |
| 113 | 55 | ||
| 114 | #define D2NET_V2_GPIO_SATA0_POWER 16 | ||
| 115 | |||
| 116 | static void __init d2net_v2_sata_power_init(void) | ||
| 117 | { | ||
| 118 | int err; | ||
| 119 | |||
| 120 | err = gpio_request(D2NET_V2_GPIO_SATA0_POWER, "SATA0 power"); | ||
| 121 | if (err == 0) { | ||
| 122 | err = gpio_direction_output(D2NET_V2_GPIO_SATA0_POWER, 1); | ||
| 123 | if (err) | ||
| 124 | gpio_free(D2NET_V2_GPIO_SATA0_POWER); | ||
| 125 | } | ||
| 126 | if (err) | ||
| 127 | pr_err("d2net_v2: failed to configure SATA0 power GPIO\n"); | ||
| 128 | } | ||
| 129 | |||
| 130 | /***************************************************************************** | 56 | /***************************************************************************** |
| 131 | * GPIO keys | 57 | * GPIO keys |
| 132 | ****************************************************************************/ | 58 | ****************************************************************************/ |
| @@ -229,20 +155,6 @@ static struct platform_device d2net_v2_leds = { | |||
| 229 | }; | 155 | }; |
| 230 | 156 | ||
| 231 | /***************************************************************************** | 157 | /***************************************************************************** |
| 232 | * Timer | ||
| 233 | ****************************************************************************/ | ||
| 234 | |||
| 235 | static void d2net_v2_timer_init(void) | ||
| 236 | { | ||
| 237 | kirkwood_tclk = 166666667; | ||
| 238 | orion_time_init(IRQ_KIRKWOOD_BRIDGE, kirkwood_tclk); | ||
| 239 | } | ||
| 240 | |||
| 241 | struct sys_timer d2net_v2_timer = { | ||
| 242 | .init = d2net_v2_timer_init, | ||
| 243 | }; | ||
| 244 | |||
| 245 | /***************************************************************************** | ||
| 246 | * General Setup | 158 | * General Setup |
| 247 | ****************************************************************************/ | 159 | ****************************************************************************/ |
| 248 | 160 | ||
| @@ -288,18 +200,14 @@ static void __init d2net_v2_init(void) | |||
| 288 | kirkwood_init(); | 200 | kirkwood_init(); |
| 289 | kirkwood_mpp_conf(d2net_v2_mpp_config); | 201 | kirkwood_mpp_conf(d2net_v2_mpp_config); |
| 290 | 202 | ||
| 291 | d2net_v2_sata_power_init(); | 203 | lacie_v2_hdd_power_init(1); |
| 292 | 204 | ||
| 293 | kirkwood_ehci_init(); | 205 | kirkwood_ehci_init(); |
| 294 | kirkwood_ge00_init(&d2net_v2_ge00_data); | 206 | kirkwood_ge00_init(&d2net_v2_ge00_data); |
| 295 | kirkwood_sata_init(&d2net_v2_sata_data); | 207 | kirkwood_sata_init(&d2net_v2_sata_data); |
| 296 | kirkwood_uart0_init(); | 208 | kirkwood_uart0_init(); |
| 297 | spi_register_board_info(d2net_v2_spi_slave_info, | 209 | lacie_v2_register_flash(); |
| 298 | ARRAY_SIZE(d2net_v2_spi_slave_info)); | 210 | lacie_v2_register_i2c_devices(); |
| 299 | kirkwood_spi_init(); | ||
| 300 | kirkwood_i2c_init(); | ||
| 301 | i2c_register_board_info(0, d2net_v2_i2c_info, | ||
| 302 | ARRAY_SIZE(d2net_v2_i2c_info)); | ||
| 303 | 211 | ||
| 304 | platform_device_register(&d2net_v2_leds); | 212 | platform_device_register(&d2net_v2_leds); |
| 305 | platform_device_register(&d2net_v2_gpio_leds); | 213 | platform_device_register(&d2net_v2_gpio_leds); |
| @@ -319,5 +227,5 @@ MACHINE_START(D2NET_V2, "LaCie d2 Network v2") | |||
| 319 | .init_machine = d2net_v2_init, | 227 | .init_machine = d2net_v2_init, |
| 320 | .map_io = kirkwood_map_io, | 228 | .map_io = kirkwood_map_io, |
| 321 | .init_irq = kirkwood_init_irq, | 229 | .init_irq = kirkwood_init_irq, |
| 322 | .timer = &d2net_v2_timer, | 230 | .timer = &lacie_v2_timer, |
| 323 | MACHINE_END | 231 | MACHINE_END |
diff --git a/arch/arm/mach-kirkwood/lacie_v2-common.c b/arch/arm/mach-kirkwood/lacie_v2-common.c new file mode 100644 index 000000000000..d3ea1b6c8a02 --- /dev/null +++ b/arch/arm/mach-kirkwood/lacie_v2-common.c | |||
| @@ -0,0 +1,127 @@ | |||
| 1 | /* | ||
| 2 | * arch/arm/mach-kirkwood/lacie_v2-common.c | ||
| 3 | * | ||
| 4 | * This file is licensed under the terms of the GNU General Public | ||
| 5 | * License version 2. This program is licensed "as is" without any | ||
| 6 | * warranty of any kind, whether express or implied. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #include <linux/kernel.h> | ||
| 10 | #include <linux/init.h> | ||
| 11 | #include <linux/mtd/physmap.h> | ||
| 12 | #include <linux/spi/flash.h> | ||
| 13 | #include <linux/spi/spi.h> | ||
| 14 | #include <linux/i2c.h> | ||
| 15 | #include <linux/i2c/at24.h> | ||
| 16 | #include <linux/gpio.h> | ||
| 17 | #include <asm/mach/time.h> | ||
| 18 | #include <mach/kirkwood.h> | ||
| 19 | #include <mach/irqs.h> | ||
| 20 | #include <plat/time.h> | ||
| 21 | #include "common.h" | ||
| 22 | |||
| 23 | /***************************************************************************** | ||
| 24 | * 512KB SPI Flash on Boot Device (MACRONIX MX25L4005) | ||
| 25 | ****************************************************************************/ | ||
| 26 | |||
| 27 | static struct mtd_partition lacie_v2_flash_parts[] = { | ||
| 28 | { | ||
| 29 | .name = "u-boot", | ||
| 30 | .size = MTDPART_SIZ_FULL, | ||
| 31 | .offset = 0, | ||
| 32 | .mask_flags = MTD_WRITEABLE, /* force read-only */ | ||
| 33 | }, | ||
| 34 | }; | ||
| 35 | |||
| 36 | static const struct flash_platform_data lacie_v2_flash = { | ||
| 37 | .type = "mx25l4005a", | ||
| 38 | .name = "spi_flash", | ||
| 39 | .parts = lacie_v2_flash_parts, | ||
| 40 | .nr_parts = ARRAY_SIZE(lacie_v2_flash_parts), | ||
| 41 | }; | ||
| 42 | |||
| 43 | static struct spi_board_info __initdata lacie_v2_spi_slave_info[] = { | ||
| 44 | { | ||
| 45 | .modalias = "m25p80", | ||
| 46 | .platform_data = &lacie_v2_flash, | ||
| 47 | .irq = -1, | ||
| 48 | .max_speed_hz = 20000000, | ||
| 49 | .bus_num = 0, | ||
| 50 | .chip_select = 0, | ||
| 51 | }, | ||
| 52 | }; | ||
| 53 | |||
| 54 | void __init lacie_v2_register_flash(void) | ||
| 55 | { | ||
| 56 | spi_register_board_info(lacie_v2_spi_slave_info, | ||
| 57 | ARRAY_SIZE(lacie_v2_spi_slave_info)); | ||
| 58 | kirkwood_spi_init(); | ||
| 59 | } | ||
| 60 | |||
| 61 | /***************************************************************************** | ||
| 62 | * I2C devices | ||
| 63 | ****************************************************************************/ | ||
| 64 | |||
| 65 | static struct at24_platform_data at24c04 = { | ||
| 66 | .byte_len = SZ_4K / 8, | ||
| 67 | .page_size = 16, | ||
| 68 | }; | ||
| 69 | |||
| 70 | /* | ||
| 71 | * i2c addr | chip | description | ||
| 72 | * 0x50 | HT24LC04 | eeprom (512B) | ||
| 73 | */ | ||
| 74 | |||
| 75 | static struct i2c_board_info __initdata lacie_v2_i2c_info[] = { | ||
| 76 | { | ||
| 77 | I2C_BOARD_INFO("24c04", 0x50), | ||
| 78 | .platform_data = &at24c04, | ||
| 79 | } | ||
| 80 | }; | ||
| 81 | |||
| 82 | void __init lacie_v2_register_i2c_devices(void) | ||
| 83 | { | ||
| 84 | kirkwood_i2c_init(); | ||
| 85 | i2c_register_board_info(0, lacie_v2_i2c_info, | ||
| 86 | ARRAY_SIZE(lacie_v2_i2c_info)); | ||
| 87 | } | ||
| 88 | |||
| 89 | /***************************************************************************** | ||
| 90 | * Hard Disk power | ||
| 91 | ****************************************************************************/ | ||
| 92 | |||
| 93 | static int __initdata lacie_v2_gpio_hdd_power[] = { 16, 17, 41, 42, 43 }; | ||
| 94 | |||
| 95 | void __init lacie_v2_hdd_power_init(int hdd_num) | ||
| 96 | { | ||
| 97 | int i; | ||
| 98 | int err; | ||
| 99 | |||
| 100 | /* Power up all hard disks. */ | ||
| 101 | for (i = 0; i < hdd_num; i++) { | ||
| 102 | err = gpio_request(lacie_v2_gpio_hdd_power[i], NULL); | ||
| 103 | if (err == 0) { | ||
| 104 | err = gpio_direction_output( | ||
| 105 | lacie_v2_gpio_hdd_power[i], 1); | ||
| 106 | /* Free the HDD power GPIOs. This allow user-space to | ||
| 107 | * configure them via the gpiolib sysfs interface. */ | ||
| 108 | gpio_free(lacie_v2_gpio_hdd_power[i]); | ||
| 109 | } | ||
| 110 | if (err) | ||
| 111 | pr_err("Failed to power up HDD%d\n", i + 1); | ||
| 112 | } | ||
| 113 | } | ||
| 114 | |||
| 115 | /***************************************************************************** | ||
| 116 | * Timer | ||
| 117 | ****************************************************************************/ | ||
| 118 | |||
| 119 | static void lacie_v2_timer_init(void) | ||
| 120 | { | ||
| 121 | kirkwood_tclk = 166666667; | ||
| 122 | orion_time_init(IRQ_KIRKWOOD_BRIDGE, kirkwood_tclk); | ||
| 123 | } | ||
| 124 | |||
| 125 | struct sys_timer lacie_v2_timer = { | ||
| 126 | .init = lacie_v2_timer_init, | ||
| 127 | }; | ||
diff --git a/arch/arm/mach-kirkwood/lacie_v2-common.h b/arch/arm/mach-kirkwood/lacie_v2-common.h new file mode 100644 index 000000000000..af521315b87b --- /dev/null +++ b/arch/arm/mach-kirkwood/lacie_v2-common.h | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | /* | ||
| 2 | * arch/arm/mach-kirkwood/lacie_v2-common.h | ||
| 3 | * | ||
| 4 | * This file is licensed under the terms of the GNU General Public | ||
| 5 | * License version 2. This program is licensed "as is" without any | ||
| 6 | * warranty of any kind, whether express or implied. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #ifndef __ARCH_KIRKWOOD_LACIE_V2_COMMON_H | ||
| 10 | #define __ARCH_KIRKWOOD_LACIE_V2_COMMON_H | ||
| 11 | |||
| 12 | void lacie_v2_register_flash(void); | ||
| 13 | void lacie_v2_register_i2c_devices(void); | ||
| 14 | void lacie_v2_hdd_power_init(int hdd_num); | ||
| 15 | |||
| 16 | extern struct sys_timer lacie_v2_timer; | ||
| 17 | |||
| 18 | #endif | ||
diff --git a/arch/arm/mach-kirkwood/netspace_v2-setup.c b/arch/arm/mach-kirkwood/netspace_v2-setup.c index d26bf324738b..fed264d28f4a 100644 --- a/arch/arm/mach-kirkwood/netspace_v2-setup.c +++ b/arch/arm/mach-kirkwood/netspace_v2-setup.c | |||
| @@ -24,56 +24,19 @@ | |||
| 24 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
| 25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
| 26 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
| 27 | #include <linux/mtd/physmap.h> | ||
| 28 | #include <linux/spi/flash.h> | ||
| 29 | #include <linux/spi/spi.h> | ||
| 30 | #include <linux/ata_platform.h> | 27 | #include <linux/ata_platform.h> |
| 31 | #include <linux/mv643xx_eth.h> | 28 | #include <linux/mv643xx_eth.h> |
| 32 | #include <linux/i2c.h> | ||
| 33 | #include <linux/i2c/at24.h> | ||
| 34 | #include <linux/input.h> | 29 | #include <linux/input.h> |
| 35 | #include <linux/gpio.h> | 30 | #include <linux/gpio.h> |
| 36 | #include <linux/gpio_keys.h> | 31 | #include <linux/gpio_keys.h> |
| 37 | #include <linux/leds.h> | 32 | #include <linux/leds.h> |
| 38 | #include <asm/mach-types.h> | 33 | #include <asm/mach-types.h> |
| 39 | #include <asm/mach/arch.h> | 34 | #include <asm/mach/arch.h> |
| 40 | #include <asm/mach/time.h> | ||
| 41 | #include <mach/kirkwood.h> | 35 | #include <mach/kirkwood.h> |
| 42 | #include <mach/leds-ns2.h> | 36 | #include <mach/leds-ns2.h> |
| 43 | #include <plat/time.h> | ||
| 44 | #include "common.h" | 37 | #include "common.h" |
| 45 | #include "mpp.h" | 38 | #include "mpp.h" |
| 46 | 39 | #include "lacie_v2-common.h" | |
| 47 | /***************************************************************************** | ||
| 48 | * 512KB SPI Flash on Boot Device (MACRONIX MX25L4005) | ||
| 49 | ****************************************************************************/ | ||
| 50 | |||
| 51 | static struct mtd_partition netspace_v2_flash_parts[] = { | ||
| 52 | { | ||
| 53 | .name = "u-boot", | ||
| 54 | .size = MTDPART_SIZ_FULL, | ||
| 55 | .offset = 0, | ||
| 56 | .mask_flags = MTD_WRITEABLE, /* force read-only */ | ||
| 57 | }, | ||
| 58 | }; | ||
| 59 | |||
| 60 | static const struct flash_platform_data netspace_v2_flash = { | ||
| 61 | .type = "mx25l4005a", | ||
| 62 | .name = "spi_flash", | ||
| 63 | .parts = netspace_v2_flash_parts, | ||
| 64 | .nr_parts = ARRAY_SIZE(netspace_v2_flash_parts), | ||
| 65 | }; | ||
| 66 | |||
| 67 | static struct spi_board_info __initdata netspace_v2_spi_slave_info[] = { | ||
| 68 | { | ||
| 69 | .modalias = "m25p80", | ||
| 70 | .platform_data = &netspace_v2_flash, | ||
| 71 | .irq = -1, | ||
| 72 | .max_speed_hz = 20000000, | ||
| 73 | .bus_num = 0, | ||
| 74 | .chip_select = 0, | ||
| 75 | }, | ||
| 76 | }; | ||
| 77 | 40 | ||
| 78 | /***************************************************************************** | 41 | /***************************************************************************** |
| 79 | * Ethernet | 42 | * Ethernet |
| @@ -84,27 +47,6 @@ static struct mv643xx_eth_platform_data netspace_v2_ge00_data = { | |||
| 84 | }; | 47 | }; |
| 85 | 48 | ||
| 86 | /***************************************************************************** | 49 | /***************************************************************************** |
| 87 | * I2C devices | ||
| 88 | ****************************************************************************/ | ||
| 89 | |||
| 90 | static struct at24_platform_data at24c04 = { | ||
| 91 | .byte_len = SZ_4K / 8, | ||
| 92 | .page_size = 16, | ||
| 93 | }; | ||
| 94 | |||
| 95 | /* | ||
| 96 | * i2c addr | chip | description | ||
| 97 | * 0x50 | HT24LC04 | eeprom (512B) | ||
| 98 | */ | ||
| 99 | |||
| 100 | static struct i2c_board_info __initdata netspace_v2_i2c_info[] = { | ||
| 101 | { | ||
| 102 | I2C_BOARD_INFO("24c04", 0x50), | ||
| 103 | .platform_data = &at24c04, | ||
| 104 | } | ||
| 105 | }; | ||
| 106 | |||
| 107 | /***************************************************************************** | ||
| 108 | * SATA | 50 | * SATA |
| 109 | ****************************************************************************/ | 51 | ****************************************************************************/ |
| 110 | 52 | ||
| @@ -112,35 +54,6 @@ static struct mv_sata_platform_data netspace_v2_sata_data = { | |||
| 112 | .n_ports = 2, | 54 | .n_ports = 2, |
| 113 | }; | 55 | }; |
| 114 | 56 | ||
| 115 | #define NETSPACE_V2_GPIO_SATA0_POWER 16 | ||
| 116 | #define NETSPACE_V2_GPIO_SATA1_POWER 17 | ||
| 117 | |||
| 118 | static void __init netspace_v2_sata_power_init(void) | ||
| 119 | { | ||
| 120 | int err; | ||
| 121 | |||
| 122 | err = gpio_request(NETSPACE_V2_GPIO_SATA0_POWER, "SATA0 power"); | ||
| 123 | if (err == 0) { | ||
| 124 | err = gpio_direction_output(NETSPACE_V2_GPIO_SATA0_POWER, 1); | ||
| 125 | if (err) | ||
| 126 | gpio_free(NETSPACE_V2_GPIO_SATA0_POWER); | ||
| 127 | } | ||
| 128 | if (err) | ||
| 129 | pr_err("netspace_v2: failed to setup SATA0 power\n"); | ||
| 130 | |||
| 131 | if (machine_is_netspace_max_v2()) { | ||
| 132 | err = gpio_request(NETSPACE_V2_GPIO_SATA1_POWER, "SATA1 power"); | ||
| 133 | if (err == 0) { | ||
| 134 | err = gpio_direction_output( | ||
| 135 | NETSPACE_V2_GPIO_SATA1_POWER, 1); | ||
| 136 | if (err) | ||
| 137 | gpio_free(NETSPACE_V2_GPIO_SATA1_POWER); | ||
| 138 | } | ||
| 139 | if (err) | ||
| 140 | pr_err("netspace_v2: failed to setup SATA1 power\n"); | ||
| 141 | } | ||
| 142 | } | ||
| 143 | |||
| 144 | /***************************************************************************** | 57 | /***************************************************************************** |
| 145 | * GPIO keys | 58 | * GPIO keys |
| 146 | ****************************************************************************/ | 59 | ****************************************************************************/ |
| @@ -224,20 +137,6 @@ static struct platform_device netspace_v2_leds = { | |||
| 224 | }; | 137 | }; |
| 225 | 138 | ||
| 226 | /***************************************************************************** | 139 | /***************************************************************************** |
| 227 | * Timer | ||
| 228 | ****************************************************************************/ | ||
| 229 | |||
| 230 | static void netspace_v2_timer_init(void) | ||
| 231 | { | ||
| 232 | kirkwood_tclk = 166666667; | ||
| 233 | orion_time_init(IRQ_KIRKWOOD_BRIDGE, kirkwood_tclk); | ||
| 234 | } | ||
| 235 | |||
| 236 | struct sys_timer netspace_v2_timer = { | ||
| 237 | .init = netspace_v2_timer_init, | ||
| 238 | }; | ||
| 239 | |||
| 240 | /***************************************************************************** | ||
| 241 | * General Setup | 140 | * General Setup |
| 242 | ****************************************************************************/ | 141 | ****************************************************************************/ |
| 243 | 142 | ||
| @@ -291,18 +190,17 @@ static void __init netspace_v2_init(void) | |||
| 291 | kirkwood_init(); | 190 | kirkwood_init(); |
| 292 | kirkwood_mpp_conf(netspace_v2_mpp_config); | 191 | kirkwood_mpp_conf(netspace_v2_mpp_config); |
| 293 | 192 | ||
| 294 | netspace_v2_sata_power_init(); | 193 | if (machine_is_netspace_max_v2()) |
| 194 | lacie_v2_hdd_power_init(2); | ||
| 195 | else | ||
| 196 | lacie_v2_hdd_power_init(1); | ||
| 295 | 197 | ||
| 296 | kirkwood_ehci_init(); | 198 | kirkwood_ehci_init(); |
| 297 | kirkwood_ge00_init(&netspace_v2_ge00_data); | 199 | kirkwood_ge00_init(&netspace_v2_ge00_data); |
| 298 | kirkwood_sata_init(&netspace_v2_sata_data); | 200 | kirkwood_sata_init(&netspace_v2_sata_data); |
| 299 | kirkwood_uart0_init(); | 201 | kirkwood_uart0_init(); |
| 300 | spi_register_board_info(netspace_v2_spi_slave_info, | 202 | lacie_v2_register_flash(); |
| 301 | ARRAY_SIZE(netspace_v2_spi_slave_info)); | 203 | lacie_v2_register_i2c_devices(); |
| 302 | kirkwood_spi_init(); | ||
| 303 | kirkwood_i2c_init(); | ||
| 304 | i2c_register_board_info(0, netspace_v2_i2c_info, | ||
| 305 | ARRAY_SIZE(netspace_v2_i2c_info)); | ||
| 306 | 204 | ||
| 307 | platform_device_register(&netspace_v2_leds); | 205 | platform_device_register(&netspace_v2_leds); |
| 308 | platform_device_register(&netspace_v2_gpio_leds); | 206 | platform_device_register(&netspace_v2_gpio_leds); |
| @@ -323,7 +221,7 @@ MACHINE_START(NETSPACE_V2, "LaCie Network Space v2") | |||
| 323 | .init_machine = netspace_v2_init, | 221 | .init_machine = netspace_v2_init, |
| 324 | .map_io = kirkwood_map_io, | 222 | .map_io = kirkwood_map_io, |
| 325 | .init_irq = kirkwood_init_irq, | 223 | .init_irq = kirkwood_init_irq, |
| 326 | .timer = &netspace_v2_timer, | 224 | .timer = &lacie_v2_timer, |
| 327 | MACHINE_END | 225 | MACHINE_END |
| 328 | #endif | 226 | #endif |
| 329 | 227 | ||
| @@ -335,7 +233,7 @@ MACHINE_START(INETSPACE_V2, "LaCie Internet Space v2") | |||
| 335 | .init_machine = netspace_v2_init, | 233 | .init_machine = netspace_v2_init, |
| 336 | .map_io = kirkwood_map_io, | 234 | .map_io = kirkwood_map_io, |
| 337 | .init_irq = kirkwood_init_irq, | 235 | .init_irq = kirkwood_init_irq, |
| 338 | .timer = &netspace_v2_timer, | 236 | .timer = &lacie_v2_timer, |
| 339 | MACHINE_END | 237 | MACHINE_END |
| 340 | #endif | 238 | #endif |
| 341 | 239 | ||
| @@ -347,6 +245,6 @@ MACHINE_START(NETSPACE_MAX_V2, "LaCie Network Space Max v2") | |||
| 347 | .init_machine = netspace_v2_init, | 245 | .init_machine = netspace_v2_init, |
| 348 | .map_io = kirkwood_map_io, | 246 | .map_io = kirkwood_map_io, |
| 349 | .init_irq = kirkwood_init_irq, | 247 | .init_irq = kirkwood_init_irq, |
| 350 | .timer = &netspace_v2_timer, | 248 | .timer = &lacie_v2_timer, |
| 351 | MACHINE_END | 249 | MACHINE_END |
| 352 | #endif | 250 | #endif |
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 |
