This is an automated email from the ASF dual-hosted git repository.
GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new af96c50b5cd net/phy: add sim:phylib config and fix stale PHYLIB
docs/comments
af96c50b5cd is described below
commit af96c50b5cd45c8ad34a70d355387c5b3644f526
Author: zhangkai25 <[email protected]>
AuthorDate: Tue Nov 10 14:51:37 2026 +0800
net/phy: add sim:phylib config and fix stale PHYLIB docs/comments
Follow-up to the PHYLIB framework merge:
- Add a boards/sim/sim/sim/configs/phylib defconfig that enables
CONFIG_NET_PHYLIB, CONFIG_MDIO_CLAUSE_45 and both Realtek PHY drivers,
so CI builds the drivers/net/phy sources (previously no in-tree
defconfig enabled PHYLIB, so none of these files were built by CI).
- Update phy_device.c and phylib.rst to match the code: mdio_reset() no
longer does per-bus idempotency (it is the lower half's responsibility),
and the vendor registration helper is rtl8221b_register() /
rtl9000b_register() (not the non-existent phy_realtek_register()) and is
not idempotent.
Signed-off-by: zhangkai25 <[email protected]>
---
Documentation/os/networking/phylib.rst | 11 +++++-----
boards/sim/sim/sim/configs/phylib/defconfig | 33 +++++++++++++++++++++++++++++
drivers/net/phy/phy_device.c | 8 +++----
3 files changed, 43 insertions(+), 9 deletions(-)
diff --git a/Documentation/os/networking/phylib.rst
b/Documentation/os/networking/phylib.rst
index 42a83021966..7710ee23640 100644
--- a/Documentation/os/networking/phylib.rst
+++ b/Documentation/os/networking/phylib.rst
@@ -180,9 +180,8 @@ Lower-half callback table ``mdio_ops_s`` (implemented by
the MAC driver):
* by logic level rather than a one-shot pulse. value != 0 asserts
* (into reset); value == 0 deasserts (release). The lower-half handles
* pin polarity (active-low RESET_N handled internally) and the
- * datasheet-specified assert/deassert settle delays; the upper-half
- * mdio_reset() handles idempotency (skips when already at the target
- * state).
+ * datasheet-specified assert/deassert settle delays, and any
+ * idempotency (a single bus may host several PHY addresses).
*/
int (*reset)(FAR struct mdio_lowerhalf_s *lower, uint8_t phyaddr,
int value);
@@ -1058,8 +1057,10 @@ PHY hardware reset callback ``aurix_mdio_reset`` (level
control):
int ret;
- /* 1. Register the vendor PHY driver (idempotent) */
- phy_realtek_register();
+ /* 1. Register the vendor PHY driver once at boot (not idempotent:
+ * each call consumes a driver-table slot, so do not call repeatedly).
+ */
+ rtl8221b_register();
/* 2. Fill the lower-half and register with the upper-half, get the
handle */
priv->mdio_lower.ops = &g_aurix_mdio_ops;
diff --git a/boards/sim/sim/sim/configs/phylib/defconfig
b/boards/sim/sim/sim/configs/phylib/defconfig
new file mode 100644
index 00000000000..f387b9ee4ae
--- /dev/null
+++ b/boards/sim/sim/sim/configs/phylib/defconfig
@@ -0,0 +1,33 @@
+#
+# This file is autogenerated: PLEASE DO NOT EDIT IT.
+#
+# You can use "make menuconfig" to make any modifications to the installed
.config file.
+# You can then do "make savedefconfig" to generate a new defconfig file that
includes your
+# modifications.
+#
+CONFIG_ARCH="sim"
+CONFIG_ARCH_BOARD="sim"
+CONFIG_ARCH_BOARD_SIM=y
+CONFIG_ARCH_CHIP="sim"
+CONFIG_ARCH_SIM=y
+CONFIG_EXAMPLES_NETTEST=y
+CONFIG_EXAMPLES_NETTEST_DRIPADDR=0xc0a80001
+CONFIG_EXAMPLES_NETTEST_IPADDR=0xc0a80080
+CONFIG_FS_FAT=y
+CONFIG_IDLETHREAD_STACKSIZE=4096
+CONFIG_INIT_ENTRYPOINT="nettest_main"
+CONFIG_MDIO_CLAUSE_45=y
+CONFIG_NET=y
+CONFIG_NETUTILS_NETLIB=y
+CONFIG_NET_MAX_LISTENPORTS=40
+CONFIG_NET_PHYLIB=y
+CONFIG_NET_PHY_REALTEK_RTL8221B=y
+CONFIG_NET_PHY_REALTEK_RTL9000B=y
+CONFIG_NET_SOCKOPTS=y
+CONFIG_NET_STATISTICS=y
+CONFIG_NET_TCP=y
+CONFIG_NET_TCP_PREALLOC_CONNS=40
+CONFIG_SCHED_LPWORK=y
+CONFIG_START_DAY=16
+CONFIG_START_MONTH=8
+CONFIG_START_YEAR=2008
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 586849ed1a2..33cae33b5b6 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -448,10 +448,10 @@ int phy_connect(FAR struct phy_device_s *phydev,
lower->phydev = phydev;
/* Deassert the PHY hardware reset (release the RESET_N line) before
- * running config_init. This is idempotent: if the MAC driver
- * already released the reset before reading the PHY ID, the underlying
- * mdio_reset() recognizes the state is unchanged and returns without
- * re-toggling. A PHY with no controllable reset line is a quiet no-op.
+ * running config_init. The request is forwarded to the lower-half
+ * mdio_reset(); the lower half owns any idempotency and the
+ * datasheet-mandated settle delay. A PHY with no controllable reset
+ * line is a quiet no-op.
*/
phy_reset(phydev, 0);