diff mbox series

[U-Boot,09/12] ARM: kirkwood: Add device-tree for nsa310s

Message ID 20180508103421.8422-10-judge.packham@gmail.com
State Rejected
Delegated to: Stefan Roese
Headers show
Series kirkwood: device tree support | expand

Commit Message

Chris Packham May 8, 2018, 10:34 a.m. UTC
Import the dts files from Linux 4.17 and enable CONFIG_OF_CONTROL.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
---

 arch/arm/dts/kirkwood-nsa310.dts         | 139 ++++++++++++++++++++
 arch/arm/dts/kirkwood-nsa3x0-common.dtsi | 158 +++++++++++++++++++++++
 configs/nsa310s_defconfig                |   3 +-
 3 files changed, 299 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/kirkwood-nsa310.dts
 create mode 100644 arch/arm/dts/kirkwood-nsa3x0-common.dtsi

Comments

Tony Dinh May 9, 2018, 6:27 p.m. UTC | #1
Hi Chris,

What we have in Linux mainline is Zyxel NSA310 (Marvell 88f6281). The Zyxel
NSA310S (Marvell 88f6702) is actually a different box, which has not been
mainlined yet.

By the way, there are 3 variations of the Zyxel NSA310 box. This box has
some combination of: red USB Led, lm85 sensor, adt7476 sensor that make
them slighly different. The mainlined NSA310 DTS is for the one with adt7476
sensor.

Regards
bodhi


On Tue, May 8, 2018 at 3:34 AM, Chris Packham <judge.packham@gmail.com>
wrote:

> Import the dts files from Linux 4.17 and enable CONFIG_OF_CONTROL.
>
> Signed-off-by: Chris Packham <judge.packham@gmail.com>
> ---
>
>  arch/arm/dts/kirkwood-nsa310.dts         | 139 ++++++++++++++++++++
>  arch/arm/dts/kirkwood-nsa3x0-common.dtsi | 158 +++++++++++++++++++++++
>  configs/nsa310s_defconfig                |   3 +-
>  3 files changed, 299 insertions(+), 1 deletion(-)
>  create mode 100644 arch/arm/dts/kirkwood-nsa310.dts
>  create mode 100644 arch/arm/dts/kirkwood-nsa3x0-common.dtsi
>
> diff --git a/arch/arm/dts/kirkwood-nsa310.dts b/arch/arm/dts/kirkwood-
> nsa310.dts
> new file mode 100644
> index 000000000000..9b861c2e76c5
> --- /dev/null
> +++ b/arch/arm/dts/kirkwood-nsa310.dts
> @@ -0,0 +1,139 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/dts-v1/;
> +
> +#include "kirkwood-nsa3x0-common.dtsi"
> +
> +/ {
> +       compatible = "zyxel,nsa310", "marvell,kirkwood-88f6281",
> "marvell,kirkwood";
> +
> +       memory {
> +               device_type = "memory";
> +               reg = <0x00000000 0x10000000>;
> +       };
> +
> +       chosen {
> +               bootargs = "console=ttyS0,115200";
> +               stdout-path = &uart0;
> +       };
> +
> +       ocp@f1000000 {
> +               pinctrl: pin-controller@10000 {
> +                       pinctrl-0 = <&pmx_unknown>;
> +                       pinctrl-names = "default";
> +
> +                       pmx_led_esata_green: pmx-led-esata-green {
> +                               marvell,pins = "mpp12";
> +                               marvell,function = "gpio";
> +                       };
> +
> +                       pmx_led_esata_red: pmx-led-esata-red {
> +                               marvell,pins = "mpp13";
> +                               marvell,function = "gpio";
> +                       };
> +
> +                       pmx_led_usb_green: pmx-led-usb-green {
> +                               marvell,pins = "mpp15";
> +                               marvell,function = "gpio";
> +                       };
> +
> +                       pmx_led_usb_red: pmx-led-usb-red {
> +                               marvell,pins = "mpp16";
> +                               marvell,function = "gpio";
> +                       };
> +
> +                       pmx_led_sys_green: pmx-led-sys-green {
> +                               marvell,pins = "mpp28";
> +                               marvell,function = "gpio";
> +                       };
> +
> +                       pmx_led_sys_red: pmx-led-sys-red {
> +                               marvell,pins = "mpp29";
> +                               marvell,function = "gpio";
> +                       };
> +
> +                       pmx_led_hdd_green: pmx-led-hdd-green {
> +                               marvell,pins = "mpp41";
> +                               marvell,function = "gpio";
> +                       };
> +
> +                       pmx_led_hdd_red: pmx-led-hdd-red {
> +                               marvell,pins = "mpp42";
> +                               marvell,function = "gpio";
> +                       };
> +
> +                       pmx_unknown: pmx-unknown {
> +                               marvell,pins = "mpp44";
> +                               marvell,function = "gpio";
> +                       };
> +
> +               };
> +
> +               i2c@11000 {
> +                       status = "okay";
> +
> +                       adt7476: adt7476a@2e {
> +                               compatible = "adi,adt7476";
> +                               reg = <0x2e>;
> +                       };
> +               };
> +       };
> +
> +       gpio-leds {
> +               compatible = "gpio-leds";
> +               pinctrl-0 = <&pmx_led_esata_green &pmx_led_esata_red
> +                            &pmx_led_usb_green &pmx_led_usb_red
> +                            &pmx_led_sys_green &pmx_led_sys_red
> +                            &pmx_led_copy_green &pmx_led_copy_red
> +                            &pmx_led_hdd_green &pmx_led_hdd_red>;
> +               pinctrl-names = "default";
> +
> +               green-sys {
> +                       label = "nsa310:green:sys";
> +                       gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>;
> +               };
> +               red-sys {
> +                       label = "nsa310:red:sys";
> +                       gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>;
> +               };
> +               green-hdd {
> +                       label = "nsa310:green:hdd";
> +                       gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>;
> +               };
> +               red-hdd {
> +                       label = "nsa310:red:hdd";
> +                       gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
> +               };
> +               green-esata {
> +                       label = "nsa310:green:esata";
> +                       gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
> +               };
> +               red-esata {
> +                       label = "nsa310:red:esata";
> +                       gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
> +               };
> +               green-usb {
> +                       label = "nsa310:green:usb";
> +                       gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
> +               };
> +               red-usb {
> +                       label = "nsa310:red:usb";
> +                       gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
> +               };
> +               green-copy {
> +                       label = "nsa310:green:copy";
> +                       gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
> +               };
> +               red-copy {
> +                       label = "nsa310:red:copy";
> +                       gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>;
> +               };
> +       };
> +};
> +
> +&pciec {
> +        status = "okay";
> +};
> +
> +&pcie0 {
> +       status = "okay";
> +};
> diff --git a/arch/arm/dts/kirkwood-nsa3x0-common.dtsi
> b/arch/arm/dts/kirkwood-nsa3x0-common.dtsi
> new file mode 100644
> index 000000000000..2c4037b07282
> --- /dev/null
> +++ b/arch/arm/dts/kirkwood-nsa3x0-common.dtsi
> @@ -0,0 +1,158 @@
> +// SPDX-License-Identifier: GPL-2.0
> +#include "kirkwood.dtsi"
> +#include "kirkwood-6281.dtsi"
> +
> +/ {
> +       model = "ZyXEL NSA310";
> +
> +       ocp@f1000000 {
> +               pinctrl: pin-controller@10000 {
> +
> +                       pmx_usb_power: pmx-usb-power {
> +                               marvell,pins = "mpp21";
> +                               marvell,function = "gpio";
> +                       };
> +
> +                       pmx_pwr_off: pmx-pwr-off {
> +                               marvell,pins = "mpp48";
> +                               marvell,function = "gpio";
> +                       };
> +
> +                       pmx_btn_reset: pmx-btn-reset {
> +                               marvell,pins = "mpp36";
> +                               marvell,function = "gpio";
> +                       };
> +
> +                       pmx_btn_copy: pmx-btn-copy {
> +                               marvell,pins = "mpp37";
> +                               marvell,function = "gpio";
> +                       };
> +
> +                       pmx_btn_power: pmx-btn-power {
> +                               marvell,pins = "mpp46";
> +                               marvell,function = "gpio";
> +                       };
> +
> +                       pmx_led_copy_green: pmx-led-copy-green {
> +                               marvell,pins = "mpp39";
> +                               marvell,function = "gpio";
> +                       };
> +
> +                       pmx_led_copy_red: pmx-led-copy-red {
> +                               marvell,pins = "mpp40";
> +                               marvell,function = "gpio";
> +                       };
> +               };
> +
> +               serial@12000 {
> +                       status = "ok";
> +               };
> +
> +               sata@80000 {
> +                       status = "okay";
> +                       nr-ports = <2>;
> +               };
> +       };
> +
> +       gpio_poweroff {
> +               compatible = "gpio-poweroff";
> +               pinctrl-0 = <&pmx_pwr_off>;
> +               pinctrl-names = "default";
> +               gpios = <&gpio1 16 GPIO_ACTIVE_HIGH>;
> +       };
> +
> +       gpio_keys {
> +               compatible = "gpio-keys";
> +               #address-cells = <1>;
> +               #size-cells = <0>;
> +               pinctrl-0 = <&pmx_btn_reset &pmx_btn_copy &pmx_btn_power>;
> +               pinctrl-names = "default";
> +
> +               power {
> +                       label = "Power Button";
> +                       linux,code = <KEY_POWER>;
> +                       gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>;
> +               };
> +               copy {
> +                       label = "Copy Button";
> +                       linux,code = <KEY_COPY>;
> +                       gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
> +               };
> +               reset {
> +                       label = "Reset Button";
> +                       linux,code = <KEY_RESTART>;
> +                       gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
> +               };
> +       };
> +
> +
> +       regulators {
> +               compatible = "simple-bus";
> +               #address-cells = <1>;
> +               #size-cells = <0>;
> +               pinctrl-0 = <&pmx_usb_power>;
> +               pinctrl-names = "default";
> +
> +               usb0_power: regulator@1 {
> +                       compatible = "regulator-fixed";
> +                       reg = <1>;
> +                       regulator-name = "USB Power";
> +                       regulator-min-microvolt = <5000000>;
> +                       regulator-max-microvolt = <5000000>;
> +                       regulator-always-on;
> +                       regulator-boot-on;
> +                       gpio = <&gpio0 21 GPIO_ACTIVE_HIGH>;
> +               };
> +       };
> +};
> +
> +&nand {
> +       status = "okay";
> +       chip-delay = <35>;
> +
> +       partition@0 {
> +               label = "uboot";
> +               reg = <0x0000000 0x0100000>;
> +               read-only;
> +       };
> +       partition@100000 {
> +               label = "uboot_env";
> +               reg = <0x0100000 0x0080000>;
> +       };
> +       partition@180000 {
> +               label = "key_store";
> +               reg = <0x0180000 0x0080000>;
> +       };
> +       partition@200000 {
> +               label = "info";
> +               reg = <0x0200000 0x0080000>;
> +       };
> +       partition@280000 {
> +               label = "etc";
> +               reg = <0x0280000 0x0a00000>;
> +       };
> +       partition@c80000 {
> +               label = "kernel_1";
> +               reg = <0x0c80000 0x0a00000>;
> +       };
> +       partition@1680000 {
> +               label = "rootfs1";
> +               reg = <0x1680000 0x2fc0000>;
> +       };
> +       partition@4640000 {
> +               label = "kernel_2";
> +               reg = <0x4640000 0x0a00000>;
> +       };
> +       partition@5040000 {
> +               label = "rootfs2";
> +               reg = <0x5040000 0x2fc0000>;
> +       };
> +};
> +
> +&pciec {
> +        status = "okay";
> +};
> +
> +&pcie0 {
> +       status = "okay";
> +};
> diff --git a/configs/nsa310s_defconfig b/configs/nsa310s_defconfig
> index 2529687414fa..d3ea933d378b 100644
> --- a/configs/nsa310s_defconfig
> +++ b/configs/nsa310s_defconfig
> @@ -2,6 +2,7 @@ CONFIG_ARM=y
>  CONFIG_KIRKWOOD=y
>  CONFIG_SYS_TEXT_BASE=0x600000
>  CONFIG_TARGET_NSA310S=y
> +CONFIG_DEFAULT_DEVICE_TREE="kirkwood-nsa310"
>  CONFIG_BOOTDELAY=3
>  # CONFIG_DISPLAY_BOARDINFO is not set
>  CONFIG_HUSH_PARSER=y
> @@ -21,6 +22,7 @@ CONFIG_CMD_JFFS2=y
>  CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:0xe0000@
> 0x0(uboot),0x20000@0xe0000(uboot_env),0x100000@0x100000(
> second_stage_uboot),-@0x200000(root)"
>  CONFIG_CMD_UBI=y
>  CONFIG_ISO_PARTITION=y
> +CONFIG_OF_CONTROL=y
>  CONFIG_ENV_IS_IN_NAND=y
>  CONFIG_MVSATA_IDE=y
>  # CONFIG_MMC is not set
> @@ -29,4 +31,3 @@ CONFIG_USB=y
>  CONFIG_USB_EHCI_HCD=y
>  CONFIG_USB_STORAGE=y
>  CONFIG_LZMA=y
> -CONFIG_OF_LIBFDT=y
> --
> 2.17.0
>
>
Chris Packham May 10, 2018, 12:51 a.m. UTC | #2
On Thu, May 10, 2018 at 6:27 AM bodhi bodhi <mibodhi@gmail.com> wrote:

> Hi Chris,

> What we have in Linux mainline is Zyxel NSA310 (Marvell 88f6281). The
Zyxel NSA310S (Marvell 88f6702) is actually a different box, which has not
been mainlined yet.

> By the way, there are 3 variations of the Zyxel NSA310 box. This box has
some combination of: red USB Led, lm85 sensor, adt7476 sensor that make
them slighly different. The mainlined NSA310 DTS is for the one with
adt7476 sensor.


Ah OK. I did see 2 boards in the kernel, this was one of the "educated
guesses" which turns out not to to be a good guess. For now I'll just drop
this conversion from the series.


> Regards
> bodhi


> On Tue, May 8, 2018 at 3:34 AM, Chris Packham <judge.packham@gmail.com>
wrote:

>> Import the dts files from Linux 4.17 and enable CONFIG_OF_CONTROL.

>> Signed-off-by: Chris Packham <judge.packham@gmail.com>
>> ---

>>   arch/arm/dts/kirkwood-nsa310.dts         | 139 ++++++++++++++++++++
>>   arch/arm/dts/kirkwood-nsa3x0-common.dtsi | 158 +++++++++++++++++++++++
>>   configs/nsa310s_defconfig                |   3 +-
>>   3 files changed, 299 insertions(+), 1 deletion(-)
>>   create mode 100644 arch/arm/dts/kirkwood-nsa310.dts
>>   create mode 100644 arch/arm/dts/kirkwood-nsa3x0-common.dtsi

>> diff --git a/arch/arm/dts/kirkwood-nsa310.dts
b/arch/arm/dts/kirkwood-nsa310.dts
>> new file mode 100644
>> index 000000000000..9b861c2e76c5
>> --- /dev/null
>> +++ b/arch/arm/dts/kirkwood-nsa310.dts
>> @@ -0,0 +1,139 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +/dts-v1/;
>> +
>> +#include "kirkwood-nsa3x0-common.dtsi"
>> +
>> +/ {
>> +       compatible = "zyxel,nsa310", "marvell,kirkwood-88f6281",
"marvell,kirkwood";
>> +
>> +       memory {
>> +               device_type = "memory";
>> +               reg = <0x00000000 0x10000000>;
>> +       };
>> +
>> +       chosen {
>> +               bootargs = "console=ttyS0,115200";
>> +               stdout-path = &uart0;
>> +       };
>> +
>> +       ocp@f1000000 {
>> +               pinctrl: pin-controller@10000 {
>> +                       pinctrl-0 = <&pmx_unknown>;
>> +                       pinctrl-names = "default";
>> +
>> +                       pmx_led_esata_green: pmx-led-esata-green {
>> +                               marvell,pins = "mpp12";
>> +                               marvell,function = "gpio";
>> +                       };
>> +
>> +                       pmx_led_esata_red: pmx-led-esata-red {
>> +                               marvell,pins = "mpp13";
>> +                               marvell,function = "gpio";
>> +                       };
>> +
>> +                       pmx_led_usb_green: pmx-led-usb-green {
>> +                               marvell,pins = "mpp15";
>> +                               marvell,function = "gpio";
>> +                       };
>> +
>> +                       pmx_led_usb_red: pmx-led-usb-red {
>> +                               marvell,pins = "mpp16";
>> +                               marvell,function = "gpio";
>> +                       };
>> +
>> +                       pmx_led_sys_green: pmx-led-sys-green {
>> +                               marvell,pins = "mpp28";
>> +                               marvell,function = "gpio";
>> +                       };
>> +
>> +                       pmx_led_sys_red: pmx-led-sys-red {
>> +                               marvell,pins = "mpp29";
>> +                               marvell,function = "gpio";
>> +                       };
>> +
>> +                       pmx_led_hdd_green: pmx-led-hdd-green {
>> +                               marvell,pins = "mpp41";
>> +                               marvell,function = "gpio";
>> +                       };
>> +
>> +                       pmx_led_hdd_red: pmx-led-hdd-red {
>> +                               marvell,pins = "mpp42";
>> +                               marvell,function = "gpio";
>> +                       };
>> +
>> +                       pmx_unknown: pmx-unknown {
>> +                               marvell,pins = "mpp44";
>> +                               marvell,function = "gpio";
>> +                       };
>> +
>> +               };
>> +
>> +               i2c@11000 {
>> +                       status = "okay";
>> +
>> +                       adt7476: adt7476a@2e {
>> +                               compatible = "adi,adt7476";
>> +                               reg = <0x2e>;
>> +                       };
>> +               };
>> +       };
>> +
>> +       gpio-leds {
>> +               compatible = "gpio-leds";
>> +               pinctrl-0 = <&pmx_led_esata_green &pmx_led_esata_red
>> +                            &pmx_led_usb_green &pmx_led_usb_red
>> +                            &pmx_led_sys_green &pmx_led_sys_red
>> +                            &pmx_led_copy_green &pmx_led_copy_red
>> +                            &pmx_led_hdd_green &pmx_led_hdd_red>;
>> +               pinctrl-names = "default";
>> +
>> +               green-sys {
>> +                       label = "nsa310:green:sys";
>> +                       gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>;
>> +               };
>> +               red-sys {
>> +                       label = "nsa310:red:sys";
>> +                       gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>;
>> +               };
>> +               green-hdd {
>> +                       label = "nsa310:green:hdd";
>> +                       gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>;
>> +               };
>> +               red-hdd {
>> +                       label = "nsa310:red:hdd";
>> +                       gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
>> +               };
>> +               green-esata {
>> +                       label = "nsa310:green:esata";
>> +                       gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
>> +               };
>> +               red-esata {
>> +                       label = "nsa310:red:esata";
>> +                       gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
>> +               };
>> +               green-usb {
>> +                       label = "nsa310:green:usb";
>> +                       gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
>> +               };
>> +               red-usb {
>> +                       label = "nsa310:red:usb";
>> +                       gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
>> +               };
>> +               green-copy {
>> +                       label = "nsa310:green:copy";
>> +                       gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
>> +               };
>> +               red-copy {
>> +                       label = "nsa310:red:copy";
>> +                       gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>;
>> +               };
>> +       };
>> +};
>> +
>> +&pciec {
>> +        status = "okay";
>> +};
>> +
>> +&pcie0 {
>> +       status = "okay";
>> +};
>> diff --git a/arch/arm/dts/kirkwood-nsa3x0-common.dtsi
b/arch/arm/dts/kirkwood-nsa3x0-common.dtsi
>> new file mode 100644
>> index 000000000000..2c4037b07282
>> --- /dev/null
>> +++ b/arch/arm/dts/kirkwood-nsa3x0-common.dtsi
>> @@ -0,0 +1,158 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +#include "kirkwood.dtsi"
>> +#include "kirkwood-6281.dtsi"
>> +
>> +/ {
>> +       model = "ZyXEL NSA310";
>> +
>> +       ocp@f1000000 {
>> +               pinctrl: pin-controller@10000 {
>> +
>> +                       pmx_usb_power: pmx-usb-power {
>> +                               marvell,pins = "mpp21";
>> +                               marvell,function = "gpio";
>> +                       };
>> +
>> +                       pmx_pwr_off: pmx-pwr-off {
>> +                               marvell,pins = "mpp48";
>> +                               marvell,function = "gpio";
>> +                       };
>> +
>> +                       pmx_btn_reset: pmx-btn-reset {
>> +                               marvell,pins = "mpp36";
>> +                               marvell,function = "gpio";
>> +                       };
>> +
>> +                       pmx_btn_copy: pmx-btn-copy {
>> +                               marvell,pins = "mpp37";
>> +                               marvell,function = "gpio";
>> +                       };
>> +
>> +                       pmx_btn_power: pmx-btn-power {
>> +                               marvell,pins = "mpp46";
>> +                               marvell,function = "gpio";
>> +                       };
>> +
>> +                       pmx_led_copy_green: pmx-led-copy-green {
>> +                               marvell,pins = "mpp39";
>> +                               marvell,function = "gpio";
>> +                       };
>> +
>> +                       pmx_led_copy_red: pmx-led-copy-red {
>> +                               marvell,pins = "mpp40";
>> +                               marvell,function = "gpio";
>> +                       };
>> +               };
>> +
>> +               serial@12000 {
>> +                       status = "ok";
>> +               };
>> +
>> +               sata@80000 {
>> +                       status = "okay";
>> +                       nr-ports = <2>;
>> +               };
>> +       };
>> +
>> +       gpio_poweroff {
>> +               compatible = "gpio-poweroff";
>> +               pinctrl-0 = <&pmx_pwr_off>;
>> +               pinctrl-names = "default";
>> +               gpios = <&gpio1 16 GPIO_ACTIVE_HIGH>;
>> +       };
>> +
>> +       gpio_keys {
>> +               compatible = "gpio-keys";
>> +               #address-cells = <1>;
>> +               #size-cells = <0>;
>> +               pinctrl-0 = <&pmx_btn_reset &pmx_btn_copy
&pmx_btn_power>;
>> +               pinctrl-names = "default";
>> +
>> +               power {
>> +                       label = "Power Button";
>> +                       linux,code = <KEY_POWER>;
>> +                       gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>;
>> +               };
>> +               copy {
>> +                       label = "Copy Button";
>> +                       linux,code = <KEY_COPY>;
>> +                       gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
>> +               };
>> +               reset {
>> +                       label = "Reset Button";
>> +                       linux,code = <KEY_RESTART>;
>> +                       gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
>> +               };
>> +       };
>> +
>> +
>> +       regulators {
>> +               compatible = "simple-bus";
>> +               #address-cells = <1>;
>> +               #size-cells = <0>;
>> +               pinctrl-0 = <&pmx_usb_power>;
>> +               pinctrl-names = "default";
>> +
>> +               usb0_power: regulator@1 {
>> +                       compatible = "regulator-fixed";
>> +                       reg = <1>;
>> +                       regulator-name = "USB Power";
>> +                       regulator-min-microvolt = <5000000>;
>> +                       regulator-max-microvolt = <5000000>;
>> +                       regulator-always-on;
>> +                       regulator-boot-on;
>> +                       gpio = <&gpio0 21 GPIO_ACTIVE_HIGH>;
>> +               };
>> +       };
>> +};
>> +
>> +&nand {
>> +       status = "okay";
>> +       chip-delay = <35>;
>> +
>> +       partition@0 {
>> +               label = "uboot";
>> +               reg = <0x0000000 0x0100000>;
>> +               read-only;
>> +       };
>> +       partition@100000 {
>> +               label = "uboot_env";
>> +               reg = <0x0100000 0x0080000>;
>> +       };
>> +       partition@180000 {
>> +               label = "key_store";
>> +               reg = <0x0180000 0x0080000>;
>> +       };
>> +       partition@200000 {
>> +               label = "info";
>> +               reg = <0x0200000 0x0080000>;
>> +       };
>> +       partition@280000 {
>> +               label = "etc";
>> +               reg = <0x0280000 0x0a00000>;
>> +       };
>> +       partition@c80000 {
>> +               label = "kernel_1";
>> +               reg = <0x0c80000 0x0a00000>;
>> +       };
>> +       partition@1680000 {
>> +               label = "rootfs1";
>> +               reg = <0x1680000 0x2fc0000>;
>> +       };
>> +       partition@4640000 {
>> +               label = "kernel_2";
>> +               reg = <0x4640000 0x0a00000>;
>> +       };
>> +       partition@5040000 {
>> +               label = "rootfs2";
>> +               reg = <0x5040000 0x2fc0000>;
>> +       };
>> +};
>> +
>> +&pciec {
>> +        status = "okay";
>> +};
>> +
>> +&pcie0 {
>> +       status = "okay";
>> +};
>> diff --git a/configs/nsa310s_defconfig b/configs/nsa310s_defconfig
>> index 2529687414fa..d3ea933d378b 100644
>> --- a/configs/nsa310s_defconfig
>> +++ b/configs/nsa310s_defconfig
>> @@ -2,6 +2,7 @@ CONFIG_ARM=y
>>   CONFIG_KIRKWOOD=y
>>   CONFIG_SYS_TEXT_BASE=0x600000
>>   CONFIG_TARGET_NSA310S=y
>> +CONFIG_DEFAULT_DEVICE_TREE="kirkwood-nsa310"
>>   CONFIG_BOOTDELAY=3
>>   # CONFIG_DISPLAY_BOARDINFO is not set
>>   CONFIG_HUSH_PARSER=y
>> @@ -21,6 +22,7 @@ CONFIG_CMD_JFFS2=y
>>   CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:0xe0000@0x0
(uboot),0x20000@0xe0000(uboot_env),0x100000@0x100000
(second_stage_uboot),-@0x200000(root)"
>>   CONFIG_CMD_UBI=y
>>   CONFIG_ISO_PARTITION=y
>> +CONFIG_OF_CONTROL=y
>>   CONFIG_ENV_IS_IN_NAND=y
>>   CONFIG_MVSATA_IDE=y
>>   # CONFIG_MMC is not set
>> @@ -29,4 +31,3 @@ CONFIG_USB=y
>>   CONFIG_USB_EHCI_HCD=y
>>   CONFIG_USB_STORAGE=y
>>   CONFIG_LZMA=y
>> -CONFIG_OF_LIBFDT=y
>> --
>> 2.17.0
Stefan Roese May 15, 2018, 12:09 p.m. UTC | #3
Hi Chris,

On 10.05.2018 02:51, Chris Packham wrote:
> On Thu, May 10, 2018 at 6:27 AM bodhi bodhi <mibodhi@gmail.com> wrote:
> 
>> Hi Chris,
> 
>> What we have in Linux mainline is Zyxel NSA310 (Marvell 88f6281). The
> Zyxel NSA310S (Marvell 88f6702) is actually a different box, which has not
> been mainlined yet.
> 
>> By the way, there are 3 variations of the Zyxel NSA310 box. This box has
> some combination of: red USB Led, lm85 sensor, adt7476 sensor that make
> them slighly different. The mainlined NSA310 DTS is for the one with
> adt7476 sensor.
> 
> 
> Ah OK. I did see 2 boards in the kernel, this was one of the "educated
> guesses" which turns out not to to be a good guess. For now I'll just drop
> this conversion from the series.

Yes, that makes sense. Please do so. We can always get the correct
version back into mainline, once we have Kirkwood "enabled" in a
modern way.

What is your plan with this Kirkwood revival? Do you plan to send
updates to enable DM for those boards and perhaps some drivers as
well? How should I proceed with this DT patch-set?

Thanks,
Stefan
Chris Packham May 16, 2018, 8:23 a.m. UTC | #4
(adding back list and cc, my bad replied from a mobile device)

On Wed, May 16, 2018 at 8:10 PM Stefan Roese <sr@denx.de> wrote:

> Hi Chris,

> On 16.05.2018 09:58, Chris Packham wrote:
> > Hi Stefan,
> >
> > On Wed, 16 May 2018, 12:09 AM Stefan Roese, <sr@denx.de
> > <mailto:sr@denx.de>> wrote:
> >
> >     Hi Chris,
> >
> >     On 10.05.2018 02:51, Chris Packham wrote:
> >      > On Thu, May 10, 2018 at 6:27 AM bodhi bodhi <mibodhi@gmail.com
> >     <mailto:mibodhi@gmail.com>> wrote:
> >      >
> >      >> Hi Chris,
> >      >
> >      >> What we have in Linux mainline is Zyxel NSA310 (Marvell
> >     88f6281). The
> >      > Zyxel NSA310S (Marvell 88f6702) is actually a different box,
> >     which has not
> >      > been mainlined yet.
> >      >
> >      >> By the way, there are 3 variations of the Zyxel NSA310 box. This
> >     box has
> >      > some combination of: red USB Led, lm85 sensor, adt7476 sensor
> >     that make
> >      > them slighly different. The mainlined NSA310 DTS is for the one
with
> >      > adt7476 sensor.
> >      >
> >      >
> >      > Ah OK. I did see 2 boards in the kernel, this was one of the
> >     "educated
> >      > guesses" which turns out not to to be a good guess. For now I'll
> >     just drop
> >      > this conversion from the series.
> >
> >     Yes, that makes sense. Please do so. We can always get the correct
> >     version back into mainline, once we have Kirkwood "enabled" in a
> >     modern way.
> >
> >     What is your plan with this Kirkwood revival? Do you plan to send
> >     updates to enable DM for those boards and perhaps some drivers as
> >     well? How should I proceed with this DT patch-set?
> >
> >
> > I was about to ask you.
> >
> > I was thinking about sending a v2 omitting nas310s, but if that's the
> > only change you could just omit it at your end.

> So for a start its good that I apply these patches, omitting the nas310s
> one?

Yes thanks. Aside from the commend from Bodhi I haven't seen any other
feedback. Not sure if you wanted to wait a bit longer.

> > Then I've got another set lined up for the boards using spi flash which
> > lays the groundwork for Jagan's spi changes. I may as well switch over
> > the i2c configs since the driver already supports DM. I'll probably send
> > those later this week.
> >
> > If i get really enthusiastic i might give converting the mvgbe driver to
> > DM a try but the hardware I have for testing is complicated.

> Sounds like a plan. Thanks for working on this.

No problem I'm keen to see Kirkwood hang around.
diff mbox series

Patch

diff --git a/arch/arm/dts/kirkwood-nsa310.dts b/arch/arm/dts/kirkwood-nsa310.dts
new file mode 100644
index 000000000000..9b861c2e76c5
--- /dev/null
+++ b/arch/arm/dts/kirkwood-nsa310.dts
@@ -0,0 +1,139 @@ 
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include "kirkwood-nsa3x0-common.dtsi"
+
+/ {
+	compatible = "zyxel,nsa310", "marvell,kirkwood-88f6281", "marvell,kirkwood";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x10000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200";
+		stdout-path = &uart0;
+	};
+
+	ocp@f1000000 {
+		pinctrl: pin-controller@10000 {
+			pinctrl-0 = <&pmx_unknown>;
+			pinctrl-names = "default";
+
+			pmx_led_esata_green: pmx-led-esata-green {
+				marvell,pins = "mpp12";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_esata_red: pmx-led-esata-red {
+				marvell,pins = "mpp13";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_usb_green: pmx-led-usb-green {
+				marvell,pins = "mpp15";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_usb_red: pmx-led-usb-red {
+				marvell,pins = "mpp16";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_sys_green: pmx-led-sys-green {
+				marvell,pins = "mpp28";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_sys_red: pmx-led-sys-red {
+				marvell,pins = "mpp29";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_hdd_green: pmx-led-hdd-green {
+				marvell,pins = "mpp41";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_hdd_red: pmx-led-hdd-red {
+				marvell,pins = "mpp42";
+				marvell,function = "gpio";
+			};
+
+			pmx_unknown: pmx-unknown {
+				marvell,pins = "mpp44";
+				marvell,function = "gpio";
+			};
+
+		};
+
+		i2c@11000 {
+			status = "okay";
+
+			adt7476: adt7476a@2e {
+				compatible = "adi,adt7476";
+				reg = <0x2e>;
+			};
+		};
+	};
+
+	gpio-leds {
+		compatible = "gpio-leds";
+		pinctrl-0 = <&pmx_led_esata_green &pmx_led_esata_red
+			     &pmx_led_usb_green &pmx_led_usb_red
+			     &pmx_led_sys_green &pmx_led_sys_red
+			     &pmx_led_copy_green &pmx_led_copy_red
+			     &pmx_led_hdd_green &pmx_led_hdd_red>;
+		pinctrl-names = "default";
+
+		green-sys {
+			label = "nsa310:green:sys";
+			gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>;
+		};
+		red-sys {
+			label = "nsa310:red:sys";
+			gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>;
+		};
+		green-hdd {
+			label = "nsa310:green:hdd";
+			gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>;
+		};
+		red-hdd {
+			label = "nsa310:red:hdd";
+			gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
+		};
+		green-esata {
+			label = "nsa310:green:esata";
+			gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
+		};
+		red-esata {
+			label = "nsa310:red:esata";
+			gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
+		};
+		green-usb {
+			label = "nsa310:green:usb";
+			gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
+		};
+		red-usb {
+			label = "nsa310:red:usb";
+			gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
+		};
+		green-copy {
+			label = "nsa310:green:copy";
+			gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
+		};
+		red-copy {
+			label = "nsa310:red:copy";
+			gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>;
+		};
+	};
+};
+
+&pciec {
+        status = "okay";
+};
+
+&pcie0 {
+	status = "okay";
+};
diff --git a/arch/arm/dts/kirkwood-nsa3x0-common.dtsi b/arch/arm/dts/kirkwood-nsa3x0-common.dtsi
new file mode 100644
index 000000000000..2c4037b07282
--- /dev/null
+++ b/arch/arm/dts/kirkwood-nsa3x0-common.dtsi
@@ -0,0 +1,158 @@ 
+// SPDX-License-Identifier: GPL-2.0
+#include "kirkwood.dtsi"
+#include "kirkwood-6281.dtsi"
+
+/ {
+	model = "ZyXEL NSA310";
+
+	ocp@f1000000 {
+		pinctrl: pin-controller@10000 {
+
+			pmx_usb_power: pmx-usb-power {
+				marvell,pins = "mpp21";
+				marvell,function = "gpio";
+			};
+
+			pmx_pwr_off: pmx-pwr-off {
+				marvell,pins = "mpp48";
+				marvell,function = "gpio";
+			};
+
+			pmx_btn_reset: pmx-btn-reset {
+				marvell,pins = "mpp36";
+				marvell,function = "gpio";
+			};
+
+			pmx_btn_copy: pmx-btn-copy {
+				marvell,pins = "mpp37";
+				marvell,function = "gpio";
+			};
+
+			pmx_btn_power: pmx-btn-power {
+				marvell,pins = "mpp46";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_copy_green: pmx-led-copy-green {
+				marvell,pins = "mpp39";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_copy_red: pmx-led-copy-red {
+				marvell,pins = "mpp40";
+				marvell,function = "gpio";
+			};
+		};
+
+		serial@12000 {
+			status = "ok";
+		};
+
+		sata@80000 {
+			status = "okay";
+			nr-ports = <2>;
+		};
+	};
+
+	gpio_poweroff {
+		compatible = "gpio-poweroff";
+		pinctrl-0 = <&pmx_pwr_off>;
+		pinctrl-names = "default";
+		gpios = <&gpio1 16 GPIO_ACTIVE_HIGH>;
+	};
+
+	gpio_keys {
+		compatible = "gpio-keys";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		pinctrl-0 = <&pmx_btn_reset &pmx_btn_copy &pmx_btn_power>;
+		pinctrl-names = "default";
+
+		power {
+			label = "Power Button";
+			linux,code = <KEY_POWER>;
+			gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>;
+		};
+		copy {
+			label = "Copy Button";
+			linux,code = <KEY_COPY>;
+			gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
+		};
+		reset {
+			label = "Reset Button";
+			linux,code = <KEY_RESTART>;
+			gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
+		};
+	};
+
+
+	regulators {
+		compatible = "simple-bus";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		pinctrl-0 = <&pmx_usb_power>;
+		pinctrl-names = "default";
+
+		usb0_power: regulator@1 {
+			compatible = "regulator-fixed";
+			reg = <1>;
+			regulator-name = "USB Power";
+			regulator-min-microvolt = <5000000>;
+			regulator-max-microvolt = <5000000>;
+			regulator-always-on;
+			regulator-boot-on;
+			gpio = <&gpio0 21 GPIO_ACTIVE_HIGH>;
+		};
+	};
+};
+
+&nand {
+	status = "okay";
+	chip-delay = <35>;
+
+	partition@0 {
+		label = "uboot";
+		reg = <0x0000000 0x0100000>;
+		read-only;
+	};
+	partition@100000 {
+		label = "uboot_env";
+		reg = <0x0100000 0x0080000>;
+	};
+	partition@180000 {
+		label = "key_store";
+		reg = <0x0180000 0x0080000>;
+	};
+	partition@200000 {
+		label = "info";
+		reg = <0x0200000 0x0080000>;
+	};
+	partition@280000 {
+		label = "etc";
+		reg = <0x0280000 0x0a00000>;
+	};
+	partition@c80000 {
+		label = "kernel_1";
+		reg = <0x0c80000 0x0a00000>;
+	};
+	partition@1680000 {
+		label = "rootfs1";
+		reg = <0x1680000 0x2fc0000>;
+	};
+	partition@4640000 {
+		label = "kernel_2";
+		reg = <0x4640000 0x0a00000>;
+	};
+	partition@5040000 {
+		label = "rootfs2";
+		reg = <0x5040000 0x2fc0000>;
+	};
+};
+
+&pciec {
+        status = "okay";
+};
+
+&pcie0 {
+	status = "okay";
+};
diff --git a/configs/nsa310s_defconfig b/configs/nsa310s_defconfig
index 2529687414fa..d3ea933d378b 100644
--- a/configs/nsa310s_defconfig
+++ b/configs/nsa310s_defconfig
@@ -2,6 +2,7 @@  CONFIG_ARM=y
 CONFIG_KIRKWOOD=y
 CONFIG_SYS_TEXT_BASE=0x600000
 CONFIG_TARGET_NSA310S=y
+CONFIG_DEFAULT_DEVICE_TREE="kirkwood-nsa310"
 CONFIG_BOOTDELAY=3
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_HUSH_PARSER=y
@@ -21,6 +22,7 @@  CONFIG_CMD_JFFS2=y
 CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:0xe0000@0x0(uboot),0x20000@0xe0000(uboot_env),0x100000@0x100000(second_stage_uboot),-@0x200000(root)"
 CONFIG_CMD_UBI=y
 CONFIG_ISO_PARTITION=y
+CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_NAND=y
 CONFIG_MVSATA_IDE=y
 # CONFIG_MMC is not set
@@ -29,4 +31,3 @@  CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
 CONFIG_LZMA=y
-CONFIG_OF_LIBFDT=y