From d8f089d2ad35861c432618900fa08ca70c168d76 Mon Sep 17 00:00:00 2001 From: Siddarth Gore Date: Mon, 22 Mar 2010 02:28:20 -0700 Subject: [PATCH 1/6] [ARM] Kirkwood: Marvell GuruPlug support GuruPlug Standard: 1 Gb Ethernet, 2 USB 2.0 GuruPlug Plus: 2 Gb Ethernet, 2 USB 2.0, 1 eSATA, 1 uSD slot References: http://www.globalscaletechnologies.com/t-guruplugdetails.aspx http://plugcomputer.org This patch is for GuruPlug Plus, but it supports Standard version as well. Signed-off-by: Siddarth Gore Signed-off-by: Nicolas Pitre --- arch/arm/mach-kirkwood/Kconfig | 6 ++ arch/arm/mach-kirkwood/Makefile | 1 + arch/arm/mach-kirkwood/guruplug-setup.c | 131 ++++++++++++++++++++++++ 3 files changed, 138 insertions(+) create mode 100644 arch/arm/mach-kirkwood/guruplug-setup.c diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig index 17879a876be..05a85526d6d 100644 --- a/arch/arm/mach-kirkwood/Kconfig +++ b/arch/arm/mach-kirkwood/Kconfig @@ -38,6 +38,12 @@ config MACH_ESATA_SHEEVAPLUG Say 'Y' here if you want your kernel to support the Marvell eSATA SheevaPlug Reference Board. +config MACH_GURUPLUG + bool "Marvell GuruPlug Reference Board" + help + Say 'Y' here if you want your kernel to support the + Marvell GuruPlug Reference Board. + config MACH_TS219 bool "QNAP TS-110, TS-119, TS-210, TS-219 and TS-219P Turbo NAS" help diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile index a5530e36ba3..85b3a39a620 100644 --- a/arch/arm/mach-kirkwood/Makefile +++ b/arch/arm/mach-kirkwood/Makefile @@ -6,6 +6,7 @@ obj-$(CONFIG_MACH_RD88F6281) += rd88f6281-setup.o obj-$(CONFIG_MACH_MV88F6281GTW_GE) += mv88f6281gtw_ge-setup.o obj-$(CONFIG_MACH_SHEEVAPLUG) += sheevaplug-setup.o obj-$(CONFIG_MACH_ESATA_SHEEVAPLUG) += sheevaplug-setup.o +obj-$(CONFIG_MACH_GURUPLUG) += guruplug-setup.o obj-$(CONFIG_MACH_TS219) += ts219-setup.o tsx1x-common.o obj-$(CONFIG_MACH_TS41X) += ts41x-setup.o tsx1x-common.o obj-$(CONFIG_MACH_OPENRD) += openrd-setup.o diff --git a/arch/arm/mach-kirkwood/guruplug-setup.c b/arch/arm/mach-kirkwood/guruplug-setup.c new file mode 100644 index 00000000000..54d07c89d4f --- /dev/null +++ b/arch/arm/mach-kirkwood/guruplug-setup.c @@ -0,0 +1,131 @@ +/* + * arch/arm/mach-kirkwood/guruplug-setup.c + * + * Marvell GuruPlug Reference Board Setup + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "common.h" +#include "mpp.h" + +static struct mtd_partition guruplug_nand_parts[] = { + { + .name = "u-boot", + .offset = 0, + .size = SZ_1M + }, { + .name = "uImage", + .offset = MTDPART_OFS_NXTBLK, + .size = SZ_4M + }, { + .name = "root", + .offset = MTDPART_OFS_NXTBLK, + .size = MTDPART_SIZ_FULL + }, +}; + +static struct mv643xx_eth_platform_data guruplug_ge00_data = { + .phy_addr = MV643XX_ETH_PHY_ADDR(0), +}; + +static struct mv643xx_eth_platform_data guruplug_ge01_data = { + .phy_addr = MV643XX_ETH_PHY_ADDR(1), +}; + +static struct mv_sata_platform_data guruplug_sata_data = { + .n_ports = 1, +}; + +static struct mvsdio_platform_data guruplug_mvsdio_data = { + /* unfortunately the CD signal has not been connected */ +}; + +static struct gpio_led guruplug_led_pins[] = { + { + .name = "guruplug:red:health", + .gpio = 46, + .active_low = 1, + }, + { + .name = "guruplug:green:health", + .gpio = 47, + .active_low = 1, + }, + { + .name = "guruplug:red:wmode", + .gpio = 48, + .active_low = 1, + }, + { + .name = "guruplug:green:wmode", + .gpio = 49, + .active_low = 1, + }, +}; + +static struct gpio_led_platform_data guruplug_led_data = { + .leds = guruplug_led_pins, + .num_leds = ARRAY_SIZE(guruplug_led_pins), +}; + +static struct platform_device guruplug_leds = { + .name = "leds-gpio", + .id = -1, + .dev = { + .platform_data = &guruplug_led_data, + } +}; + +static unsigned int guruplug_mpp_config[] __initdata = { + MPP46_GPIO, /* M_RLED */ + MPP47_GPIO, /* M_GLED */ + MPP48_GPIO, /* B_RLED */ + MPP49_GPIO, /* B_GLED */ + 0 +}; + +static void __init guruplug_init(void) +{ + /* + * Basic setup. Needs to be called early. + */ + kirkwood_init(); + kirkwood_mpp_conf(guruplug_mpp_config); + + kirkwood_uart0_init(); + kirkwood_nand_init(ARRAY_AND_SIZE(guruplug_nand_parts), 25); + + kirkwood_ehci_init(); + kirkwood_ge00_init(&guruplug_ge00_data); + kirkwood_ge01_init(&guruplug_ge01_data); + kirkwood_sata_init(&guruplug_sata_data); + kirkwood_sdio_init(&guruplug_mvsdio_data); + + platform_device_register(&guruplug_leds); +} + +MACHINE_START(GURUPLUG, "Marvell GuruPlug Reference Board") + /* Maintainer: Siddarth Gore */ + .phys_io = KIRKWOOD_REGS_PHYS_BASE, + .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc, + .boot_params = 0x00000100, + .init_machine = guruplug_init, + .map_io = kirkwood_map_io, + .init_irq = kirkwood_init_irq, + .timer = &kirkwood_timer, +MACHINE_END From 5ccc8dab611fcd1d0961b73e22d6c2d108967862 Mon Sep 17 00:00:00 2001 From: Arnaud Patard Date: Sat, 3 Apr 2010 10:31:33 +0200 Subject: [PATCH 2/6] [ARM] dns323-setup.c: fix WARN() when booting Since commit b2a731aa5cbca7e0252da75e16de7ae5feb1313a, dns323_init() is setting the power led gpio direction with gpio_direction_output() but doesn't request the gpio before (which is not permitted by the gpio layer afaik). This behaviour is triggering a WARN() at boot time. Tested-by: Christian Samsel Cc: Martin Michlmayr Signed-off-by: Arnaud Patard Signed-off-by: Nicolas Pitre [ Part 2: "Attached Text" ] --- arch/arm/mach-orion5x/dns323-setup.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c index 421b82f7c63..685f34a9634 100644 --- a/arch/arm/mach-orion5x/dns323-setup.c +++ b/arch/arm/mach-orion5x/dns323-setup.c @@ -439,6 +439,7 @@ static void __init dns323_init(void) */ if (dns323_dev_id() == MV88F5181_DEV_ID) { dns323_leds[0].active_low = 1; + gpio_request(DNS323_GPIO_LED_POWER1, "Power Led Enable"); gpio_direction_output(DNS323_GPIO_LED_POWER1, 0); } From 18e2842b85a00158054b5751c4e5a1b56906895f Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Mon, 3 May 2010 16:43:47 -0400 Subject: [PATCH 3/6] update MAINTAINERS file I'm no longer at Marvell. Ditto for Lennert. I don't hack on SMC91x much either these days. Signed-off-by: Nicolas Pitre --- MAINTAINERS | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index d5b0b1b6dc5..d634cb098b7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -775,11 +775,10 @@ M: Philipp Zabel S: Maintained ARM/Marvell Loki/Kirkwood/MV78xx0/Orion SOC support -M: Lennert Buytenhek -M: Nicolas Pitre +M: Lennert Buytenhek +M: Nicolas Pitre L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -T: git git://git.marvell.com/orion -S: Maintained +S: Odd Fixes F: arch/arm/mach-loki/ F: arch/arm/mach-kirkwood/ F: arch/arm/mach-mv78xx0/ @@ -3624,7 +3623,8 @@ F: drivers/net/wireless/mwl8k.c MARVELL SOC MMC/SD/SDIO CONTROLLER DRIVER M: Nicolas Pitre -S: Maintained +S: Odd Fixes +F: drivers/mmc/host/mvsdio.* MARVELL YUKON / SYSKONNECT DRIVER M: Mirko Lindner @@ -5121,7 +5121,7 @@ F: mm/sl?b.c SMC91x ETHERNET DRIVER M: Nicolas Pitre -S: Maintained +S: Odd Fixes F: drivers/net/smc91x.* SMSC47B397 HARDWARE MONITOR DRIVER From 2a49456fdae0cc9e4286de38b8fcb85f9c7c7559 Mon Sep 17 00:00:00 2001 From: Simon Guinot Date: Wed, 3 Feb 2010 01:41:09 +0100 Subject: [PATCH 4/6] [ARM] Kirkwood: add LaCie 2Big Network v2 support Signed-off-by: Nicolas Pitre --- arch/arm/mach-kirkwood/Kconfig | 6 + arch/arm/mach-kirkwood/Makefile | 1 + arch/arm/mach-kirkwood/net2big_v2-setup.c | 334 ++++++++++++++++++++++ 3 files changed, 341 insertions(+) create mode 100644 arch/arm/mach-kirkwood/net2big_v2-setup.c diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig index 05a85526d6d..953681ae69e 100644 --- a/arch/arm/mach-kirkwood/Kconfig +++ b/arch/arm/mach-kirkwood/Kconfig @@ -87,6 +87,12 @@ config MACH_INETSPACE_V2 Say 'Y' here if you want your kernel to support the LaCie Internet Space v2 NAS. +config MACH_NET2BIG_V2 + bool "LaCie 2Big Network v2 NAS Board" + help + Say 'Y' here if you want your kernel to support the + LaCie 2Big Network v2 NAS. + endmenu endif diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile index 85b3a39a620..3697d8e5968 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 obj-$(CONFIG_MACH_OPENRD) += openrd-setup.o obj-$(CONFIG_MACH_NETSPACE_V2) += netspace_v2-setup.o obj-$(CONFIG_MACH_INETSPACE_V2) += netspace_v2-setup.o +obj-$(CONFIG_MACH_NET2BIG_V2) += net2big_v2-setup.o 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 00000000000..359bb19e366 --- /dev/null +++ b/arch/arm/mach-kirkwood/net2big_v2-setup.c @@ -0,0 +1,334 @@ +/* + * arch/arm/mach-kirkwood/net2big_v2-setup.c + * + * LaCie 2Big Network v2 board setup + * + * Copyright (C) 2010 Simon Guinot + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "common.h" +#include "mpp.h" + +/***************************************************************************** + * 512KB SPI Flash on Boot Device (MACRONIX MX25L4005) + ****************************************************************************/ + +static struct mtd_partition net2big_v2_flash_parts[] = { + { + .name = "u-boot", + .size = MTDPART_SIZ_FULL, + .offset = 0, + .mask_flags = MTD_WRITEABLE, /* force read-only */ + }, +}; + +static const struct flash_platform_data net2big_v2_flash = { + .type = "mx25l4005a", + .name = "spi_flash", + .parts = net2big_v2_flash_parts, + .nr_parts = ARRAY_SIZE(net2big_v2_flash_parts), +}; + +static struct spi_board_info __initdata net2big_v2_spi_slave_info[] = { + { + .modalias = "m25p80", + .platform_data = &net2big_v2_flash, + .irq = -1, + .max_speed_hz = 20000000, + .bus_num = 0, + .chip_select = 0, + }, +}; + +/***************************************************************************** + * Ethernet + ****************************************************************************/ + +static struct mv643xx_eth_platform_data net2big_v2_ge00_data = { + .phy_addr = MV643XX_ETH_PHY_ADDR(8), +}; + +/***************************************************************************** + * I2C devices + ****************************************************************************/ + +static struct at24_platform_data at24c04 = { + .byte_len = SZ_4K / 8, + .page_size = 16, +}; + +/* + * i2c addr | chip | description + * 0x50 | HT24LC04 | eeprom (512B) + */ + +static struct i2c_board_info __initdata net2big_v2_i2c_info[] = { + { + I2C_BOARD_INFO("24c04", 0x50), + .platform_data = &at24c04, + } +}; + +/***************************************************************************** + * SATA + ****************************************************************************/ + +static struct mv_sata_platform_data net2big_v2_sata_data = { + .n_ports = 2, +}; + +static int __initdata net2big_v2_gpio_hdd_power[] = { 16, 17 }; + +static void __init net2big_v2_sata_power_init(void) +{ + int i; + int err; + + /* Power up all hard disks. */ + for (i = 0; i < ARRAY_SIZE(net2big_v2_gpio_hdd_power); i++) { + err = gpio_request(net2big_v2_gpio_hdd_power[i], NULL); + if (err == 0) { + err = gpio_direction_output( + net2big_v2_gpio_hdd_power[i], 1); + /* Free the HDD power GPIOs. This allow user-space to + * configure them via the gpiolib sysfs interface. */ + gpio_free(net2big_v2_gpio_hdd_power[i]); + } + if (err) + pr_err("net2big_v2: failed to power-up HDD%d\n", i + 1); + } +} + +/***************************************************************************** + * GPIO keys + ****************************************************************************/ + +#define NET2BIG_V2_GPIO_SWITCH_POWER_ON 13 +#define NET2BIG_V2_GPIO_SWITCH_POWER_OFF 15 +#define NET2BIG_V2_GPIO_FUNC_BUTTON 34 + +#define NET2BIG_V2_SWITCH_POWER_ON 0x1 +#define NET2BIG_V2_SWITCH_POWER_OFF 0x2 + +static struct gpio_keys_button net2big_v2_buttons[] = { + [0] = { + .type = EV_SW, + .code = NET2BIG_V2_SWITCH_POWER_ON, + .gpio = NET2BIG_V2_GPIO_SWITCH_POWER_ON, + .desc = "Back power switch (on|auto)", + .active_low = 1, + }, + [1] = { + .type = EV_SW, + .code = NET2BIG_V2_SWITCH_POWER_OFF, + .gpio = NET2BIG_V2_GPIO_SWITCH_POWER_OFF, + .desc = "Back power switch (auto|off)", + .active_low = 1, + }, + [2] = { + .code = KEY_OPTION, + .gpio = NET2BIG_V2_GPIO_FUNC_BUTTON, + .desc = "Function button", + .active_low = 1, + }, +}; + +static struct gpio_keys_platform_data net2big_v2_button_data = { + .buttons = net2big_v2_buttons, + .nbuttons = ARRAY_SIZE(net2big_v2_buttons), +}; + +static struct platform_device net2big_v2_gpio_buttons = { + .name = "gpio-keys", + .id = -1, + .dev = { + .platform_data = &net2big_v2_button_data, + }, +}; + +/***************************************************************************** + * GPIO LEDs + ****************************************************************************/ + +/* + * The LEDs are controlled by a CPLD and can be configured through a GPIO + * extension bus: + * + * - address register : bit [0-2] -> GPIO [47-49] + * - data register : bit [0-2] -> GPIO [44-46] + * - enable register : GPIO 29 + * + * Address register selection: + * + * addr | register + * ---------------------------- + * 0 | front LED + * 1 | front LED brightness + * 2 | HDD LED brightness + * 3 | HDD1 LED + * 4 | HDD2 LED + * + * Data register configuration: + * + * data | LED brightness + * ------------------------------------------------- + * 0 | min (off) + * - | - + * 7 | max + * + * data | front LED mode + * ------------------------------------------------- + * 0 | fix off + * 1 | fix blue on + * 2 | fix red on + * 3 | blink blue on=1 sec and blue off=1 sec + * 4 | blink red on=1 sec and red off=1 sec + * 5 | blink blue on=2.5 sec and red on=0.5 sec + * 6 | blink blue on=1 sec and red on=1 sec + * 7 | blink blue on=0.5 sec and blue off=2.5 sec + * + * data | HDD LED mode + * ------------------------------------------------- + * 0 | fix blue on + * 1 | SATA activity blink + * 2 | fix red on + * 3 | blink blue on=1 sec and blue off=1 sec + * 4 | blink red on=1 sec and red off=1 sec + * 5 | blink blue on=2.5 sec and red on=0.5 sec + * 6 | blink blue on=1 sec and red on=1 sec + * 7 | blink blue on=0.5 sec and blue off=2.5 sec + */ + +/***************************************************************************** + * Timer + ****************************************************************************/ + +static void net2big_v2_timer_init(void) +{ + kirkwood_tclk = 166666667; + orion_time_init(IRQ_KIRKWOOD_BRIDGE, kirkwood_tclk); +} + +struct sys_timer net2big_v2_timer = { + .init = net2big_v2_timer_init, +}; + +/***************************************************************************** + * General Setup + ****************************************************************************/ + +static unsigned int net2big_v2_mpp_config[] __initdata = { + MPP0_SPI_SCn, + MPP1_SPI_MOSI, + MPP2_SPI_SCK, + MPP3_SPI_MISO, + MPP6_SYSRST_OUTn, + MPP7_GPO, /* Request power-off */ + MPP8_TW_SDA, + MPP9_TW_SCK, + MPP10_UART0_TXD, + MPP11_UART0_RXD, + MPP13_GPIO, /* Rear power switch (on|auto) */ + MPP14_GPIO, /* USB fuse alarm */ + MPP15_GPIO, /* Rear power switch (auto|off) */ + MPP16_GPIO, /* SATA HDD1 power */ + MPP17_GPIO, /* SATA HDD2 power */ + MPP20_SATA1_ACTn, + MPP21_SATA0_ACTn, + MPP24_GPIO, /* USB mode select */ + MPP26_GPIO, /* USB device vbus */ + MPP28_GPIO, /* USB enable host vbus */ + MPP29_GPIO, /* GPIO extension ALE */ + MPP34_GPIO, /* Rear Push button */ + MPP35_GPIO, /* Inhibit switch power-off */ + MPP36_GPIO, /* SATA HDD1 presence */ + MPP37_GPIO, /* SATA HDD2 presence */ + MPP40_GPIO, /* eSATA presence */ + MPP44_GPIO, /* GPIO extension (data 0) */ + MPP45_GPIO, /* GPIO extension (data 1) */ + MPP46_GPIO, /* GPIO extension (data 2) */ + MPP47_GPIO, /* GPIO extension (addr 0) */ + MPP48_GPIO, /* GPIO extension (addr 1) */ + MPP49_GPIO, /* GPIO extension (addr 2) */ + 0 +}; + +#define NET2BIG_V2_GPIO_POWER_OFF 7 + +static void net2big_v2_power_off(void) +{ + gpio_set_value(NET2BIG_V2_GPIO_POWER_OFF, 1); +} + +static void __init net2big_v2_init(void) +{ + /* + * Basic setup. Needs to be called early. + */ + kirkwood_init(); + kirkwood_mpp_conf(net2big_v2_mpp_config); + + net2big_v2_sata_power_init(); + + kirkwood_ehci_init(); + kirkwood_ge00_init(&net2big_v2_ge00_data); + kirkwood_sata_init(&net2big_v2_sata_data); + kirkwood_uart0_init(); + spi_register_board_info(net2big_v2_spi_slave_info, + ARRAY_SIZE(net2big_v2_spi_slave_info)); + kirkwood_spi_init(); + kirkwood_i2c_init(); + i2c_register_board_info(0, net2big_v2_i2c_info, + ARRAY_SIZE(net2big_v2_i2c_info)); + + platform_device_register(&net2big_v2_gpio_buttons); + + if (gpio_request(NET2BIG_V2_GPIO_POWER_OFF, "power-off") == 0 && + gpio_direction_output(NET2BIG_V2_GPIO_POWER_OFF, 0) == 0) + pm_power_off = net2big_v2_power_off; + else + pr_err("net2big_v2: failed to configure power-off GPIO\n"); +} + +MACHINE_START(NET2BIG_V2, "LaCie 2Big Network v2") + .phys_io = KIRKWOOD_REGS_PHYS_BASE, + .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc, + .boot_params = 0x00000100, + .init_machine = net2big_v2_init, + .map_io = kirkwood_map_io, + .init_irq = kirkwood_init_irq, + .timer = &net2big_v2_timer, +MACHINE_END From 3e05ec1b93cd839fa1d1a9961b155b0dbc9a4055 Mon Sep 17 00:00:00 2001 From: Simon Guinot Date: Mon, 4 Jan 2010 20:20:07 +0100 Subject: [PATCH 5/6] [ARM] Kirkwood: add LaCie 5Big Network v2 support Signed-off-by: Nicolas Pitre --- arch/arm/mach-kirkwood/Kconfig | 6 + arch/arm/mach-kirkwood/Makefile | 1 + arch/arm/mach-kirkwood/net5big_v2-setup.c | 355 ++++++++++++++++++++++ 3 files changed, 362 insertions(+) create mode 100644 arch/arm/mach-kirkwood/net5big_v2-setup.c diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig index 953681ae69e..29b2163b1fe 100644 --- a/arch/arm/mach-kirkwood/Kconfig +++ b/arch/arm/mach-kirkwood/Kconfig @@ -93,6 +93,12 @@ config MACH_NET2BIG_V2 Say 'Y' here if you want your kernel to support the LaCie 2Big Network v2 NAS. +config MACH_NET5BIG_V2 + bool "LaCie 5Big Network v2 NAS Board" + help + Say 'Y' here if you want your kernel to support the + LaCie 5Big Network v2 NAS. + endmenu endif diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile index 3697d8e5968..bbb8dd3fa21 100644 --- a/arch/arm/mach-kirkwood/Makefile +++ b/arch/arm/mach-kirkwood/Makefile @@ -13,5 +13,6 @@ obj-$(CONFIG_MACH_OPENRD) += openrd-setup.o obj-$(CONFIG_MACH_NETSPACE_V2) += netspace_v2-setup.o obj-$(CONFIG_MACH_INETSPACE_V2) += netspace_v2-setup.o obj-$(CONFIG_MACH_NET2BIG_V2) += net2big_v2-setup.o +obj-$(CONFIG_MACH_NET5BIG_V2) += net5big_v2-setup.o obj-$(CONFIG_CPU_IDLE) += cpuidle.o diff --git a/arch/arm/mach-kirkwood/net5big_v2-setup.c b/arch/arm/mach-kirkwood/net5big_v2-setup.c new file mode 100644 index 00000000000..f0617ecc8a2 --- /dev/null +++ b/arch/arm/mach-kirkwood/net5big_v2-setup.c @@ -0,0 +1,355 @@ +/* + * arch/arm/mach-kirkwood/net5big_v2-setup.c + * + * LaCie 5Big Network v2 board setup + * + * Copyright (C) 2010 Simon Guinot + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "common.h" +#include "mpp.h" + +/***************************************************************************** + * 512KB SPI Flash on Boot Device (MACRONIX MX25L4005) + ****************************************************************************/ + +static struct mtd_partition net5big_v2_flash_parts[] = { + { + .name = "u-boot", + .size = MTDPART_SIZ_FULL, + .offset = 0, + .mask_flags = MTD_WRITEABLE, /* force read-only */ + }, +}; + +static const struct flash_platform_data net5big_v2_flash = { + .type = "mx25l4005a", + .name = "spi_flash", + .parts = net5big_v2_flash_parts, + .nr_parts = ARRAY_SIZE(net5big_v2_flash_parts), +}; + +static struct spi_board_info __initdata net5big_v2_spi_slave_info[] = { + { + .modalias = "m25p80", + .platform_data = &net5big_v2_flash, + .irq = -1, + .max_speed_hz = 20000000, + .bus_num = 0, + .chip_select = 0, + }, +}; + +/***************************************************************************** + * Ethernet + ****************************************************************************/ + +static struct mv643xx_eth_platform_data net5big_v2_ge00_data = { + .phy_addr = MV643XX_ETH_PHY_ADDR(8), +}; + +static struct mv643xx_eth_platform_data net5big_v2_ge01_data = { + .phy_addr = MV643XX_ETH_PHY_ADDR(0), +}; + +/***************************************************************************** + * I2C devices + ****************************************************************************/ + +static struct at24_platform_data at24c04 = { + .byte_len = SZ_4K / 8, + .page_size = 16, +}; + +/* + * i2c addr | chip | description + * 0x50 | HT24LC04 | eeprom (512B) + */ + +static struct i2c_board_info __initdata net5big_v2_i2c_info[] = { + { + I2C_BOARD_INFO("24c04", 0x50), + .platform_data = &at24c04, + } +}; + +/***************************************************************************** + * SATA + ****************************************************************************/ + +static struct mv_sata_platform_data net5big_v2_sata_data = { + .n_ports = 2, +}; + +static int __initdata net5big_v2_gpio_hdd_power[] = { 16, 17, 41, 42, 43 }; + +static void __init net5big_v2_sata_power_init(void) +{ + int i; + int err; + + /* Power up all hard disks. */ + for (i = 0; i < ARRAY_SIZE(net5big_v2_gpio_hdd_power); i++) { + err = gpio_request(net5big_v2_gpio_hdd_power[i], NULL); + if (err == 0) { + err = gpio_direction_output( + net5big_v2_gpio_hdd_power[i], 1); + /* Free the HDD power GPIOs. This allow user-space to + * configure them via the gpiolib sysfs interface. */ + gpio_free(net5big_v2_gpio_hdd_power[i]); + } + if (err) + pr_err("net5big_v2: failed to power up HDD%d\n", i + 1); + } +} + +/***************************************************************************** + * GPIO keys + ****************************************************************************/ + +#define NET5BIG_V2_GPIO_SWITCH_POWER_ON 13 +#define NET5BIG_V2_GPIO_SWITCH_POWER_OFF 15 +#define NET5BIG_V2_GPIO_FUNC_BUTTON 34 + +#define NET5BIG_V2_SWITCH_POWER_ON 0x1 +#define NET5BIG_V2_SWITCH_POWER_OFF 0x2 + +static struct gpio_keys_button net5big_v2_buttons[] = { + [0] = { + .type = EV_SW, + .code = NET5BIG_V2_SWITCH_POWER_ON, + .gpio = NET5BIG_V2_GPIO_SWITCH_POWER_ON, + .desc = "Back power switch (on|auto)", + .active_low = 1, + }, + [1] = { + .type = EV_SW, + .code = NET5BIG_V2_SWITCH_POWER_OFF, + .gpio = NET5BIG_V2_GPIO_SWITCH_POWER_OFF, + .desc = "Back power switch (auto|off)", + .active_low = 1, + }, + [2] = { + .code = KEY_OPTION, + .gpio = NET5BIG_V2_GPIO_FUNC_BUTTON, + .desc = "Function button", + .active_low = 1, + }, +}; + +static struct gpio_keys_platform_data net5big_v2_button_data = { + .buttons = net5big_v2_buttons, + .nbuttons = ARRAY_SIZE(net5big_v2_buttons), +}; + +static struct platform_device net5big_v2_gpio_buttons = { + .name = "gpio-keys", + .id = -1, + .dev = { + .platform_data = &net5big_v2_button_data, + }, +}; + +/***************************************************************************** + * GPIO LEDs + ****************************************************************************/ + +/* + * The LEDs are controlled by a CPLD and can be configured through a GPIO + * extension bus: + * + * - address register : bit [0-2] -> GPIO [47-49] + * - data register : bit [0-2] -> GPIO [44-46] + * - enable register : GPIO 29 + * + * Address register selection: + * + * addr | register + * ---------------------------- + * 0 | front LED + * 1 | front LED brightness + * 2 | HDD LED brightness + * 3 | HDD1 LED + * 4 | HDD2 LED + * 5 | HDD3 LED + * 6 | HDD4 LED + * 7 | HDD5 LED + * + * Data register configuration: + * + * data | LED brightness + * ------------------------------------------------- + * 0 | min (off) + * - | - + * 7 | max + * + * data | front LED mode + * ------------------------------------------------- + * 0 | fix off + * 1 | fix blue on + * 2 | fix red on + * 3 | blink blue on=1 sec and blue off=1 sec + * 4 | blink red on=1 sec and red off=1 sec + * 5 | blink blue on=2.5 sec and red on=0.5 sec + * 6 | blink blue on=1 sec and red on=1 sec + * 7 | blink blue on=0.5 sec and blue off=2.5 sec + * + * data | HDD LED mode + * ------------------------------------------------- + * 0 | fix blue on + * 1 | SATA activity blink + * 2 | fix red on + * 3 | blink blue on=1 sec and blue off=1 sec + * 4 | blink red on=1 sec and red off=1 sec + * 5 | blink blue on=2.5 sec and red on=0.5 sec + * 6 | blink blue on=1 sec and red on=1 sec + * 7 | blink blue on=0.5 sec and blue off=2.5 sec + */ + +/***************************************************************************** + * Timer + ****************************************************************************/ + +static void net5big_v2_timer_init(void) +{ + kirkwood_tclk = 166666667; + orion_time_init(IRQ_KIRKWOOD_BRIDGE, kirkwood_tclk); +} + +struct sys_timer net5big_v2_timer = { + .init = net5big_v2_timer_init, +}; + +/***************************************************************************** + * General Setup + ****************************************************************************/ + +static unsigned int net5big_v2_mpp_config[] __initdata = { + MPP0_SPI_SCn, + MPP1_SPI_MOSI, + MPP2_SPI_SCK, + MPP3_SPI_MISO, + MPP6_SYSRST_OUTn, + MPP7_GPO, /* Request power-off */ + MPP8_TW_SDA, + MPP9_TW_SCK, + MPP10_UART0_TXD, + MPP11_UART0_RXD, + MPP13_GPIO, /* Rear power switch (on|auto) */ + MPP14_GPIO, /* USB fuse alarm */ + MPP15_GPIO, /* Rear power switch (auto|off) */ + MPP16_GPIO, /* SATA HDD1 power */ + MPP17_GPIO, /* SATA HDD2 power */ + MPP20_GE1_0, + MPP21_GE1_1, + MPP22_GE1_2, + MPP23_GE1_3, + MPP24_GE1_4, + MPP25_GE1_5, + MPP26_GE1_6, + MPP27_GE1_7, + MPP28_GPIO, /* USB enable host vbus */ + MPP29_GPIO, /* CPLD extension ALE */ + MPP30_GE1_10, + MPP31_GE1_11, + MPP32_GE1_12, + MPP33_GE1_13, + MPP34_GPIO, /* Rear Push button */ + MPP35_GPIO, /* Inhibit switch power-off */ + MPP36_GPIO, /* SATA HDD1 presence */ + MPP37_GPIO, /* SATA HDD2 presence */ + MPP38_GPIO, /* SATA HDD3 presence */ + MPP39_GPIO, /* SATA HDD4 presence */ + MPP40_GPIO, /* SATA HDD5 presence */ + MPP41_GPIO, /* SATA HDD3 power */ + MPP42_GPIO, /* SATA HDD4 power */ + MPP43_GPIO, /* SATA HDD5 power */ + MPP44_GPIO, /* CPLD extension (data 0) */ + MPP45_GPIO, /* CPLD extension (data 1) */ + MPP46_GPIO, /* CPLD extension (data 2) */ + MPP47_GPIO, /* CPLD extension (addr 0) */ + MPP48_GPIO, /* CPLD extension (addr 1) */ + MPP49_GPIO, /* CPLD extension (addr 2) */ + 0 +}; + +#define NET5BIG_V2_GPIO_POWER_OFF 7 + +static void net5big_v2_power_off(void) +{ + gpio_set_value(NET5BIG_V2_GPIO_POWER_OFF, 1); +} + +static void __init net5big_v2_init(void) +{ + /* + * Basic setup. Needs to be called early. + */ + kirkwood_init(); + kirkwood_mpp_conf(net5big_v2_mpp_config); + + net5big_v2_sata_power_init(); + + kirkwood_ehci_init(); + kirkwood_ge00_init(&net5big_v2_ge00_data); + kirkwood_ge01_init(&net5big_v2_ge01_data); + kirkwood_sata_init(&net5big_v2_sata_data); + kirkwood_uart0_init(); + spi_register_board_info(net5big_v2_spi_slave_info, + ARRAY_SIZE(net5big_v2_spi_slave_info)); + kirkwood_spi_init(); + kirkwood_i2c_init(); + i2c_register_board_info(0, net5big_v2_i2c_info, + ARRAY_SIZE(net5big_v2_i2c_info)); + + platform_device_register(&net5big_v2_gpio_buttons); + + if (gpio_request(NET5BIG_V2_GPIO_POWER_OFF, "power-off") == 0 && + gpio_direction_output(NET5BIG_V2_GPIO_POWER_OFF, 0) == 0) + pm_power_off = net5big_v2_power_off; + else + pr_err("net5big_v2: failed to configure power-off GPIO\n"); +} + +MACHINE_START(NET5BIG_V2, "LaCie 5Big Network v2") + .phys_io = KIRKWOOD_REGS_PHYS_BASE, + .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc, + .boot_params = 0x00000100, + .init_machine = net5big_v2_init, + .map_io = kirkwood_map_io, + .init_irq = kirkwood_init_irq, + .timer = &net5big_v2_timer, +MACHINE_END From 57475b1a47b3e891ce087ca3c6fc93f5a446a244 Mon Sep 17 00:00:00 2001 From: Simon Guinot Date: Mon, 8 Feb 2010 19:08:34 +0100 Subject: [PATCH 6/6] [ARM] Kirkwood: merge net2big_v2 and net5big_v2 board setups Signed-off-by: Nicolas Pitre --- arch/arm/mach-kirkwood/Makefile | 4 +- arch/arm/mach-kirkwood/net2big_v2-setup.c | 334 ------------------ ...{net5big_v2-setup.c => netxbig_v2-setup.c} | 176 ++++++--- 3 files changed, 120 insertions(+), 394 deletions(-) delete mode 100644 arch/arm/mach-kirkwood/net2big_v2-setup.c rename arch/arm/mach-kirkwood/{net5big_v2-setup.c => netxbig_v2-setup.c} (62%) diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile index bbb8dd3fa21..c0cd5d36200 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 obj-$(CONFIG_MACH_OPENRD) += openrd-setup.o obj-$(CONFIG_MACH_NETSPACE_V2) += netspace_v2-setup.o obj-$(CONFIG_MACH_INETSPACE_V2) += netspace_v2-setup.o -obj-$(CONFIG_MACH_NET2BIG_V2) += net2big_v2-setup.o -obj-$(CONFIG_MACH_NET5BIG_V2) += net5big_v2-setup.o +obj-$(CONFIG_MACH_NET2BIG_V2) += netxbig_v2-setup.o +obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o 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 359bb19e366..00000000000 --- a/arch/arm/mach-kirkwood/net2big_v2-setup.c +++ /dev/null @@ -1,334 +0,0 @@ -/* - * arch/arm/mach-kirkwood/net2big_v2-setup.c - * - * LaCie 2Big Network v2 board setup - * - * Copyright (C) 2010 Simon Guinot - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "common.h" -#include "mpp.h" - -/***************************************************************************** - * 512KB SPI Flash on Boot Device (MACRONIX MX25L4005) - ****************************************************************************/ - -static struct mtd_partition net2big_v2_flash_parts[] = { - { - .name = "u-boot", - .size = MTDPART_SIZ_FULL, - .offset = 0, - .mask_flags = MTD_WRITEABLE, /* force read-only */ - }, -}; - -static const struct flash_platform_data net2big_v2_flash = { - .type = "mx25l4005a", - .name = "spi_flash", - .parts = net2big_v2_flash_parts, - .nr_parts = ARRAY_SIZE(net2big_v2_flash_parts), -}; - -static struct spi_board_info __initdata net2big_v2_spi_slave_info[] = { - { - .modalias = "m25p80", - .platform_data = &net2big_v2_flash, - .irq = -1, - .max_speed_hz = 20000000, - .bus_num = 0, - .chip_select = 0, - }, -}; - -/***************************************************************************** - * Ethernet - ****************************************************************************/ - -static struct mv643xx_eth_platform_data net2big_v2_ge00_data = { - .phy_addr = MV643XX_ETH_PHY_ADDR(8), -}; - -/***************************************************************************** - * I2C devices - ****************************************************************************/ - -static struct at24_platform_data at24c04 = { - .byte_len = SZ_4K / 8, - .page_size = 16, -}; - -/* - * i2c addr | chip | description - * 0x50 | HT24LC04 | eeprom (512B) - */ - -static struct i2c_board_info __initdata net2big_v2_i2c_info[] = { - { - I2C_BOARD_INFO("24c04", 0x50), - .platform_data = &at24c04, - } -}; - -/***************************************************************************** - * SATA - ****************************************************************************/ - -static struct mv_sata_platform_data net2big_v2_sata_data = { - .n_ports = 2, -}; - -static int __initdata net2big_v2_gpio_hdd_power[] = { 16, 17 }; - -static void __init net2big_v2_sata_power_init(void) -{ - int i; - int err; - - /* Power up all hard disks. */ - for (i = 0; i < ARRAY_SIZE(net2big_v2_gpio_hdd_power); i++) { - err = gpio_request(net2big_v2_gpio_hdd_power[i], NULL); - if (err == 0) { - err = gpio_direction_output( - net2big_v2_gpio_hdd_power[i], 1); - /* Free the HDD power GPIOs. This allow user-space to - * configure them via the gpiolib sysfs interface. */ - gpio_free(net2big_v2_gpio_hdd_power[i]); - } - if (err) - pr_err("net2big_v2: failed to power-up HDD%d\n", i + 1); - } -} - -/***************************************************************************** - * GPIO keys - ****************************************************************************/ - -#define NET2BIG_V2_GPIO_SWITCH_POWER_ON 13 -#define NET2BIG_V2_GPIO_SWITCH_POWER_OFF 15 -#define NET2BIG_V2_GPIO_FUNC_BUTTON 34 - -#define NET2BIG_V2_SWITCH_POWER_ON 0x1 -#define NET2BIG_V2_SWITCH_POWER_OFF 0x2 - -static struct gpio_keys_button net2big_v2_buttons[] = { - [0] = { - .type = EV_SW, - .code = NET2BIG_V2_SWITCH_POWER_ON, - .gpio = NET2BIG_V2_GPIO_SWITCH_POWER_ON, - .desc = "Back power switch (on|auto)", - .active_low = 1, - }, - [1] = { - .type = EV_SW, - .code = NET2BIG_V2_SWITCH_POWER_OFF, - .gpio = NET2BIG_V2_GPIO_SWITCH_POWER_OFF, - .desc = "Back power switch (auto|off)", - .active_low = 1, - }, - [2] = { - .code = KEY_OPTION, - .gpio = NET2BIG_V2_GPIO_FUNC_BUTTON, - .desc = "Function button", - .active_low = 1, - }, -}; - -static struct gpio_keys_platform_data net2big_v2_button_data = { - .buttons = net2big_v2_buttons, - .nbuttons = ARRAY_SIZE(net2big_v2_buttons), -}; - -static struct platform_device net2big_v2_gpio_buttons = { - .name = "gpio-keys", - .id = -1, - .dev = { - .platform_data = &net2big_v2_button_data, - }, -}; - -/***************************************************************************** - * GPIO LEDs - ****************************************************************************/ - -/* - * The LEDs are controlled by a CPLD and can be configured through a GPIO - * extension bus: - * - * - address register : bit [0-2] -> GPIO [47-49] - * - data register : bit [0-2] -> GPIO [44-46] - * - enable register : GPIO 29 - * - * Address register selection: - * - * addr | register - * ---------------------------- - * 0 | front LED - * 1 | front LED brightness - * 2 | HDD LED brightness - * 3 | HDD1 LED - * 4 | HDD2 LED - * - * Data register configuration: - * - * data | LED brightness - * ------------------------------------------------- - * 0 | min (off) - * - | - - * 7 | max - * - * data | front LED mode - * ------------------------------------------------- - * 0 | fix off - * 1 | fix blue on - * 2 | fix red on - * 3 | blink blue on=1 sec and blue off=1 sec - * 4 | blink red on=1 sec and red off=1 sec - * 5 | blink blue on=2.5 sec and red on=0.5 sec - * 6 | blink blue on=1 sec and red on=1 sec - * 7 | blink blue on=0.5 sec and blue off=2.5 sec - * - * data | HDD LED mode - * ------------------------------------------------- - * 0 | fix blue on - * 1 | SATA activity blink - * 2 | fix red on - * 3 | blink blue on=1 sec and blue off=1 sec - * 4 | blink red on=1 sec and red off=1 sec - * 5 | blink blue on=2.5 sec and red on=0.5 sec - * 6 | blink blue on=1 sec and red on=1 sec - * 7 | blink blue on=0.5 sec and blue off=2.5 sec - */ - -/***************************************************************************** - * Timer - ****************************************************************************/ - -static void net2big_v2_timer_init(void) -{ - kirkwood_tclk = 166666667; - orion_time_init(IRQ_KIRKWOOD_BRIDGE, kirkwood_tclk); -} - -struct sys_timer net2big_v2_timer = { - .init = net2big_v2_timer_init, -}; - -/***************************************************************************** - * General Setup - ****************************************************************************/ - -static unsigned int net2big_v2_mpp_config[] __initdata = { - MPP0_SPI_SCn, - MPP1_SPI_MOSI, - MPP2_SPI_SCK, - MPP3_SPI_MISO, - MPP6_SYSRST_OUTn, - MPP7_GPO, /* Request power-off */ - MPP8_TW_SDA, - MPP9_TW_SCK, - MPP10_UART0_TXD, - MPP11_UART0_RXD, - MPP13_GPIO, /* Rear power switch (on|auto) */ - MPP14_GPIO, /* USB fuse alarm */ - MPP15_GPIO, /* Rear power switch (auto|off) */ - MPP16_GPIO, /* SATA HDD1 power */ - MPP17_GPIO, /* SATA HDD2 power */ - MPP20_SATA1_ACTn, - MPP21_SATA0_ACTn, - MPP24_GPIO, /* USB mode select */ - MPP26_GPIO, /* USB device vbus */ - MPP28_GPIO, /* USB enable host vbus */ - MPP29_GPIO, /* GPIO extension ALE */ - MPP34_GPIO, /* Rear Push button */ - MPP35_GPIO, /* Inhibit switch power-off */ - MPP36_GPIO, /* SATA HDD1 presence */ - MPP37_GPIO, /* SATA HDD2 presence */ - MPP40_GPIO, /* eSATA presence */ - MPP44_GPIO, /* GPIO extension (data 0) */ - MPP45_GPIO, /* GPIO extension (data 1) */ - MPP46_GPIO, /* GPIO extension (data 2) */ - MPP47_GPIO, /* GPIO extension (addr 0) */ - MPP48_GPIO, /* GPIO extension (addr 1) */ - MPP49_GPIO, /* GPIO extension (addr 2) */ - 0 -}; - -#define NET2BIG_V2_GPIO_POWER_OFF 7 - -static void net2big_v2_power_off(void) -{ - gpio_set_value(NET2BIG_V2_GPIO_POWER_OFF, 1); -} - -static void __init net2big_v2_init(void) -{ - /* - * Basic setup. Needs to be called early. - */ - kirkwood_init(); - kirkwood_mpp_conf(net2big_v2_mpp_config); - - net2big_v2_sata_power_init(); - - kirkwood_ehci_init(); - kirkwood_ge00_init(&net2big_v2_ge00_data); - kirkwood_sata_init(&net2big_v2_sata_data); - kirkwood_uart0_init(); - spi_register_board_info(net2big_v2_spi_slave_info, - ARRAY_SIZE(net2big_v2_spi_slave_info)); - kirkwood_spi_init(); - kirkwood_i2c_init(); - i2c_register_board_info(0, net2big_v2_i2c_info, - ARRAY_SIZE(net2big_v2_i2c_info)); - - platform_device_register(&net2big_v2_gpio_buttons); - - if (gpio_request(NET2BIG_V2_GPIO_POWER_OFF, "power-off") == 0 && - gpio_direction_output(NET2BIG_V2_GPIO_POWER_OFF, 0) == 0) - pm_power_off = net2big_v2_power_off; - else - pr_err("net2big_v2: failed to configure power-off GPIO\n"); -} - -MACHINE_START(NET2BIG_V2, "LaCie 2Big Network v2") - .phys_io = KIRKWOOD_REGS_PHYS_BASE, - .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc, - .boot_params = 0x00000100, - .init_machine = net2big_v2_init, - .map_io = kirkwood_map_io, - .init_irq = kirkwood_init_irq, - .timer = &net2big_v2_timer, -MACHINE_END diff --git a/arch/arm/mach-kirkwood/net5big_v2-setup.c b/arch/arm/mach-kirkwood/netxbig_v2-setup.c similarity index 62% rename from arch/arm/mach-kirkwood/net5big_v2-setup.c rename to arch/arm/mach-kirkwood/netxbig_v2-setup.c index f0617ecc8a2..8a2bb0228e4 100644 --- a/arch/arm/mach-kirkwood/net5big_v2-setup.c +++ b/arch/arm/mach-kirkwood/netxbig_v2-setup.c @@ -1,7 +1,7 @@ /* - * arch/arm/mach-kirkwood/net5big_v2-setup.c + * arch/arm/mach-kirkwood/netxbig_v2-setup.c * - * LaCie 5Big Network v2 board setup + * LaCie 2Big and 5Big Network v2 board setup * * Copyright (C) 2010 Simon Guinot * @@ -46,7 +46,7 @@ * 512KB SPI Flash on Boot Device (MACRONIX MX25L4005) ****************************************************************************/ -static struct mtd_partition net5big_v2_flash_parts[] = { +static struct mtd_partition netxbig_v2_flash_parts[] = { { .name = "u-boot", .size = MTDPART_SIZ_FULL, @@ -55,17 +55,17 @@ static struct mtd_partition net5big_v2_flash_parts[] = { }, }; -static const struct flash_platform_data net5big_v2_flash = { +static const struct flash_platform_data netxbig_v2_flash = { .type = "mx25l4005a", .name = "spi_flash", - .parts = net5big_v2_flash_parts, - .nr_parts = ARRAY_SIZE(net5big_v2_flash_parts), + .parts = netxbig_v2_flash_parts, + .nr_parts = ARRAY_SIZE(netxbig_v2_flash_parts), }; -static struct spi_board_info __initdata net5big_v2_spi_slave_info[] = { +static struct spi_board_info __initdata netxbig_v2_spi_slave_info[] = { { .modalias = "m25p80", - .platform_data = &net5big_v2_flash, + .platform_data = &netxbig_v2_flash, .irq = -1, .max_speed_hz = 20000000, .bus_num = 0, @@ -77,11 +77,11 @@ static struct spi_board_info __initdata net5big_v2_spi_slave_info[] = { * Ethernet ****************************************************************************/ -static struct mv643xx_eth_platform_data net5big_v2_ge00_data = { +static struct mv643xx_eth_platform_data netxbig_v2_ge00_data = { .phy_addr = MV643XX_ETH_PHY_ADDR(8), }; -static struct mv643xx_eth_platform_data net5big_v2_ge01_data = { +static struct mv643xx_eth_platform_data netxbig_v2_ge01_data = { .phy_addr = MV643XX_ETH_PHY_ADDR(0), }; @@ -99,7 +99,7 @@ static struct at24_platform_data at24c04 = { * 0x50 | HT24LC04 | eeprom (512B) */ -static struct i2c_board_info __initdata net5big_v2_i2c_info[] = { +static struct i2c_board_info __initdata netxbig_v2_i2c_info[] = { { I2C_BOARD_INFO("24c04", 0x50), .platform_data = &at24c04, @@ -110,29 +110,35 @@ static struct i2c_board_info __initdata net5big_v2_i2c_info[] = { * SATA ****************************************************************************/ -static struct mv_sata_platform_data net5big_v2_sata_data = { +static struct mv_sata_platform_data netxbig_v2_sata_data = { .n_ports = 2, }; -static int __initdata net5big_v2_gpio_hdd_power[] = { 16, 17, 41, 42, 43 }; +static int __initdata netxbig_v2_gpio_hdd_power[] = { 16, 17, 41, 42, 43 }; -static void __init net5big_v2_sata_power_init(void) +static void __init netxbig_v2_sata_power_init(void) { int i; int err; + int hdd_nb; + + if (machine_is_net2big_v2()) + hdd_nb = 2; + else + hdd_nb = 5; /* Power up all hard disks. */ - for (i = 0; i < ARRAY_SIZE(net5big_v2_gpio_hdd_power); i++) { - err = gpio_request(net5big_v2_gpio_hdd_power[i], NULL); + for (i = 0; i < hdd_nb; i++) { + err = gpio_request(netxbig_v2_gpio_hdd_power[i], NULL); if (err == 0) { err = gpio_direction_output( - net5big_v2_gpio_hdd_power[i], 1); + netxbig_v2_gpio_hdd_power[i], 1); /* Free the HDD power GPIOs. This allow user-space to * configure them via the gpiolib sysfs interface. */ - gpio_free(net5big_v2_gpio_hdd_power[i]); + gpio_free(netxbig_v2_gpio_hdd_power[i]); } if (err) - pr_err("net5big_v2: failed to power up HDD%d\n", i + 1); + pr_err("netxbig_v2: failed to power up HDD%d\n", i + 1); } } @@ -140,46 +146,46 @@ static void __init net5big_v2_sata_power_init(void) * GPIO keys ****************************************************************************/ -#define NET5BIG_V2_GPIO_SWITCH_POWER_ON 13 -#define NET5BIG_V2_GPIO_SWITCH_POWER_OFF 15 -#define NET5BIG_V2_GPIO_FUNC_BUTTON 34 +#define NETXBIG_V2_GPIO_SWITCH_POWER_ON 13 +#define NETXBIG_V2_GPIO_SWITCH_POWER_OFF 15 +#define NETXBIG_V2_GPIO_FUNC_BUTTON 34 -#define NET5BIG_V2_SWITCH_POWER_ON 0x1 -#define NET5BIG_V2_SWITCH_POWER_OFF 0x2 +#define NETXBIG_V2_SWITCH_POWER_ON 0x1 +#define NETXBIG_V2_SWITCH_POWER_OFF 0x2 -static struct gpio_keys_button net5big_v2_buttons[] = { +static struct gpio_keys_button netxbig_v2_buttons[] = { [0] = { .type = EV_SW, - .code = NET5BIG_V2_SWITCH_POWER_ON, - .gpio = NET5BIG_V2_GPIO_SWITCH_POWER_ON, + .code = NETXBIG_V2_SWITCH_POWER_ON, + .gpio = NETXBIG_V2_GPIO_SWITCH_POWER_ON, .desc = "Back power switch (on|auto)", .active_low = 1, }, [1] = { .type = EV_SW, - .code = NET5BIG_V2_SWITCH_POWER_OFF, - .gpio = NET5BIG_V2_GPIO_SWITCH_POWER_OFF, + .code = NETXBIG_V2_SWITCH_POWER_OFF, + .gpio = NETXBIG_V2_GPIO_SWITCH_POWER_OFF, .desc = "Back power switch (auto|off)", .active_low = 1, }, [2] = { .code = KEY_OPTION, - .gpio = NET5BIG_V2_GPIO_FUNC_BUTTON, + .gpio = NETXBIG_V2_GPIO_FUNC_BUTTON, .desc = "Function button", .active_low = 1, }, }; -static struct gpio_keys_platform_data net5big_v2_button_data = { - .buttons = net5big_v2_buttons, - .nbuttons = ARRAY_SIZE(net5big_v2_buttons), +static struct gpio_keys_platform_data netxbig_v2_button_data = { + .buttons = netxbig_v2_buttons, + .nbuttons = ARRAY_SIZE(netxbig_v2_buttons), }; -static struct platform_device net5big_v2_gpio_buttons = { +static struct platform_device netxbig_v2_gpio_buttons = { .name = "gpio-keys", .id = -1, .dev = { - .platform_data = &net5big_v2_button_data, + .platform_data = &netxbig_v2_button_data, }, }; @@ -243,20 +249,56 @@ static struct platform_device net5big_v2_gpio_buttons = { * Timer ****************************************************************************/ -static void net5big_v2_timer_init(void) +static void netxbig_v2_timer_init(void) { kirkwood_tclk = 166666667; orion_time_init(IRQ_KIRKWOOD_BRIDGE, kirkwood_tclk); } -struct sys_timer net5big_v2_timer = { - .init = net5big_v2_timer_init, +struct sys_timer netxbig_v2_timer = { + .init = netxbig_v2_timer_init, }; /***************************************************************************** * General Setup ****************************************************************************/ +static unsigned int net2big_v2_mpp_config[] __initdata = { + MPP0_SPI_SCn, + MPP1_SPI_MOSI, + MPP2_SPI_SCK, + MPP3_SPI_MISO, + MPP6_SYSRST_OUTn, + MPP7_GPO, /* Request power-off */ + MPP8_TW_SDA, + MPP9_TW_SCK, + MPP10_UART0_TXD, + MPP11_UART0_RXD, + MPP13_GPIO, /* Rear power switch (on|auto) */ + MPP14_GPIO, /* USB fuse alarm */ + MPP15_GPIO, /* Rear power switch (auto|off) */ + MPP16_GPIO, /* SATA HDD1 power */ + MPP17_GPIO, /* SATA HDD2 power */ + MPP20_SATA1_ACTn, + MPP21_SATA0_ACTn, + MPP24_GPIO, /* USB mode select */ + MPP26_GPIO, /* USB device vbus */ + MPP28_GPIO, /* USB enable host vbus */ + MPP29_GPIO, /* CPLD extension ALE */ + MPP34_GPIO, /* Rear Push button */ + MPP35_GPIO, /* Inhibit switch power-off */ + MPP36_GPIO, /* SATA HDD1 presence */ + MPP37_GPIO, /* SATA HDD2 presence */ + MPP40_GPIO, /* eSATA presence */ + MPP44_GPIO, /* CPLD extension (data 0) */ + MPP45_GPIO, /* CPLD extension (data 1) */ + MPP46_GPIO, /* CPLD extension (data 2) */ + MPP47_GPIO, /* CPLD extension (addr 0) */ + MPP48_GPIO, /* CPLD extension (addr 1) */ + MPP49_GPIO, /* CPLD extension (addr 2) */ + 0 +}; + static unsigned int net5big_v2_mpp_config[] __initdata = { MPP0_SPI_SCn, MPP1_SPI_MOSI, @@ -306,50 +348,68 @@ static unsigned int net5big_v2_mpp_config[] __initdata = { 0 }; -#define NET5BIG_V2_GPIO_POWER_OFF 7 +#define NETXBIG_V2_GPIO_POWER_OFF 7 -static void net5big_v2_power_off(void) +static void netxbig_v2_power_off(void) { - gpio_set_value(NET5BIG_V2_GPIO_POWER_OFF, 1); + gpio_set_value(NETXBIG_V2_GPIO_POWER_OFF, 1); } -static void __init net5big_v2_init(void) +static void __init netxbig_v2_init(void) { /* * Basic setup. Needs to be called early. */ kirkwood_init(); - kirkwood_mpp_conf(net5big_v2_mpp_config); + if (machine_is_net2big_v2()) + kirkwood_mpp_conf(net2big_v2_mpp_config); + else + kirkwood_mpp_conf(net5big_v2_mpp_config); - net5big_v2_sata_power_init(); + netxbig_v2_sata_power_init(); kirkwood_ehci_init(); - kirkwood_ge00_init(&net5big_v2_ge00_data); - kirkwood_ge01_init(&net5big_v2_ge01_data); - kirkwood_sata_init(&net5big_v2_sata_data); + kirkwood_ge00_init(&netxbig_v2_ge00_data); + if (machine_is_net5big_v2()) + kirkwood_ge01_init(&netxbig_v2_ge01_data); + kirkwood_sata_init(&netxbig_v2_sata_data); kirkwood_uart0_init(); - spi_register_board_info(net5big_v2_spi_slave_info, - ARRAY_SIZE(net5big_v2_spi_slave_info)); + spi_register_board_info(netxbig_v2_spi_slave_info, + ARRAY_SIZE(netxbig_v2_spi_slave_info)); kirkwood_spi_init(); kirkwood_i2c_init(); - i2c_register_board_info(0, net5big_v2_i2c_info, - ARRAY_SIZE(net5big_v2_i2c_info)); + i2c_register_board_info(0, netxbig_v2_i2c_info, + ARRAY_SIZE(netxbig_v2_i2c_info)); - platform_device_register(&net5big_v2_gpio_buttons); + platform_device_register(&netxbig_v2_gpio_buttons); - if (gpio_request(NET5BIG_V2_GPIO_POWER_OFF, "power-off") == 0 && - gpio_direction_output(NET5BIG_V2_GPIO_POWER_OFF, 0) == 0) - pm_power_off = net5big_v2_power_off; + if (gpio_request(NETXBIG_V2_GPIO_POWER_OFF, "power-off") == 0 && + gpio_direction_output(NETXBIG_V2_GPIO_POWER_OFF, 0) == 0) + pm_power_off = netxbig_v2_power_off; else - pr_err("net5big_v2: failed to configure power-off GPIO\n"); + pr_err("netxbig_v2: failed to configure power-off GPIO\n"); } +#ifdef CONFIG_MACH_NET2BIG_V2 +MACHINE_START(NET2BIG_V2, "LaCie 2Big Network v2") + .phys_io = KIRKWOOD_REGS_PHYS_BASE, + .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc, + .boot_params = 0x00000100, + .init_machine = netxbig_v2_init, + .map_io = kirkwood_map_io, + .init_irq = kirkwood_init_irq, + .timer = &netxbig_v2_timer, +MACHINE_END +#endif + +#ifdef CONFIG_MACH_NET5BIG_V2 MACHINE_START(NET5BIG_V2, "LaCie 5Big Network v2") .phys_io = KIRKWOOD_REGS_PHYS_BASE, .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc, .boot_params = 0x00000100, - .init_machine = net5big_v2_init, + .init_machine = netxbig_v2_init, .map_io = kirkwood_map_io, .init_irq = kirkwood_init_irq, - .timer = &net5big_v2_timer, + .timer = &netxbig_v2_timer, MACHINE_END +#endif