Buffalo NAS-Central Forums

Welcome to the Linkstation Wiki community
It is currently Thu Nov 23, 2017 12:25 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 44 posts ]  Go to page 1 2 3 Next
Author Message
 Post subject: Debian on LS Pro Duo
PostPosted: Sat Aug 27, 2011 11:30 am 
Offline
Newbie

Joined: Thu Jun 11, 2009 9:41 pm
Posts: 8
I have a Buffalo LinkStation Pro 2 Duo
Model: LS-W2.0TGL/R1-US

I'd like to try to install Debian on my Duo. I use Debian testing on my computer, so I thought the multistrap tool in Debian would be a good way to go. I would then simply use an eSATA or similar cable to cross-install to the primary hard drive of the Duo, and boot the device from the freshly created Debian root fs. This will of course involve opening the device and moving som cables, but I am comfortable with such a procedure. Another way to go would be to create a firmware update image to be used directly from the stock firmware update tools, but this is way beyond my scope. Moreover i do not have access to MS Windows on a regular basis.

I have located some information on the subject, such as
http://wiki.debian.org/Multistrap
http://wiki.debian.org/Multistrap/CustomisingRootfs
http://wiki.debian.org/EmDebian/CrossDebootstrap

As far as I can tell the best achitecture for Debian on the Duo is 'armel'.
I would also assume that installing avr-evtd would be a good idea.
http://packages.debian.org/squeeze/avr-evtd

Any other things to keep in mind? Thoughts on how to customize the root fs prior to booting for the first time, i.e. contents of files in /etc and ways to create device nodes?

Anyone tried this before?

;)Frode


Top
   
 Post subject: Re: Debian on LS Pro Duo
PostPosted: Sun Aug 28, 2011 7:15 am 
Offline
Moderator

Joined: Fri Jun 29, 2007 10:39 am
Posts: 2604
Do NOT restrict your search for Debian on "LS Pro Duo", and
you will find tons of threads dealing with putting Debian on a
LS. You will also find a lot of stuff in our Wiki regarding this
topic.
Sorry for being too lazy this morning to search for the links for
you.

_________________
Please do not use private mail (PN/M) to ask questions. Use the proper forum instead. (me)

If there is no verified backup of a dataset, the dataset, by definition, is unimportant. (c't 2012)

RAID (no matter which level) never ever substitutes a backup. (me)


Top
   
 Post subject: Re: Debian on LS Pro Duo
PostPosted: Mon Oct 10, 2011 6:32 am 
Offline
Newbie

Joined: Mon Oct 10, 2011 5:23 am
Posts: 19
I was able to get debian sid installed with kernel 3.0.0-1-orion5x using the installer from
http://d-i.debian.org/daily-images/arme ... alo/lspro/

System boots, raid and network works great. The USB ports, power switch, fan control, etc., don't work with the stock debian kernel, although the micro-evtd package installs and its service starts fine. I have applied the patches from the 2.6.30.5 version and working on compiling a patched kernel to see if that does the trick

What I did:
I installed 2 new 2TB drives, and TFTP booted the device with the files from the link above. If starting with a working system, you'd need to send it into emergency mode to get the TFTP boot.

At first I just ssh'd into the box and followed the the menu driven sequence. The install seemed to progress normally, but then system didn't boot (which was no surprise as the pro duo is not supported). However, I had copied (by scp) the kernel and initrd off the box for examination, and tried to TFTP boot using these, and it worked! So I knew the image was OK, just the bootloader wasn't finding the kernel and initrd.

Examining the results from the previous attempt in the installer shell, most likely problems which may have prevented booting:
1. installed defaults to using a GPT rather than MBR partition scheme.
2. Installer created all raids with version 1.2 metadata.

So I repeated the installer.
In the "get installer components section", get fdisk and md tools. drop to shell and manually partition disks with fdisk. I tried to manually create the raids at this point, but mdadm was complaining about something. So I proceeded with the installer and let it create the raids. Then I dropped back to shell and stopped the arrays for boot and root, recreated those using metadata 0.90, and then proceeded with the installation. Rebooted, and it was on the network in a minute or two! What a relief, and a bit of a surprise.

eg
Code:
mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sd[ab]1  --metadata=0.90 


Also, It was probably because I has to restart the ssh session at one point, but the installer did not to create the users and save the root and user passwords from the earlier step, so verify there are sensible entries in /etc/shadow and /etc/passwd (actually /target/etc/shadow ...) before leaving the installer, and create them via your preferred method if needed.



My layout - each of the disks has
sd[ab]1 - primary 50 MB for md0 raid1 - ext2 boot partition
sd[ab]2 - primary 8 GB for md1 raid1 - ext4 root partition
sd[ab]3 - Extended partition over the rest of the drive, which contains
sd[ab]5 - 1TB logical partition for md2 raid1 - ext4 mirrored backed for important stuff
sd[ab]6 - 854 GB logical partition for md3 1.7TB RAID0 - ext4 striped array for replaceable content (which was as many GB as I could fit using fdisk)
sd[ab]7 - almost 1G was left for swap

Originally I had stock firmware which I had opened and using a non-supported disk layout: array1 was a raid1, array2 was a raid0, both with xfs filesystems. It worked well for over a year, but eventually the system balked, and on pushing the reset button on the back it reformatted the disks. I was able to recover ~97% of the data, but it took many many sad hours. After that I could not trust the buffalo firmware again with all its undocumented scripts and checks, and so the box had sat for a year without use. After all that I am looking forward to having a debian system without any buffalo weirdness.

I'll try to post back if I get the kernel going with the extras. Glad to see some activity on the board.


Last edited by tmgoblin on Wed Oct 12, 2011 11:01 pm, edited 1 time in total.

Top
   
 Post subject: Re: Debian on LS Pro Duo
PostPosted: Mon Oct 10, 2011 8:48 am 
Offline
Newbie

Joined: Thu Jul 28, 2011 8:27 am
Posts: 12
You were triumphant. Congratulations.

I gather that the link at the start of your post is to a Debian installer specifically for the Duo, all be it with problems which you describe how to get around. Are we talking of a full blown partition your disk, select packages and create every-day users installer? I used this procedure viewtopic.php?f=61&t=23271 which worked perfectly. My box is stable on Squeeze so I don't need to reload, but would like to understand what else is out there.

You mention working on the kernel. Can you share knowledge about ways to compile our own and install it without annoying the Debian package manager? I've used this one viewtopic.php?f=61&t=23793, which again worked for me when I needed additional modules for LVM. But it's a wee bit clunky in working out what updates are available. And the package manager is not aware of it so keeps offering me updates for kerenel stuff
I suspect NFS3 is not cutting it for mythtv and would like to try NFS4 as I'm not confident about iSCSI in the Duo just yet (viewtopic.php?f=50&t=21837), but can't seem to find a kernel source where it's offered in menuconfig on Arm. Granted, the performance issue is probably coming up when I'm running a Bacula backup of my main Gentoo box from the Duo, but the additional caching of NFS4 may help.


Top
   
 Post subject: Re: Debian on LS Pro Duo
PostPosted: Tue Oct 11, 2011 4:47 am 
Offline
Newbie

Joined: Mon Oct 10, 2011 5:23 am
Posts: 19
Greetings fellow gentoo user, it is also my main desktop's system.

I am not knowledgeable about iSCSI or much on NFS, but as to your other points:

Actually the installer was just for the LS Pro (Not DUO), but I hoped it would be a good starting point. I had read somewhere that the orion5x debian installer did not support any of the raid models of the linkstations, but that was sort of old so I thought I'd give it a try anyway.

Using the d-i (debian-installer) feels and proceeds much like a standard console based desktop installation of debian, only is done completely over the network. Once the installer obtains an IP address and starts its services, you log in via ssh (un:installer, pw:install) and are greeted by the familiar debian console install menu, with a few differences for the hardware. But yes, it is installing from scratch - select repository, get installer components, create users, partition disks, install base system, select extra (meta-)packages, select kernel.

While I know next to nothing about C, I was able to adapt prodigy7's patch for the 2.6.30 kernel to the newer 3.0.0 kernel, (enough so that it compiled anyhow, I can't say yet if works) by also mimicking other changes between the two versions of the arch/arm/march-orion5x/lsmini-setup.c file, which prodigy7 had noted basing the source for a lsproduo-setup.c file. Hopefully it will and will have /proc/buffalo stuff and can implement so of the other scripts from this forum and similar.

After several tries and overcoming several roadblocks which I'll try to summarize later, the kernel is now compiled and that shell (via screen) is now compiling the modules. Once it is done I'll retrace the steps and test the result. Its a pretty bloated set of kernel and module options, based off the debian default, so it seems to take an epoch to compile on the pro duo's 400MHz processor. Fortunately the lsproduo-setup.c file is compiled early in the processes, so it didnt take long to break each time until it compiled error free. Even if I am lucky it might take a few iterations, so I'll either have to be patient or need to get distcc and some cross compilation setup, but that has always been a headache the times I have tried.

Patching and compiling a kernel the "debian way" is not so bad, but is a bit more to wade through than on gentoo, which makes sense as not all debian systems are compiling their own kernels, whereas it is ubiquitous to gentoo.

In short, you need to install the tools, download the appropriate debian or vanilla sources, apply patches, make menuconfig. Then departing from the gentoo way, you compile and build a deb package of the kernel/modules, and then install those packages. That allows the apt system to install or uninstall them on request. For uboot devices such as this, it may also be needed to use the uboot-mkimage tool to do some magic to the kernel and initrd so they are uboot friendly. I don't know yet if that will be needed here, but it was done as one of the final steps of the d-i installer, creating an uImage.buffalo and initrd.buffalo, presumably from the vmlinuz and initrd.img in /boot.

I'd recommend doing it the debian way on a debian box, but in general you should be able to put a good kernel and initrd in /boot and its modules in /lib/modules and boot them, just not manage through apt, if you had too. Also with the uboot-mkimage caveat here.

Thanks to those developing debian, and prodigy7 for the early LSPRODUO patches. Once I can 'make clean' I'll post source diffs and step by step of what I have done, if they work at all.


Top
   
 Post subject: Re: Debian on LS Pro Duo
PostPosted: Wed Oct 12, 2011 9:42 pm 
Offline
Newbie

Joined: Mon Oct 10, 2011 5:23 am
Posts: 19
The updated patch worked on the kernel 3.0.0. By work, the usb ports have power, and recognizes the insertion of a USB stick (eg creates a /dev/sdc and /dev/sdc1, that's all I have tried) and exposes fan control to /proc/linkstation/gpio/fan. There are no other files in /proc/linkstation. I don't know if the LEDs and powerswitch and function button are exposed anywhere. It doesn't look like the definitions for these are provided in the patch, but i don't know if I consider them important enough to invest time into. IF anyone knows/cares how to implement them, I am willing to try it out. Hushing the fan and enabling USB was the most important.

Again, I based this patch of of prodigy7 for the 2.6.30 kernel, emulating a number of other changes that occurred between the 2.6.30 and 3.0.0 versions of the lsmini-setup.c file in arch/arm/mach-orion5x/.

Here is a patch file, and in the next post I'll put the steps I followed to compile it ON the linkstation, running debian sid with a 3.0.0 kernel. If you are using it with my steps below, save it as a file eg "lsproduo.patch", assumed to /usr/src/linux-source-3.0.0, or where ever you have your source saved.

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
+


Last edited by tmgoblin on Thu Oct 13, 2011 2:25 am, edited 1 time in total.

Top
   
 Post subject: Re: Debian on LS Pro Duo
PostPosted: Wed Oct 12, 2011 10:26 pm 
Offline
Newbie

Joined: Mon Oct 10, 2011 5:23 am
Posts: 19
Here are the steps I followed to compile a patched 3.0.0 kernel for the linkstation pro duo (revision 2). Of course this kernel wont work for stock firmware, so don't try. I am sure the below shows my ignorance of many things, so if you have a better way, by all means ...


Quote:
##update apt and install needed tools
apt-get update
apt-get install devscripts kernel-package build-essential libncurses5-dev devio uboot-mkimage lzma

##recommended if you are familliar with how to use the program screen
#apt-get install screen

##probably not needed, but I installed them upon getting arm-linux-gnueabi errors from kernel compilation. Installing these did not fix the problem, which was that somewhere in the makefiles or configs, it is usuming that if you are compiling for armel it is a cross compilation, and seting the cross-compile prefix to "arm-linux-gnueabi-". The fix was symlinking the local compile tools to the names sought by the compilation, as in the next step below. But it could be without these I would have encountered other errors later?
#apt-get install mlton-runtime-arm-linux-gnueabi type-handling

ln -s /usr/bin/objdump /usr/bin/arm-linux-gnueabi-objdump
ln -s /usr/bin/ld /usr/bin/arm-linux-gnueabi-ld
ln -s /usr/bin/ar /usr/bin/arm-linux-gnueabi-ar
ln -s /usr/bin/nm /usr/bin/arm-linux-gnueabi-nm
ln -s /usr/bin/objcopy /usr/bin/arm-linux-gnueabi-objcopy
ln -s /usr/bin/strip /usr/bin/arm-linux-gnueabi-strip

##install source and chande into its directory
apt-get install linux-source-3.0.0
cd /usr/src/linux-source-3.0.0/



##if you like screen, do it now
#screen

##make the patch file from the previous post and patch the sources
patch -p 1 -i lsproduo.patch

##the mach-types file in the source is short, and doesnot contain the infor for the LS PRO DUO, but the version from arm.linux.org.uk does, so replace.
cd arch/arm/tools/
mv mach-types mach-types.bak
wget http://www.arm.linux.org.uk/developer/m ... wnload.php -O mach-types

##by default this will build a new config based off the current config found in /boot, which is enourmous. You may want to start with a more minimal .config file
make menuconfig

##set the following, and any other options you [cd]are to enable or disable
##General Setup
## (lsproduo) Local version - append to kernel release (or what ever you like, but no CAPITAL letters)
##System type
## ARM system type (Marvel Orion), if not set it
## Orion Implementations
## [*] Buffalo Linkstation Pro Duo
## HW model (Revision 2)

##some debian kernel compilation instructions said to do this, but it didnt do anything for me
#fakeroot debian/rules debian/build debian/stamps


##now time to make the kernel. make-kpkg makes and installedable .deb file, which we dont really need, but it works. a simple "make" might work just as well
##or just "make-kpkg --initrd kernel_image" if you dont care to see how long it takes

cd /usr/src/linux-source-3.0.0/
time make-kpkg --initrd kernel_image

##depending on how many options and modules you have, this might take 24-48 hours to complete. Of course you'll want to check in every once in a while to see if it is still working, or made some error that needs to be fixed.

##assuming it worked it produces a .deb file in the parent directory (i.e. /usr/src/). I think this is only needed to put the initrd.img in boot, i couldnt find it anywhere in the source tree
dpkg -i /usr/src/linux-image-3.0.0lsproduo_3.0.0lsproduo-10.00.Custom_armel.deb #or whatever your generated package is named


##You probably want to scp both the new and old uImage.buffalo and initrd.buffalo files off the linkstation so you can try to tftp boot if things go wrong. and backup the originals on the box

mkdir /boot/backup
mv /boot/*.buffalo /boot/backup/
scp /boot/backup/uImage.buffalo username@anothercomputerwithsshd:/full/path/to/a/directory/
scp /boot/backup/initrd.buffalo username@anothercomputerwithsshd:/full/path/to/a/directory/

## now we make uboot friendly kernel and initrd.
##from http://buffalo.nas-central.org/index.ph ... ded_device
cd /usr/src/linux-source-3.0.0
devio > foo 'wl 0xe3a01c07,4' 'wl 0xe3811027,4'
cat foo arch/arm/boot/zImage > zImage.new
mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n 'linux' -d zImage.new uImage.buffalo
cp uImage.buffalo /boot/

##lucky guess here, but running file on the initrd.buffalo created by the debian installer suggest these are the correct values, and later found a post from other architectures using the same.
##if your newly installed initrd is called something besides /boot/initrd.img-3.0.0lsproduo, use that in place of the below.
mkimage -A arm -O linux -T ramdisk -C none -a 0x00000000 -e 0x00000000 -n 'linux' -d /boot/initrd.img-3.0.0lsproduo initrd.buffalo
cp initrd.buffalo /boot/initrd.buffalo

scp /boot/uImage.buffalo username@anothercomputerwithsshd:/full/path/to/another/directory/
scp /boot/initrd.buffalo username@anothercomputerwithsshd:/full/path/to/another/directory/

reboot

#wait a few minutes, at least 2 maybe 3. Watch on your router for it take a network address, then
ssh root@yourdevice-hostname-or-ip

#verify new kernel and loaded modules
uname -a
# eg Linux buffalo 3.0.0lsproduo #2 Tue Oct 11 10:45:49 MDT 2011 armv5tel GNU/Linux

lsmod

#verify fan control, should return something like "state: full"
cat /proc/linkstation/gpio/fan

#manually set fan speed, options are off slow fast full
echo slow > /proc/linkstation/gpio/fan

#script to control fan speed based off hdd temp viewtopic.php?f=50&t=5781&start=63
# requires an "apt-get install hddtemp"


Last edited by tmgoblin on Fri Jun 15, 2012 10:44 pm, edited 1 time in total.

Top
   
 Post subject: Re: Debian on LS Pro Duo
PostPosted: Sat Nov 26, 2011 12:06 am 
Offline
Regular Member
User avatar

Joined: Sun Nov 16, 2008 2:45 am
Posts: 105
Location: eu/fr/35/rennes
Edit : installed debian see my signature

http://bugs.debian.org/650992# installation-reports: buffalo linkstation pro duo aka “LS-WTGL/R1 (3)” or lsproduo needs custom kernel ; #NaS

Orig:


> It worked well for over a year, but eventually the system balked, and on pushing the reset button on the back it reformatted the disks. I was able to recover ~97% of the data, but it took many many sad hours.

yes same for me but I did not recovered it ,
how did you recover you stuff ? I plan to use photorec :-(


thank you this is a great update ...

but the 1st thread talk about Model: LS-W2.0TGL/R1-US

will LS-WTGL/R1 be supported too ?

I'll think about testing that once I recover my disks ,
just curious could it be worthable to just clone the md disks once installed
and restore on other units ?

please can you share those compiled deb or rootfs

this could save time isnt it ?
I can see zillions of FreedomBoxes now

I am trying to document a step by step process at :

http://rzr.online.fr/q/armv5



what are the regression if you compare to the original fw ?

have you planned to submit those patches upstream too

too many questions i shut up now


Top
   
 Post subject: Re: Debian on LS Pro Duo
PostPosted: Sat Feb 18, 2012 10:14 pm 
Offline
Total Newbie

Joined: Sat Feb 18, 2012 10:08 pm
Posts: 1
tmgoblin
Tnx for a patch. Just installed Debian Wheezy (3.2.4)
Everything works fine with minor fixes ..
Tnx again !!


Top
   
 Post subject: Re: Debian on LS Pro Duo
PostPosted: Sun Mar 18, 2012 12:21 pm 
Offline
Regular Member
User avatar

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

I am also pretty happy to have debian running on this device ...

I had to update the patch to get it supported, and if no one does i will try to push it to main line ...

I just contacted p7 and tmg ...


fyi :

cat /proc/version
Linux version 3.1.1lsproduo-00009-g4d27e1c (rzr@lap) (gcc version 4.4.5 (Debian 4.4.5-8) ) #1 PREEMPT Sat Dec 3 23:43:17 CET 2011

I will try out the 3.3 version soon ..

Later


Top
   
 Post subject: Re: Debian on LS Pro Duo
PostPosted: Tue Mar 20, 2012 6:47 am 
Offline
Newbie

Joined: Mon Oct 10, 2011 5:23 am
Posts: 19
Whatever you can/want to do to add to the support in upstream or official debian is most awesome of you and certainly welcome by me, i dont know who are the maintainers are or how to go about it. I havent looked at your updated patch in details, but I think with the earlier patch I posted some of the GPIO's are still not quite right, at least they didnt work as expected for me. Certainly better than nothing, though if you have the time and know how it might be worth experimenting to fix:

-powerswitch
-only lower usb was working, not upper.
-some of the LEDS maybe not?

Ideally all could show up under /proc/linkstation/gpio/ along with the fan

I can confirm that GPIO 2 is the red middle LED, and GPIO 3 is the middle orange, eg through
Code:
echo 3 > /sys/class/gpio/export 
echo out >/sys/class/gpio/gpio3/direction
echo 1 > /sys/class/gpio/gpio3/value
echo 0 > /sys/class/gpio/gpio3/value

One of the others, maybe gpio1, was the main or drive power and altering the state killed the box immediately

About as far as I got with it was to bind mount most of the system's active files on a usb key (/var, /root, /tmp, /mnt, swapfile) and experimenting with getting the drives to spindown after awhile, when one of the drives died and I moved on to a less dangerous tinkering until a replacement could be had.
cron to turn on the orange light when the drive was on standby, with
Code:
hdparm -C /dev/sd[ab] |grep idle > /dev/null; if [ $? = 0 ]; then echo 1 > /sys/class/gpio/gpio3/value; else echo 0 > /sys/class/gpio/gpio3/value; fi 

Once I get into it again I'd like to have the system entirely on a usb key, and have the drives entirely for data, and spundown most of the time, as it might sit for days between rsyncs or fileserving.

After witnessing first and secondhand several failures with these, I would definielty recommend to only use RAID 1 setups, and to put the coolest low power drives in that you can.


Top
   
 Post subject: Re: Debian on LS Pro Duo
PostPosted: Wed Aug 01, 2012 5:39 pm 
Offline
Regular Member
User avatar

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

It's me again , FYI I helped raignarok to get debian in less than 10 min , using a rawimage to dump one of the disks and it worked :


253M rzr-hardisk-debian-wheezy-armel-lsproduo-2012.img
time dd if=rzr-hardisk-debian-wheezy-armel-lsproduo-2012.img of=/dev/sda ; reboot

et voila :-)

Email me to grab that small file , it's shared in http://rzr.online.fr/q/pub

btw do you use micro-evtd ?

_________________
URL: http://rzr.online.fr/q/lsproduo

Hardware: lsproduo2 aka LS-WTGL/R1 (3) | LS-W1.0TGL/R1-EU | MainBoard: MVYAKE4-BA
|
OS: Debian/GNU/Linux jessie armel | Linux: 4.3.0-orion5x-lsproduo2+

Firmware-Orig: LS-WTGL-V3_FwUp_309

PM me to test : debian-8-armel-lsproduo2-20151104rzr.qcow2 ( http://db.tt/gn5Qffd6# )


Top
   
 Post subject: Re: Debian on LS Pro Duo
PostPosted: Fri Aug 17, 2012 6:51 pm 
Offline
Newbie

Joined: Mon Oct 10, 2011 5:23 am
Posts: 19
I dont use the micro-evtd, I dont believe it is compatible with this model (as we have no microcontroller). We need a new userspace tool to monitor input events from the buttons, switches, possibly control the fan and leds as well.

I have a new patchset that has better matching of the MPP_GPIOs for the version 2 of the hardware, and other changes to work with both for versions 3.3+ of the kernel. Built from vanilla 3.4-RC7, but should work with all 3.3 to at least 3.4, and hopefully beyond.

Download from http://buffalo-nas-devices.googlecode.c ... wtgl.patch or from copying the below.

Code:
diff -uprN linux-3.4-rc7/arch/arm/configs/orion5x_defconfig linux-3.4-rc7-wtgl/arch/arm/configs/orion5x_defconfig
--- linux-3.4-rc7/arch/arm/configs/orion5x_defconfig   2012-05-12 19:37:47.000000000 -0600
+++ linux-3.4-rc7-wtgl/arch/arm/configs/orion5x_defconfig   2012-08-16 23:41:47.118502384 -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-3.4-rc7/arch/arm/mach-orion5x/Kconfig linux-3.4-rc7-wtgl/arch/arm/mach-orion5x/Kconfig
--- linux-3.4-rc7/arch/arm/mach-orion5x/Kconfig   2012-05-12 19:37:47.000000000 -0600
+++ linux-3.4-rc7-wtgl/arch/arm/mach-orion5x/Kconfig   2012-08-16 23:47:02.334496150 -0600
@@ -65,13 +65,52 @@ 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
    help
      Say 'Y' here if you want your kernel to support the
      Buffalo Linkstation LS-HGL platform.
-
+    
 config MACH_TS409
    bool "QNAP TS-409"
    help
diff -uprN linux-3.4-rc7/arch/arm/mach-orion5x/Makefile linux-3.4-rc7-wtgl/arch/arm/mach-orion5x/Makefile
--- linux-3.4-rc7/arch/arm/mach-orion5x/Makefile   2012-05-12 19:37:47.000000000 -0600
+++ linux-3.4-rc7-wtgl/arch/arm/mach-orion5x/Makefile   2012-08-16 23:48:26.182494492 -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-3.4-rc7/arch/arm/mach-orion5x/lsproduo-setup.c linux-3.4-rc7-wtgl/arch/arm/mach-orion5x/lsproduo-setup.c
--- linux-3.4-rc7/arch/arm/mach-orion5x/lsproduo-setup.c   1969-12-31 17:00:00.000000000 -0700
+++ linux-3.4-rc7-wtgl/arch/arm/mach-orion5x/lsproduo-setup.c   2012-08-16 23:52:09.630490073 -0600
@@ -0,0 +1,459 @@
+/*
+ * arch/arm/mach-orion5x/lsproduo-setup.c
+ *
+ * Source taken from arch/arm/mach-orion5x/lsmini-setup.c - kernel 2.6.30
+ * 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 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
+
+#ifdef CONFIG_MACH_LINKSTATION_PRODUO_REV2
+  #define LSPRODUO_GPIO_LED_FUNC   18
+#endif
+
+#ifdef CONFIG_MACH_LINKSTATION_PRODUO_REV1
+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:greem",
+       .gpio   = LSPRODUO_GPIO_LED_PWR,
+       .active_low   = 1,
+   },
+};
+#endif
+#ifdef CONFIG_MACH_LINKSTATION_PRODUO_REV2
+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:green",
+       .gpio   = LSPRODUO_GPIO_LED_PWR,
+       .active_low   = 1,
+   },{
+       .name   = "func:blue",
+       .gpio   = LSPRODUO_GPIO_LED_FUNC,
+       .active_low   = 1,
+   },
+};
+#endif
+
+
+
+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
+ ****************************************************************************/
+#ifdef CONFIG_MACH_LINKSTATION_PRODUO_REV1
+ #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,
+   },
+};
+
+#endif
+#ifdef CONFIG_MACH_LINKSTATION_PRODUO_REV2
+ #define LSPRODUO_GPIO_KEY_POWER      10
+ #define LSPRODUO_GPIO_KEY_AUTOPOWER   22
+ #define LSPRODUO_GPIO_KEY_FUNC         8
+
+ #define LSPRODUO_SW_POWER      0x00
+ #define LSPRODUO_SW_AUTOPOWER      0x01
+
+static struct gpio_keys_button lsproduo_buttons[] = {
+   {
+       .code   = KEY_OPTION,
+       .gpio   = LSPRODUO_GPIO_KEY_FUNC,
+       .desc   = "Function Button",
+       .active_low   = 1,
+   },{
+       .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,
+   },
+};
+
+#endif
+
+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)
+{
+   orion5x_restart('h', NULL);
+   // arm_machine_restart(0, NULL);
+}
+
+
+/*****************************************************************************
+ * General Setup
+ ****************************************************************************/
+#define LSPRODUO_GPIO_HDD_POWER0   1
+#define LSPRODUO_GPIO_USB_POWER      9
+#ifdef CONFIG_MACH_LINKSTATION_PRODUO_REV1
+ #define LSPRODUO_GPIO_POWER      8
+ #define LSPRODUO_GPIO_AUTO_POWER   10
+#endif
+#ifdef CONFIG_MACH_LINKSTATION_PRODUO_REV2
+ #define LSPRODUO_GPIO_POWER      10
+ #define LSPRODUO_GPIO_USB_POWER2   19
+ #define LSPRODUO_GPIO_AUTO_POWER   22
+#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 */
+    MPP9_GPIO,   /* USB_PWR */
+    MPP11_UNUSED,   /* LED_ETH dummy */
+    MPP12_UNUSED,
+    MPP13_UNUSED,
+    MPP14_GPIO,   /* FAN_HIGH */
+    MPP15_UNUSED,
+    MPP16_UNUSED,
+    MPP17_GPIO,   /* FAN_LOW */
+
+#ifdef CONFIG_MACH_LINKSTATION_PRODUO_REV1
+      MPP7_GPIO,   /* INIT */
+      MPP8_GPIO,   /* POWER */
+      MPP10_GPIO,   /* AUTO_POWER */
+      MPP18_UNUSED,
+      MPP19_UNUSED,
+#endif
+#ifdef CONFIG_MACH_LINKSTATION_PRODUO_REV2
+      MPP7_UNUSED,
+      MPP8_GPIO,   /* FUNC */
+      MPP10_GPIO,    /* POWER */
+      MPP18_GPIO,   /* LED_FUNC*/
+    MPP19_GPIO,   /* USB_PWR2 */
+    MPP22_GPIO,   /* AUTO_POWER */
+#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, "fast");
+   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")
+   .atag_offset   = 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,
+   .restart    = orion5x_restart,
+MACHINE_END
+#endif
+
+#ifdef CONFIG_MACH_LINKSTATION_PRODUO_REV2
+MACHINE_START(LINKSTATION_PRODUO, "Buffalo Linkstation Pro Duo - Revision 2")
+   .atag_offset   = 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,
+   .restart    = orion5x_restart,
+MACHINE_END
+#endif
+
diff -uprN linux-3.4-rc7/arch/arm/mach-orion5x/mpp.h linux-3.4-rc7-wtgl/arch/arm/mach-orion5x/mpp.h
--- linux-3.4-rc7/arch/arm/mach-orion5x/mpp.h   2012-05-12 19:37:47.000000000 -0600
+++ linux-3.4-rc7-wtgl/arch/arm/mach-orion5x/mpp.h   2012-08-16 22:15:34.000000000 -0600
@@ -122,7 +122,10 @@
 #define MPP19_GIGE              MPP(19, 0x1, 0, 0, 1,   1,   1)
 #define MPP19_UART              MPP(19, 0x0, 0, 0, 0,   1,   1)
 
-#define MPP_MAX         19
+#define MPP22_GPIO      MPP(22, 0x5, 1, 1, 0,   1,   0)
+
+
+#define MPP_MAX         22
 
 void orion5x_mpp_conf(unsigned int *mpp_list);
 
diff -uprN linux-3.4-rc7/arch/arm/tools/mach-types linux-3.4-rc7-wtgl/arch/arm/tools/mach-types
--- linux-3.4-rc7/arch/arm/tools/mach-types   2012-05-12 19:37:47.000000000 -0600
+++ linux-3.4-rc7-wtgl/arch/arm/tools/mach-types   2012-08-16 23:43:59.830499760 -0600
@@ -333,6 +333,8 @@ smdkc100      MACH_SMDKC100      SMDKC100      1826
 tavorevb      MACH_TAVOREVB      TAVOREVB      1827
 saar         MACH_SAAR      SAAR         1828
 at91sam9m10g45ek   MACH_AT91SAM9M10G45EK   AT91SAM9M10G45EK   1830
+linkstation_produo   MACH_LINKSTATION_PRODUO   LINKSTATION_PRODUO   1831
+##see header for btaining a new version, preferred to patching
 usb_a9g20      MACH_USB_A9G20      USB_A9G20      1841
 mxlads         MACH_MXLADS      MXLADS         1851
 linkstation_mini   MACH_LINKSTATION_MINI   LINKSTATION_MINI   1858



Top
   
 Post subject: Re: Debian on LS Pro Duo
PostPosted: Sun Nov 04, 2012 8:04 pm 
Offline
Total Newbie

Joined: Sun Nov 04, 2012 7:53 pm
Posts: 1
Sorry for my poor english...i have bricked LS PRO DUO i get it free from my friend. So i'm wondering is there anywhere clear and straight how-to recipe for non-unix person to install debian in this box. Of course i have used linux(ubuntu & xubuntu) but still im basic user not wizard :)

yours, and im keeping hat in my hand and looking down to my toes :)

LB

Model was LS-W1.0TGL/R1-EU, blackbox with Power:auto,on,off SW and 2 USB ports.


Top
   
 Post subject: Re: Debian on LS Pro Duo
PostPosted: Sun Nov 04, 2012 10:28 pm 
Offline
Regular Member
User avatar

Joined: Sun Nov 16, 2008 2:45 am
Posts: 105
Location: eu/fr/35/rennes
yes you can boot debian wheezy easly , just dump a disk image to one of your disk it will boot ...

I started a short tutorial for fj and it worked for him ... I can enhance it if needed :

http://rzr.online.fr/q/lsproduo

later


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 44 posts ]  Go to page 1 2 3 Next

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 8 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