kernel.patches/3.2.34/v3.2-ARM-kirkwood-Add-support-for-Buffalo-LS-VL.patch

382 lines
10 KiB
Diff
Raw Permalink Normal View History

2012-11-24 17:08:51 +01:00
diff -uNr linux-3.2.33-go.orig/arch/arm/mach-kirkwood/Kconfig linux-3.2.33-go/arch/arm/mach-kirkwood/Kconfig
--- linux-3.2.33-go.orig/arch/arm/mach-kirkwood/Kconfig 2012-11-14 21:20:22.326388580 +0100
+++ linux-3.2.33-go/arch/arm/mach-kirkwood/Kconfig 2012-11-14 21:21:02.353908681 +0100
@@ -136,6 +136,12 @@
Say 'Y' here if you want your kernel to support the
Buffalo LS-XHL Series.
+config MACH_LSVL
+ bool "Buffalo LS-VL Series"
+ help
+ Say 'Y' here if you want your kernel to support the
+ Buffalo LS-VL Series.
+
endmenu
endif
diff -uNr linux-3.2.33-go.orig/arch/arm/mach-kirkwood/lsvl-setup.c linux-3.2.33-go/arch/arm/mach-kirkwood/lsvl-setup.c
--- linux-3.2.33-go.orig/arch/arm/mach-kirkwood/lsvl-setup.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-3.2.33-go/arch/arm/mach-kirkwood/lsvl-setup.c 2012-11-14 21:22:54.158568343 +0100
@@ -0,0 +1,340 @@
+/*
+ * arch/arm/mach-kirkwood/lsvl-setup.c
+ *
+ * Buffalo LS-VL Series 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 <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/mtd/physmap.h>
+#include <linux/ata_platform.h>
+#include <linux/mtd/partitions.h>
+#include <linux/spi/flash.h>
+#include <linux/spi/spi.h>
+#include <linux/mv643xx_eth.h>
+#include <linux/gpio.h>
+#include <linux/gpio_keys.h>
+#include <linux/gpio-fan.h>
+#include <linux/input.h>
+#include <linux/leds.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <mach/kirkwood.h>
+#include <plat/mvsdio.h>
+#include "common.h"
+#include "mpp.h"
+
+/*****************************************************************************
+ * 512KB SPI Flash on BOOT Device
+ ****************************************************************************/
+static struct mtd_partition lsvl_partitions[] = {
+ {
+ .name = "u-boot",
+ .size = 0x80000,
+ .offset = 0x00000,
+ .mask_flags = MTD_WRITEABLE, /* force read-only */
+ }
+};
+
+static struct flash_platform_data lsvl_spi_slave_data = {
+ .type = "m25p40-nonjedec",
+ .parts = lsvl_partitions,
+ .nr_parts = ARRAY_SIZE(lsvl_partitions),
+};
+
+static struct spi_board_info __initdata lsvl_spi_slave_info[] = {
+ {
+ .modalias = "m25p80",
+ .platform_data = &lsvl_spi_slave_data,
+ .irq = -1,
+ .max_speed_hz = 20000000,
+ .bus_num = 0,
+ .chip_select = 0,
+ }
+};
+
+/*****************************************************************************
+ * Ethernet
+ ****************************************************************************/
+static struct mv643xx_eth_platform_data lsvl_ge00_data = {
+ .phy_addr = MV643XX_ETH_PHY_ADDR(0),
+};
+
+/*****************************************************************************
+ * SATA
+ ****************************************************************************/
+static struct mv_sata_platform_data lsvl_sata_data = {
+ .n_ports = 1,
+};
+
+/*****************************************************************************
+ * LEDs attached to GPIO
+ ****************************************************************************/
+#define LSVL_GPIO_LED_ALARM 36
+#define LSVL_GPIO_LED_FUNC_RED 37
+#define LSVL_GPIO_LED_INFO 38
+#define LSVL_GPIO_LED_FUNC_BLUE 39
+#define LSVL_GPIO_LED_PWR 40
+
+static struct gpio_led lsvl_led_pins[] = {
+ {
+ .name = "alarm:red",
+ .gpio = LSVL_GPIO_LED_ALARM,
+ },
+ {
+ .name = "func:red:bottom",
+ .gpio = LSVL_GPIO_LED_FUNC_RED,
+ },
+ {
+ .name = "info:amber",
+ .gpio = LSVL_GPIO_LED_INFO,
+ },
+ {
+ .name = "func:blue:bottom",
+ .gpio = LSVL_GPIO_LED_FUNC_BLUE,
+ },
+
+ {
+ .name = "power:blue",
+ .default_trigger = "default-on",
+ .gpio = LSVL_GPIO_LED_PWR,
+ .active_low = 1,
+ },
+};
+
+static struct gpio_led_platform_data lsvl_led_data = {
+ .leds = lsvl_led_pins,
+ .num_leds = ARRAY_SIZE(lsvl_led_pins),
+};
+
+static struct platform_device lsvl_leds = {
+ .name = "leds-gpio",
+ .id = -1,
+ .dev = {
+ .platform_data = &lsvl_led_data,
+ }
+};
+
+/*****************************************************************************
+ * General Setup
+ ****************************************************************************/
+#define LSVL_GPIO_HDD_POWER 8
+#define LSVL_GPIO_USB_POWER 12
+
+/*****************************************************************************
+ * GPIO Attached Keys
+ ****************************************************************************/
+/*#define LSVL_GPIO_KEY_FUNC 45
+#define LSVL_GPIO_KEY_POWER 46
+#define LSVL_GPIO_KEY_AUTOPOWER 47
+#define LSVL_SW_POWER 0x00
+#define LSVL_SW_AUTOPOWER 0x01
+#define LSVL_SW_FUNC 0x02
+
+static struct gpio_keys_button lsvl_buttons[] = {
+ {
+ .type = EV_SW,
+ .code = LSVL_SW_POWER,
+ .gpio = LSVL_GPIO_KEY_POWER,
+ .desc = "Power-on Switch",
+ .active_low = 1,
+ }, {
+ .type = EV_SW,
+ .code = LSVL_SW_AUTOPOWER,
+ .gpio = LSVL_GPIO_KEY_AUTOPOWER,
+ .desc = "Power-auto Switch",
+ .active_low = 1,
+ }, {
+ .type = EV_SW,
+ .code = LSVL_SW_FUNC,
+ .gpio = LSVL_GPIO_KEY_FUNC,
+ .desc = "Function Button",
+ .active_low = 1,
+ },
+};
+
+static struct gpio_keys_platform_data lsvl_button_data = {
+ .buttons = lsvl_buttons,
+ .nbuttons = ARRAY_SIZE(lsvl_buttons),
+};
+
+static struct platform_device lsvl_button_device = {
+ .name = "gpio-keys",
+ .id = -1,
+ .num_resources = 0,
+ .dev = {
+ .platform_data = &lsvl_button_data,
+ },
+};
+*/
+
+/*****************************************************************************
+ * GPIO Fan
+ ****************************************************************************/
+#define LSVL_GPIO_FAN_HIGH 16
+#define LSVL_GPIO_FAN_LOW 17
+#define LSVL_GPIO_FAN_LOCK 43
+
+static struct gpio_fan_alarm lsvl_alarm = {
+ .gpio = LSVL_GPIO_FAN_LOCK,
+};
+
+static struct gpio_fan_speed lsvl_speeds[] = {
+ {
+ .rpm = 0,
+ .ctrl_val = 3,
+ }, {
+ .rpm = 1500,
+ .ctrl_val = 1,
+ }, {
+ .rpm = 3250,
+ .ctrl_val = 2,
+ }, {
+ .rpm = 5000,
+ .ctrl_val = 0,
+ }
+};
+
+static int lsvl_gpio_list[] = {
+ LSVL_GPIO_FAN_HIGH, LSVL_GPIO_FAN_LOW,
+};
+
+static struct gpio_fan_platform_data lsvl_fan_data = {
+ .num_ctrl = ARRAY_SIZE(lsvl_gpio_list),
+ .ctrl = lsvl_gpio_list,
+ .alarm = &lsvl_alarm,
+ .num_speed = ARRAY_SIZE(lsvl_speeds),
+ .speed = lsvl_speeds,
+};
+
+static struct platform_device lsvl_fan_device = {
+ .name = "gpio-fan",
+ .id = -1,
+ .num_resources = 0,
+ .dev = {
+ .platform_data = &lsvl_fan_data,
+ },
+};
+
+/*****************************************************************************
+ * GPIO Data
+ ****************************************************************************/
+
+static unsigned int lsvl_mpp_config[] __initdata = {
+ MPP0_NF_IO2,
+ MPP1_NF_IO3,
+ MPP2_NF_IO4,
+ MPP3_NF_IO5,
+ MPP4_NF_IO6,
+ MPP5_NF_IO7,
+ MPP6_SYSRST_OUTn,
+ MPP7_SPI_SCn,
+ MPP8_GPIO, /* HDD Power */
+ MPP9_GPIO,
+ MPP10_UART0_TXD,
+ MPP11_UART0_RXD,
+ MPP12_GPO, /* USB VBUS EN */
+ MPP13_GPIO,
+ MPP14_GPIO,
+ MPP15_GPIO,
+ MPP16_GPIO, /* FAN HIGH: on:0, off:1 */
+ MPP17_GPIO, /* FAN LOW: on:0, off:1 */
+ MPP18_NF_IO0,
+ MPP19_NF_IO1,
+ MPP20_GPIO,
+ MPP21_GPIO,
+ MPP22_GPIO,
+ MPP23_GPIO,
+ MPP24_GPIO,
+ MPP25_GPIO,
+ MPP26_GPIO,
+ MPP27_GPIO,
+ MPP28_GPIO,
+ MPP29_GPIO,
+ MPP30_GPIO,
+ MPP31_GPIO,
+ MPP32_GPIO,
+ MPP33_GPO,
+ MPP34_GPIO,
+ MPP35_GPIO,
+ MPP36_GPIO, /* ALARM LED */
+ MPP37_GPIO, /* FUNC RED LED */
+ MPP38_GPIO, /* INFO LED */
+ MPP39_GPIO, /* FUNC LED */
+ MPP40_GPIO, /* POWER LED */
+ MPP41_GPIO,
+ MPP42_GPIO,
+ MPP43_GPIO, /* FAN LOCK */
+ MPP44_GPIO,
+ MPP45_GPIO, /* FUNC SW */
+ MPP46_GPIO, /* POWER SW */
+ MPP47_GPIO, /* POWER AUTO SW */
+ MPP48_GPIO, /* UART EN */
+ MPP49_GPIO,
+ 0
+};
+
+/*****************************************************************************
+ * LS-VL specific power off method: reboot
+ ****************************************************************************/
+/*
+ * On the LS-VL, the shutdown process is following:
+ * - Userland monitors key events until the power switch goes to off position
+ * - The board reboots
+ * - U-boot starts and goes into an idle mode waiting for the user
+ * to move the switch to ON position
+ *
+ */
+
+static void lsvl_power_off(void)
+{
+ arm_machine_restart('h', NULL);
+}
+
+static void __init lsvl_init(void)
+{
+ /*
+ * Basic setup. Needs to be called early.
+ */
+ kirkwood_init();
+ kirkwood_mpp_conf(lsvl_mpp_config);
+
+ /*
+ * Configure peripherals.
+ */
+ kirkwood_uart0_init();
+ kirkwood_ehci_init();
+ kirkwood_ge00_init(&lsvl_ge00_data);
+ kirkwood_sata_init(&lsvl_sata_data);
+ kirkwood_spi_init();
+
+ platform_device_register(&lsvl_leds);
+// platform_device_register(&lsvl_button_device);
+ platform_device_register(&lsvl_fan_device);
+
+ spi_register_board_info(lsvl_spi_slave_info,
+ ARRAY_SIZE(lsvl_spi_slave_info));
+
+ /* usb power on */
+ gpio_set_value(LSVL_GPIO_USB_POWER, 1);
+
+ /* register power-off method */
+ pm_power_off = lsvl_power_off;
+
+ pr_info("%s: finished\n", __func__);
+}
+
+MACHINE_START(LSVL, "Buffalo LS-VL Series")
+ .atag_offset = 0x100,
+ .init_machine = lsvl_init,
+ .map_io = kirkwood_map_io,
+ .init_early = kirkwood_init_early,
+ .init_irq = kirkwood_init_irq,
+ .timer = &kirkwood_timer,
+MACHINE_END
+
diff -uNr linux-3.2.33-go.orig/arch/arm/mach-kirkwood/Makefile linux-3.2.33-go/arch/arm/mach-kirkwood/Makefile
--- linux-3.2.33-go.orig/arch/arm/mach-kirkwood/Makefile 2012-11-14 21:20:22.326388580 +0100
+++ linux-3.2.33-go/arch/arm/mach-kirkwood/Makefile 2012-11-14 21:22:20.882968794 +0100
@@ -19,5 +19,6 @@
obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o
obj-$(CONFIG_MACH_T5325) += t5325-setup.o
obj-$(CONFIG_MACH_LSXHL) += lsxhl-setup.o
+obj-$(CONFIG_MACH_LSVL) += lsvl-setup.o
obj-$(CONFIG_CPU_IDLE) += cpuidle.o
diff -uNr linux-3.2.33-go.orig/arch/arm/tools/mach-types linux-3.2.33-go/arch/arm/tools/mach-types
--- linux-3.2.33-go.orig/arch/arm/tools/mach-types 2012-11-14 21:20:22.348388327 +0100
+++ linux-3.2.33-go/arch/arm/tools/mach-types 2012-11-14 21:21:02.356908648 +0100
@@ -118,6 +118,7 @@
omap_osk MACH_OMAP_OSK OMAP_OSK 515
tosa MACH_TOSA TOSA 520
avila MACH_AVILA AVILA 526
+lsvl MACH_LSVL LSVL 5277
edb9302 MACH_EDB9302 EDB9302 538
husky MACH_HUSKY HUSKY 543
shepherd MACH_SHEPHERD SHEPHERD 545