440 lines
13 KiB
Diff
440 lines
13 KiB
Diff
diff -uNr linux-3.3.8-go.orig/arch/arm/configs/orion5x_defconfig linux-3.3.8-go/arch/arm/configs/orion5x_defconfig
|
|
--- linux-3.3.8-go.orig/arch/arm/configs/orion5x_defconfig 2012-11-22 21:40:48.443921973 +0100
|
|
+++ linux-3.3.8-go/arch/arm/configs/orion5x_defconfig 2012-11-22 21:41:29.388436783 +0100
|
|
@@ -21,6 +21,7 @@
|
|
CONFIG_MACH_LINKSTATION_MINI=y
|
|
CONFIG_MACH_LINKSTATION_PRODUO=y
|
|
CONFIG_MACH_LINKSTATION_LS_HGL=y
|
|
+CONFIG_MACH_LINKSTATION_LSQL=y
|
|
CONFIG_MACH_TS409=y
|
|
CONFIG_MACH_WRT350N_V2=y
|
|
CONFIG_MACH_TS78XX=y
|
|
diff -uNr linux-3.3.8-go.orig/arch/arm/mach-orion5x/Kconfig linux-3.3.8-go/arch/arm/mach-orion5x/Kconfig
|
|
--- linux-3.3.8-go.orig/arch/arm/mach-orion5x/Kconfig 2012-11-22 21:40:48.648919605 +0100
|
|
+++ linux-3.3.8-go/arch/arm/mach-orion5x/Kconfig 2012-11-22 21:41:29.389436772 +0100
|
|
@@ -111,6 +111,13 @@
|
|
Say 'Y' here if you want your kernel to support the
|
|
Buffalo Linkstation LS-HGL platform.
|
|
|
|
+config MACH_LINKSTATION_LSQL
|
|
+ bool "Buffalo Linkstation LS-QL"
|
|
+ select I2C_BOARDINFO
|
|
+ help
|
|
+ Say 'Y' here if you want your kernel to support the
|
|
+ Buffalo Linkstation LS-QL platform.
|
|
+
|
|
config MACH_TS409
|
|
bool "QNAP TS-409"
|
|
help
|
|
diff -uNr linux-3.3.8-go.orig/arch/arm/mach-orion5x/lsql-setup.c linux-3.3.8-go/arch/arm/mach-orion5x/lsql-setup.c
|
|
--- linux-3.3.8-go.orig/arch/arm/mach-orion5x/lsql-setup.c 1970-01-01 01:00:00.000000000 +0100
|
|
+++ linux-3.3.8-go/arch/arm/mach-orion5x/lsql-setup.c 2012-11-22 21:41:29.390436761 +0100
|
|
@@ -0,0 +1,388 @@
|
|
+/*
|
|
+ * arch/arm/mach-orion5x/lsql-setup.c
|
|
+ *
|
|
+ * Source based off arch/arm/mach-orion5x/lsproduo-setup.c, which was from lsmini-setup.c
|
|
+ * Maintainer: Matt Gomboc <gomboc0@gmail.com>
|
|
+ *
|
|
+ * 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/mv643xx_eth.h>
|
|
+#include <linux/leds.h>
|
|
+#include <linux/gpio_keys.h>
|
|
+#include <linux/input.h>
|
|
+#include <linux/i2c.h>
|
|
+#include <linux/ata_platform.h>
|
|
+#include <linux/gpio.h>
|
|
+#include <asm/mach-types.h>
|
|
+#include <asm/mach/arch.h>
|
|
+#include <mach/orion5x.h>
|
|
+#include "common.h"
|
|
+#include "mpp.h"
|
|
+#include <linux/module.h>
|
|
+#include <linux/proc_fs.h>
|
|
+#include <asm/uaccess.h>
|
|
+
|
|
+/*****************************************************************************
|
|
+ * Linkstation Quad LS-QL/R5 Info
|
|
+ ****************************************************************************/
|
|
+
|
|
+/*
|
|
+ * 256K NOR flash Device bus boot chip select
|
|
+ */
|
|
+
|
|
+#define LSQL_NOR_BOOT_BASE 0xf4000000
|
|
+#define LSQL_NOR_BOOT_SIZE SZ_256K
|
|
+
|
|
+/*****************************************************************************
|
|
+ * 256KB NOR Flash on BOOT Device
|
|
+ ****************************************************************************/
|
|
+
|
|
+static struct physmap_flash_data lsql_nor_flash_data = {
|
|
+ .width = 1,
|
|
+};
|
|
+
|
|
+static struct resource lsql_nor_flash_resource = {
|
|
+ .flags = IORESOURCE_MEM,
|
|
+ .start = LSQL_NOR_BOOT_BASE,
|
|
+ .end = LSQL_NOR_BOOT_BASE + LSQL_NOR_BOOT_SIZE - 1,
|
|
+};
|
|
+
|
|
+static struct platform_device lsql_nor_flash = {
|
|
+ .name = "physmap-flash",
|
|
+ .id = 0,
|
|
+ .dev = {
|
|
+ .platform_data = &lsql_nor_flash_data,
|
|
+ },
|
|
+ .num_resources = 1,
|
|
+ .resource = &lsql_nor_flash_resource,
|
|
+};
|
|
+
|
|
+/*****************************************************************************
|
|
+ * Ethernet
|
|
+ ****************************************************************************/
|
|
+
|
|
+static struct mv643xx_eth_platform_data lsql_eth_data = {
|
|
+ .phy_addr = 8,
|
|
+};
|
|
+
|
|
+/*****************************************************************************
|
|
+ * RTC 5C372a on I2C bus
|
|
+ ****************************************************************************/
|
|
+
|
|
+static struct i2c_board_info __initdata lsql_i2c_rtc = {
|
|
+ I2C_BOARD_INFO("rs5c372a", 0x32),
|
|
+};
|
|
+
|
|
+/*****************************************************************************
|
|
+ * LEDs attached to GPIO
|
|
+ ****************************************************************************/
|
|
+
|
|
+#define LSQL_GPIO_LED_ALARM 2 /* looks like it should be 2 by the uboot sources, but doesnt successfully trigger the3 top LED*/
|
|
+#define LSQL_GPIO_LED_INFO 3
|
|
+#define LSQL_GPIO_LED_PWR 0
|
|
+#define LSQL_GPIO_LED_FUNC 18
|
|
+
|
|
+
|
|
+static struct gpio_led lsql_led_pins[] = {
|
|
+ {
|
|
+ .name = "alarm:red",
|
|
+ .gpio = LSQL_GPIO_LED_ALARM,
|
|
+ .active_low = 1,
|
|
+ }, {
|
|
+ .name = "info:amber",
|
|
+ .gpio = LSQL_GPIO_LED_INFO,
|
|
+ .active_low = 1,
|
|
+ }, {
|
|
+ .name = "power:blue",
|
|
+ .gpio = LSQL_GPIO_LED_PWR,
|
|
+ .active_low = 1,
|
|
+ },{
|
|
+ .name = "func:blue",
|
|
+ .gpio = LSQL_GPIO_LED_FUNC,
|
|
+ .active_low = 1,
|
|
+ },
|
|
+};
|
|
+
|
|
+
|
|
+
|
|
+static struct gpio_led_platform_data lsql_led_data = {
|
|
+ .leds = lsql_led_pins,
|
|
+ .num_leds = ARRAY_SIZE(lsql_led_pins),
|
|
+};
|
|
+
|
|
+
|
|
+static struct platform_device lsql_leds = {
|
|
+ .name = "leds-gpio",
|
|
+ .id = -1,
|
|
+ .dev = {
|
|
+ .platform_data = &lsql_led_data,
|
|
+ },
|
|
+};
|
|
+
|
|
+
|
|
+/****************************************************************************
|
|
+ * GPIO Attached Keys
|
|
+ ****************************************************************************/
|
|
+
|
|
+ #define LSQL_GPIO_KEY_POWER 10
|
|
+ #define LSQL_GPIO_KEY_AUTOPOWER 22
|
|
+ #define LSQL_GPIO_KEY_FUNC 7
|
|
+
|
|
+ #define LSQL_SW_POWER 0x00
|
|
+ #define LSQL_SW_AUTOPOWER 0x01
|
|
+
|
|
+static struct gpio_keys_button lsql_buttons[] = {
|
|
+ {
|
|
+ .code = KEY_OPTION,
|
|
+ .gpio = LSQL_GPIO_KEY_FUNC,
|
|
+ .desc = "Function Button",
|
|
+ .active_low = 1,
|
|
+ },{
|
|
+ .type = EV_SW,
|
|
+ .code = LSQL_SW_POWER,
|
|
+ .gpio = LSQL_GPIO_KEY_POWER,
|
|
+ .desc = "Power-on Switch",
|
|
+ .active_low = 1,
|
|
+ }, {
|
|
+ .type = EV_SW,
|
|
+ .code = LSQL_SW_AUTOPOWER,
|
|
+ .gpio = LSQL_GPIO_KEY_AUTOPOWER,
|
|
+ .desc = "Power-auto Switch",
|
|
+ .active_low = 1,
|
|
+ },
|
|
+};
|
|
+
|
|
+
|
|
+static struct gpio_keys_platform_data lsql_button_data = {
|
|
+ .buttons = lsql_buttons,
|
|
+ .nbuttons = ARRAY_SIZE(lsql_buttons),
|
|
+};
|
|
+
|
|
+static struct platform_device lsql_button_device = {
|
|
+ .name = "gpio-keys",
|
|
+ .id = -1,
|
|
+ .num_resources = 0,
|
|
+ .dev = {
|
|
+ .platform_data = &lsql_button_data,
|
|
+ },
|
|
+};
|
|
+
|
|
+/****************************************************************************
|
|
+ * GPIO Attached Fan
|
|
+ ****************************************************************************/
|
|
+
|
|
+/* Define max char len */
|
|
+
|
|
+#define MAX_LEN 8
|
|
+
|
|
+#define LSQL_GPIO_FAN_LOW 17
|
|
+#define LSQL_GPIO_FAN_HIGH 14
|
|
+
|
|
+static struct proc_dir_entry *lsql_proc_dir_root, *lsql_proc_dir_gpio, *lsql_fan_proc_file;
|
|
+static char lsql_fan_state[MAX_LEN];
|
|
+
|
|
+static int lsql_fan_get(char *buf, char **start, off_t offset, int count, int *eof, void *data)
|
|
+{
|
|
+ int len;
|
|
+
|
|
+ len = snprintf(buf, count, "state: %s\n", lsql_fan_state);
|
|
+ return len;
|
|
+}
|
|
+
|
|
+static int lsql_fan_set( struct file *file, const char *buffer, unsigned long count, void *data )
|
|
+{
|
|
+ int len, ret;
|
|
+ char *ptr, tState[MAX_LEN];
|
|
+
|
|
+ if (count > MAX_LEN )
|
|
+ len = MAX_LEN;
|
|
+ else
|
|
+ len = count;
|
|
+
|
|
+ ret = copy_from_user(tState, buffer, len);
|
|
+ if(ret < 0)
|
|
+ {
|
|
+ printk(KERN_ERR "%s: Setting fan speed failed\n", "lsql");
|
|
+ return -EFAULT;
|
|
+ }
|
|
+
|
|
+ ptr = strrchr(tState, '\n');
|
|
+ if(ptr) *ptr = '\0';
|
|
+
|
|
+ if (strcasecmp(tState, "off") == 0)
|
|
+ {
|
|
+ printk(KERN_DEBUG "%s: set fan off\n", "lsql");
|
|
+ sprintf(lsql_fan_state, "off");
|
|
+ gpio_set_value(LSQL_GPIO_FAN_LOW, 1);
|
|
+ gpio_set_value(LSQL_GPIO_FAN_HIGH, 1);
|
|
+ } else if (strcasecmp(tState, "slow") == 0)
|
|
+ {
|
|
+ printk(KERN_DEBUG "%s: set fan slow\n", "lsql");
|
|
+ sprintf(lsql_fan_state, "slow");
|
|
+ gpio_set_value(LSQL_GPIO_FAN_LOW, 1);
|
|
+ gpio_set_value(LSQL_GPIO_FAN_HIGH, 0);
|
|
+ } else if (strcasecmp(tState, "fast") == 0)
|
|
+ {
|
|
+ printk(KERN_DEBUG "%s: set fan fast\n", "lsql");
|
|
+ sprintf(lsql_fan_state, "fast");
|
|
+ gpio_set_value(LSQL_GPIO_FAN_LOW, 0);
|
|
+ gpio_set_value(LSQL_GPIO_FAN_HIGH, 1);
|
|
+ } else if (strcasecmp(tState, "full") == 0)
|
|
+ {
|
|
+ printk(KERN_DEBUG "%s: set fan full\n", "lsql");
|
|
+ sprintf(lsql_fan_state, "full");
|
|
+ gpio_set_value(LSQL_GPIO_FAN_LOW, 0);
|
|
+ gpio_set_value(LSQL_GPIO_FAN_HIGH, 0);
|
|
+ } else
|
|
+ {
|
|
+ printk(KERN_ERR "%s: unknown fan speed given\n", "lsql");
|
|
+ }
|
|
+
|
|
+ lsql_fan_state[len] = '\0';
|
|
+
|
|
+ return len;
|
|
+}
|
|
+
|
|
+/*****************************************************************************
|
|
+ * SATA
|
|
+ ****************************************************************************/
|
|
+static struct mv_sata_platform_data lsql_sata_data = {
|
|
+ .n_ports = 2, /*maybe this should be 4, but works with 2 */
|
|
+};
|
|
+
|
|
+
|
|
+/*****************************************************************************
|
|
+ * Linkstation Quad specific power off method: reboot
|
|
+ ****************************************************************************/
|
|
+/*
|
|
+ * On Linkstations in general, 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
|
|
+ *
|
|
+ * on the Quad however, there is a power button on the upper, front,
|
|
+ * a function button on the lower front, ans a Auto/Manual power button on the back.
|
|
+ * After halting system, uboot waits the power button on the front panel to be pushed
|
|
+ *
|
|
+ *
|
|
+ */
|
|
+
|
|
+static void lsql_power_off(void)
|
|
+{
|
|
+ orion5x_restart('h', NULL); /* arm_machine_restart(0, NULL); */
|
|
+}
|
|
+
|
|
+
|
|
+/*****************************************************************************
|
|
+ * General Setup
|
|
+ ****************************************************************************/
|
|
+#define LSQL_GPIO_USB_POWER 9
|
|
+#define LSQL_GPIO_POWER 10
|
|
+#define LSQL_GPIO_USB_POWER2 19
|
|
+#define LSQL_GPIO_AUTO_POWER 22
|
|
+
|
|
+static unsigned int lsql_mpp_modes[] __initdata = {
|
|
+ MPP0_GPIO, /* LED_PWR */
|
|
+ MPP1_GPIO, /* for debugging purposes, change to MPP1_UNUSED for final */
|
|
+ MPP2_GPIO, /* LED_ALARM */ /* looks like it should be 2 by the uboot sources, but doesnt successfully trigger the3 top LED*/
|
|
+ MPP3_GPIO, /* LED_INFO */
|
|
+ MPP4_GPIO,
|
|
+ MPP5_GPIO,
|
|
+ MPP6_GPIO, /* FAN_LCK */
|
|
+ MPP7_GPIO, /* FUNC */
|
|
+ MPP8_GPIO,
|
|
+ MPP9_GPIO, /* USB_PWR */
|
|
+ MPP10_GPIO, /* POWER */
|
|
+ MPP11_GPIO,
|
|
+ MPP12_GPIO,
|
|
+ MPP13_GPIO,
|
|
+ MPP14_GPIO, /* FAN_HIGH */
|
|
+ MPP15_GPIO,
|
|
+ MPP16_GPIO,
|
|
+ MPP17_GPIO, /* FAN_LOW */
|
|
+ MPP18_GPIO, /* LED_FUNC*/
|
|
+ MPP19_GPIO, /* USB_PWR2 */
|
|
+ MPP22_GPIO, /* AUTO_POWER*/
|
|
+ 0,
|
|
+};
|
|
+
|
|
+static void __init lsql_init(void)
|
|
+{
|
|
+ /*
|
|
+ * Setup basic Orion functions. Need to be called early.
|
|
+ */
|
|
+ orion5x_init();
|
|
+
|
|
+ orion5x_mpp_conf(lsql_mpp_modes);
|
|
+
|
|
+ /*
|
|
+ * Configure peripherals.
|
|
+ */
|
|
+ orion5x_ehci0_init();
|
|
+ orion5x_ehci1_init();
|
|
+ orion5x_eth_init(&lsql_eth_data);
|
|
+ orion5x_i2c_init();
|
|
+ orion5x_sata_init(&lsql_sata_data);
|
|
+ orion5x_uart0_init();
|
|
+ orion5x_xor_init();
|
|
+
|
|
+ orion5x_setup_dev_boot_win(LSQL_NOR_BOOT_BASE,
|
|
+ LSQL_NOR_BOOT_SIZE);
|
|
+ platform_device_register(&lsql_nor_flash);
|
|
+
|
|
+ platform_device_register(&lsql_button_device);
|
|
+
|
|
+ platform_device_register(&lsql_leds);
|
|
+
|
|
+ i2c_register_board_info(0, &lsql_i2c_rtc, 1);
|
|
+
|
|
+ /* enable USB power */
|
|
+ gpio_set_value(LSQL_GPIO_USB_POWER, 1);
|
|
+ gpio_set_value(LSQL_GPIO_USB_POWER2, 1);
|
|
+
|
|
+
|
|
+ printk(KERN_INFO "Buffalo Linkstation fan driver loaded\n");
|
|
+ sprintf(lsql_fan_state, "fast");
|
|
+ gpio_set_value(LSQL_GPIO_FAN_LOW, 0);
|
|
+ gpio_set_value(LSQL_GPIO_FAN_HIGH, 1);
|
|
+
|
|
+ lsql_proc_dir_root = proc_mkdir( "linkstation", NULL );
|
|
+ lsql_proc_dir_gpio = proc_mkdir( "gpio", lsql_proc_dir_root );
|
|
+ lsql_fan_proc_file = create_proc_entry( "fan", S_IRUGO, lsql_proc_dir_gpio );
|
|
+ if( lsql_fan_proc_file ) {
|
|
+ lsql_fan_proc_file->read_proc = lsql_fan_get;
|
|
+ lsql_fan_proc_file->write_proc = lsql_fan_set;
|
|
+ lsql_fan_proc_file->data = NULL;
|
|
+ } else
|
|
+ {
|
|
+ printk(KERN_INFO "Registration of fan device failed\n");
|
|
+ }
|
|
+
|
|
+ /* register power-off method */
|
|
+ pm_power_off = lsql_power_off;
|
|
+
|
|
+ pr_info("%s: finished\n", __func__);
|
|
+}
|
|
+
|
|
+#ifdef CONFIG_MACH_LINKSTATION_LSQL
|
|
+MACHINE_START(LINKSTATION_LSQL, "Buffalo Linkstation Quad QL/R5")
|
|
+ .atag_offset = 0x00000100,
|
|
+ .init_machine = lsql_init,
|
|
+ .map_io = orion5x_map_io,
|
|
+ .init_early = orion5x_init_early,
|
|
+ .init_irq = orion5x_init_irq,
|
|
+ .timer = &orion5x_timer,
|
|
+ .fixup = tag_fixup_mem32,
|
|
+ .restart = orion5x_restart,
|
|
+MACHINE_END
|
|
+#endif
|
|
+
|
|
+
|
|
diff -uNr linux-3.3.8-go.orig/arch/arm/mach-orion5x/Makefile linux-3.3.8-go/arch/arm/mach-orion5x/Makefile
|
|
--- linux-3.3.8-go.orig/arch/arm/mach-orion5x/Makefile 2012-11-22 21:40:48.647919616 +0100
|
|
+++ linux-3.3.8-go/arch/arm/mach-orion5x/Makefile 2012-11-22 21:41:29.391436749 +0100
|
|
@@ -7,6 +7,7 @@
|
|
obj-$(CONFIG_MACH_LINKSTATION_MINI) += lsmini-setup.o
|
|
obj-$(CONFIG_MACH_LINKSTATION_PRODUO) += lsproduo-setup.o
|
|
obj-$(CONFIG_MACH_LINKSTATION_LS_HGL) += ls_hgl-setup.o
|
|
+obj-$(CONFIG_MACH_LINKSTATION_LSQL) += lsql-setup.o
|
|
obj-$(CONFIG_MACH_DNS323) += dns323-setup.o
|
|
obj-$(CONFIG_MACH_TS209) += ts209-setup.o tsx09-common.o
|
|
obj-$(CONFIG_MACH_TS409) += ts409-setup.o tsx09-common.o
|
|
diff -uNr linux-3.3.8-go.orig/arch/arm/tools/mach-types linux-3.3.8-go/arch/arm/tools/mach-types
|
|
--- linux-3.3.8-go.orig/arch/arm/tools/mach-types 2012-11-22 21:40:48.446921940 +0100
|
|
+++ linux-3.3.8-go/arch/arm/tools/mach-types 2012-11-22 21:41:53.355153632 +0100
|
|
@@ -1172,3 +1172,4 @@
|
|
pov2 MACH_POV2 POV2 3889
|
|
ipod_touch_2g MACH_IPOD_TOUCH_2G IPOD_TOUCH_2G 3890
|
|
da850_pqab MACH_DA850_PQAB DA850_PQAB 3891
|
|
+linkstation_lsql MACH_LINKSTATION_LSQL LINKSTATION_LSQL 4238
|