diff options
| author | Simon Guinot <sguinot@lacie.com> | 2010-02-02 19:41:09 -0500 |
|---|---|---|
| committer | Nicolas Pitre <nico@fluxnic.net> | 2010-05-03 17:02:10 -0400 |
| commit | 2a49456fdae0cc9e4286de38b8fcb85f9c7c7559 (patch) | |
| tree | ada4516673a3b16eeffb72265d54f65106172753 | |
| parent | 18e2842b85a00158054b5751c4e5a1b56906895f (diff) | |
[ARM] Kirkwood: add LaCie 2Big Network v2 support
Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
| -rw-r--r-- | arch/arm/mach-kirkwood/Kconfig | 6 | ||||
| -rw-r--r-- | arch/arm/mach-kirkwood/Makefile | 1 | ||||
| -rw-r--r-- | arch/arm/mach-kirkwood/net2big_v2-setup.c | 334 |
3 files changed, 341 insertions, 0 deletions
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig index 05a85526d6d5..953681ae69ea 100644 --- a/arch/arm/mach-kirkwood/Kconfig +++ b/arch/arm/mach-kirkwood/Kconfig | |||
| @@ -87,6 +87,12 @@ config MACH_INETSPACE_V2 | |||
| 87 | Say 'Y' here if you want your kernel to support the | 87 | Say 'Y' here if you want your kernel to support the |
| 88 | LaCie Internet Space v2 NAS. | 88 | LaCie Internet Space v2 NAS. |
| 89 | 89 | ||
| 90 | config MACH_NET2BIG_V2 | ||
| 91 | bool "LaCie 2Big Network v2 NAS Board" | ||
| 92 | help | ||
| 93 | Say 'Y' here if you want your kernel to support the | ||
| 94 | LaCie 2Big Network v2 NAS. | ||
| 95 | |||
| 90 | endmenu | 96 | endmenu |
| 91 | 97 | ||
| 92 | endif | 98 | endif |
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile index 85b3a39a6204..3697d8e59687 100644 --- a/arch/arm/mach-kirkwood/Makefile +++ b/arch/arm/mach-kirkwood/Makefile | |||
| @@ -12,5 +12,6 @@ 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 | 16 | ||
| 16 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o | 17 | 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 new file mode 100644 index 000000000000..359bb19e366c --- /dev/null +++ b/arch/arm/mach-kirkwood/net2big_v2-setup.c | |||
| @@ -0,0 +1,334 @@ | |||
| 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 | ||
