Skip to content

rust: phy: extend abstractions for real-world PHY drivers

Artem Lytkin netdev rust-for-linux 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest5 patches 1 replyIn review
  2. v14 patches 2 repliesSuperseded

Changes in v2 from the cover letter

- Added cover letter (Andrew)
- Fixed Subject prefix to net-next (Andrew)
- Added RTL8211F driver as API user (Andrew)
- Fixed rustfmt issues reported by kernel test robot
- Removed RGMII from interface() doc example (Andrew)

[1] https://lore.kernel.org/lkml/20240201-rockchip-rust-phy_depend-v2-0-c5fa4faab924@christina-quast.de/

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5rust: phy: add read-only device field accessorsrust/kernel/net/phy.rs+41 -00 replies
2/5rust: phy: add paged register access and bit manipulation helpersrust/kernel/net/phy.rs+43 -20 replies
3/5rust: phy: add config_init, read_page, and write_page callbacksrust/kernel/net/phy.rs+83 -00 replies
4/5rust: phy: add interrupt supportrust/kernel/net/phy.rs+90 -30 replies
5/5net: phy: realtek: add Rust RTL8211F PHY driverdrivers/net/phy/realtek/Kconfig drivers/net/phy/realtek/Makefile drivers/net/phy/realtek/rtl8211f_rust.rs+140 -01 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH net-next v2 0/5] rust: phy: extend abstractions for real-world PHY drivers

This series extends the Rust PHY abstractions in rust/kernel/net/phy.rs with features needed to write production-quality Rust PHY drivers, and adds a Realtek RTL8211F driver as the first user of these APIs.

Patches 1-4 add new Device accessors, register manipulation helpers, driver callbacks (config_init, read_page/write_page, config_intr, handle_interrupt), and interrupt support infrastructure.

Patch 5 adds a Rust RTL8211F Gigabit Ethernet PHY driver that exercises all the new abstractions. The driver implements RGMII delay configuration, PHY EEE disable, paged register access, and interrupt-driven link detection. ALDPS, CLKOUT, and WoL are omitted as they require per-device private data not yet available in the abstraction. PME interrupts are not handled for the same reason.

config_init was previously proposed in an RFC for the Rockchip PHY driver [1] but not merged at that time. This series re-introduces it in a form consistent with the existing vtable infrastructure.

Changes since v1:
- Added cover letter (Andrew)
- Fixed Subject prefix to net-next (Andrew)
- Added RTL8211F driver as API user (Andrew)
- Fixed rustfmt issues reported by kernel test robot
- Removed RGMII from interface() doc example (Andrew)

[1] https://lore.kernel.org/lkml/20240201-rockchip-rust-phy_depend-v2-0-c5fa4faab924@christina-quast.de/

Artem Lytkin (5):
rust: phy: add read-only device field accessors
rust: phy: add paged register access and bit manipulation helpers
rust: phy: add config_init, read_page, and write_page callbacks
rust: phy: add interrupt support
net: phy: realtek: add Rust RTL8211F PHY driver

 drivers/net/phy/realtek/Kconfig          |  12 ++
 drivers/net/phy/realtek/Makefile         |   1 +
 drivers/net/phy/realtek/rtl8211f_rust.rs | 140 +++++++++++++++++++
 rust/kernel/net/phy.rs                   | 260 +++++++++++++++++++++++++++++++
 4 files changed, 413 insertions(+)
 create mode 100644 drivers/net/phy/realtek/rtl8211f_rust.rs