Skip to contentSkip to conversation

Zyxel NSA310S NAS : convert to Driver Model.

PATCH In review Tony Dinh 2 participants 12 messages Jul 1, 2021 – Jul 19, 2021 Arm (32-bit)

lore
Share & tools
lore

Tony Dinh

author
#0 lore raw

cover Zyxel NSA310S NAS : convert to Driver Model.

- Add device tree kirkwood-nsa310s.dts
- Add DM_USB, DM_ETH, DM_SATA and associated configs to nsa310s_defconfig
- Move some miscellaneous configs from board file to nsa310s_defconfig
- Replace old device name "egiga0" with Ethernet PHY name from device tree kirkwood.dtsi
- Removed IDE, and add SATA configs in board file nsa310s.c

Tony Dinh (4):
NSA310S : Add device tree DTS for Zyxel NSA310S board NSA310S : Add DM USB, DM Ethernet, and DM SATA configs NSA310S : Use Ethernet PHY name from device tree NSA310S : Add DM SATA configs

 arch/arm/dts/Makefile             |   1 +
 arch/arm/dts/kirkwood-nsa310s.dts | 318 ++++++++++++++++++++++++++++++
 board/zyxel/nsa310s/nsa310s.c     |  15 +-
 configs/nsa310s_defconfig         |  12 +-
 include/configs/nsa310s.h         |   9 +-
 5 files changed, 342 insertions(+), 13 deletions(-)
 create mode 100644 arch/arm/dts/kirkwood-nsa310s.dts
Signature · 1 line
2.20.1
author
#1 lore raw

PATCH 1/4 NSA310S : Add device tree DTS for Zyxel NSA310S board

Add device tree kirkwood-nsa310s.dts for Zyxel NSA310S board to convert to Driver Model.

---

 arch/arm/dts/Makefile             |   1 +
 arch/arm/dts/kirkwood-nsa310s.dts | 318 ++++++++++++++++++++++++++++++
 2 files changed, 319 insertions(+)
 create mode 100644 arch/arm/dts/kirkwood-nsa310s.dts
arch/arm/dts/Makefile +1 -0
index 096068261d..0ff77c8b3d 100644
@@ -56,6 +56,7 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += \
 	kirkwood-ns2lite.dtb \
 	kirkwood-ns2max.dtb \
 	kirkwood-ns2mini.dtb \
+	kirkwood-nsa310s.dtb \
 	kirkwood-openrd-base.dtb \
 	kirkwood-openrd-client.dtb \
 	kirkwood-openrd-ultimate.dtb \
arch/arm/dts/kirkwood-nsa310s.dts new file +318 -0

318 lines not on this page · raw message

Signature · 1 line
2.20.1
Reviewed-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] NSA310S : Add device tree DTS for Zyxel NSA310S board

Quoted 4 lines · Tony Dinh

Add device tree kirkwood-nsa310s.dts for Zyxel NSA310S board to convert to Driver Model.

Thanks,
Stefan

Quoted 334 lines

---

  arch/arm/dts/Makefile             |   1 +
  arch/arm/dts/kirkwood-nsa310s.dts | 318 ++++++++++++++++++++++++++++++
  2 files changed, 319 insertions(+)

create mode 100644 arch/arm/dts/kirkwood-nsa310s.dts

arch/arm/dts/Makefile +1 -0
index 096068261d..0ff77c8b3d 100644
@@ -56,6 +56,7 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += \
  	kirkwood-ns2lite.dtb \
  	kirkwood-ns2max.dtb \
  	kirkwood-ns2mini.dtb \
+	kirkwood-nsa310s.dtb \
  	kirkwood-openrd-base.dtb \
  	kirkwood-openrd-client.dtb \
  	kirkwood-openrd-ultimate.dtb \
arch/arm/dts/kirkwood-nsa310s.dts new file +308 -0
new file mode 100644
index 0000000000..e1c9c9080c
@@ -0,0 +1,318 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device tree file for the Zyxel NSA 310S NAS box.
+ *
+ * Copyright (c) 2015-2021, Tony Dinh <[email protected]>
+ *
+ * Based on
+ * Copyright (c) 2014, Adam Baker <[email protected]>
+ * Based upon the board setup file created by Peter Schildmann
+ */
+/dts-v1/;
+
+#include "kirkwood.dtsi"
+#include "kirkwood-6281.dtsi"
+
+/ {
+	model = "Zyxel NSA310S";
+	compatible = "zyxel,nsa320s", "marvell,kirkwood-88f6702", "marvell,kirkwood";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x10000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200";
+		stdout-path = &uart0;
+	};
+
+	ocp@f1000000 {
+		pinctrl: pin-controller@10000 {
+			pinctrl-names = "default";
+
+			pmx_sata0: pmx-sata0 {
+				marvell,pins ;
+				marvell,function = "sata0";
+			};
+
+			pmx_sata1: pmx-sata1 {
+				marvell,pins ;
+				marvell,function = "sata1";
+			};
+
+			pmx_usb_power: pmx-usb-power {
+				marvell,pins = "mpp21";
+				marvell,function = "gpio";
+			};
+
+			pmx_pwr_off: pmx-pwr-off {
+				marvell,pins = "mpp27";
+				marvell,function = "gpio";
+			};
+
+			pmx_btn_reset: pmx-btn-reset {
+				marvell,pins = "mpp24";
+				marvell,function = "gpio";
+			};
+
+			pmx_btn_copy: pmx-btn-copy {
+				marvell,pins = "mpp25";
+				marvell,function = "gpio";
+			};
+
+			pmx_btn_power: pmx-btn-power {
+				marvell,pins = "mpp26";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_hdd2_green: pmx-led-hdd2-green {
+				marvell,pins = "mpp34";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_hdd2_red: pmx-led-hdd2-red {
+				marvell,pins = "mpp12";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_usb_green: pmx-led-usb-green {
+				marvell,pins = "mpp15";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_copy_green: pmx-led-copy-green {
+				marvell,pins = "mpp22";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_copy_red: pmx-led-copy-red {
+				marvell,pins = "mpp23";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_sys_green: pmx-led-sys-green {
+				marvell,pins = "mpp28";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_sys_orange: pmx-led-sys-orange {
+				marvell,pins = "mpp29";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_hdd1_green: pmx-led-hdd1-green {
+				marvell,pins = "mpp16";
+				marvell,function = "gpio";
+			};
+
+			pmx_led_hdd1_red: pmx-led-hdd1-red {
+				marvell,pins = "mpp13";
+				marvell,function = "gpio";
+			};
+
+			pmx_pwr_sata1: pmx-pwr-sata1 {
+				marvell,pins = "mpp33";
+				marvell,function = "gpio";
+			};
+		};
+
+		serial@12000 {
+			status = "ok";
+		};
+
+		sata@80000 {
+			status = "okay";
+			nr-ports = <1>;
+		};
+
+		rtc@10300 {
+			status = "disabled";
+		};
+
+		i2c@11000 {
+			status = "okay";
+			ht1382: rtc@68 {
+				compatible = "htk,ht1382";
+				reg = <0x68>;
+			};
+		};
+	};
+
+	regulators {
+		compatible = "simple-bus";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&pmx_usb_power &pmx_pwr_sata1>;
+
+		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;
+			enable-active-high;
+			gpio = <&gpio0 21 GPIO_ACTIVE_HIGH>;
+		};
+
+		sata1_power: regulator@2 {
+			compatible = "regulator-fixed";
+			reg = <2>;
+			regulator-name = "SATA1 Power";
+			regulator-min-microvolt = <5000000>;
+			regulator-max-microvolt = <5000000>;
+			regulator-always-on;
+			regulator-boot-on;
+			enable-active-high;
+			gpio = <&gpio1 1 GPIO_ACTIVE_HIGH>;
+		};
+	};
+
+	gpio_poweroff {
+		compatible = "gpio-poweroff";
+		pinctrl-0 = <&pmx_pwr_off>;
+		pinctrl-names = "default";
+		gpios = <&gpio0 27 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";
+
+		button@1 {
+			label = "Power Button";
+			linux,code = <KEY_POWER>;
+			gpios = <&gpio0 26 GPIO_ACTIVE_HIGH>;
+		};
+		button@2 {
+			label = "Copy Button";
+			linux,code = <KEY_COPY>;
+			gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
+		};
+		button@3 {
+			label = "Reset Button";
+			linux,code = <KEY_RESTART>;
+			gpios = <&gpio0 24 GPIO_ACTIVE_LOW>;
+		};
+	};
+
+	gpio-leds {
+		compatible = "gpio-leds";
+		pinctrl-0 = <&pmx_led_hdd2_green &pmx_led_hdd2_red
+			     &pmx_led_usb_green
+			     &pmx_led_sys_green &pmx_led_sys_orange
+			     &pmx_led_copy_green &pmx_led_copy_red
+			     &pmx_led_hdd1_green &pmx_led_hdd1_red>;
+		pinctrl-names = "default";
+
+		green-sys {
+			label = "nsa310s:green:sys";
+			gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>;
+			linux,default-trigger = "default-on";
+		};
+		orange-sys {
+			label = "nsa310s:orange:sys";
+			gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>;
+		};
+		green-hdd1 {
+			label = "nsa310s:green:hdd1";
+			gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
+		};
+		red-hdd1 {
+			label = "nsa310s:red:hdd1";
+			gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
+		};
+		green-hdd2 {
+			label = "nsa310s:green:hdd2";
+			gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
+		};
+		red-hdd2 {
+			label = "nsa310s:red:hdd2";
+			gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
+		};
+		green-usb {
+			label = "nsa310s:green:usb";
+			gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
+		};
+		green-copy {
+			label = "nsa310s:green:copy";
+			gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>;
+			linux,default-trigger = "ide-disk";
+		};
+		red-copy {
+			label = "nsa310s:red:copy";
+			gpios = <&gpio0 23 GPIO_ACTIVE_HIGH>;
+		};
+	};
+};
+
+&nand {
+	status = "okay";
+	chip-delay = <35>;
+
+	partition@0 {
+		label = "uboot";
+		reg = <0x0000000 0x0100000>;
+	};
+	partition@100000 {
+		label = "stock_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>;
+	};
+};
+
+&mdio {
+	status = "okay";
+	ethphy0: ethernet-phy@1 {
+		compatible = "marvell,88e1510";
+		reg = <1>;
+	};
+};
+
+&eth0 {
+	status = "okay";
+	ethernet0-port@0 {
+		phy-handle = <&ethphy0>;

arch/arm/dts/kirkwood-nsa310s.dts line 318

Quoted 10 lines
arch/arm/dts/kirkwood-nsa310s.dts new file +10 -0
+	};
+};
+
+&pciec {
+	status = "okay";
+};
+
+&pcie0 {
+	status = "okay";
+};

Viele Grüße,
Stefan

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
author
#3 lore raw

PATCH 2/4 NSA310S : Add DM USB, DM Ethernet, and DM SATA configs

In reply to Tony Dinh

Convert to Driver Model.

- Add DM USB, DM Ethernet, and DM SATA configs to nsa310s_defconfig
- Add CONFIG_DEFAULT_DEVICE_TREE to nsa310s_defconfig
- Move CONFIG_ENV_SECT_SIZE from board file to nsa310s_defconfig
- Add CONFIG_IDENT_STRING, and CONFIG_NET_RANDOM_ETHADDR to nsa310s_defconfig

---

 configs/nsa310s_defconfig | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
configs/nsa310s_defconfig +11 -1
index e4cf1c470e..fac0322e2b 100644
@@ -7,14 +7,16 @@ CONFIG_NR_DRAM_BANKS=2
 CONFIG_TARGET_NSA310S=y
 CONFIG_ENV_SIZE=0x20000
 CONFIG_ENV_OFFSET=0xE0000
+CONFIG_ENV_SECT_SIZE=0x20000
+CONFIG_DEFAULT_DEVICE_TREE="kirkwood-nsa310s"
 CONFIG_BOOTDELAY=3
 CONFIG_USE_PREBOOT=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PROMPT="nsa310s => "
+CONFIG_IDENT_STRING="\nZyXEL NSA310S/320S 1/2-Bay Power Media Server"
 CONFIG_CMD_BOOTZ=y
 # CONFIG_CMD_FLASH is not set
-CONFIG_CMD_IDE=y
 CONFIG_CMD_NAND=y
 CONFIG_CMD_USB=y
 # CONFIG_CMD_SETEXPR is not set
@@ -44,3 +46,11 @@ CONFIG_USB_STORAGE=y
 CONFIG_LZMA=y
 CONFIG_BZIP2=y
 CONFIG_OF_LIBFDT=y
+CONFIG_DM=y
+CONFIG_BLK=y
+CONFIG_OF_CONTROL=y
+CONFIG_DM_USB=y
+CONFIG_DM_ETH=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_CMD_SATA=y
+CONFIG_SATA_MV=y
Signature · 1 line
2.20.1
Reviewed-by on v1 2/4
#4 lore raw

Re: [PATCH 2/4] NSA310S : Add DM USB, DM Ethernet, and DM SATA configs

Quoted 9 lines · Tony Dinh

Convert to Driver Model.

- Add DM USB, DM Ethernet, and DM SATA configs to nsa310s_defconfig
- Add CONFIG_DEFAULT_DEVICE_TREE to nsa310s_defconfig
- Move CONFIG_ENV_SECT_SIZE from board file to nsa310s_defconfig
- Add CONFIG_IDENT_STRING, and CONFIG_NET_RANDOM_ETHADDR to nsa310s_defconfig

Thanks,
Stefan

Quoted 30 lines

---

  configs/nsa310s_defconfig | 12 +++++++++++-
  1 file changed, 11 insertions(+), 1 deletion(-)
configs/nsa310s_defconfig +3 -1
index e4cf1c470e..fac0322e2b 100644
@@ -7,14 +7,16 @@ CONFIG_NR_DRAM_BANKS=2
  CONFIG_TARGET_NSA310S=y
  CONFIG_ENV_SIZE=0x20000
  CONFIG_ENV_OFFSET=0xE0000
+CONFIG_ENV_SECT_SIZE=0x20000
+CONFIG_DEFAULT_DEVICE_TREE="kirkwood-nsa310s"
  CONFIG_BOOTDELAY=3
  CONFIG_USE_PREBOOT=y
  # CONFIG_DISPLAY_BOARDINFO is not set
  CONFIG_HUSH_PARSER=y
  CONFIG_SYS_PROMPT="nsa310s => "
+CONFIG_IDENT_STRING="\nZyXEL NSA310S/320S 1/2-Bay Power Media Server"
  CONFIG_CMD_BOOTZ=y
  # CONFIG_CMD_FLASH is not set
-CONFIG_CMD_IDE=y
  CONFIG_CMD_NAND=y
  CONFIG_CMD_USB=y
  # CONFIG_CMD_SETEXPR is not set
@@ -44,3 +46,11 @@ CONFIG_USB_STORAGE=y
  CONFIG_LZMA=y

configs/nsa310s_defconfig CONFIG_USB_STORAGE=y · line 56

Quoted 10 lines
configs/nsa310s_defconfig +8 -0
  CONFIG_BZIP2=y
  CONFIG_OF_LIBFDT=y
+CONFIG_DM=y
+CONFIG_BLK=y
+CONFIG_OF_CONTROL=y
+CONFIG_DM_USB=y
+CONFIG_DM_ETH=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_CMD_SATA=y
+CONFIG_SATA_MV=y

Viele Grüße,
Stefan

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
author
#5 lore raw

PATCH 3/4 NSA310S : Use Ethernet PHY name from device tree

In reply to Tony Dinh

In DM Ethernet, the old "egiga0" name is no longer valid, so replace it with Ethernet PHY name from device tree.

---

 board/zyxel/nsa310s/nsa310s.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
board/zyxel/nsa310s/nsa310s.c +7 -8
index cd4a7723b1..29aded1910 100644
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
+ * Copyright (C) 2021 Tony Dinh <[email protected]>
  * Copyright (C) 2015
  * Gerald Kerma <[email protected]>
  * Tony Dinh <[email protected]>
@@ -81,22 +82,18 @@ int board_init(void)
 	return 0;
 }
 
+#define PHY_ADR	1
+
 #ifdef CONFIG_RESET_PHY_R
 void reset_phy(void)
 {
 	u16 reg;
-	u16 phyaddr;
-	char *name = "egiga0";
+	u16 phyaddr = PHY_ADR;
+	char *name = "ethernet-controller@72000";
 
 	if (miiphy_set_current_dev(name))
 		return;
 
-	/* read PHY dev address */
-	if (miiphy_read(name, 0xee, 0xee, (u16 *) &phyaddr)) {
-		printf("could not read PHY dev address\n");
-		return;
-	}
-
 	/* set RGMII delay */
 	miiphy_write(name, phyaddr, MV88E1318_PGADR_REG, MV88E1318_MAC_CTRL_PG);
 	miiphy_read(name, phyaddr, MV88E1318_MAC_CTRL_REG, &reg);
@@ -131,5 +128,7 @@ void reset_phy(void)
 	/* downshift */
 	miiphy_write(name, phyaddr, 0x10, 0x3860);
 	miiphy_write(name, phyaddr, 0x0, 0x9140);
+
+	printf("MV88E1318 PHY initialized on %s\n", name);
 }
 #endif /* CONFIG_RESET_PHY_R */
Signature · 1 line
2.20.1
#6 lore raw

Re: [PATCH 3/4] NSA310S : Use Ethernet PHY name from device tree

Quoted 14 lines · Tony Dinh

In DM Ethernet, the old "egiga0" name is no longer valid, so replace it with Ethernet PHY name from device tree.

---

  board/zyxel/nsa310s/nsa310s.c | 15 +++++++--------
  1 file changed, 7 insertions(+), 8 deletions(-)
board/zyxel/nsa310s/nsa310s.c +0 -0
index cd4a7723b1..29aded1910 100644

board/zyxel/nsa310s/nsa310s.c line 3

Quoted 3 lines
board/zyxel/nsa310s/nsa310s.c +1 -0
@@ -1,5 +1,6 @@
  // SPDX-License-Identifier: GPL-2.0+
  /*
+ * Copyright (C) 2021 Tony Dinh <[email protected]>

AFAIU, just changing a few lines, as this patch does, does not justify to add a copyright notice to this file.

board/zyxel/nsa310s/nsa310s.c int board_init(void) · line 85

Quoted 8 lines
board/zyxel/nsa310s/nsa310s.c +1 -0
   * Copyright (C) 2015
   * Gerald Kerma <[email protected]>
   * Tony Dinh <[email protected]>
@@ -81,22 +82,18 @@ int board_init(void)
  	return 0;
  }
 
+#define PHY_ADR	1

You should be able to read this PHY address from the device-tree now. No need to define this here again.

Thanks,
Stefan

Quoted 24 lines
board/zyxel/nsa310s/nsa310s.c +3 -8
+
  #ifdef CONFIG_RESET_PHY_R
  void reset_phy(void)
  {
  	u16 reg;
-	u16 phyaddr;
-	char *name = "egiga0";
+	u16 phyaddr = PHY_ADR;
+	char *name = "ethernet-controller@72000";
 
  	if (miiphy_set_current_dev(name))
  		return;
 
-	/* read PHY dev address */
-	if (miiphy_read(name, 0xee, 0xee, (u16 *) &phyaddr)) {
-		printf("could not read PHY dev address\n");
-		return;
-	}
-
  	/* set RGMII delay */
  	miiphy_write(name, phyaddr, MV88E1318_PGADR_REG, MV88E1318_MAC_CTRL_PG);
  	miiphy_read(name, phyaddr, MV88E1318_MAC_CTRL_REG, &reg);

board/zyxel/nsa310s/nsa310s.c void reset_phy(void) · line 134

Quoted 7 lines
board/zyxel/nsa310s/nsa310s.c +2 -0
@@ -131,5 +128,7 @@ void reset_phy(void)
  	/* downshift */
  	miiphy_write(name, phyaddr, 0x10, 0x3860);
  	miiphy_write(name, phyaddr, 0x0, 0x9140);
+
+	printf("MV88E1318 PHY initialized on %s\n", name);
  }
  #endif /* CONFIG_RESET_PHY_R */

Viele Grüße,
Stefan

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#7 lore raw

Re: [PATCH 3/4] NSA310S : Use Ethernet PHY name from device tree

Hi Tony,

Quoted 10 lines · Stefan Roese
Quoted 9 lines · Tony Dinh

In DM Ethernet, the old "egiga0" name is no longer valid, so replace it with Ethernet PHY name from device tree.

---

  board/zyxel/nsa310s/nsa310s.c | 15 +++++++--------

  1 file changed, 7 insertions(+), 8 deletions(-)
Quoted 11 lines

board/zyxel/nsa310s/nsa310s.c line 3

Quoted 8 lines
board/zyxel/nsa310s/nsa310s.c +1 -0
index cd4a7723b1..29aded1910 100644
@@ -1,5 +1,6 @@
   // SPDX-License-Identifier: GPL-2.0+
   /*
+ * Copyright (C) 2021 Tony Dinh <[email protected]>

AFAIU, just changing a few lines, as this patch does, does not justify to add a copyright notice to this file.

I just noticed that you already are present in the copyright notice below. I suggest to change this in a way, so that your name only occurs once, like:

* Copyright (C) 2015, 2021 Tony Dinh <[email protected]>

Does this make sense?

Thanks,
Stefan

Quoted 39 lines

board/zyxel/nsa310s/nsa310s.c int board_init(void) · line 84

Quoted 7 lines
board/zyxel/nsa310s/nsa310s.c +1 -0
    * Copyright (C) 2015
    * Gerald Kerma <[email protected]>
    * Tony Dinh <[email protected]>
@@ -81,22 +82,18 @@ int board_init(void)
       return 0;
   }
+#define PHY_ADR    1

You should be able to read this PHY address from the device-tree now. No need to define this here again.

Thanks,
Stefan

Quoted 25 lines
board/zyxel/nsa310s/nsa310s.c +4 -8
+
   #ifdef CONFIG_RESET_PHY_R
   void reset_phy(void)
   {
       u16 reg;
-    u16 phyaddr;
-    char *name = "egiga0";
+    u16 phyaddr = PHY_ADR;
+    char *name = "ethernet-controller@72000";
       if (miiphy_set_current_dev(name))
           return;
-    /* read PHY dev address */
-    if (miiphy_read(name, 0xee, 0xee, (u16 *) &phyaddr)) {
-        printf("could not read PHY dev address\n");
-        return;
-    }
-
       /* set RGMII delay */
       miiphy_write(name, phyaddr, MV88E1318_PGADR_REG, MV88E1318_MAC_CTRL_PG);
       miiphy_read(name, phyaddr, MV88E1318_MAC_CTRL_REG, &reg);
@@ -131,5 +128,7 @@ void reset_phy(void)
       /* downshift */
       miiphy_write(name, phyaddr, 0x10, 0x3860);
       miiphy_write(name, phyaddr, 0x0, 0x9140);
+
Quoted 9 lines

board/zyxel/nsa310s/nsa310s.c void reset_phy(void) · line 134

Quoted 4 lines
board/zyxel/nsa310s/nsa310s.c +1 -0
+    printf("MV88E1318 PHY initialized on %s\n", name);
   }
   #endif /* CONFIG_RESET_PHY_R */

Viele Grüße,
Stefan

Viele Grüße,
Stefan

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#8 lore raw

Re: [PATCH 3/4] NSA310S : Use Ethernet PHY name from device tree

Hi Stefan,

Quoted 27 lines · Stefan Roese

Hi Tony,

Quoted 10 lines · Stefan Roese
Quoted 9 lines · Tony Dinh

In DM Ethernet, the old "egiga0" name is no longer valid, so replace it with Ethernet PHY name from device tree.

---

  board/zyxel/nsa310s/nsa310s.c | 15 +++++++--------
  1 file changed, 7 insertions(+), 8 deletions(-)
Quoted 12 lines

board/zyxel/nsa310s/nsa310s.c line 3

Quoted 9 lines
board/zyxel/nsa310s/nsa310s.c +1 -0
index cd4a7723b1..29aded1910 100644
@@ -1,5 +1,6 @@
  // SPDX-License-Identifier: GPL-2.0+
  /*
+ * Copyright (C) 2021 Tony Dinh <[email protected]>

AFAIU, just changing a few lines, as this patch does, does not justify to add a copyright notice to this file.

Quoted 7 lines

I just noticed that you already are present in the copyright notice below. I suggest to change this in a way, so that your name only occurs once, like:

* Copyright (C) 2015, 2021 Tony Dinh <[email protected]>

Does this make sense?

Definitely! I will correct the copyright for this patch and also the copyright in patch 4/4 using this convention.

Quoted 14 lines

Thanks,
Stefan

Quoted 10 lines

board/zyxel/nsa310s/nsa310s.c int board_init(void) · line 84

Quoted 7 lines
board/zyxel/nsa310s/nsa310s.c +1 -0
   * Copyright (C) 2015
   * Gerald Kerma <[email protected]>
   * Tony Dinh <[email protected]>
@@ -81,22 +82,18 @@ int board_init(void)
      return 0;
  }
+#define PHY_ADR    1

You should be able to read this PHY address from the device-tree now. No need to define this here again.

I don't know yet how to extract this info from the device tree nodes (I am familiar with this in Linux kernel, but at first glance it seems like u-boot fdt library is different).

So if it is OK, perhaps I could send in another patch for this correction after this DM conversion is done.

Thanks,
Tony

author
#9 lore raw

PATCH 4/4 NSA310S : Add DM SATA configs

In reply to Tony Dinh

Enable DM SATA, removed IDE driver, and add SATA MV driver.

---

 include/configs/nsa310s.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
include/configs/nsa310s.h +5 -4
index e38c65a485..94f293de90 100644
@@ -1,5 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
+ * Copyright (C) 2021 Tony Dinh <[email protected]>
  * Copyright (C) 2015
  * Gerald Kerma <[email protected]>
  * Tony Dinh <[email protected]>
@@ -46,10 +47,10 @@
 #endif /* CONFIG_CMD_NET */
 
 /* SATA driver configuration */
-#ifdef CONFIG_IDE
-#define __io
-#define CONFIG_SYS_ATA_IDE0_OFFSET	MV_SATA_PORT0_OFFSET
-#endif /* CONFIG_IDE */
+#ifdef CONFIG_SATA
+#define CONFIG_SYS_SATA_MAX_DEVICE	1
+#define CONFIG_LBA48
+#endif /* CONFIG_SATA */
 
 /* RTC driver configuration */
 #ifdef CONFIG_CMD_DATE
Signature · 1 line
2.20.1
Reviewed-by on v1 4/4
#10 lore raw

Re: [PATCH 4/4] NSA310S : Add DM SATA configs

Quoted 13 lines · Tony Dinh

Enable DM SATA, removed IDE driver, and add SATA MV driver.

---

  include/configs/nsa310s.h | 9 +++++----
  1 file changed, 5 insertions(+), 4 deletions(-)
include/configs/nsa310s.h +0 -0
index e38c65a485..94f293de90 100644

include/configs/nsa310s.h line 6

Quoted 6 lines
include/configs/nsa310s.h +1 -0
@@ -1,5 +1,6 @@
  /* SPDX-License-Identifier: GPL-2.0+ */
  /*
+ * Copyright (C) 2021 Tony Dinh <[email protected]>
   * Copyright (C) 2015
   * Gerald Kerma <[email protected]>
   * Tony Dinh <[email protected]>

Please change this copyright line instead of adding yourself a 2nd time.

Other than this:

Thanks,
Stefan

Quoted 6 lines
include/configs/nsa310s.h +0 -1
@@ -46,10 +47,10 @@
  #endif /* CONFIG_CMD_NET */
 
  /* SATA driver configuration */
-#ifdef CONFIG_IDE

include/configs/nsa310s.h line 56

Quoted 10 lines
include/configs/nsa310s.h +4 -3
-#define __io
-#define CONFIG_SYS_ATA_IDE0_OFFSET	MV_SATA_PORT0_OFFSET
-#endif /* CONFIG_IDE */
+#ifdef CONFIG_SATA
+#define CONFIG_SYS_SATA_MAX_DEVICE	1
+#define CONFIG_LBA48
+#endif /* CONFIG_SATA */
 
  /* RTC driver configuration */
  #ifdef CONFIG_CMD_DATE

Viele Grüße,
Stefan

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#11 lore raw
In reply to Tony Dinh
Quoted 15 lines · Tony Dinh

- Add device tree kirkwood-nsa310s.dts
- Add DM_USB, DM_ETH, DM_SATA and associated configs to nsa310s_defconfig
- Move some miscellaneous configs from board file to nsa310s_defconfig
- Replace old device name "egiga0" with Ethernet PHY name from device tree kirkwood.dtsi
- Removed IDE, and add SATA configs in board file nsa310s.c

Tony Dinh (4):
NSA310S : Add device tree DTS for Zyxel NSA310S board NSA310S : Add DM USB, DM Ethernet, and DM SATA configs NSA310S : Use Ethernet PHY name from device tree NSA310S : Add DM SATA configs

Quoted 8 lines
  arch/arm/dts/Makefile             |   1 +
  arch/arm/dts/kirkwood-nsa310s.dts | 318 ++++++++++++++++++++++++++++++
  board/zyxel/nsa310s/nsa310s.c     |  15 +-
  configs/nsa310s_defconfig         |  12 +-
  include/configs/nsa310s.h         |   9 +-
  5 files changed, 342 insertions(+), 13 deletions(-)

create mode 100644 arch/arm/dts/kirkwood-nsa310s.dts

Applied to u-boot-marvell/master

Thanks,
Stefan