Buffalo NAS-Central Forums

Welcome to the Linkstation Wiki community
It is currently Fri Aug 17, 2018 4:56 am

All times are UTC+01:00




Post new topic  Reply to topic  [ 20 posts ]  Go to page Previous 1 2
Author Message
PostPosted: Wed Oct 12, 2011 10:36 pm 
Offline
Newbie

Joined: Mon Oct 10, 2011 5:23 am
Posts: 19
I updated prodigy7's patch to work on the newer 3.0.0 kernel Tested only on debian source. Discussion on the thread at viewtopic.php?f=50&t=23971

Code:
diff -uprN linux-source-3.0.0/arch/arm/configs/orion5x_defconfig linux-source-3.0.0_lsproduo/arch/arm/configs/orion5x_defconfig
--- linux-source-3.0.0/arch/arm/configs/orion5x_defconfig       2011-07-21 20:17:23.000000000 -0600
+++ linux-source-3.0.0_lsproduo/arch/arm/configs/orion5x_defconfig      2011-10-12 13:26:13.725977387 -0600
@@ -19,6 +19,7 @@ CONFIG_MACH_TS209=y
 CONFIG_MACH_TERASTATION_PRO2=y
 CONFIG_MACH_LINKSTATION_PRO=y
 CONFIG_MACH_LINKSTATION_MINI=y
+CONFIG_MACH_LINKSTATION_PRODUO=y
 CONFIG_MACH_LINKSTATION_LS_HGL=y
 CONFIG_MACH_TS409=y
 CONFIG_MACH_WRT350N_V2=y
diff -uprN linux-source-3.0.0/arch/arm/mach-orion5x/Makefile linux-source-3.0.0_lsproduo/arch/arm/mach-orion5x/Makefile
--- linux-source-3.0.0/arch/arm/mach-orion5x/Makefile   2011-07-21 20:17:23.000000000 -0600
+++ linux-source-3.0.0_lsproduo/arch/arm/mach-orion5x/Makefile  2011-10-12 13:27:43.116381679 -0600
@@ -5,6 +5,7 @@ obj-$(CONFIG_MACH_KUROBOX_PRO)  += kurobo
 obj-$(CONFIG_MACH_TERASTATION_PRO2)    += terastation_pro2-setup.o
 obj-$(CONFIG_MACH_LINKSTATION_PRO) += kurobox_pro-setup.o
 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_DNS323)      += dns323-setup.o
 obj-$(CONFIG_MACH_TS209)       += ts209-setup.o tsx09-common.o
diff -uprN linux-source-3.0.0/arch/arm/mach-orion5x/Kconfig linux-source-3.0.0_lsproduo/arch/arm/mach-orion5x/Kconfig
--- linux-source-3.0.0/arch/arm/mach-orion5x/Kconfig    2011-07-21 20:17:23.000000000 -0600
+++ linux-source-3.0.0_lsproduo/arch/arm/mach-orion5x/Kconfig   2011-10-12 13:27:06.046224691 -0600
@@ -65,6 +65,46 @@ config MACH_LINKSTATION_MINI
          Say 'Y' here if you want your kernel to support the
          Buffalo Linkstation Mini platform.
 
+config MACH_LINKSTATION_PRODUO
+       bool "Buffalo Linkstation Pro Duo"
+       select I2C_BOARDINFO
+       help
+         Say 'Y' here if you want your kernel to support the
+         Buffalo Linkstation Pro Duo platform.
+         
+         LS-W1.0TGL/R1 is the general model number. There
+         is no /R3 models, as /R1 stands for RAID1.
+         There are two hardware revisions of the product.
+       
+         The first revision has version 1.xx firmware, 64 MB RAM, 
+         a single USB port, a power BUTTON, an Auto/Manual
+         power MODE SWITCH, and a RESET button.
+       
+         The second revision has version 3.xx firmware, 128 MB RAM, 
+         two USB ports, an Off/On/Auto power SWITCH, and a FUNCTION button.
+
+       choice
+               prompt "HW model"
+               depends on MACH_LINKSTATION_PRODUO
+               default MACH_LINKSTATION_PRODUO_REV1
+               default MACH_LINKSTATION_PRODUO_REV2
+
+               config MACH_LINKSTATION_PRODUO_REV1
+                   bool "Revision 1"
+                   help
+                     The first revision has version 1.xx firmware, 64 MB RAM, 
+                     a single USB port, a power BUTTON, an Auto/Manual
+                     power MODE SWITCH, and a RESET button.
+
+               config MACH_LINKSTATION_PRODUO_REV2
+                   bool "Revision 2"
+                   help
+                     The second revision has version 3.xx firmware, 128 MB RAM, 
+                     two USB ports, an Off/On/Auto power SWITCH, and a FUNCTION button.
+       endchoice
+
+
+
 config MACH_LINKSTATION_LS_HGL
        bool "Buffalo Linkstation LS-HGL"
        select I2C_BOARDINFO
diff -uprN linux-source-3.0.0/arch/arm/mach-orion5x/lsproduo-setup.c linux-source-3.0.0_lsproduo/arch/arm/mach-orion5x/lsproduo-setup.c
--- linux-source-3.0.0/arch/arm/mach-orion5x/lsproduo-setup.c   1969-12-31 17:00:00.000000000 -0700
+++ linux-source-3.0.0_lsproduo/arch/arm/mach-orion5x/lsproduo-setup.c  2011-10-12 13:28:13.306485260 -0600
@@ -0,0 +1,390 @@
+/*
+ * arch/arm/mach-orion5x/lsproduo-setup.c
+ *
+ * Source taken from arch/arm/mach-orion5x/lsmini-setup.c - kernel 2.6.30
+ * Maintainer: Manuel Bernhardt <prodigy7@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 <asm/system.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 Pro Duo Info
+ ****************************************************************************/
+
+/*
+ * 256K NOR flash Device bus boot chip select
+ */
+
+#define LSPRODUO_NOR_BOOT_BASE 0xf4000000
+#define LSPRODUO_NOR_BOOT_SIZE SZ_256K
+
+/*****************************************************************************
+ * 256KB NOR Flash on BOOT Device
+ ****************************************************************************/
+
+static struct physmap_flash_data lsproduo_nor_flash_data = {
+       .width          = 1,
+};
+
+static struct resource lsproduo_nor_flash_resource = {
+       .flags  = IORESOURCE_MEM,
+       .start  = LSPRODUO_NOR_BOOT_BASE,
+       .end    = LSPRODUO_NOR_BOOT_BASE + LSPRODUO_NOR_BOOT_SIZE - 1,
+};
+
+static struct platform_device lsproduo_nor_flash = {
+       .name                   = "physmap-flash",
+       .id                     = 0,
+       .dev            = {
+               .platform_data  = &lsproduo_nor_flash_data,
+       },
+       .num_resources          = 1,
+       .resource               = &lsproduo_nor_flash_resource,
+};
+
+/*****************************************************************************
+ * Ethernet
+ ****************************************************************************/
+
+static struct mv643xx_eth_platform_data lsproduo_eth_data = {
+       .phy_addr       = 8,
+};
+
+/*****************************************************************************
+ * RTC 5C372a on I2C bus
+ ****************************************************************************/
+
+static struct i2c_board_info __initdata lsproduo_i2c_rtc = {
+       I2C_BOARD_INFO("rs5c372a", 0x32),
+};
+
+/*****************************************************************************
+ * LEDs attached to GPIO
+ ****************************************************************************/
+
+#define LSPRODUO_GPIO_LED_ALARM        2
+#define LSPRODUO_GPIO_LED_INFO 3
+#define LSPRODUO_GPIO_LED_PWR  0
+
+static struct gpio_led lsproduo_led_pins[] = {
+       {
+               .name      = "alarm:red",
+               .gpio      = LSPRODUO_GPIO_LED_ALARM,
+               .active_low     = 1,
+       }, {
+               .name      = "info:amber",
+               .gpio      = LSPRODUO_GPIO_LED_INFO,
+               .active_low     = 1,
+       }, {
+               .name      = "power:amber",
+               .gpio      = LSPRODUO_GPIO_LED_PWR,
+               .active_low     = 1,
+       },
+};
+
+static struct gpio_led_platform_data lsproduo_led_data = {
+       .leds      = lsproduo_led_pins,
+       .num_leds       = ARRAY_SIZE(lsproduo_led_pins),
+};
+
+static struct platform_device lsproduo_leds = {
+       .name   = "leds-gpio",
+       .id     = -1,
+       .dev    = {
+               .platform_data  = &lsproduo_led_data,
+       },
+};
+
+/****************************************************************************
+ * GPIO Attached Keys
+ ****************************************************************************/
+
+#define LSPRODUO_GPIO_KEY_POWER                8
+#define LSPRODUO_GPIO_KEY_AUTOPOWER    10
+
+#define LSPRODUO_SW_POWER              0x00
+#define LSPRODUO_SW_AUTOPOWER          0x01
+
+static struct gpio_keys_button lsproduo_buttons[] = {
+       {
+               .type           = EV_SW,
+               .code      = LSPRODUO_SW_POWER,
+               .gpio      = LSPRODUO_GPIO_KEY_POWER,
+               .desc      = "Power-on Switch",
+               .active_low     = 1,
+       }, {
+               .type           = EV_SW,
+               .code      = LSPRODUO_SW_AUTOPOWER,
+               .gpio      = LSPRODUO_GPIO_KEY_AUTOPOWER,
+               .desc      = "Power-auto Switch",
+               .active_low     = 1,
+       },
+};
+
+static struct gpio_keys_platform_data lsproduo_button_data = {
+       .buttons        = lsproduo_buttons,
+       .nbuttons       = ARRAY_SIZE(lsproduo_buttons),
+};
+
+static struct platform_device lsproduo_button_device = {
+       .name      = "gpio-keys",
+       .id          = -1,
+       .num_resources  = 0,
+       .dev        = {
+               .platform_data  = &lsproduo_button_data,
+       },
+};
+
+/****************************************************************************
+ * GPIO Attached Fan
+ ****************************************************************************/
+
+/* Define max char len */
+#define MAX_LEN 8
+
+#define LSPRODUO_GPIO_FAN_LOW          17
+#define LSPRODUO_GPIO_FAN_HIGH         14
+
+static struct proc_dir_entry *lsproduo_proc_dir_root, *lsproduo_proc_dir_gpio, *lsproduo_fan_proc_file;
+static char lsproduo_fan_state[MAX_LEN];
+
+static int lsproduo_fan_get(char *buf, char **start, off_t offset, int count, int *eof, void *data)
+{
+       int len;
+
+       len = snprintf(buf, count, "state: %s\n", lsproduo_fan_state);
+       return len;
+}
+
+static int lsproduo_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", "lsproduo");
+           return -EFAULT;
+       }
+
+       ptr = strrchr(tState, '\n');
+       if(ptr) *ptr = '\0';
+
+       if (strcasecmp(tState, "off") == 0)
+       {
+           printk(KERN_DEBUG "%s: set fan off\n", "lsproduo");
+           sprintf(lsproduo_fan_state, "off");
+           gpio_set_value(LSPRODUO_GPIO_FAN_LOW, 1);
+           gpio_set_value(LSPRODUO_GPIO_FAN_HIGH, 1);
+       } else if (strcasecmp(tState, "slow") == 0)
+       {
+           printk(KERN_DEBUG "%s: set fan slow\n", "lsproduo");
+           sprintf(lsproduo_fan_state, "slow");
+           gpio_set_value(LSPRODUO_GPIO_FAN_LOW, 1);
+           gpio_set_value(LSPRODUO_GPIO_FAN_HIGH, 0);
+       } else if (strcasecmp(tState, "fast") == 0)
+       {
+           printk(KERN_DEBUG "%s: set fan fast\n", "lsproduo");
+           sprintf(lsproduo_fan_state, "fast");
+           gpio_set_value(LSPRODUO_GPIO_FAN_LOW, 0);
+           gpio_set_value(LSPRODUO_GPIO_FAN_HIGH, 1);
+       } else if (strcasecmp(tState, "full") == 0)
+       {
+           printk(KERN_DEBUG "%s: set fan full\n", "lsproduo");
+           sprintf(lsproduo_fan_state, "full");
+           gpio_set_value(LSPRODUO_GPIO_FAN_LOW, 0);
+           gpio_set_value(LSPRODUO_GPIO_FAN_HIGH, 0);
+       } else
+       {
+           printk(KERN_ERR "%s: unknown fan speed given\n", "lsproduo");
+       }
+
+       lsproduo_fan_state[len] = '\0';
+
+       return len;
+}
+
+/*****************************************************************************
+ * SATA
+ ****************************************************************************/
+static struct mv_sata_platform_data lsproduo_sata_data = {
+       .n_ports        = 2,
+};
+
+
+/*****************************************************************************
+ * Linkstation Pro Duo specific power off method: reboot
+ ****************************************************************************/
+/*
+ * On the Linkstation Pro Duo, 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 lsproduo_power_off(void)
+{
+       arm_machine_restart(0, NULL);
+}
+
+
+/*****************************************************************************
+ * General Setup
+ ****************************************************************************/
+
+#define LSPRODUO_GPIO_USB_POWER                9
+#define LSPRODUO_GPIO_AUTO_POWER       10
+#define LSPRODUO_GPIO_POWER            8
+
+#define LSPRODUO_GPIO_HDD_POWER0       1
+
+#ifdef CONFIG_MACH_LINKSTATION_PRODUO_REV2
+#define LSPRODUO_GPIO_USB_POWER2       19
+#endif
+
+static unsigned int lsproduo_mpp_modes[] __initdata = {
+          MPP0_GPIO,   /* LED_PWR */
+         MPP1_GPIO,    /* HDD_PWR */
+        MPP2_GPIO,     /* LED_ALARM */
+        MPP3_GPIO,     /* LED_INFO */
+        MPP4_UNUSED,
+        MPP5_UNUSED,
+        MPP6_GPIO,     /* FAN_LCK */
+        MPP7_GPIO,     /* INIT */
+        MPP8_GPIO,     /* POWER */
+        MPP9_GPIO,     /* USB_PWR */
+        MPP10_GPIO,    /* AUTO_POWER */
+        MPP11_UNUSED,  /* LED_ETH dummy */
+        MPP12_UNUSED,
+        MPP13_UNUSED,
+        MPP14_GPIO,    /* FAN_HIGH */
+        MPP15_UNUSED,
+        MPP16_UNUSED,
+        MPP17_GPIO,    /* FAN_LOW */
+        MPP18_UNUSED,
+#ifdef CONFIG_MACH_LINKSTATION_PRODUO_REV1
+        MPP19_UNUSED,
+#endif
+#ifdef CONFIG_MACH_LINKSTATION_PRODUO_REV2
+        MPP19_GPIO,    /* USB_PWR2 */
+#endif
+        -0,
+};
+
+static void __init lsproduo_init(void)
+{
+       /*
+        * Setup basic Orion functions. Need to be called early.
+        */
+       orion5x_init();
+
+       orion5x_mpp_conf(lsproduo_mpp_modes);
+
+       /*
+        * Configure peripherals.
+        */
+       orion5x_ehci0_init();
+       orion5x_ehci1_init();
+       orion5x_eth_init(&lsproduo_eth_data);
+       orion5x_i2c_init();
+       orion5x_sata_init(&lsproduo_sata_data);
+       orion5x_uart0_init();
+       orion5x_xor_init();
+
+       orion5x_setup_dev_boot_win(LSPRODUO_NOR_BOOT_BASE,
+                                  LSPRODUO_NOR_BOOT_SIZE);
+       platform_device_register(&lsproduo_nor_flash);
+
+       platform_device_register(&lsproduo_button_device);
+
+       platform_device_register(&lsproduo_leds);
+
+       i2c_register_board_info(0, &lsproduo_i2c_rtc, 1);
+
+       /* enable USB power */
+       gpio_set_value(LSPRODUO_GPIO_USB_POWER, 1);
+
+#ifdef CONFIG_MACH_LINKSTATION_PRODUO_REV2
+       gpio_set_value(LSPRODUO_GPIO_USB_POWER2, 1);
+#endif
+
+       printk(KERN_INFO "Buffalo Linkstation Pro Duo fan driver loaded\n");
+       sprintf(lsproduo_fan_state, "full");
+       gpio_set_value(LSPRODUO_GPIO_FAN_LOW, 1);
+       gpio_set_value(LSPRODUO_GPIO_FAN_HIGH, 0);
+
+       lsproduo_proc_dir_root = proc_mkdir( "linkstation", NULL );
+       lsproduo_proc_dir_gpio = proc_mkdir( "gpio", lsproduo_proc_dir_root );
+       lsproduo_fan_proc_file = create_proc_entry( "fan", S_IRUGO, lsproduo_proc_dir_gpio );
+       if( lsproduo_fan_proc_file ) {
+           lsproduo_fan_proc_file->read_proc  = lsproduo_fan_get;
+           lsproduo_fan_proc_file->write_proc = lsproduo_fan_set;
+           lsproduo_fan_proc_file->data = NULL;
+       } else
+       {
+           printk(KERN_INFO "Registration of fan device failed\n");
+       }
+
+       /* register power-off method */
+       pm_power_off = lsproduo_power_off;
+
+       pr_info("%s: finished\n", __func__);
+}
+
+#ifdef CONFIG_MACH_LINKSTATION_PRODUO_REV1
+MACHINE_START(LINKSTATION_PRODUO, "Buffalo Linkstation Pro Duo - Revision 1")
+       /* Maintainer: Manuel Bernhardt <prodigy7@gmail.com> */
+       .phys_io        = ORION5X_REGS_PHYS_BASE,
+       .io_pg_offst    = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
+       .boot_params    = 0x00000100,
+       .init_machine   = lsproduo_init,
+       .map_io         = orion5x_map_io,
+       .init_irq       = orion5x_init_irq,
+       .timer          = &orion5x_timer,
+       .fixup          = tag_fixup_mem32,
+MACHINE_END
+#endif
+
+#ifdef CONFIG_MACH_LINKSTATION_PRODUO_REV2
+MACHINE_START(LINKSTATION_PRODUO, "Buffalo Linkstation Pro Duo - Revision 2")
+       /* Maintainer: Manuel Bernhardt <prodigy7@gmail.com> */
+       .boot_params    = 0x00000100,
+       .init_machine   = lsproduo_init,
+       .map_io         = orion5x_map_io,
+        .init_early     = orion5x_init_early,
+       .init_irq       = orion5x_init_irq,
+       .timer          = &orion5x_timer,
+       .fixup          = tag_fixup_mem32,
+MACHINE_END
+#endif
+


Top
   
PostPosted: Sat Nov 26, 2011 12:30 am 
Offline
Regular Member
User avatar

Joined: Sun Nov 16, 2008 2:45 am
Posts: 105
Location: eu/fr/35/rennes
congratz

let's hope it will be merged upstream soon ,

I am tracking :

http://git.kernel.org/?p=linux/kernel/g ... x/Kconfig#


Top
   
PostPosted: Sun Apr 22, 2012 1:16 pm 
Offline
Regular Member

Joined: Mon Nov 07, 2005 4:37 pm
Posts: 205
Location: Germany
Hi!

It is a long time ago, I was active here. Because the U-Boot config of my duo was broken, I takt off my duo and build a system with x86 components.
Thank you very much for every one, where support the duo currently.

I've a small request:
Code:
+ * Source taken from arch/arm/mach-orion5x/lsmini-setup.c - kernel 2.6.30
+ * Maintainer: Manuel Bernhardt <prodigy7@gmail.com>
Please remove my name as maintainer.

First: I've "ported" the code for the duo, but I'm not really an c/c++ hacker and can't really support the code. (I know, I was the one which insert this line in the first source code ...)
Second: Because I can't code great stuff in c/c++, I can't maintain the code. I'm more an supporter or contributor :-)

So: If someone match the qualification, the one should set their name in the source code!

Thx for all supporter!
prodigy7

by the way: The u-boot config of my Duo Rev. 1 ist broken (see also here: viewtopic.php?f=50&t=21447). Maybe now there's someone where can support me with an image of the needed mtd partition?

_________________
LS2 (U-Boot + Freelink) | Kurobox (U-Boot + Deboostraped) | LS Pro Duo (Freelink)


Top
   
PostPosted: Fri Jun 15, 2012 11:16 pm 
Offline
Newbie

Joined: Mon Oct 10, 2011 5:23 am
Posts: 19
I hope to post an updated set of patches soon, and will remove you as the "maintainer". As it looks like support for the LS Pro Duo will not ever be included in mainline, here is probably the only place where it will be maintained. Thanks for what great work you accomplished with it.

My Pro Duo is rev2, and dont know if the uboot and setting are different or not. Looks like mine may at least be the same size:
Code:
cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00040000 00001000 "physmap-flash.0"


However I am able to best set the uboot environment variables with the fw_setenv tool from uboot-envtools. Using the nvram tool I couldn't get it to accept stings with semicolons, regardless of quoting strategy.

Must have mtdblock support in kernel and set /etc/fw_env.config with

Code:
            
    # Configuration file for fw_(printenv/saveenv) utility. Examples at /usr/share/doc/uboot-envtools/examples

    # MTD device name Device offset Env. size Flash sector size
    #    /dev/mtd0           0x0000           0x40000    0x40000
          /dev/mtd0           0x3F000         0x1000      0x1000 # LS Pro Duo v2
 


I think I recall the d-i installer image can load mtdblock support, so one can can initialize the installer, load installer componexts, drop to a shell, apt-get uboot-envtools, write /etc/fw_env.config, and the issue

fw_setenv 'bootcmd=ide reset; ext2load ide 1:1 0x00100000 /$(kernel);ext2load ide 1:1 0x00800000 /$(initrd);setenv bootargs $(bootargs_base) $(bootargs_root) $(buffalo_ver);bootm 0x00100000 0x00800000'

It may be a lot of work just to set a few variables, but seems safer than overwriting the entire device.

If you want to download the dump of my mtdblock for comparison or flashing, it should be accessible from https://docs.google.com/open?id=0B_Qzm6 ... E5GdW5KUVU


Top
   
PostPosted: Fri Aug 17, 2012 11:09 pm 
Offline
Newbie

Joined: Mon Oct 10, 2011 5:23 am
Posts: 19
An updated patch for 3.3+ kernel source on the LS Pro Duo is posted at viewtopic.php?f=50&t=23971#p157297


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 20 posts ]  Go to page Previous 1 2

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Limited