[dm][ethernet] Add ethernet and drivers for DM#11641
Conversation
📌 Code Review Assignment🏷️ Tag: componentsReviewers: @Maihuanyi Changed Files (Click to expand)
📊 Current Review Status (Last Updated: 2026-07-23 09:54 CST)
📝 Review Instructions
|
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
There was a problem hiding this comment.
Pull request overview
This PR adds Device-Model (DM) based Ethernet driver infrastructure to RT-Thread, improves PHY v2 handling, and introduces new MAC/PHY driver implementations (Cadence MACB/GEM and Synopsys DWMAC, plus Realtek RTL8211F PHY).
Changes:
- Add a new DM Ethernet driver framework and build/Kconfig integration under
components/drivers/ethernet/.
新增基于 DM 的以太网驱动框架,并补齐对应的构建与 Kconfig 集成。 - Improve PHY v2 support, including better OFW PHY-id discovery and a new Realtek RTL8211F PHY driver.
完善 PHY v2 支持(含 OFW 兼容匹配/MDIO 读取兜底),并新增 RTL8211F PHY 驱动。 - Add new Ethernet MAC drivers: Cadence MACB/GEM and Synopsys DesignWare GMAC4 (DWMAC) with optional PTP.
新增 Cadence MACB/GEM 与 Synopsys DWMAC(可选 PTP)MAC 驱动实现。
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| components/drivers/phy/SConscript | Adjust PHY source selection and add conditional Realtek PHY build. |
| components/drivers/phy/phy.c | Fix PHY mask scanning loop; initialize supported/advertising for genphy fallback. |
| components/drivers/phy/phy-realtek.c | Add RTL8211F PHY driver implementation. |
| components/drivers/phy/ofw.c | Improve OFW PHY-id parsing (multi-compatible) and add MDIO PHY-id fallback. |
| components/drivers/phy/mdio.c | Use zero-initializing allocation for mii_bus. |
| components/drivers/phy/Kconfig | Add Realtek PHY v2 option. |
| components/drivers/phy/general.c | Update genphy link update logic and error propagation. |
| components/drivers/ethernet/SConscript | Add Ethernet driver group build entry and subdir discovery. |
| components/drivers/ethernet/Kconfig | Add Ethernet driver menu and per-vendor Kconfig includes. |
| components/drivers/ethernet/ethernet_dm.h | Add common Ethernet DM helpers (random MAC API). |
| components/drivers/ethernet/ethernet_dm.c | Implement random MAC address generation helper. |
| components/drivers/ethernet/cadence/SConscript | Add Cadence MACB/GEM driver build integration. |
| components/drivers/ethernet/cadence/Kconfig | Add Cadence MACB/GEM Kconfig entries (PCI/PTP options). |
| components/drivers/ethernet/cadence/macb.h | Add MACB/GEM register definitions and driver structs. |
| components/drivers/ethernet/cadence/macb.c | Add MACB/GEM Ethernet MAC driver implementation. |
| components/drivers/ethernet/cadence/macb_phy.c | Add MACB MDIO/PHY handling helpers. |
| components/drivers/ethernet/cadence/macb_ptp.c | Add MACB/GEM PTP support implementation. |
| components/drivers/ethernet/cadence/macb_pci.c | Add PCI wrapper driver for MACB/GEM. |
| components/drivers/ethernet/synopsys/SConscript | Add Synopsys DWMAC driver build integration. |
| components/drivers/ethernet/synopsys/Kconfig | Add Synopsys DWMAC Kconfig entries (PTP option). |
| components/drivers/ethernet/synopsys/dwmac.h | Add DWMAC register/descriptor definitions and driver structs. |
| components/drivers/ethernet/synopsys/dwmac.c | Add DWMAC Ethernet MAC driver implementation. |
| components/drivers/ethernet/synopsys/dwmac-platform.h | Add DWMAC platform registration API. |
| components/drivers/ethernet/synopsys/dwmac-platform.c | Add DWMAC platform glue (iomap/irq/mac address). |
| components/drivers/ethernet/synopsys/dwmac_ptp.h | Add DWMAC PTP register definitions and API. |
| components/drivers/ethernet/synopsys/dwmac_ptp.c | Add DWMAC PTP support implementation. |
Signed-off-by: GuEe-GUI <2991707448@qq.com>
Signed-off-by: GuEe-GUI <2991707448@qq.com>
They support PTP, too. Signed-off-by: GuEe-GUI <2991707448@qq.com>
|
@Rbb666 审核建议已修改完成 |
|
@GuEe-GUI 验证情况还麻烦补充下,谢谢 |
|
目前在树莓派5b + BCM54213 PHY和zynqmp-a53-dfzu2eg (仅QEMU)下MACB 可正常工作,DWMAC + RTL phy 基于rk3568正常工作,phy 框架均在前面提到的平台,以及 Spacemit K1 和树莓派4b 上验证通过 |
[
]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up