diff mbox

[RFC] ARM: dts: Convert Linkstation Mini to Device Tree

Message ID 1434765234.5177.25.camel@dolka.fr
State New
Headers show

Commit Message

Benjamin Cama June 20, 2015, 1:53 a.m. UTC
Hi,

This is my conversion patch to DT for my Linkstation Mini. The name of
the file better reflects the manufacturer's device name (LS-WSGL), as
there also exists a newer Linkstation Mini (LS-WSXL) based on Kirkwood
(and as Andrew noted, a patch for it landed yesterday). I did not
actually re-test it from clean build (it worked fine before, modulo
some cosmetics fixes), as I had a problem with the hardware that I am
going to fix soon, but I wanted some comments on it. I included
Andrew's remarks, even though I do not know what to do about the
buttons name for now: I don't know how the switch is wired exactly for
now, and FYI the “auto-power” is an intermediate position between off
and power that in the original firmware does some wake-up/sleep of the
disks when the backup utility is run from the PC connected to the NAS.
I never used it and do not know what to do with it, and what “key”
should be associated with it.

Signed-off-by: Benjamin Cama <benoar@dolka.fr>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
 arch/arm/boot/dts/Makefile           |   3 +-
 arch/arm/boot/dts/orion5x-lswsgl.dts | 241 ++++++++++++++++++++++++++++++
 arch/arm/mach-orion5x/Kconfig        |   6 +-
 arch/arm/mach-orion5x/lsmini-setup.c | 280 -----------------------------------
 4 files changed, 246 insertions(+), 284 deletions(-)
 create mode 100644 arch/arm/boot/dts/orion5x-lswsgl.dts
 delete mode 100644 arch/arm/mach-orion5x/lsmini-setup.c

Comments

Benjamin Cama June 20, 2015, 10:33 a.m. UTC | #1
Le samedi 20 juin 2015 à 03:53 +0200, Benjamin Cama a écrit :
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>

Please ignore this Reviewed-by, it is a mistake, Andrew did not find it
acceptable yet. I was not sure of the meaning of this and sent this
email too soon. I apologize for this.

Regards,
--
benjamin
Andrew Lunn June 20, 2015, 2:31 p.m. UTC | #2
On Sat, Jun 20, 2015 at 12:33:12PM +0200, Benjamin Cama wrote:
> Le samedi 20 juin 2015 à 03:53 +0200, Benjamin Cama a écrit :
> > Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> 
> Please ignore this Reviewed-by, it is a mistake, Andrew did not find it
> acceptable yet. I was not sure of the meaning of this and sent this
> email too soon. I apologize for this.

Hi Benjamin

Thanks for revoking the Reviewed-by. You can expect to get an Acked-by
from me once the patch is good.

You can find details about these tags starting here:

http://lxr.free-electrons.com/source/Documentation/SubmittingPatches#L407

	Andrew
Jason Cooper June 20, 2015, 5:34 p.m. UTC | #3
Benjamin, Andrew, other mvebu cats,

On Sat, Jun 20, 2015 at 03:53:54AM +0200, Benjamin Cama wrote:

>From here -----vvvv

> Hi,
> 
> This is my conversion patch to DT for my Linkstation Mini. The name of
> the file better reflects the manufacturer's device name (LS-WSGL), as
> there also exists a newer Linkstation Mini (LS-WSXL) based on Kirkwood
> (and as Andrew noted, a patch for it landed yesterday). I did not
> actually re-test it from clean build (it worked fine before, modulo
> some cosmetics fixes), as I had a problem with the hardware that I am
> going to fix soon, but I wanted some comments on it. I included
> Andrew's remarks, even though I do not know what to do about the
> buttons name for now: I don't know how the switch is wired exactly for
> now, and FYI the ???auto-power??? is an intermediate position between off
> and power that in the original firmware does some wake-up/sleep of the
> disks when the backup utility is run from the PC connected to the NAS.
> I never used it and do not know what to do with it, and what ???key???
> should be associated with it.

To here -----^^^^^

Is very conversational.  This should be a more technical description of
the changes being made as this is the block that 'git am' will use for
the commit message.  Then the conversational bits go ...

> 
> Signed-off-by: Benjamin Cama <benoar@dolka.fr>
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> ---

right here, below the '---'.

>  arch/arm/boot/dts/Makefile           |   3 +-
>  arch/arm/boot/dts/orion5x-lswsgl.dts | 241 ++++++++++++++++++++++++++++++
>  arch/arm/mach-orion5x/Kconfig        |   6 +-
>  arch/arm/mach-orion5x/lsmini-setup.c | 280 -----------------------------------
>  4 files changed, 246 insertions(+), 284 deletions(-)
>  create mode 100644 arch/arm/boot/dts/orion5x-lswsgl.dts
>  delete mode 100644 arch/arm/mach-orion5x/lsmini-setup.c

Ahhh, that's always refreshing to see...

> diff --git a/arch/arm/boot/dts/orion5x-lswsgl.dts b/arch/arm/boot/dts/orion5x-lswsgl.dts
> new file mode 100644
> index 0000000..c7537a6
> --- /dev/null
> +++ b/arch/arm/boot/dts/orion5x-lswsgl.dts
> @@ -0,0 +1,241 @@
> +/*
> + * Copyright (C) 2015 Benjamin Cama <benoar@dolka.fr>
> + * Copyright (C) 2014 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> + * Copyright (C) 2008 Alexey Kopytko <alexey@kopytko.ru>

It may be preferable to say "Based on the board file
arch/arm/mach-orion5x/lsmini-setup.c, Copyright (C) 2008 Alexey Kopytko
<alexey@kopytko.ru>"  But that's very nit-picky.  As long as Alexey is
recognized, it should be fine.

> + *
> + * 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.
> + */

We're trying to move the dts{i} files to dual license.  Please take a
look at the current armada-*.dts{i} license blocks.  If you are ok with
it, please change the above to match.

> diff --git a/arch/arm/mach-orion5x/Kconfig b/arch/arm/mach-orion5x/Kconfig
> index 2412efb..08d2be2 100644
> --- a/arch/arm/mach-orion5x/Kconfig
> +++ b/arch/arm/mach-orion5x/Kconfig
> @@ -78,11 +78,11 @@ config MACH_LINKSTATION_LSCHL
>  	  Buffalo Linkstation Live v3 (LS-CHL) platform.
>  
>  config MACH_LINKSTATION_MINI
> -	bool "Buffalo Linkstation Mini"
> -	select I2C_BOARDINFO
> +	bool "Buffalo Linkstation Mini (Flattened Device Tree)"
> +	select ARCH_ORION5X_DT
>  	help
>  	  Say 'Y' here if you want your kernel to support the
> -	  Buffalo Linkstation Mini platform.
> +	  Buffalo Linkstation Mini (LS-WSGL) platform.

Hmmm, this question is for the other mvebu maintainers:  When we
originally converted kirkwood and dove, we put a lot of effort into
keeping the board files and the dts files around in parallel for a
while.  Do we need to do that here?  All the drivers are converted, so
we don't need to keep the legacy board files for that reason.

I'm not sure it's necessary myself, but I'm thinking it might be a good
idea on general principal to deprecate the board file over time.
Thoughts?

thx,

Jason.
Andrew Lunn June 20, 2015, 6:08 p.m. UTC | #4
> >  arch/arm/boot/dts/Makefile           |   3 +-
> >  arch/arm/boot/dts/orion5x-lswsgl.dts | 241 ++++++++++++++++++++++++++++++
> >  arch/arm/mach-orion5x/Kconfig        |   6 +-
> >  arch/arm/mach-orion5x/lsmini-setup.c | 280 -----------------------------------
> >  4 files changed, 246 insertions(+), 284 deletions(-)
> >  create mode 100644 arch/arm/boot/dts/orion5x-lswsgl.dts
> >  delete mode 100644 arch/arm/mach-orion5x/lsmini-setup.c
> 
> Ahhh, that's always refreshing to see...

And i missed it all together. More discussion below.

> 
> > diff --git a/arch/arm/boot/dts/orion5x-lswsgl.dts b/arch/arm/boot/dts/orion5x-lswsgl.dts
> > new file mode 100644
> > index 0000000..c7537a6
> > --- /dev/null
> > +++ b/arch/arm/boot/dts/orion5x-lswsgl.dts
> > @@ -0,0 +1,241 @@
> > +/*
> > + * Copyright (C) 2015 Benjamin Cama <benoar@dolka.fr>
> > + * Copyright (C) 2014 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> > + * Copyright (C) 2008 Alexey Kopytko <alexey@kopytko.ru>
> 
> It may be preferable to say "Based on the board file
> arch/arm/mach-orion5x/lsmini-setup.c, Copyright (C) 2008 Alexey Kopytko
> <alexey@kopytko.ru>"  But that's very nit-picky.  As long as Alexey is
> recognized, it should be fine.
> 
> > + *
> > + * 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.
> > + */
> 
> We're trying to move the dts{i} files to dual license.  Please take a
> look at the current armada-*.dts{i} license blocks.  If you are ok with
> it, please change the above to match.

For orion5x we have a chance to make this happen, since most of
orion5x.dtsi comes from the usual suspects.

So, yes, this makes sense.
 
> > diff --git a/arch/arm/mach-orion5x/Kconfig b/arch/arm/mach-orion5x/Kconfig
> > index 2412efb..08d2be2 100644
> > --- a/arch/arm/mach-orion5x/Kconfig
> > +++ b/arch/arm/mach-orion5x/Kconfig
> > @@ -78,11 +78,11 @@ config MACH_LINKSTATION_LSCHL
> >  	  Buffalo Linkstation Live v3 (LS-CHL) platform.
> >  
> >  config MACH_LINKSTATION_MINI
> > -	bool "Buffalo Linkstation Mini"
> > -	select I2C_BOARDINFO
> > +	bool "Buffalo Linkstation Mini (Flattened Device Tree)"
> > +	select ARCH_ORION5X_DT
> >  	help
> >  	  Say 'Y' here if you want your kernel to support the
> > -	  Buffalo Linkstation Mini platform.
> > +	  Buffalo Linkstation Mini (LS-WSGL) platform.
> 
> Hmmm, this question is for the other mvebu maintainers:  When we
> originally converted kirkwood and dove, we put a lot of effort into
> keeping the board files and the dts files around in parallel for a
> while.  Do we need to do that here?  All the drivers are converted, so
> we don't need to keep the legacy board files for that reason.

We get so little interest in orion5x, and it has been shown to be
broken for quite a while with respect to IRQ0, that if a real user
comes by and swaps his platform to DT only, i say we go with it.

      Andrew
Thomas Petazzoni June 20, 2015, 7:35 p.m. UTC | #5
Jason,

On Sat, 20 Jun 2015 17:34:21 +0000, Jason Cooper wrote:

> >  config MACH_LINKSTATION_MINI
> > -	bool "Buffalo Linkstation Mini"
> > -	select I2C_BOARDINFO
> > +	bool "Buffalo Linkstation Mini (Flattened Device Tree)"
> > +	select ARCH_ORION5X_DT
> >  	help
> >  	  Say 'Y' here if you want your kernel to support the
> > -	  Buffalo Linkstation Mini platform.
> > +	  Buffalo Linkstation Mini (LS-WSGL) platform.
> 
> Hmmm, this question is for the other mvebu maintainers:  When we
> originally converted kirkwood and dove, we put a lot of effort into
> keeping the board files and the dts files around in parallel for a
> while.  Do we need to do that here?  All the drivers are converted, so
> we don't need to keep the legacy board files for that reason.
> 
> I'm not sure it's necessary myself, but I'm thinking it might be a good
> idea on general principal to deprecate the board file over time.
> Thoughts?

I don't think it's necessary to keep both the DT and legacy versions
around. If the DT conversion is as functional as the legacy one (even
if it requires doing some legacy probing of certain devices that don't
yet have a DT binding), then there is no point in keeping the legacy
board file.

There is only one board for which I've kept both the DT and legacy
versions: the rd88f5182. That's because it's a board I have, and
keeping both the DT and legacy versions allowed me to make sure that
legacy booting is not broken by the progressive conversion do DT for
other boards.

Best regards,

Thomas
Alexey Kopytko June 21, 2015, 1:05 a.m. UTC | #6
> On 20 june 2015 г., at 10:53, Benjamin Cama <benoar@dolka.fr> wrote:
>
>  as I had a problem with the hardware that I am
> going to fix soon, but I wanted some comments on it. I included
> Andrew's remarks, even though I do not know what to do about the
> buttons name for now: I don't know how the switch is wired exactly for
> now, and FYI the “auto-power” is an intermediate position between off
> and power that in the original firmware does some wake-up/sleep of the
> disks when the backup utility is run from the PC connected to the NAS.
> I never used it and do not know what to do with it, and what “key”
> should be associated with it.
>

1. These buttons shall be dealt with from the userspace. Actually
there is a userspace daemon in the original firmware that reboots the
whole thing if you turn the switch to off position. That's clearly not
a kernel's job so don't just worry about this switch for now. Moreover
I don't think this button does anything at all if there's no daemon.

Running evtest against this button and wiggling it gives this:

# evtest /dev/input/event0
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100
Input device name: "gpio-keys"
Supported events:
  Event type 0 (Sync)
  Event type 1 (Key)
    Event code 357 (Option)
  Event type 5 (?)
    Event code 0 (?)
    Event code 1 (?)
Testing ... (interrupt to exit)
Event: time 1434848366.955536, type 5 (?), code 0 (?), value 0
Event: time 1434848366.955557, -------------- Report Sync ------------
Event: time 1434848366.955576, type 5 (?), code 0 (?), value 1
Event: time 1434848366.955589, -------------- Report Sync ------------
Event: time 1434848366.955593, type 5 (?), code 0 (?), value 0


2. As far as I remember in my patch I intentionally changed states of
some of the lights to be able to see if a kernel is booting or we have
a bad build. Can't tell if you did this too, but if I would that will
be nice for those people who don't have a serial soldered.

-Alexey


> Signed-off-by: Benjamin Cama <benoar@dolka.fr>
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> ---
> arch/arm/boot/dts/Makefile           |   3 +-
> arch/arm/boot/dts/orion5x-lswsgl.dts | 241 ++++++++++++++++++++++++++++++
> arch/arm/mach-orion5x/Kconfig        |   6 +-
> arch/arm/mach-orion5x/lsmini-setup.c | 280 -----------------------------------
> 4 files changed, 246 insertions(+), 284 deletions(-)
> create mode 100644 arch/arm/boot/dts/orion5x-lswsgl.dts
> delete mode 100644 arch/arm/mach-orion5x/lsmini-setup.c
>
> diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> index 992736b..bd5ad2f 100644
> --- a/arch/arm/boot/dts/Makefile
> +++ b/arch/arm/boot/dts/Makefile
> @@ -441,7 +441,8 @@ dtb-$(CONFIG_ARCH_ORION5X) += \
>    orion5x-lacie-d2-network.dtb \
>    orion5x-lacie-ethernet-disk-mini-v2.dtb \
>    orion5x-maxtor-shared-storage-2.dtb \
> -    orion5x-rd88f5182-nas.dtb
> +    orion5x-rd88f5182-nas.dtb \
> +    orion5x-lswsgl.dtb
> dtb-$(CONFIG_ARCH_PRIMA2) += \
>    prima2-evb.dtb
> dtb-$(CONFIG_ARCH_QCOM) += \
> diff --git a/arch/arm/boot/dts/orion5x-lswsgl.dts b/arch/arm/boot/dts/orion5x-lswsgl.dts
> new file mode 100644
> index 0000000..c7537a6
> --- /dev/null
> +++ b/arch/arm/boot/dts/orion5x-lswsgl.dts
> @@ -0,0 +1,241 @@
> +/*
> + * Copyright (C) 2015 Benjamin Cama <benoar@dolka.fr>
> + * Copyright (C) 2014 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> + * Copyright (C) 2008 Alexey Kopytko <alexey@kopytko.ru>
> + *
> + * 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.
> + */
> +
> +/dts-v1/;
> +
> +#include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/input/input.h>
> +#include <dt-bindings/interrupt-controller/irq.h>
> +#include "orion5x-mv88f5182.dtsi"
> +
> +/ {
> +    model = "Buffalo Linkstation Mini (LS-WSGL)";
> +    compatible = "buffalo,lswsgl", "marvell,orion5x-88f5182", "marvell,orion5x";
> +
> +    memory {
> +        reg = <0x00000000 0x8000000>; /* 128 MB */
> +    };
> +
> +    chosen {
> +        bootargs = "console=ttyS0,115200";
> +        linux,stdout-path = &uart0;
> +    };
> +
> +    soc {
> +        ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000>,
> +             <MBUS_ID(0x09, 0x00) 0 0xf2200000 0x800>,
> +             <MBUS_ID(0x01, 0x0f) 0 0xf4000000 0x40000>;
> +    };
> +
> +    gpio-keys {
> +        compatible = "gpio-keys";
> +        pinctrl-0 = <&pmx_buttons>;
> +        pinctrl-names = "default";
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +        func {
> +            label = "Function Button";
> +            linux,code = <KEY_OPTION>;
> +            gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
> +        };
> +
> +        power {
> +            label = "Power-on Switch";
> +            linux,input-type = <5>; /* EV_SW */
> +            linux,code = <0>; /* LSMINI_SW_POWER */
> +            gpios = <&gpio0 18 GPIO_ACTIVE_LOW>;
> +        };
> +
> +        autopower {
> +            label = "Power-auto Switch";
> +            linux,input-type = <5>; /* EV_SW */
> +            linux,code = <1>; /* LSMINI_SW_AUTOPOWER */
> +            gpios = <&gpio0 17 GPIO_ACTIVE_LOW>;
> +        };
> +    };
> +
> +    gpio-leds {
> +        compatible = "gpio-leds";
> +        pinctrl-0 = <&pmx_led_alarm &pmx_led_info &pmx_led_func
> +                 &pmx_led_power>;
> +        pinctrl-names = "default";
> +
> +        alarm {
> +            label = "lswsgl:alarm:red";
> +            gpio = <&gpio0 2 GPIO_ACTIVE_LOW>;
> +        };
> +
> +        info {
> +            label = "lswsgl:info:amber";
> +            gpio = <&gpio0 3 GPIO_ACTIVE_LOW>;
> +        };
> +
> +        func {
> +            label = "lswsgl:func:blue:top";
> +            gpio = <&gpio0 9 GPIO_ACTIVE_LOW>;
> +        };
> +
> +        power {
> +            label = "lswsgl:power:blue:bottom";
> +            gpio = <&gpio0 14 GPIO_ACTIVE_LOW>;
> +            default-state = "on";
> +        };
> +    };
> +
> +    restart_poweroff {
> +        compatible = "restart-poweroff";
> +    };
> +
> +    regulators {
> +        compatible = "simple-bus";
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +        pinctrl-0 = <&pmx_sata0_power &pmx_sata1_power &pmx_usb_power>;
> +        pinctrl-names = "default";
> +
> +        sata0_power: regulator@0 {
> +            compatible = "regulator-fixed";
> +            reg = <0>;
> +            regulator-name = "SATA0 Power";
> +            regulator-min-microvolt = <5000000>;
> +            regulator-max-microvolt = <5000000>;
> +            enable-active-high;
> +            regulator-always-on;
> +            regulator-boot-on;
> +            gpio = <&gpio0 1 GPIO_ACTIVE_HIGH>;
> +        };
> +
> +        sata1_power: regulator@1 {
> +            compatible = "regulator-fixed";
> +            reg = <1>;
> +            regulator-name = "SATA1 Power";
> +            regulator-min-microvolt = <5000000>;
> +            regulator-max-microvolt = <5000000>;
> +            enable-active-high;
> +            regulator-always-on;
> +            regulator-boot-on;
> +            gpio = <&gpio0 19 GPIO_ACTIVE_HIGH>;
> +        };
> +
> +        usb_power: regulator@2 {
> +            compatible = "regulator-fixed";
> +            reg = <2>;
> +            regulator-name = "USB Power";
> +            regulator-min-microvolt = <5000000>;
> +            regulator-max-microvolt = <5000000>;
> +            enable-active-high;
> +            regulator-always-on;
> +            regulator-boot-on;
> +            gpio = <&gpio0 16 GPIO_ACTIVE_HIGH>;
> +        };
> +    };
> +};
> +
> +&devbus_bootcs {
> +    status = "okay";
> +
> +    devbus,keep-config;
> +
> +    flash@0 {
> +        compatible = "cfi-flash";
> +        reg = <0 0x40000>;
> +        bank-width = <1>;
> +                #address-cells = <1>;
> +        #size-cells = <1>;
> +
> +        partition@0 {
> +            label = "Full256Kb";
> +            reg = <0 0x40000>;
> +            read-only;
> +        };
> +    };
> +};
> +
> +&mdio {
> +    status = "okay";
> +
> +    ethphy: ethernet-phy {
> +        reg = <8>;
> +    };
> +};
> +
> +&ehci0 {
> +    status = "okay";
> +};
> +
> +&eth {
> +    status = "okay";
> +
> +    ethernet-port@0 {
> +        phy-handle = <&ethphy>;
> +    };
> +};
> +
> +&i2c {
> +    status = "okay";
> +    clock-frequency = <100000>;
> +    #address-cells = <1>;
> +
> +    rtc@32 {
> +        compatible = "ricoh,rs5c372a";
> +        reg = <0x32>;
> +    };
> +};
> +
> +&pinctrl {
> +    pmx_buttons: pmx-buttons {
> +        marvell,pins = "mpp15", "mpp17", "mpp18";
> +        marvell,function = "gpio";
> +    };
> +
> +    pmx_led_alarm: pmx-leds {
> +        marvell,pins = "mpp2";
> +        marvell,function = "gpio";
> +    };
> +
> +    pmx_led_info: pmx-leds {
> +        marvell,pins = "mpp3";
> +        marvell,function = "gpio";
> +    };
> +
> +    pmx_led_func: pmx-leds {
> +        marvell,pins = "mpp9";
> +        marvell,function = "gpio";
> +    };
> +
> +    pmx_led_power: pmx-leds {
> +        marvell,pins = "mpp14";
> +        marvell,function = "gpio";
> +    };
> +
> +    pmx_sata0_power: pmx-sata0-power {
> +        marvell,pins = "mpp1";
> +        marvell,function = "gpio";
> +    };
> +
> +    pmx_sata1_power: pmx-sata1-power {
> +        marvell,pins = "mpp19";
> +        marvell,function = "gpio";
> +    };
> +
> +    pmx_usb_power: pmx-usb-power {
> +        marvell,pins = "mpp16";
> +        marvell,function = "gpio";
> +    };
> +};
> +
> +&sata {
> +    status = "okay";
> +    nr-ports = <2>;
> +};
> +
> +&uart0 {
> +    status = "okay";
> +};
> diff --git a/arch/arm/mach-orion5x/Kconfig b/arch/arm/mach-orion5x/Kconfig
> index 2412efb..08d2be2 100644
> --- a/arch/arm/mach-orion5x/Kconfig
> +++ b/arch/arm/mach-orion5x/Kconfig
> @@ -78,11 +78,11 @@ config MACH_LINKSTATION_LSCHL
>      Buffalo Linkstation Live v3 (LS-CHL) platform.
>
> config MACH_LINKSTATION_MINI
> -    bool "Buffalo Linkstation Mini"
> -    select I2C_BOARDINFO
> +    bool "Buffalo Linkstation Mini (Flattened Device Tree)"
> +    select ARCH_ORION5X_DT
>    help
>      Say 'Y' here if you want your kernel to support the
> -      Buffalo Linkstation Mini platform.
> +      Buffalo Linkstation Mini (LS-WSGL) platform.
>
> config MACH_LINKSTATION_LS_HGL
>    bool "Buffalo Linkstation LS-HGL"
> diff --git a/arch/arm/mach-orion5x/lsmini-setup.c b/arch/arm/mach-orion5x/lsmini-setup.c
> deleted file mode 100644
> index a6493e7..0000000
> --- a/arch/arm/mach-orion5x/lsmini-setup.c
> +++ /dev/null
> @@ -1,280 +0,0 @@
> -/*
> - * arch/arm/mach-orion5x/lsmini-setup.c
> - *
> - * Maintainer: Alexey Kopytko <alexey@kopytko.ru>
> - *
> - * 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"
> -
> -/*****************************************************************************
> - * Linkstation Mini Info
> - ****************************************************************************/
> -
> -/*
> - * 256K NOR flash Device bus boot chip select
> - */
> -
> -#define LSMINI_NOR_BOOT_BASE    0xf4000000
> -#define LSMINI_NOR_BOOT_SIZE    SZ_256K
> -
> -/*****************************************************************************
> - * 256KB NOR Flash on BOOT Device
> - ****************************************************************************/
> -
> -static struct physmap_flash_data lsmini_nor_flash_data = {
> -    .width        = 1,
> -};
> -
> -static struct resource lsmini_nor_flash_resource = {
> -    .flags    = IORESOURCE_MEM,
> -    .start    = LSMINI_NOR_BOOT_BASE,
> -    .end    = LSMINI_NOR_BOOT_BASE + LSMINI_NOR_BOOT_SIZE - 1,
> -};
> -
> -static struct platform_device lsmini_nor_flash = {
> -    .name            = "physmap-flash",
> -    .id            = 0,
> -    .dev        = {
> -        .platform_data    = &lsmini_nor_flash_data,
> -    },
> -    .num_resources        = 1,
> -    .resource        = &lsmini_nor_flash_resource,
> -};
> -
> -/*****************************************************************************
> - * Ethernet
> - ****************************************************************************/
> -
> -static struct mv643xx_eth_platform_data lsmini_eth_data = {
> -    .phy_addr    = 8,
> -};
> -
> -/*****************************************************************************
> - * RTC 5C372a on I2C bus
> - ****************************************************************************/
> -
> -static struct i2c_board_info __initdata lsmini_i2c_rtc = {
> -    I2C_BOARD_INFO("rs5c372a", 0x32),
> -};
> -
> -/*****************************************************************************
> - * LEDs attached to GPIO
> - ****************************************************************************/
> -
> -#define LSMINI_GPIO_LED_ALARM    2
> -#define LSMINI_GPIO_LED_INFO    3
> -#define LSMINI_GPIO_LED_FUNC    9
> -#define LSMINI_GPIO_LED_PWR    14
> -
> -static struct gpio_led lsmini_led_pins[] = {
> -    {
> -        .name       = "alarm:red",
> -        .gpio       = LSMINI_GPIO_LED_ALARM,
> -        .active_low     = 1,
> -    }, {
> -        .name       = "info:amber",
> -        .gpio       = LSMINI_GPIO_LED_INFO,
> -        .active_low     = 1,
> -    }, {
> -        .name       = "func:blue:top",
> -        .gpio       = LSMINI_GPIO_LED_FUNC,
> -        .active_low     = 1,
> -    }, {
> -        .name       = "power:blue:bottom",
> -        .gpio       = LSMINI_GPIO_LED_PWR,
> -    },
> -};
> -
> -static struct gpio_led_platform_data lsmini_led_data = {
> -    .leds       = lsmini_led_pins,
> -    .num_leds       = ARRAY_SIZE(lsmini_led_pins),
> -};
> -
> -static struct platform_device lsmini_leds = {
> -    .name   = "leds-gpio",
> -    .id     = -1,
> -    .dev    = {
> -        .platform_data  = &lsmini_led_data,
> -    },
> -};
> -
> -/****************************************************************************
> - * GPIO Attached Keys
> - ****************************************************************************/
> -
> -#define LSMINI_GPIO_KEY_FUNC       15
> -#define LSMINI_GPIO_KEY_POWER       18
> -#define LSMINI_GPIO_KEY_AUTOPOWER 17
> -
> -#define LSMINI_SW_POWER        0x00
> -#define LSMINI_SW_AUTOPOWER    0x01
> -
> -static struct gpio_keys_button lsmini_buttons[] = {
> -    {
> -        .code       = KEY_OPTION,
> -        .gpio       = LSMINI_GPIO_KEY_FUNC,
> -        .desc       = "Function Button",
> -        .active_low     = 1,
> -    }, {
> -        .type        = EV_SW,
> -        .code       = LSMINI_SW_POWER,
> -        .gpio       = LSMINI_GPIO_KEY_POWER,
> -        .desc       = "Power-on Switch",
> -        .active_low     = 1,
> -    }, {
> -        .type        = EV_SW,
> -        .code       = LSMINI_SW_AUTOPOWER,
> -        .gpio       = LSMINI_GPIO_KEY_AUTOPOWER,
> -        .desc       = "Power-auto Switch",
> -        .active_low     = 1,
> -    },
> -};
> -
> -static struct gpio_keys_platform_data lsmini_button_data = {
> -    .buttons    = lsmini_buttons,
> -    .nbuttons       = ARRAY_SIZE(lsmini_buttons),
> -};
> -
> -static struct platform_device lsmini_button_device = {
> -    .name       = "gpio-keys",
> -    .id         = -1,
> -    .num_resources  = 0,
> -    .dev        = {
> -        .platform_data  = &lsmini_button_data,
> -    },
> -};
> -
> -
> -/*****************************************************************************
> - * SATA
> - ****************************************************************************/
> -static struct mv_sata_platform_data lsmini_sata_data = {
> -    .n_ports    = 2,
> -};
> -
> -
> -/*****************************************************************************
> - * Linkstation Mini specific power off method: reboot
> - ****************************************************************************/
> -/*
> - * On the Linkstation Mini, 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 lsmini_power_off(void)
> -{
> -    orion5x_restart(REBOOT_HARD, NULL);
> -}
> -
> -
> -/*****************************************************************************
> - * General Setup
> - ****************************************************************************/
> -
> -#define LSMINI_GPIO_USB_POWER    16
> -#define LSMINI_GPIO_AUTO_POWER    17
> -#define LSMINI_GPIO_POWER    18
> -
> -#define LSMINI_GPIO_HDD_POWER0    1
> -#define LSMINI_GPIO_HDD_POWER1    19
> -
> -static unsigned int lsmini_mpp_modes[] __initdata = {
> -    MPP0_UNUSED, /* LED_RESERVE1 (unused) */
> -    MPP1_GPIO, /* HDD_PWR */
> -    MPP2_GPIO, /* LED_ALARM */
> -    MPP3_GPIO, /* LED_INFO */
> -    MPP4_UNUSED,
> -    MPP5_UNUSED,
> -    MPP6_UNUSED,
> -    MPP7_UNUSED,
> -    MPP8_UNUSED,
> -    MPP9_GPIO, /* LED_FUNC */
> -    MPP10_UNUSED,
> -    MPP11_UNUSED, /* LED_ETH (dummy) */
> -    MPP12_UNUSED,
> -    MPP13_UNUSED,
> -    MPP14_GPIO, /* LED_PWR */
> -    MPP15_GPIO, /* FUNC */
> -    MPP16_GPIO, /* USB_PWR */
> -    MPP17_GPIO, /* AUTO_POWER */
> -    MPP18_GPIO, /* POWER */
> -    MPP19_GPIO, /* HDD_PWR1 */
> -    0,
> -};
> -
> -static void __init lsmini_init(void)
> -{
> -    /*
> -     * Setup basic Orion functions. Need to be called early.
> -     */
> -    orion5x_init();
> -
> -    orion5x_mpp_conf(lsmini_mpp_modes);
> -
> -    /*
> -     * Configure peripherals.
> -     */
> -    orion5x_ehci0_init();
> -    orion5x_ehci1_init();
> -    orion5x_eth_init(&lsmini_eth_data);
> -    orion5x_i2c_init();
> -    orion5x_sata_init(&lsmini_sata_data);
> -    orion5x_uart0_init();
> -    orion5x_xor_init();
> -
> -    mvebu_mbus_add_window_by_id(ORION_MBUS_DEVBUS_BOOT_TARGET,
> -                    ORION_MBUS_DEVBUS_BOOT_ATTR,
> -                    LSMINI_NOR_BOOT_BASE,
> -                    LSMINI_NOR_BOOT_SIZE);
> -    platform_device_register(&lsmini_nor_flash);
> -
> -    platform_device_register(&lsmini_button_device);
> -
> -    platform_device_register(&lsmini_leds);
> -
> -    i2c_register_board_info(0, &lsmini_i2c_rtc, 1);
> -
> -    /* enable USB power */
> -    gpio_set_value(LSMINI_GPIO_USB_POWER, 1);
> -
> -    /* register power-off method */
> -    pm_power_off = lsmini_power_off;
> -
> -    pr_info("%s: finished\n", __func__);
> -}
> -
> -#ifdef CONFIG_MACH_LINKSTATION_MINI
> -MACHINE_START(LINKSTATION_MINI, "Buffalo Linkstation Mini")
> -    /* Maintainer: Alexey Kopytko <alexey@kopytko.ru> */
> -    .atag_offset    = 0x100,
> -    .init_machine    = lsmini_init,
> -    .map_io        = orion5x_map_io,
> -    .init_early    = orion5x_init_early,
> -    .init_irq    = orion5x_init_irq,
> -    .init_time    = orion5x_timer_init,
> -    .fixup        = tag_fixup_mem32,
> -    .restart    = orion5x_restart,
> -MACHINE_END
> -#endif
> --
> 2.1.4
>
Benjamin Cama June 21, 2015, 5:49 p.m. UTC | #7
Le dimanche 21 juin 2015 à 10:05 +0900, Alexey Kopytko a écrit :
> > 
> > On 20 june 2015 г., at 10:53, Benjamin Cama <benoar@dolka.fr> wrote:
> > 
> >  as I had a problem with the hardware that I am
> > going to fix soon, but I wanted some comments on it. I included
> > Andrew's remarks, even though I do not know what to do about the
> > buttons name for now: I don't know how the switch is wired exactly for
> > now, and FYI the “auto-power” is an intermediate position between off
> > and power that in the original firmware does some wake-up/sleep of the
> > disks when the backup utility is run from the PC connected to the NAS.
> > I never used it and do not know what to do with it, and what “key”
> > should be associated with it.
> > 
> 
> 1. These buttons shall be dealt with from the userspace. Actually
> there is a userspace daemon in the original firmware that reboots the
> whole thing if you turn the switch to off position. That's clearly not
> a kernel's job so don't just worry about this switch for now. Moreover
> I don't think this button does anything at all if there's no daemon.

Sorry, I didn't mean to handle it in the kernel, but to associate a
correct _keycode_ with it. I mean, 0 (KEY_RESERVED) for power and 1
(KEY_ESC) for auto-power don't seem right to me.

> Running evtest against this button and wiggling it gives this:
> 
> # evtest /dev/input/event0
> Input driver version is 1.0.1
> Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100
> Input device name: "gpio-keys"
> Supported events:
>   Event type 0 (Sync)
>   Event type 1 (Key)
>     Event code 357 (Option)
>   Event type 5 (?)
>     Event code 0 (?)
>     Event code 1 (?)
> Testing ... (interrupt to exit)
> Event: time 1434848366.955536, type 5 (?), code 0 (?), value 0
> Event: time 1434848366.955557, -------------- Report Sync ------------
> Event: time 1434848366.955576, type 5 (?), code 0 (?), value 1
> Event: time 1434848366.955589, -------------- Report Sync ------------
> Event: time 1434848366.955593, type 5 (?), code 0 (?), value 0
> 
> 
> 2. As far as I remember in my patch I intentionally changed states of
> some of the lights to be able to see if a kernel is booting or we have
> a bad build. Can't tell if you did this too, but if I would that will
> be nice for those people who don't have a serial soldered.

Well, there is the basic blinking blue power (from bootloader) named
now lswsgl:power:blue:bottom that transitions to solid blue, that IIRC
the original firmware does too.

Regarding people without serial access: this is the main problem I
think, that make people not use anything else than their stock
firmware; it is too easy to fuck things up and need serial for repair.
Personally, *every* board that I tried toying with ended up needing
some serial access for recovery, so I understand that less
knowledgeable people don't want to risk “bricking” their device.

Furthermore, Buffalo are really vicious with serial access: traces cut
under a capacitor for this Mini, but for the newer one (LS-WSXL),
traces cut under the SOIC-8 NOR Flash (more difficult to solder) _and_
bootloader not outputting anything on serial port!

No wonder these boards don't get tested much, only crazy people like
me, you and some others do it.

--
benjamin
Benjamin Cama June 21, 2015, 5:56 p.m. UTC | #8
Hi Jason,

Le samedi 20 juin 2015 à 17:34 +0000, Jason Cooper a écrit :
> On Sat, Jun 20, 2015 at 03:53:54AM +0200, Benjamin Cama wrote:
> 
> From here -----vvvv
> 
> > Hi,
> > 
> > This is my conversion patch to DT for my Linkstation Mini. The name of
> > the file better reflects the manufacturer's device name (LS-WSGL), as
> > there also exists a newer Linkstation Mini (LS-WSXL) based on Kirkwood
> > (and as Andrew noted, a patch for it landed yesterday). I did not
> > actually re-test it from clean build (it worked fine before, modulo
> > some cosmetics fixes), as I had a problem with the hardware that I am
> > going to fix soon, but I wanted some comments on it. I included
> > Andrew's remarks, even though I do not know what to do about the
> > buttons name for now: I don't know how the switch is wired exactly for
> > now, and FYI the ???auto-power??? is an intermediate position between off
> > and power that in the original firmware does some wake-up/sleep of the
> > disks when the backup utility is run from the PC connected to the NAS.
> > I never used it and do not know what to do with it, and what ???key???
> > should be associated with it.
> 
> To here -----^^^^^
> 
> Is very conversational.  This should be a more technical description of
> the changes being made as this is the block that 'git am' will use for
> the commit message.  Then the conversational bits go ...
> 
> > 
> > Signed-off-by: Benjamin Cama <benoar@dolka.fr>
> > Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> > ---
> 
> right here, below the '---'.

Thanks, I didn't know there was a way to do that. As it was an RFC, I
didn't bother separating the chatting, sorry.

> 
> >  arch/arm/boot/dts/Makefile           |   3 +-
> >  arch/arm/boot/dts/orion5x-lswsgl.dts | 241 ++++++++++++++++++++++++++++++
> >  arch/arm/mach-orion5x/Kconfig        |   6 +-
> >  arch/arm/mach-orion5x/lsmini-setup.c | 280 -----------------------------------
> >  4 files changed, 246 insertions(+), 284 deletions(-)
> >  create mode 100644 arch/arm/boot/dts/orion5x-lswsgl.dts
> >  delete mode 100644 arch/arm/mach-orion5x/lsmini-setup.c
> 
> Ahhh, that's always refreshing to see...
> 
> > diff --git a/arch/arm/boot/dts/orion5x-lswsgl.dts b/arch/arm/boot/dts/orion5x-lswsgl.dts
> > new file mode 100644
> > index 0000000..c7537a6
> > --- /dev/null
> > +++ b/arch/arm/boot/dts/orion5x-lswsgl.dts
> > @@ -0,0 +1,241 @@
> > +/*
> > + * Copyright (C) 2015 Benjamin Cama <benoar@dolka.fr>
> > + * Copyright (C) 2014 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> > + * Copyright (C) 2008 Alexey Kopytko <alexey@kopytko.ru>
> 
> It may be preferable to say "Based on the board file
> arch/arm/mach-orion5x/lsmini-setup.c, Copyright (C) 2008 Alexey Kopytko
> <alexey@kopytko.ru>"  But that's very nit-picky.  As long as Alexey is
> recognized, it should be fine.

OK, I'll do that.

> > + *
> > + * 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.
> > + */
> 
> We're trying to move the dts{i} files to dual license.  Please take a
> look at the current armada-*.dts{i} license blocks.  If you are ok with
> it, please change the above to match.

OK, so this is moving to dual-licensed GPLv2+ and X11? I am OK with it,
if Alexey and Thomas are too (Thomas, your Armada changes are dual
-licensed while your orion5x and GPLv2 only; is this because of the
previous work licences?).

Regards,
--
benjamin
Andrew Lunn June 21, 2015, 8:11 p.m. UTC | #9
> > We're trying to move the dts{i} files to dual license.  Please take a
> > look at the current armada-*.dts{i} license blocks.  If you are ok with
> > it, please change the above to match.
> 
> OK, so this is moving to dual-licensed GPLv2+ and X11? I am OK with it,
> if Alexey and Thomas are too (Thomas, your Armada changes are dual
> -licensed while your orion5x and GPLv2 only; is this because of the
> previous work licences?).

I can put this onto my TODO list. Of the existing files, the
orion5x.dtsi should probably be done first, since that is used by all
boards.

	Andrew
Jason Cooper June 22, 2015, 12:12 p.m. UTC | #10
On Sat, Jun 20, 2015 at 08:08:39PM +0200, Andrew Lunn wrote:
...
> > > diff --git a/arch/arm/mach-orion5x/Kconfig b/arch/arm/mach-orion5x/Kconfig
> > > index 2412efb..08d2be2 100644
> > > --- a/arch/arm/mach-orion5x/Kconfig
> > > +++ b/arch/arm/mach-orion5x/Kconfig
> > > @@ -78,11 +78,11 @@ config MACH_LINKSTATION_LSCHL
> > >  	  Buffalo Linkstation Live v3 (LS-CHL) platform.
> > >  
> > >  config MACH_LINKSTATION_MINI
> > > -	bool "Buffalo Linkstation Mini"
> > > -	select I2C_BOARDINFO
> > > +	bool "Buffalo Linkstation Mini (Flattened Device Tree)"
> > > +	select ARCH_ORION5X_DT
> > >  	help
> > >  	  Say 'Y' here if you want your kernel to support the
> > > -	  Buffalo Linkstation Mini platform.
> > > +	  Buffalo Linkstation Mini (LS-WSGL) platform.
> > 
> > Hmmm, this question is for the other mvebu maintainers:  When we
> > originally converted kirkwood and dove, we put a lot of effort into
> > keeping the board files and the dts files around in parallel for a
> > while.  Do we need to do that here?  All the drivers are converted, so
> > we don't need to keep the legacy board files for that reason.
> 
> We get so little interest in orion5x, and it has been shown to be
> broken for quite a while with respect to IRQ0, that if a real user
> comes by and swaps his platform to DT only, i say we go with it.

Ack.

thx,

Jason.
diff mbox

Patch

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 992736b..bd5ad2f 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -441,7 +441,8 @@  dtb-$(CONFIG_ARCH_ORION5X) += \
 	orion5x-lacie-d2-network.dtb \
 	orion5x-lacie-ethernet-disk-mini-v2.dtb \
 	orion5x-maxtor-shared-storage-2.dtb \
-	orion5x-rd88f5182-nas.dtb
+	orion5x-rd88f5182-nas.dtb \
+	orion5x-lswsgl.dtb
 dtb-$(CONFIG_ARCH_PRIMA2) += \
 	prima2-evb.dtb
 dtb-$(CONFIG_ARCH_QCOM) += \
diff --git a/arch/arm/boot/dts/orion5x-lswsgl.dts b/arch/arm/boot/dts/orion5x-lswsgl.dts
new file mode 100644
index 0000000..c7537a6
--- /dev/null
+++ b/arch/arm/boot/dts/orion5x-lswsgl.dts
@@ -0,0 +1,241 @@ 
+/*
+ * Copyright (C) 2015 Benjamin Cama <benoar@dolka.fr>
+ * Copyright (C) 2014 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+ * Copyright (C) 2008 Alexey Kopytko <alexey@kopytko.ru>
+ *
+ * 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.
+ */
+
+/dts-v1/;
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+#include "orion5x-mv88f5182.dtsi"
+
+/ {
+	model = "Buffalo Linkstation Mini (LS-WSGL)";
+	compatible = "buffalo,lswsgl", "marvell,orion5x-88f5182", "marvell,orion5x";
+
+	memory {
+		reg = <0x00000000 0x8000000>; /* 128 MB */
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200";
+		linux,stdout-path = &uart0;
+	};
+
+	soc {
+		ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000>,
+			 <MBUS_ID(0x09, 0x00) 0 0xf2200000 0x800>,
+			 <MBUS_ID(0x01, 0x0f) 0 0xf4000000 0x40000>;
+	};
+
+	gpio-keys {
+		compatible = "gpio-keys";
+		pinctrl-0 = <&pmx_buttons>;
+		pinctrl-names = "default";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		func {
+			label = "Function Button";
+			linux,code = <KEY_OPTION>;
+			gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
+		};
+
+		power {
+			label = "Power-on Switch";
+			linux,input-type = <5>; /* EV_SW */
+			linux,code = <0>; /* LSMINI_SW_POWER */
+			gpios = <&gpio0 18 GPIO_ACTIVE_LOW>;
+		};
+
+		autopower {
+			label = "Power-auto Switch";
+			linux,input-type = <5>; /* EV_SW */
+			linux,code = <1>; /* LSMINI_SW_AUTOPOWER */
+			gpios = <&gpio0 17 GPIO_ACTIVE_LOW>;
+		};
+	};
+
+	gpio-leds {
+		compatible = "gpio-leds";
+		pinctrl-0 = <&pmx_led_alarm &pmx_led_info &pmx_led_func
+			     &pmx_led_power>;
+		pinctrl-names = "default";
+
+		alarm {
+			label = "lswsgl:alarm:red";
+			gpio = <&gpio0 2 GPIO_ACTIVE_LOW>;
+		};
+
+		info {
+			label = "lswsgl:info:amber";
+			gpio = <&gpio0 3 GPIO_ACTIVE_LOW>;
+		};
+
+		func {
+			label = "lswsgl:func:blue:top";
+			gpio = <&gpio0 9 GPIO_ACTIVE_LOW>;
+		};
+
+		power {
+			label = "lswsgl:power:blue:bottom";
+			gpio = <&gpio0 14 GPIO_ACTIVE_LOW>;
+			default-state = "on";
+		};
+	};
+
+	restart_poweroff {
+		compatible = "restart-poweroff";
+	};
+
+	regulators {
+		compatible = "simple-bus";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		pinctrl-0 = <&pmx_sata0_power &pmx_sata1_power &pmx_usb_power>;
+		pinctrl-names = "default";
+
+		sata0_power: regulator@0 {
+			compatible = "regulator-fixed";
+			reg = <0>;
+			regulator-name = "SATA0 Power";
+			regulator-min-microvolt = <5000000>;
+			regulator-max-microvolt = <5000000>;
+			enable-active-high;
+			regulator-always-on;
+			regulator-boot-on;
+			gpio = <&gpio0 1 GPIO_ACTIVE_HIGH>;
+		};
+
+		sata1_power: regulator@1 {
+			compatible = "regulator-fixed";
+			reg = <1>;
+			regulator-name = "SATA1 Power";
+			regulator-min-microvolt = <5000000>;
+			regulator-max-microvolt = <5000000>;
+			enable-active-high;
+			regulator-always-on;
+			regulator-boot-on;
+			gpio = <&gpio0 19 GPIO_ACTIVE_HIGH>;
+		};
+
+		usb_power: regulator@2 {
+			compatible = "regulator-fixed";
+			reg = <2>;
+			regulator-name = "USB Power";
+			regulator-min-microvolt = <5000000>;
+			regulator-max-microvolt = <5000000>;
+			enable-active-high;
+			regulator-always-on;
+			regulator-boot-on;
+			gpio = <&gpio0 16 GPIO_ACTIVE_HIGH>;
+		};
+	};
+};
+
+&devbus_bootcs {
+	status = "okay";
+
+	devbus,keep-config;
+
+	flash@0 {
+		compatible = "cfi-flash";
+		reg = <0 0x40000>;
+		bank-width = <1>;
+                #address-cells = <1>;
+		#size-cells = <1>;
+
+		partition@0 {
+			label = "Full256Kb";
+			reg = <0 0x40000>;
+			read-only;
+		};
+	};
+};
+
+&mdio {
+	status = "okay";
+
+	ethphy: ethernet-phy {
+		reg = <8>;
+	};
+};
+
+&ehci0 {
+	status = "okay";
+};
+
+&eth {
+	status = "okay";
+
+	ethernet-port@0 {
+		phy-handle = <&ethphy>;
+	};
+};
+
+&i2c {
+	status = "okay";
+	clock-frequency = <100000>;
+	#address-cells = <1>;
+
+	rtc@32 {
+		compatible = "ricoh,rs5c372a";
+		reg = <0x32>;
+	};
+};
+
+&pinctrl {
+	pmx_buttons: pmx-buttons {
+		marvell,pins = "mpp15", "mpp17", "mpp18";
+		marvell,function = "gpio";
+	};
+
+	pmx_led_alarm: pmx-leds {
+		marvell,pins = "mpp2";
+		marvell,function = "gpio";
+	};
+
+	pmx_led_info: pmx-leds {
+		marvell,pins = "mpp3";
+		marvell,function = "gpio";
+	};
+
+	pmx_led_func: pmx-leds {
+		marvell,pins = "mpp9";
+		marvell,function = "gpio";
+	};
+
+	pmx_led_power: pmx-leds {
+		marvell,pins = "mpp14";
+		marvell,function = "gpio";
+	};
+
+	pmx_sata0_power: pmx-sata0-power {
+		marvell,pins = "mpp1";
+		marvell,function = "gpio";
+	};
+
+	pmx_sata1_power: pmx-sata1-power {
+		marvell,pins = "mpp19";
+		marvell,function = "gpio";
+	};
+
+	pmx_usb_power: pmx-usb-power {
+		marvell,pins = "mpp16";
+		marvell,function = "gpio";
+	};
+};
+
+&sata {
+	status = "okay";
+	nr-ports = <2>;
+};
+
+&uart0 {
+	status = "okay";
+};
diff --git a/arch/arm/mach-orion5x/Kconfig b/arch/arm/mach-orion5x/Kconfig
index 2412efb..08d2be2 100644
--- a/arch/arm/mach-orion5x/Kconfig
+++ b/arch/arm/mach-orion5x/Kconfig
@@ -78,11 +78,11 @@  config MACH_LINKSTATION_LSCHL
 	  Buffalo Linkstation Live v3 (LS-CHL) platform.
 
 config MACH_LINKSTATION_MINI
-	bool "Buffalo Linkstation Mini"
-	select I2C_BOARDINFO
+	bool "Buffalo Linkstation Mini (Flattened Device Tree)"
+	select ARCH_ORION5X_DT
 	help
 	  Say 'Y' here if you want your kernel to support the
-	  Buffalo Linkstation Mini platform.
+	  Buffalo Linkstation Mini (LS-WSGL) platform.
 
 config MACH_LINKSTATION_LS_HGL
 	bool "Buffalo Linkstation LS-HGL"
diff --git a/arch/arm/mach-orion5x/lsmini-setup.c b/arch/arm/mach-orion5x/lsmini-setup.c
deleted file mode 100644
index a6493e7..0000000
--- a/arch/arm/mach-orion5x/lsmini-setup.c
+++ /dev/null
@@ -1,280 +0,0 @@ 
-/*
- * arch/arm/mach-orion5x/lsmini-setup.c
- *
- * Maintainer: Alexey Kopytko <alexey@kopytko.ru>
- *
- * 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"
-
-/*****************************************************************************
- * Linkstation Mini Info
- ****************************************************************************/
-
-/*
- * 256K NOR flash Device bus boot chip select
- */
-
-#define LSMINI_NOR_BOOT_BASE	0xf4000000
-#define LSMINI_NOR_BOOT_SIZE	SZ_256K
-
-/*****************************************************************************
- * 256KB NOR Flash on BOOT Device
- ****************************************************************************/
-
-static struct physmap_flash_data lsmini_nor_flash_data = {
-	.width		= 1,
-};
-
-static struct resource lsmini_nor_flash_resource = {
-	.flags	= IORESOURCE_MEM,
-	.start	= LSMINI_NOR_BOOT_BASE,
-	.end	= LSMINI_NOR_BOOT_BASE + LSMINI_NOR_BOOT_SIZE - 1,
-};
-
-static struct platform_device lsmini_nor_flash = {
-	.name			= "physmap-flash",
-	.id			= 0,
-	.dev		= {
-		.platform_data	= &lsmini_nor_flash_data,
-	},
-	.num_resources		= 1,
-	.resource		= &lsmini_nor_flash_resource,
-};
-
-/*****************************************************************************
- * Ethernet
- ****************************************************************************/
-
-static struct mv643xx_eth_platform_data lsmini_eth_data = {
-	.phy_addr	= 8,
-};
-
-/*****************************************************************************
- * RTC 5C372a on I2C bus
- ****************************************************************************/
-
-static struct i2c_board_info __initdata lsmini_i2c_rtc = {
-	I2C_BOARD_INFO("rs5c372a", 0x32),
-};
-
-/*****************************************************************************
- * LEDs attached to GPIO
- ****************************************************************************/
-
-#define LSMINI_GPIO_LED_ALARM	2
-#define LSMINI_GPIO_LED_INFO	3
-#define LSMINI_GPIO_LED_FUNC	9
-#define LSMINI_GPIO_LED_PWR	14
-
-static struct gpio_led lsmini_led_pins[] = {
-	{
-		.name	   = "alarm:red",
-		.gpio	   = LSMINI_GPIO_LED_ALARM,
-		.active_low     = 1,
-	}, {
-		.name	   = "info:amber",
-		.gpio	   = LSMINI_GPIO_LED_INFO,
-		.active_low     = 1,
-	}, {
-		.name	   = "func:blue:top",
-		.gpio	   = LSMINI_GPIO_LED_FUNC,
-		.active_low     = 1,
-	}, {
-		.name	   = "power:blue:bottom",
-		.gpio	   = LSMINI_GPIO_LED_PWR,
-	},
-};
-
-static struct gpio_led_platform_data lsmini_led_data = {
-	.leds	   = lsmini_led_pins,
-	.num_leds       = ARRAY_SIZE(lsmini_led_pins),
-};
-
-static struct platform_device lsmini_leds = {
-	.name   = "leds-gpio",
-	.id     = -1,
-	.dev    = {
-		.platform_data  = &lsmini_led_data,
-	},
-};
-
-/****************************************************************************
- * GPIO Attached Keys
- ****************************************************************************/
-
-#define LSMINI_GPIO_KEY_FUNC       15
-#define LSMINI_GPIO_KEY_POWER	   18
-#define LSMINI_GPIO_KEY_AUTOPOWER 17
-
-#define LSMINI_SW_POWER		0x00
-#define LSMINI_SW_AUTOPOWER	0x01
-
-static struct gpio_keys_button lsmini_buttons[] = {
-	{
-		.code	   = KEY_OPTION,
-		.gpio	   = LSMINI_GPIO_KEY_FUNC,
-		.desc	   = "Function Button",
-		.active_low     = 1,
-	}, {
-		.type		= EV_SW,
-		.code	   = LSMINI_SW_POWER,
-		.gpio	   = LSMINI_GPIO_KEY_POWER,
-		.desc	   = "Power-on Switch",
-		.active_low     = 1,
-	}, {
-		.type		= EV_SW,
-		.code	   = LSMINI_SW_AUTOPOWER,
-		.gpio	   = LSMINI_GPIO_KEY_AUTOPOWER,
-		.desc	   = "Power-auto Switch",
-		.active_low     = 1,
-	},
-};
-
-static struct gpio_keys_platform_data lsmini_button_data = {
-	.buttons	= lsmini_buttons,
-	.nbuttons       = ARRAY_SIZE(lsmini_buttons),
-};
-
-static struct platform_device lsmini_button_device = {
-	.name	   = "gpio-keys",
-	.id	     = -1,
-	.num_resources  = 0,
-	.dev	    = {
-		.platform_data  = &lsmini_button_data,
-	},
-};
-
-
-/*****************************************************************************
- * SATA
- ****************************************************************************/
-static struct mv_sata_platform_data lsmini_sata_data = {
-	.n_ports	= 2,
-};
-
-
-/*****************************************************************************
- * Linkstation Mini specific power off method: reboot
- ****************************************************************************/
-/*
- * On the Linkstation Mini, 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 lsmini_power_off(void)
-{
-	orion5x_restart(REBOOT_HARD, NULL);
-}
-
-
-/*****************************************************************************
- * General Setup
- ****************************************************************************/
-
-#define LSMINI_GPIO_USB_POWER	16
-#define LSMINI_GPIO_AUTO_POWER	17
-#define LSMINI_GPIO_POWER	18
-
-#define LSMINI_GPIO_HDD_POWER0	1
-#define LSMINI_GPIO_HDD_POWER1	19
-
-static unsigned int lsmini_mpp_modes[] __initdata = {
-	MPP0_UNUSED, /* LED_RESERVE1 (unused) */
-	MPP1_GPIO, /* HDD_PWR */
-	MPP2_GPIO, /* LED_ALARM */
-	MPP3_GPIO, /* LED_INFO */
-	MPP4_UNUSED,
-	MPP5_UNUSED,
-	MPP6_UNUSED,
-	MPP7_UNUSED,
-	MPP8_UNUSED,
-	MPP9_GPIO, /* LED_FUNC */
-	MPP10_UNUSED,
-	MPP11_UNUSED, /* LED_ETH (dummy) */
-	MPP12_UNUSED,
-	MPP13_UNUSED,
-	MPP14_GPIO, /* LED_PWR */
-	MPP15_GPIO, /* FUNC */
-	MPP16_GPIO, /* USB_PWR */
-	MPP17_GPIO, /* AUTO_POWER */
-	MPP18_GPIO, /* POWER */
-	MPP19_GPIO, /* HDD_PWR1 */
-	0,
-};
-
-static void __init lsmini_init(void)
-{
-	/*
-	 * Setup basic Orion functions. Need to be called early.
-	 */
-	orion5x_init();
-
-	orion5x_mpp_conf(lsmini_mpp_modes);
-
-	/*
-	 * Configure peripherals.
-	 */
-	orion5x_ehci0_init();
-	orion5x_ehci1_init();
-	orion5x_eth_init(&lsmini_eth_data);
-	orion5x_i2c_init();
-	orion5x_sata_init(&lsmini_sata_data);
-	orion5x_uart0_init();
-	orion5x_xor_init();
-
-	mvebu_mbus_add_window_by_id(ORION_MBUS_DEVBUS_BOOT_TARGET,
-				    ORION_MBUS_DEVBUS_BOOT_ATTR,
-				    LSMINI_NOR_BOOT_BASE,
-				    LSMINI_NOR_BOOT_SIZE);
-	platform_device_register(&lsmini_nor_flash);
-
-	platform_device_register(&lsmini_button_device);
-
-	platform_device_register(&lsmini_leds);
-
-	i2c_register_board_info(0, &lsmini_i2c_rtc, 1);
-
-	/* enable USB power */
-	gpio_set_value(LSMINI_GPIO_USB_POWER, 1);
-
-	/* register power-off method */
-	pm_power_off = lsmini_power_off;
-
-	pr_info("%s: finished\n", __func__);
-}
-
-#ifdef CONFIG_MACH_LINKSTATION_MINI
-MACHINE_START(LINKSTATION_MINI, "Buffalo Linkstation Mini")
-	/* Maintainer: Alexey Kopytko <alexey@kopytko.ru> */
-	.atag_offset	= 0x100,
-	.init_machine	= lsmini_init,
-	.map_io		= orion5x_map_io,
-	.init_early	= orion5x_init_early,
-	.init_irq	= orion5x_init_irq,
-	.init_time	= orion5x_timer_init,
-	.fixup		= tag_fixup_mem32,
-	.restart	= orion5x_restart,
-MACHINE_END
-#endif