mbox series

[net-next,v3,0/6] net: phy: add Applied Micro QT2025 PHY driver

Message ID 20240804233835.223460-1-fujita.tomonori@gmail.com (mailing list archive)
Headers show
Series net: phy: add Applied Micro QT2025 PHY driver | expand

Message

FUJITA Tomonori Aug. 4, 2024, 11:38 p.m. UTC
This patchset adds a PHY driver for Applied Micro Circuits Corporation
QT2025.

The first patch adds Rust equivalent to include/linux/sizes.h, makes
code more readable. The 2-5th patches update the PHYLIB Rust bindings.

QT2025 PHY support was implemented as a part of an Ethernet driver for
Tehuti Networks TN40xx chips. Multiple vendors (DLink, Asus, Edimax,
QNAP, etc) developed adapters based on TN40xx chips. Tehuti Networks
went out of business and the driver wasn't merged into mainline. But
it's still distributed with some of the hardware (and also available
on some vendor sites).

The original driver handles multiple PHY hardware (AMCC QT2025, TI
TLK10232, Aqrate AQR105, and Marvell MV88X3120, MV88X3310, and
MV88E2010). I divided the original driver into MAC and PHY drivers and
implemented a QT2025 PHY driver in Rust.

The MAC driver for Tehuti Networks TN40xx chips was already merged in
6.11-rc1. The MAC and this PHY drivers have been tested with Edimax
EN-9320SFP+ 10G network adapter.

v3:
- use addr_of_mut!` to avoid intermediate mutable reference
- update probe callback's Safety comment
- add MODULE_FIRMWARE equivalent
- add Alice's Reviewed-by
v2: https://lore.kernel.org/netdev/20240731042136.201327-1-fujita.tomonori@gmail.com/
- add comments in accordance with the hw datasheet
- unify C22 and C45 APIs
- load firmware in probe callback instead of config_init
- use firmware API
- handle firmware endian
- check firmware size
- use SZ_*K constants
- avoid confusing phy_id variable
v1: https://lore.kernel.org/netdev/20240415104701.4772-1-fujita.tomonori@gmail.com/

FUJITA Tomonori (6):
  rust: sizes: add commonly used constants
  rust: net::phy support probe callback
  rust: net::phy implement AsRef<kernel::device::Device> trait
  rust: net::phy unified read/write API for C22 and C45 registers
  rust: net::phy unified genphy_read_status function for C22 and C45
    registers
  net: phy: add Applied Micro QT2025 PHY driver

 MAINTAINERS                      |   8 ++
 drivers/net/phy/Kconfig          |   6 +
 drivers/net/phy/Makefile         |   1 +
 drivers/net/phy/ax88796b_rust.rs |   7 +-
 drivers/net/phy/qt2025.rs        |  93 +++++++++++++
 rust/kernel/lib.rs               |   1 +
 rust/kernel/net/phy.rs           |  78 ++++++-----
 rust/kernel/net/phy/reg.rs       | 219 +++++++++++++++++++++++++++++++
 rust/kernel/sizes.rs             |  26 ++++
 rust/uapi/uapi_helper.h          |   1 +
 10 files changed, 402 insertions(+), 38 deletions(-)
 create mode 100644 drivers/net/phy/qt2025.rs
 create mode 100644 rust/kernel/net/phy/reg.rs
 create mode 100644 rust/kernel/sizes.rs


base-commit: 3608d6aca5e793958462e6e01a8cdb6c6e8088d0

Comments

Andrew Lunn Aug. 5, 2024, 1:10 a.m. UTC | #1
On Mon, Aug 05, 2024 at 08:38:29AM +0900, FUJITA Tomonori wrote:
> This patchset adds a PHY driver for Applied Micro Circuits Corporation
> QT2025.
> 
> The first patch adds Rust equivalent to include/linux/sizes.h, makes
> code more readable. The 2-5th patches update the PHYLIB Rust bindings.
> 
> QT2025 PHY support was implemented as a part of an Ethernet driver for
> Tehuti Networks TN40xx chips. Multiple vendors (DLink, Asus, Edimax,
> QNAP, etc) developed adapters based on TN40xx chips. Tehuti Networks
> went out of business and the driver wasn't merged into mainline. But
> it's still distributed with some of the hardware (and also available
> on some vendor sites).
> 
> The original driver handles multiple PHY hardware (AMCC QT2025, TI
> TLK10232, Aqrate AQR105, and Marvell MV88X3120, MV88X3310, and
> MV88E2010). I divided the original driver into MAC and PHY drivers and
> implemented a QT2025 PHY driver in Rust.
> 
> The MAC driver for Tehuti Networks TN40xx chips was already merged in
> 6.11-rc1. The MAC and this PHY drivers have been tested with Edimax
> EN-9320SFP+ 10G network adapter.

Sorry about being slow reviewing this. I will get to it by the middle
of the week.

	Andrew
FUJITA Tomonori Aug. 14, 2024, 2:57 a.m. UTC | #2
Hi,

On Mon, 5 Aug 2024 03:10:50 +0200
Andrew Lunn <andrew@lunn.ch> wrote:

>> The MAC driver for Tehuti Networks TN40xx chips was already merged in
>> 6.11-rc1. The MAC and this PHY drivers have been tested with Edimax
>> EN-9320SFP+ 10G network adapter.
> 
> Sorry about being slow reviewing this. I will get to it by the middle
> of the week.

Would you happen to have a chance to review this?