Skip to contentSkip to conversation

NSA310S : Use Ethernet PHY name from device tree

PATCH Superseded Tony Dinh 2 participants 3 messages Jul 3, 2021

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Tony Dinh

author
#0 lore raw

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

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

---

Changes in v2:
- Correct copyright

 board/zyxel/nsa310s/nsa310s.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)
board/zyxel/nsa310s/nsa310s.c +8 -11
index cd4a7723b1..41479af8e6 100644
@@ -1,8 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
- * Copyright (C) 2015
- * Gerald Kerma <[email protected]>
- * Tony Dinh <[email protected]>
+ * Copyright (C) 2015, 2021 Tony Dinh <[email protected]>
+ * Copyright (C) 2015 Gerald Kerma <[email protected]>
  */
 
 #include <common.h>
@@ -81,22 +80,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 +126,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
author
#1 lore raw

PATCH v2 4/4 NSA310S : Add DM SATA configs

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

---

Changes in v2:
- Correct copyright

 include/configs/nsa310s.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
include/configs/nsa310s.h +5 -5
index e38c65a485..23cf94ec99 100644
@@ -1,8 +1,8 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
+ * Copyright (C) 2015, 2021 Tony Dinh <[email protected]>
  * Copyright (C) 2015
  * Gerald Kerma <[email protected]>
- * Tony Dinh <[email protected]>
  * Luka Perkov <[email protected]>
  */
 
@@ -46,10 +46,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
#2 lore raw
In reply to Tony Dinh
Quoted 28 lines · Tony Dinh

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

---

Changes in v2:
- Correct copyright

  board/zyxel/nsa310s/nsa310s.c | 19 ++++++++-----------
  1 file changed, 8 insertions(+), 11 deletions(-)
board/zyxel/nsa310s/nsa310s.c +2 -3
index cd4a7723b1..41479af8e6 100644
@@ -1,8 +1,7 @@
  // SPDX-License-Identifier: GPL-2.0+
  /*
- * Copyright (C) 2015
- * Gerald Kerma <[email protected]>
- * Tony Dinh <[email protected]>
+ * Copyright (C) 2015, 2021 Tony Dinh <[email protected]>
+ * Copyright (C) 2015 Gerald Kerma <[email protected]>
   */
 
  #include <common.h>

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

Quoted 5 lines
board/zyxel/nsa310s/nsa310s.c +2 -0
@@ -81,22 +80,18 @@ int board_init(void)
  	return 0;
  }
 
+#define PHY_ADR	1
+

Please read the PHY address from the DT instead. It's encoded in the "reg" property and should be able to read it from there. No need to double define this value here again.

Thanks,
Stefan

Quoted 23 lines
board/zyxel/nsa310s/nsa310s.c +2 -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 132

Quoted 7 lines
board/zyxel/nsa310s/nsa310s.c +2 -0
@@ -131,5 +126,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]