Adds support for Buffalo Linkstation Live v3 (LS-CHL) NAS drives. Fan speeds added from data sheet and indentation tidied.<br>
Signed-off-by: Ash Hughes <<a href="mailto:ashley.hughes@blueyonder.co.uk">ashley.hughes@blueyonder.co.uk</a>><br><br>---<br><br>diff -uprN linux-2.6-vanilla//arch/arm/mach-orion5x/Kconfig linux-2.6/arch/arm/mach-orion5x/Kconfig<br>
--- linux-2.6-vanilla//arch/arm/mach-orion5x/Kconfig 2010-11-14 10:58:39.000000000 +0000<br>+++ linux-2.6/arch/arm/mach-orion5x/Kconfig 2010-11-14 11:02:42.874582000 +0000<br>@@ -51,6 +51,13 @@ config MACH_LINKSTATION_PRO<br>
Buffalo Linkstation Pro/Live platform. Both v1 and<br> v2 devices are supported.<br> <br>+config MACH_LINKSTATION_LSCHL<br>+ bool "Buffalo Linkstation Live v3 (LS-CHL)"<br>+ select I2C_BOARDINFO<br>
+ help<br>+ Say 'Y' here if you want your kernel to support the<br>+ Buffalo Linkstation Live v3 (LS-CHL) platform.<br>+<br> config MACH_LINKSTATION_MINI<br> bool "Buffalo Linkstation Mini"<br>
select I2C_BOARDINFO<br>diff -uprN linux-2.6-vanilla//arch/arm/mach-orion5x/ls-chl-setup.c linux-2.6/arch/arm/mach-orion5x/ls-chl-setup.c<br>--- linux-2.6-vanilla//arch/arm/mach-orion5x/ls-chl-setup.c 1970-01-01 01:00:00.000000000 +0100<br>
+++ linux-2.6/arch/arm/mach-orion5x/ls-chl-setup.c 2010-11-26 00:07:05.860743000 +0000<br>@@ -0,0 +1,328 @@<br>+/*<br>+ * arch/arm/mach-orion5x/ls-chl-setup.c<br>+ *<br>+ * Maintainer: Ash Hughes <<a href="mailto:ashley.hughes@blueyonder.co.uk">ashley.hughes@blueyonder.co.uk</a>><br>
+ *<br>+ * This file is licensed under the terms of the GNU General Public<br>+ * License version 2. This program is licensed "as is" without any<br>+ * warranty of any kind, whether express or implied.<br>+ */<br>
+<br>+#include <linux/kernel.h><br>+#include <linux/init.h><br>+#include <linux/platform_device.h><br>+#include <linux/mtd/physmap.h><br>+#include <linux/mv643xx_eth.h><br>+#include <linux/leds.h><br>
+#include <linux/gpio_keys.h><br>+#include <linux/gpio-fan.h><br>+#include <linux/input.h><br>+#include <linux/i2c.h><br>+#include <linux/ata_platform.h><br>+#include <linux/gpio.h><br>
+#include <asm/mach-types.h><br>+#include <asm/mach/arch.h><br>+#include <asm/system.h><br>+#include <mach/orion5x.h><br>+#include "common.h"<br>+#include "mpp.h"<br>+<br>+/*****************************************************************************<br>
+ * Linkstation LS-CHL Info<br>+ ****************************************************************************/<br>+<br>+/*<br>+ * 256K NOR flash Device bus boot chip select<br>+ */<br>+<br>+#define LSCHL_NOR_BOOT_BASE 0xf4000000<br>
+#define LSCHL_NOR_BOOT_SIZE SZ_256K<br>+<br>+/*****************************************************************************<br>+ * 256KB NOR Flash on BOOT Device<br>+ ****************************************************************************/<br>
+<br>+static struct physmap_flash_data lschl_nor_flash_data = {<br>+ .width = 1,<br>+};<br>+<br>+static struct resource lschl_nor_flash_resource = {<br>+ .flags = IORESOURCE_MEM,<br>+ .start = LSCHL_NOR_BOOT_BASE,<br>
+ .end = LSCHL_NOR_BOOT_BASE + LSCHL_NOR_BOOT_SIZE - 1,<br>+};<br>+<br>+static struct platform_device lschl_nor_flash = {<br>+ .name = "physmap-flash",<br>+ .id = 0,<br>+ .dev = {<br>+ .platform_data = &lschl_nor_flash_data,<br>
+ },<br>+ .num_resources = 1,<br>+ .resource = &lschl_nor_flash_resource,<br>+};<br>+<br>+/*****************************************************************************<br>+ * Ethernet<br>+ ****************************************************************************/<br>
+<br>+static struct mv643xx_eth_platform_data lschl_eth_data = {<br>+ .phy_addr = MV643XX_ETH_PHY_ADDR(8),<br>+};<br>+<br>+/*****************************************************************************<br>+ * RTC 5C372a on I2C bus<br>
+ ****************************************************************************/<br>+<br>+static struct i2c_board_info __initdata lschl_i2c_rtc = {<br>+ I2C_BOARD_INFO("rs5c372a", 0x32),<br>+};<br>+<br>+/*****************************************************************************<br>
+ * LEDs attached to GPIO<br>+ ****************************************************************************/<br>+<br>+#define LSCHL_GPIO_LED_ALARM 2<br>+#define LSCHL_GPIO_LED_INFO 3<br>+#define LSCHL_GPIO_LED_FUNC 17<br>
+#define LSCHL_GPIO_LED_PWR 0<br>+<br>+static struct gpio_led lschl_led_pins[] = {<br>+ {<br>+ .name = "alarm:red",<br>+ .gpio = LSCHL_GPIO_LED_ALARM,<br>+ .active_low = 1,<br>+ }, {<br>
+ .name = "info:amber",<br>+ .gpio = LSCHL_GPIO_LED_INFO,<br>+ .active_low = 1,<br>+ }, {<br>+ .name = "func:blue:top",<br>+ .gpio = LSCHL_GPIO_LED_FUNC,<br>+ .active_low = 1,<br>
+ }, {<br>+ .name = "power:blue:bottom",<br>+ .gpio = LSCHL_GPIO_LED_PWR,<br>+ },<br>+};<br>+<br>+static struct gpio_led_platform_data lschl_led_data = {<br>+ .leds = lschl_led_pins,<br>+ .num_leds = ARRAY_SIZE(lschl_led_pins),<br>
+};<br>+<br>+static struct platform_device lschl_leds = {<br>+ .name = "leds-gpio",<br>+ .id = -1,<br>+ .dev = {<br>+ .platform_data = &lschl_led_data,<br>+ },<br>+};<br>+<br>+/*****************************************************************************<br>
+ * SATA<br>+ ****************************************************************************/<br>+static struct mv_sata_platform_data lschl_sata_data = {<br>+ .n_ports = 2,<br>+};<br>+<br>+/*****************************************************************************<br>
+ * LS-CHL specific power off method: reboot<br>+ ****************************************************************************/<br>+/*<br>+ * On the LS-CHL, the shutdown process is following:<br>+ * - Userland monitors key events until the power switch goes to off position<br>
+ * - The board reboots<br>+ * - U-boot starts and goes into an idle mode waiting for the user<br>+ * to move the switch to ON position<br>+ *<br>+ */<br>+<br>+static void lschl_power_off(void)<br>+{<br>+ arm_machine_restart('h', NULL);<br>
+}<br>+<br>+/*****************************************************************************<br>+ * General Setup<br>+ ****************************************************************************/<br>+#define LSCHL_GPIO_USB_POWER 9<br>
+#define LSCHL_GPIO_AUTO_POWER 17<br>+#define LSCHL_GPIO_POWER 18<br>+<br>+/****************************************************************************<br>+ * GPIO Attached Keys<br>+ ****************************************************************************/<br>
+#define LSCHL_GPIO_KEY_FUNC 15<br>+#define LSCHL_GPIO_KEY_POWER 8<br>+#define LSCHL_GPIO_KEY_AUTOPOWER 10<br>+#define LSCHL_SW_POWER 0x00<br>+#define LSCHL_SW_AUTOPOWER 0x01<br>+#define LSCHL_SW_FUNC 0x02<br>
+<br>+static struct gpio_keys_button lschl_buttons[] = {<br>+ {<br>+ .type = EV_SW,<br>+ .code = LSCHL_SW_POWER,<br>+ .gpio = LSCHL_GPIO_KEY_POWER,<br>+ .desc = "Power-on Switch",<br>
+ .active_low = 1,<br>+ }, {<br>+ .type = EV_SW,<br>+ .code = LSCHL_SW_AUTOPOWER,<br>+ .gpio = LSCHL_GPIO_KEY_AUTOPOWER,<br>+ .desc = "Power-auto Switch",<br>+ .active_low = 1,<br>
+ }, {<br>+ .type = EV_SW,<br>+ .code = LSCHL_SW_FUNC,<br>+ .gpio = LSCHL_GPIO_KEY_FUNC,<br>+ .desc = "Function Switch",<br>+ .active_low = 1,<br>+ },<br>+};<br>+<br>+static struct gpio_keys_platform_data lschl_button_data = {<br>
+ .buttons = lschl_buttons,<br>+ .nbuttons = ARRAY_SIZE(lschl_buttons),<br>+};<br>+<br>+static struct platform_device lschl_button_device = {<br>+ .name = "gpio-keys",<br>+ .id = -1,<br>+ .num_resources = 0,<br>
+ .dev = {<br>+ .platform_data = &lschl_button_data,<br>+ },<br>+};<br>+<br>+#define LSCHL_GPIO_HDD_POWER 1<br>+<br>+/****************************************************************************<br>+ * GPIO Fan<br>
+ ****************************************************************************/<br>+<br>+#define LSCHL_GPIO_FAN_LOW 16<br>+#define LSCHL_GPIO_FAN_HIGH 14<br>+#define LSCHL_GPIO_FAN_LOCK 6<br>+<br>+static struct gpio_fan_alarm lschl_alarm = {<br>
+ .gpio = LSCHL_GPIO_FAN_LOCK,<br>+};<br>+<br>+static struct gpio_fan_speed lschl_speeds[] = {<br>+ {<br>+ .rpm = 0,<br>+ .ctrl_val = 3,<br>+ }, {<br>+ .rpm = 1500,<br>+ .ctrl_val = 2,<br>
+ }, {<br>+ .rpm = 3250,<br>+ .ctrl_val = 1,<br>+ }, {<br>+ .rpm = 5000,<br>+ .ctrl_val = 0,<br>+ },<br>+};<br>+<br>+static int lschl_gpio_list[] = {<br>+ LSCHL_GPIO_FAN_HIGH, LSCHL_GPIO_FAN_LOW,<br>
+};<br>+<br>+static struct gpio_fan_platform_data lschl_fan_data = {<br>+ .num_ctrl = ARRAY_SIZE(lschl_gpio_list),<br>+ .ctrl = lschl_gpio_list,<br>+ .alarm = &lschl_alarm,<br>+ .num_speed = ARRAY_SIZE(lschl_speeds),<br>
+ .speed = lschl_speeds,<br>+};<br>+<br>+static struct platform_device lschl_fan_device = {<br>+ .name = "gpio-fan",<br>+ .id = -1,<br>+ .num_resources = 0,<br>+ .dev = {<br>+ .platform_data = &lschl_fan_data,<br>
+ },<br>+};<br>+<br>+/****************************************************************************<br>+ * GPIO Data<br>+ ****************************************************************************/<br>+<br>+static struct orion5x_mpp_mode lschl_mpp_modes[] __initdata = {<br>
+ { 0, MPP_GPIO }, /* LED POWER */<br>+ { 1, MPP_GPIO }, /* HDD POWER */<br>+ { 2, MPP_GPIO }, /* LED ALARM */<br>+ { 3, MPP_GPIO }, /* LED INFO */<br>+ { 4, MPP_UNUSED },<br>+ { 5, MPP_UNUSED },<br>
+ { 6, MPP_GPIO }, /* FAN LOCK */<br>+ { 7, MPP_GPIO }, /* SW INIT */<br>+ { 8, MPP_GPIO }, /* SW POWER */<br>+ { 9, MPP_GPIO }, /* USB POWER */<br>+ { 10, MPP_GPIO }, /* SW AUTO POWER */<br>+ { 11, MPP_UNUSED },<br>
+ { 12, MPP_UNUSED },<br>+ { 13, MPP_UNUSED },<br>+ { 14, MPP_GPIO }, /* FAN HIGH */<br>+ { 15, MPP_GPIO }, /* SW FUNC */<br>+ { 16, MPP_GPIO }, /* FAN LOW */<br>+ { 17, MPP_GPIO }, /* LED FUNC */<br>+ { 18, MPP_UNUSED },<br>
+ { 19, MPP_UNUSED },<br>+ { -1 },<br>+};<br>+<br>+static void __init lschl_init(void)<br>+{<br>+ /*<br>+ * Setup basic Orion functions. Needs to be called early.<br>+ */<br>+ orion5x_init();<br>+<br>+ orion5x_mpp_conf(lschl_mpp_modes);<br>
+<br>+ /*<br>+ * Configure peripherals.<br>+ */<br>+ orion5x_ehci0_init();<br>+ orion5x_ehci1_init();<br>+ orion5x_eth_init(&lschl_eth_data);<br>+ orion5x_i2c_init();<br>+ orion5x_sata_init(&lschl_sata_data);<br>
+ orion5x_uart0_init();<br>+ orion5x_xor_init();<br>+<br>+ orion5x_setup_dev_boot_win(LSCHL_NOR_BOOT_BASE,<br>+ LSCHL_NOR_BOOT_SIZE);<br>+ platform_device_register(&lschl_nor_flash);<br>+<br>
+ platform_device_register(&lschl_leds);<br>+<br>+ platform_device_register(&lschl_button_device);<br>+<br>+ platform_device_register(&lschl_fan_device);<br>+<br>+ i2c_register_board_info(0, &lschl_i2c_rtc, 1);<br>
+<br>+ /* usb power on */<br>+ gpio_set_value(LSCHL_GPIO_USB_POWER, 1);<br>+<br>+ /* register power-off method */<br>+ pm_power_off = lschl_power_off;<br>+<br>+ pr_info("%s: finished\n", __func__);<br>
+}<br>+<br>+MACHINE_START(LINKSTATION_LSCHL, "Buffalo Linkstation LiveV3 (LS-CHL)")<br>+ /* Maintainer: Ash Hughes <<a href="mailto:ashley.hughes@blueyonder.co.uk">ashley.hughes@blueyonder.co.uk</a>> */<br>
+ .boot_params = 0x00000100,<br>+ .init_machine = lschl_init,<br>+ .map_io = orion5x_map_io,<br>+ .init_irq = orion5x_init_irq,<br>+ .timer = &orion5x_timer,<br>+ .fixup = tag_fixup_mem32,<br>
+MACHINE_END<br>+<br>diff -uprN linux-2.6-vanilla//arch/arm/mach-orion5x/Makefile linux-2.6/arch/arm/mach-orion5x/Makefile<br>--- linux-2.6-vanilla//arch/arm/mach-orion5x/Makefile 2010-11-14 10:58:39.000000000 +0000<br>
+++ linux-2.6/arch/arm/mach-orion5x/Makefile 2010-11-24 19:36:07.868220002 +0000<br>@@ -21,3 +21,4 @@ obj-$(CONFIG_MACH_WNR854T) += wnr854t-se<br> obj-$(CONFIG_MACH_RD88F5181L_GE) += rd88f5181l-ge-setup.o<br> obj-$(CONFIG_MACH_RD88F5181L_FXO) += rd88f5181l-fxo-setup.o<br>
obj-$(CONFIG_MACH_RD88F6183AP_GE) += rd88f6183ap-ge-setup.o<br>+obj-$(CONFIG_MACH_LINKSTATION_LSCHL) += ls-chl-setup.o<br>