Rust for Linux List
 help / color / mirror / Atom feed
* [PATCH net-next v3 0/6] net: phy: add Applied Micro QT2025 PHY driver
@ 2024-08-04 23:38 FUJITA Tomonori
  2024-08-04 23:38 ` [PATCH net-next v3 1/6] rust: sizes: add commonly used constants FUJITA Tomonori
                   ` (6 more replies)
  0 siblings, 7 replies; 23+ messages in thread
From: FUJITA Tomonori @ 2024-08-04 23:38 UTC (permalink / raw)
  To: netdev
  Cc: rust-for-linux, andrew, tmgross, miguel.ojeda.sandonis,
	benno.lossin, aliceryhl

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
-- 
2.34.1


^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH net-next v3 1/6] rust: sizes: add commonly used constants
  2024-08-04 23:38 [PATCH net-next v3 0/6] net: phy: add Applied Micro QT2025 PHY driver FUJITA Tomonori
@ 2024-08-04 23:38 ` FUJITA Tomonori
  2024-08-16  0:37   ` Andrew Lunn
  2024-08-04 23:38 ` [PATCH net-next v3 2/6] rust: net::phy support probe callback FUJITA Tomonori
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 23+ messages in thread
From: FUJITA Tomonori @ 2024-08-04 23:38 UTC (permalink / raw)
  To: netdev
  Cc: rust-for-linux, andrew, tmgross, miguel.ojeda.sandonis,
	benno.lossin, aliceryhl

Add rust equivalent to include/linux/sizes.h, makes code more
readable.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
---
 rust/kernel/lib.rs   |  1 +
 rust/kernel/sizes.rs | 26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+)
 create mode 100644 rust/kernel/sizes.rs

diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs
index 274bdc1b0a82..58ed400198bf 100644
--- a/rust/kernel/lib.rs
+++ b/rust/kernel/lib.rs
@@ -43,6 +43,7 @@
 pub mod page;
 pub mod prelude;
 pub mod print;
+pub mod sizes;
 mod static_assert;
 #[doc(hidden)]
 pub mod std_vendor;
diff --git a/rust/kernel/sizes.rs b/rust/kernel/sizes.rs
new file mode 100644
index 000000000000..834c343e4170
--- /dev/null
+++ b/rust/kernel/sizes.rs
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0
+
+//! Commonly used sizes.
+//!
+//! C headers: [`include/linux/sizes.h`](srctree/include/linux/sizes.h).
+
+/// 0x00000400
+pub const SZ_1K: usize = bindings::SZ_1K as usize;
+/// 0x00000800
+pub const SZ_2K: usize = bindings::SZ_2K as usize;
+/// 0x00001000
+pub const SZ_4K: usize = bindings::SZ_4K as usize;
+/// 0x00002000
+pub const SZ_8K: usize = bindings::SZ_8K as usize;
+/// 0x00004000
+pub const SZ_16K: usize = bindings::SZ_16K as usize;
+/// 0x00008000
+pub const SZ_32K: usize = bindings::SZ_32K as usize;
+/// 0x00010000
+pub const SZ_64K: usize = bindings::SZ_64K as usize;
+/// 0x00020000
+pub const SZ_128K: usize = bindings::SZ_128K as usize;
+/// 0x00040000
+pub const SZ_256K: usize = bindings::SZ_256K as usize;
+/// 0x00080000
+pub const SZ_512K: usize = bindings::SZ_512K as usize;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH net-next v3 2/6] rust: net::phy support probe callback
  2024-08-04 23:38 [PATCH net-next v3 0/6] net: phy: add Applied Micro QT2025 PHY driver FUJITA Tomonori
  2024-08-04 23:38 ` [PATCH net-next v3 1/6] rust: sizes: add commonly used constants FUJITA Tomonori
@ 2024-08-04 23:38 ` FUJITA Tomonori
  2024-08-16  0:40   ` Andrew Lunn
  2024-08-04 23:38 ` [PATCH net-next v3 3/6] rust: net::phy implement AsRef<kernel::device::Device> trait FUJITA Tomonori
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 23+ messages in thread
From: FUJITA Tomonori @ 2024-08-04 23:38 UTC (permalink / raw)
  To: netdev
  Cc: rust-for-linux, andrew, tmgross, miguel.ojeda.sandonis,
	benno.lossin, aliceryhl

Support phy_driver probe callback, used to set up device-specific
structures.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
---
 rust/kernel/net/phy.rs | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/rust/kernel/net/phy.rs b/rust/kernel/net/phy.rs
index fd40b703d224..60d3d8f8b44f 100644
--- a/rust/kernel/net/phy.rs
+++ b/rust/kernel/net/phy.rs
@@ -338,6 +338,21 @@ impl<T: Driver> Adapter<T> {
         })
     }
 
+    /// # Safety
+    ///
+    /// `phydev` must be passed by the corresponding callback in `phy_driver`.
+    unsafe extern "C" fn probe_callback(phydev: *mut bindings::phy_device) -> core::ffi::c_int {
+        from_result(|| {
+            // SAFETY: This callback is called only in contexts
+            // where we can exclusively access to `phy_device` because
+            // it's not published yet, so the accessors on `Device` are okay
+            // to call.
+            let dev = unsafe { Device::from_raw(phydev) };
+            T::probe(dev)?;
+            Ok(0)
+        })
+    }
+
     /// # Safety
     ///
     /// `phydev` must be passed by the corresponding callback in `phy_driver`.
@@ -511,6 +526,11 @@ pub const fn create_phy_driver<T: Driver>() -> DriverVTable {
         } else {
             None
         },
+        probe: if T::HAS_PROBE {
+            Some(Adapter::<T>::probe_callback)
+        } else {
+            None
+        },
         get_features: if T::HAS_GET_FEATURES {
             Some(Adapter::<T>::get_features_callback)
         } else {
@@ -583,6 +603,11 @@ fn soft_reset(_dev: &mut Device) -> Result {
         kernel::build_error(VTABLE_DEFAULT_ERROR)
     }
 
+    /// Sets up device-specific structures during discovery.
+    fn probe(_dev: &mut Device) -> Result {
+        kernel::build_error(VTABLE_DEFAULT_ERROR)
+    }
+
     /// Probes the hardware to determine what abilities it has.
     fn get_features(_dev: &mut Device) -> Result {
         kernel::build_error(VTABLE_DEFAULT_ERROR)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH net-next v3 3/6] rust: net::phy implement AsRef<kernel::device::Device> trait
  2024-08-04 23:38 [PATCH net-next v3 0/6] net: phy: add Applied Micro QT2025 PHY driver FUJITA Tomonori
  2024-08-04 23:38 ` [PATCH net-next v3 1/6] rust: sizes: add commonly used constants FUJITA Tomonori
  2024-08-04 23:38 ` [PATCH net-next v3 2/6] rust: net::phy support probe callback FUJITA Tomonori
@ 2024-08-04 23:38 ` FUJITA Tomonori
  2024-08-16  0:41   ` Andrew Lunn
  2024-08-04 23:38 ` [PATCH net-next v3 4/6] rust: net::phy unified read/write API for C22 and C45 registers FUJITA Tomonori
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 23+ messages in thread
From: FUJITA Tomonori @ 2024-08-04 23:38 UTC (permalink / raw)
  To: netdev
  Cc: rust-for-linux, andrew, tmgross, miguel.ojeda.sandonis,
	benno.lossin, aliceryhl

Implement AsRef<kernel::device::Device> trait for Device. A PHY driver
needs a reference to device::Device to call the firmware API.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
---
 rust/kernel/net/phy.rs | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/rust/kernel/net/phy.rs b/rust/kernel/net/phy.rs
index 60d3d8f8b44f..bd9fc7a84cd4 100644
--- a/rust/kernel/net/phy.rs
+++ b/rust/kernel/net/phy.rs
@@ -7,8 +7,7 @@
 //! C headers: [`include/linux/phy.h`](srctree/include/linux/phy.h).
 
 use crate::{error::*, prelude::*, types::Opaque};
-
-use core::marker::PhantomData;
+use core::{marker::PhantomData, ptr::addr_of_mut};
 
 /// PHY state machine states.
 ///
@@ -302,6 +301,15 @@ pub fn genphy_read_abilities(&mut self) -> Result {
     }
 }
 
+impl AsRef<kernel::device::Device> for Device {
+    fn as_ref(&self) -> &kernel::device::Device {
+        let phydev = self.0.get();
+        // SAFETY: The struct invariant ensures that we may access
+        // this field without additional synchronization.
+        unsafe { kernel::device::Device::as_ref(addr_of_mut!((*phydev).mdio.dev)) }
+    }
+}
+
 /// Defines certain other features this PHY supports (like interrupts).
 ///
 /// These flag values are used in [`Driver::FLAGS`].
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH net-next v3 4/6] rust: net::phy unified read/write API for C22 and C45 registers
  2024-08-04 23:38 [PATCH net-next v3 0/6] net: phy: add Applied Micro QT2025 PHY driver FUJITA Tomonori
                   ` (2 preceding siblings ...)
  2024-08-04 23:38 ` [PATCH net-next v3 3/6] rust: net::phy implement AsRef<kernel::device::Device> trait FUJITA Tomonori
@ 2024-08-04 23:38 ` FUJITA Tomonori
  2024-08-16  1:09   ` Andrew Lunn
  2024-08-04 23:38 ` [PATCH net-next v3 5/6] rust: net::phy unified genphy_read_status function " FUJITA Tomonori
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 23+ messages in thread
From: FUJITA Tomonori @ 2024-08-04 23:38 UTC (permalink / raw)
  To: netdev
  Cc: rust-for-linux, andrew, tmgross, miguel.ojeda.sandonis,
	benno.lossin, aliceryhl

Add the unified read/write API for C22 and C45 registers. The
abstractions support access to only C22 registers now. Instead of
adding read/write_c45 methods specifically for C45, a new reg module
supports the unified API to access C22 and C45 registers with trait,
by calling an appropriate phylib functions.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Reviewed-by: Trevor Gross <tmgross@umich.edu>
Reviewed-by: Benno Lossin <benno.lossin@proton.me>
---
 MAINTAINERS                      |   1 +
 drivers/net/phy/ax88796b_rust.rs |   7 +-
 rust/kernel/net/phy.rs           |  31 ++---
 rust/kernel/net/phy/reg.rs       | 193 +++++++++++++++++++++++++++++++
 rust/uapi/uapi_helper.h          |   1 +
 5 files changed, 206 insertions(+), 27 deletions(-)
 create mode 100644 rust/kernel/net/phy/reg.rs

diff --git a/MAINTAINERS b/MAINTAINERS
index 8766f3e5e87e..f0639034ef96 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8354,6 +8354,7 @@ L:	netdev@vger.kernel.org
 L:	rust-for-linux@vger.kernel.org
 S:	Maintained
 F:	rust/kernel/net/phy.rs
+F:	rust/kernel/net/phy/reg.rs
 
 EXEC & BINFMT API, ELF
 R:	Eric Biederman <ebiederm@xmission.com>
diff --git a/drivers/net/phy/ax88796b_rust.rs b/drivers/net/phy/ax88796b_rust.rs
index 5c92572962dc..8c7eb009d9fc 100644
--- a/drivers/net/phy/ax88796b_rust.rs
+++ b/drivers/net/phy/ax88796b_rust.rs
@@ -6,7 +6,7 @@
 //! C version of this driver: [`drivers/net/phy/ax88796b.c`](./ax88796b.c)
 use kernel::{
     c_str,
-    net::phy::{self, DeviceId, Driver},
+    net::phy::{self, reg::C22, DeviceId, Driver},
     prelude::*,
     uapi,
 };
@@ -24,7 +24,6 @@
     license: "GPL",
 }
 
-const MII_BMCR: u16 = uapi::MII_BMCR as u16;
 const BMCR_SPEED100: u16 = uapi::BMCR_SPEED100 as u16;
 const BMCR_FULLDPLX: u16 = uapi::BMCR_FULLDPLX as u16;
 
@@ -33,7 +32,7 @@
 // Toggle BMCR_RESET bit off to accommodate broken AX8796B PHY implementation
 // such as used on the Individual Computers' X-Surf 100 Zorro card.
 fn asix_soft_reset(dev: &mut phy::Device) -> Result {
-    dev.write(uapi::MII_BMCR as u16, 0)?;
+    dev.write(C22::BMCR, 0)?;
     dev.genphy_soft_reset()
 }
 
@@ -55,7 +54,7 @@ fn read_status(dev: &mut phy::Device) -> Result<u16> {
         }
         // If MII_LPA is 0, phy_resolve_aneg_linkmode() will fail to resolve
         // linkmode so use MII_BMCR as default values.
-        let ret = dev.read(MII_BMCR)?;
+        let ret = dev.read(C22::BMCR)?;
 
         if ret & BMCR_SPEED100 != 0 {
             dev.set_speed(uapi::SPEED_100);
diff --git a/rust/kernel/net/phy.rs b/rust/kernel/net/phy.rs
index bd9fc7a84cd4..60e30e7b3f41 100644
--- a/rust/kernel/net/phy.rs
+++ b/rust/kernel/net/phy.rs
@@ -9,6 +9,8 @@
 use crate::{error::*, prelude::*, types::Opaque};
 use core::{marker::PhantomData, ptr::addr_of_mut};
 
+pub mod reg;
+
 /// PHY state machine states.
 ///
 /// Corresponds to the kernel's [`enum phy_state`].
@@ -174,32 +176,15 @@ pub fn set_duplex(&mut self, mode: DuplexMode) {
         unsafe { (*phydev).duplex = v };
     }
 
-    /// Reads a given C22 PHY register.
+    /// Reads a PHY register.
     // This function reads a hardware register and updates the stats so takes `&mut self`.
-    pub fn read(&mut self, regnum: u16) -> Result<u16> {
-        let phydev = self.0.get();
-        // SAFETY: `phydev` is pointing to a valid object by the type invariant of `Self`.
-        // So it's just an FFI call, open code of `phy_read()` with a valid `phy_device` pointer
-        // `phydev`.
-        let ret = unsafe {
-            bindings::mdiobus_read((*phydev).mdio.bus, (*phydev).mdio.addr, regnum.into())
-        };
-        if ret < 0 {
-            Err(Error::from_errno(ret))
-        } else {
-            Ok(ret as u16)
-        }
+    pub fn read<R: reg::Register>(&mut self, reg: R) -> Result<u16> {
+        reg.read(self)
     }
 
-    /// Writes a given C22 PHY register.
-    pub fn write(&mut self, regnum: u16, val: u16) -> Result {
-        let phydev = self.0.get();
-        // SAFETY: `phydev` is pointing to a valid object by the type invariant of `Self`.
-        // So it's just an FFI call, open code of `phy_write()` with a valid `phy_device` pointer
-        // `phydev`.
-        to_result(unsafe {
-            bindings::mdiobus_write((*phydev).mdio.bus, (*phydev).mdio.addr, regnum.into(), val)
-        })
+    /// Writes a PHY register.
+    pub fn write<R: reg::Register>(&mut self, reg: R, val: u16) -> Result {
+        reg.write(self, val)
     }
 
     /// Reads a paged register.
diff --git a/rust/kernel/net/phy/reg.rs b/rust/kernel/net/phy/reg.rs
new file mode 100644
index 000000000000..91f73179315e
--- /dev/null
+++ b/rust/kernel/net/phy/reg.rs
@@ -0,0 +1,193 @@
+// SPDX-License-Identifier: GPL-2.0
+
+// Copyright (C) 2024 FUJITA Tomonori <fujita.tomonori@gmail.com>
+
+//! PHY register interfaces.
+//!
+//! This module provides support for accessing PHY registers via Ethernet
+//! management interface clause 22 and 45, as defined in IEEE 802.3.
+
+use super::Device;
+use crate::build_assert;
+use crate::error::*;
+use crate::uapi;
+
+mod private {
+    /// Marker that a trait cannot be implemented outside of this crate
+    pub trait Sealed {}
+}
+
+/// Accesses PHY registers.
+///
+/// This trait is used to implement the unified interface to access
+/// C22 and C45 PHY registers.
+///
+/// # Examples
+///
+/// ```ignore
+/// fn link_change_notify(dev: &mut Device) {
+///     // read C22 BMCR register
+///     dev.read(C22::BMCR);
+///     // read C45 PMA/PMD control 1 register
+///     dev.read(C45::new(Mmd::PMAPMD, 0));
+/// }
+/// ```
+pub trait Register: private::Sealed {
+    /// Reads a PHY register.
+    fn read(&self, dev: &mut Device) -> Result<u16>;
+
+    /// Writes a PHY register.
+    fn write(&self, dev: &mut Device, val: u16) -> Result;
+}
+
+/// A single MDIO clause 22 register address (5 bits).
+pub struct C22(u8);
+
+impl C22 {
+    /// Basic mode control.
+    pub const BMCR: Self = C22(0x00);
+    /// Basic mode status.
+    pub const BMSR: Self = C22(0x01);
+    /// PHY identifier 1.
+    pub const PHYSID1: Self = C22(0x02);
+    /// PHY identifier 2.
+    pub const PHYSID2: Self = C22(0x03);
+    /// Auto-negotiation advertisement.
+    pub const ADVERTISE: Self = C22(0x04);
+    /// Auto-negotiation link partner base page ability.
+    pub const LPA: Self = C22(0x05);
+    /// Auto-negotiation expansion.
+    pub const EXPANSION: Self = C22(0x06);
+    /// Auto-negotiation next page transmit.
+    pub const NEXT_PAGE_TRANSMIT: Self = C22(0x07);
+    /// Auto-negotiation link partner received next page.
+    pub const LP_RECEIVED_NEXT_PAGE: Self = C22(0x08);
+    /// Master-slave control.
+    pub const MASTER_SLAVE_CONTROL: Self = C22(0x09);
+    /// Master-slave status.
+    pub const MASTER_SLAVE_STATUS: Self = C22(0x0a);
+    /// PSE Control.
+    pub const PSE_CONTROL: Self = C22(0x0b);
+    /// PSE Status.
+    pub const PSE_STATUS: Self = C22(0x0c);
+    /// MMD Register control.
+    pub const MMD_CONTROL: Self = C22(0x0d);
+    /// MMD Register address data.
+    pub const MMD_DATA: Self = C22(0x0e);
+    /// Extended status.
+    pub const EXTENDED_STATUS: Self = C22(0x0f);
+
+    /// Creates a new instance of `C22` with a vendor specific register.
+    pub const fn vendor_specific<const N: u8>() -> Self {
+        build_assert!(
+            N > 0x0f && N < 0x20,
+            "Vendor-specific register address must be between 16 and 31"
+        );
+        C22(N)
+    }
+}
+
+impl private::Sealed for C22 {}
+
+impl Register for C22 {
+    fn read(&self, dev: &mut Device) -> Result<u16> {
+        let phydev = dev.0.get();
+        // SAFETY: `phydev` is pointing to a valid object by the type invariant of `Device`.
+        // So it's just an FFI call, open code of `phy_read()` with a valid `phy_device` pointer
+        // `phydev`.
+        let ret = unsafe {
+            bindings::mdiobus_read((*phydev).mdio.bus, (*phydev).mdio.addr, self.0.into())
+        };
+        to_result(ret)?;
+        Ok(ret as u16)
+    }
+
+    fn write(&self, dev: &mut Device, val: u16) -> Result {
+        let phydev = dev.0.get();
+        // SAFETY: `phydev` is pointing to a valid object by the type invariant of `Device`.
+        // So it's just an FFI call, open code of `phy_write()` with a valid `phy_device` pointer
+        // `phydev`.
+        to_result(unsafe {
+            bindings::mdiobus_write((*phydev).mdio.bus, (*phydev).mdio.addr, self.0.into(), val)
+        })
+    }
+}
+
+/// A single MDIO clause 45 register device and address.
+pub struct Mmd(u8);
+
+impl Mmd {
+    /// Physical Medium Attachment/Dependent.
+    pub const PMAPMD: Self = Mmd(uapi::MDIO_MMD_PMAPMD as u8);
+    /// WAN interface sublayer.
+    pub const WIS: Self = Mmd(uapi::MDIO_MMD_WIS as u8);
+    /// Physical coding sublayer.
+    pub const PCS: Self = Mmd(uapi::MDIO_MMD_PCS as u8);
+    /// PHY Extender sublayer.
+    pub const PHYXS: Self = Mmd(uapi::MDIO_MMD_PHYXS as u8);
+    /// DTE Extender sublayer.
+    pub const DTEXS: Self = Mmd(uapi::MDIO_MMD_DTEXS as u8);
+    /// Transmission convergence.
+    pub const TC: Self = Mmd(uapi::MDIO_MMD_TC as u8);
+    /// Auto negotiation.
+    pub const AN: Self = Mmd(uapi::MDIO_MMD_AN as u8);
+    /// Separated PMA (1).
+    pub const SEPARATED_PMA1: Self = Mmd(8);
+    /// Separated PMA (2).
+    pub const SEPARATED_PMA2: Self = Mmd(9);
+    /// Separated PMA (3).
+    pub const SEPARATED_PMA3: Self = Mmd(10);
+    /// Separated PMA (4).
+    pub const SEPARATED_PMA4: Self = Mmd(11);
+    /// OFDM PMA/PMD.
+    pub const OFDM_PMAPMD: Self = Mmd(12);
+    /// Power unit.
+    pub const POWER_UNIT: Self = Mmd(13);
+    /// Clause 22 extension.
+    pub const C22_EXT: Self = Mmd(uapi::MDIO_MMD_C22EXT as u8);
+    /// Vendor specific 1.
+    pub const VEND1: Self = Mmd(uapi::MDIO_MMD_VEND1 as u8);
+    /// Vendor specific 2.
+    pub const VEND2: Self = Mmd(uapi::MDIO_MMD_VEND2 as u8);
+}
+
+/// A single MDIO clause 45 register device and address.
+///
+/// Clause 45 uses a 5-bit device address to access a specific MMD within
+/// a port, then a 16-bit register address to access a location within
+/// that device. `C45` represents this by storing a [`Mmd`] and
+/// a register number.
+pub struct C45 {
+    devad: Mmd,
+    regnum: u16,
+}
+
+impl C45 {
+    /// Creates a new instance of `C45`.
+    pub fn new(devad: Mmd, regnum: u16) -> Self {
+        Self { devad, regnum }
+    }
+}
+
+impl private::Sealed for C45 {}
+
+impl Register for C45 {
+    fn read(&self, dev: &mut Device) -> Result<u16> {
+        let phydev = dev.0.get();
+        // SAFETY: `phydev` is pointing to a valid object by the type invariant of `Device`.
+        // So it's just an FFI call.
+        let ret =
+            unsafe { bindings::phy_read_mmd(phydev, self.devad.0.into(), self.regnum.into()) };
+        to_result(ret)?;
+        Ok(ret as u16)
+    }
+
+    fn write(&self, dev: &mut Device, val: u16) -> Result {
+        let phydev = dev.0.get();
+        // SAFETY: `phydev` is pointing to a valid object by the type invariant of `Device`.
+        // So it's just an FFI call.
+        to_result(unsafe {
+            bindings::phy_write_mmd(phydev, self.devad.0.into(), self.regnum.into(), val)
+        })
+    }
+}
diff --git a/rust/uapi/uapi_helper.h b/rust/uapi/uapi_helper.h
index 08f5e9334c9e..76d3f103e764 100644
--- a/rust/uapi/uapi_helper.h
+++ b/rust/uapi/uapi_helper.h
@@ -7,5 +7,6 @@
  */
 
 #include <uapi/asm-generic/ioctl.h>
+#include <uapi/linux/mdio.h>
 #include <uapi/linux/mii.h>
 #include <uapi/linux/ethtool.h>
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH net-next v3 5/6] rust: net::phy unified genphy_read_status function for C22 and C45 registers
  2024-08-04 23:38 [PATCH net-next v3 0/6] net: phy: add Applied Micro QT2025 PHY driver FUJITA Tomonori
                   ` (3 preceding siblings ...)
  2024-08-04 23:38 ` [PATCH net-next v3 4/6] rust: net::phy unified read/write API for C22 and C45 registers FUJITA Tomonori
@ 2024-08-04 23:38 ` FUJITA Tomonori
  2024-08-16  1:19   ` Andrew Lunn
  2024-08-04 23:38 ` [PATCH net-next v3 6/6] net: phy: add Applied Micro QT2025 PHY driver FUJITA Tomonori
  2024-08-05  1:10 ` [PATCH net-next v3 0/6] " Andrew Lunn
  6 siblings, 1 reply; 23+ messages in thread
From: FUJITA Tomonori @ 2024-08-04 23:38 UTC (permalink / raw)
  To: netdev
  Cc: rust-for-linux, andrew, tmgross, miguel.ojeda.sandonis,
	benno.lossin, aliceryhl

Add unified genphy_read_status function for C22 and C45
registers. Instead of having genphy_c22 and genphy_c45 methods, this
unifies genphy_read_status functions for C22 and C45.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Reviewed-by: Trevor Gross <tmgross@umich.edu>
Reviewed-by: Benno Lossin <benno.lossin@proton.me>
---
 rust/kernel/net/phy.rs     | 12 ++----------
 rust/kernel/net/phy/reg.rs | 26 ++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/rust/kernel/net/phy.rs b/rust/kernel/net/phy.rs
index 60e30e7b3f41..6703bf288d76 100644
--- a/rust/kernel/net/phy.rs
+++ b/rust/kernel/net/phy.rs
@@ -249,16 +249,8 @@ pub fn genphy_suspend(&mut self) -> Result {
     }
 
     /// Checks the link status and updates current link state.
-    pub fn genphy_read_status(&mut self) -> Result<u16> {
-        let phydev = self.0.get();
-        // SAFETY: `phydev` is pointing to a valid object by the type invariant of `Self`.
-        // So it's just an FFI call.
-        let ret = unsafe { bindings::genphy_read_status(phydev) };
-        if ret < 0 {
-            Err(Error::from_errno(ret))
-        } else {
-            Ok(ret as u16)
-        }
+    pub fn genphy_read_status<R: reg::Register>(&mut self) -> Result<u16> {
+        R::read_status(self)
     }
 
     /// Updates the link status.
diff --git a/rust/kernel/net/phy/reg.rs b/rust/kernel/net/phy/reg.rs
index 91f73179315e..4cf47335539b 100644
--- a/rust/kernel/net/phy/reg.rs
+++ b/rust/kernel/net/phy/reg.rs
@@ -30,6 +30,11 @@ pub trait Sealed {}
 ///     dev.read(C22::BMCR);
 ///     // read C45 PMA/PMD control 1 register
 ///     dev.read(C45::new(Mmd::PMAPMD, 0));
+///
+///     // Checks the link status and updates current link state via C22.
+///     dev.genphy_read_status::<phy::C22>();
+///     // Checks the link status and updates current link state via C45.
+///     dev.genphy_read_status::<phy::C45>();
 /// }
 /// ```
 pub trait Register: private::Sealed {
@@ -38,6 +43,9 @@ pub trait Register: private::Sealed {
 
     /// Writes a PHY register.
     fn write(&self, dev: &mut Device, val: u16) -> Result;
+
+    /// Checks the link status and updates current link state.
+    fn read_status(dev: &mut Device) -> Result<u16>;
 }
 
 /// A single MDIO clause 22 register address (5 bits).
@@ -111,6 +119,15 @@ fn write(&self, dev: &mut Device, val: u16) -> Result {
             bindings::mdiobus_write((*phydev).mdio.bus, (*phydev).mdio.addr, self.0.into(), val)
         })
     }
+
+    fn read_status(dev: &mut Device) -> Result<u16> {
+        let phydev = dev.0.get();
+        // SAFETY: `phydev` is pointing to a valid object by the type invariant of `Self`.
+        // So it's just an FFI call.
+        let ret = unsafe { bindings::genphy_read_status(phydev) };
+        to_result(ret)?;
+        Ok(ret as u16)
+    }
 }
 
 /// A single MDIO clause 45 register device and address.
@@ -190,4 +207,13 @@ fn write(&self, dev: &mut Device, val: u16) -> Result {
             bindings::phy_write_mmd(phydev, self.devad.0.into(), self.regnum.into(), val)
         })
     }
+
+    fn read_status(dev: &mut Device) -> Result<u16> {
+        let phydev = dev.0.get();
+        // SAFETY: `phydev` is pointing to a valid object by the type invariant of `Self`.
+        // So it's just an FFI call.
+        let ret = unsafe { bindings::genphy_c45_read_status(phydev) };
+        to_result(ret)?;
+        Ok(ret as u16)
+    }
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH net-next v3 6/6] net: phy: add Applied Micro QT2025 PHY driver
  2024-08-04 23:38 [PATCH net-next v3 0/6] net: phy: add Applied Micro QT2025 PHY driver FUJITA Tomonori
                   ` (4 preceding siblings ...)
  2024-08-04 23:38 ` [PATCH net-next v3 5/6] rust: net::phy unified genphy_read_status function " FUJITA Tomonori
@ 2024-08-04 23:38 ` FUJITA Tomonori
  2024-08-16  1:45   ` Andrew Lunn
  2024-08-05  1:10 ` [PATCH net-next v3 0/6] " Andrew Lunn
  6 siblings, 1 reply; 23+ messages in thread
From: FUJITA Tomonori @ 2024-08-04 23:38 UTC (permalink / raw)
  To: netdev
  Cc: rust-for-linux, andrew, tmgross, miguel.ojeda.sandonis,
	benno.lossin, aliceryhl

This driver supports Applied Micro Circuits Corporation QT2025 PHY,
based on a driver for Tehuti Networks TN40xx chips.

The original driver for TN40xx chips supports multiple PHY hardware
(AMCC QT2025, TI TLK10232, Aqrate AQR105, and Marvell 88X3120,
88X3310, and MV88E2010). This driver is extracted from the original
driver and modified to a PHY driver in Rust.

This has been tested with Edimax EN-9320SFP+ 10G network adapter.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
---
 MAINTAINERS               |  7 +++
 drivers/net/phy/Kconfig   |  6 +++
 drivers/net/phy/Makefile  |  1 +
 drivers/net/phy/qt2025.rs | 93 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 107 insertions(+)
 create mode 100644 drivers/net/phy/qt2025.rs

diff --git a/MAINTAINERS b/MAINTAINERS
index f0639034ef96..d25a529f6e48 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1609,6 +1609,13 @@ F:	Documentation/admin-guide/perf/xgene-pmu.rst
 F:	Documentation/devicetree/bindings/perf/apm-xgene-pmu.txt
 F:	drivers/perf/xgene_pmu.c
 
+APPLIED MICRO QT2025 PHY DRIVER
+M:	FUJITA Tomonori <fujita.tomonori@gmail.com>
+L:	netdev@vger.kernel.org
+L:	rust-for-linux@vger.kernel.org
+S:	Maintained
+F:	drivers/net/phy/qt2025.rs
+
 APTINA CAMERA SENSOR PLL
 M:	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
 L:	linux-media@vger.kernel.org
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 7fddc8306d82..e0ff386d90cd 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -109,6 +109,12 @@ config ADIN1100_PHY
 	  Currently supports the:
 	  - ADIN1100 - Robust,Industrial, Low Power 10BASE-T1L Ethernet PHY
 
+config AMCC_QT2025_PHY
+	tristate "AMCC QT2025 PHY"
+	depends on RUST_PHYLIB_ABSTRACTIONS
+	help
+	  Adds support for the Applied Micro Circuits Corporation QT2025 PHY.
+
 source "drivers/net/phy/aquantia/Kconfig"
 
 config AX88796B_PHY
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
index 202ed7f450da..461d6a3b9997 100644
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
@@ -36,6 +36,7 @@ obj-$(CONFIG_ADIN_PHY)		+= adin.o
 obj-$(CONFIG_ADIN1100_PHY)	+= adin1100.o
 obj-$(CONFIG_AIR_EN8811H_PHY)   += air_en8811h.o
 obj-$(CONFIG_AMD_PHY)		+= amd.o
+obj-$(CONFIG_AMCC_QT2025_PHY)	+= qt2025.o
 obj-$(CONFIG_AQUANTIA_PHY)	+= aquantia/
 ifdef CONFIG_AX88796B_RUST_PHY
   obj-$(CONFIG_AX88796B_PHY)	+= ax88796b_rust.o
diff --git a/drivers/net/phy/qt2025.rs b/drivers/net/phy/qt2025.rs
new file mode 100644
index 000000000000..ef245e8d4161
--- /dev/null
+++ b/drivers/net/phy/qt2025.rs
@@ -0,0 +1,93 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (C) Tehuti Networks Ltd.
+// Copyright (C) 2024 FUJITA Tomonori <fujita.tomonori@gmail.com>
+
+//! Applied Micro Circuits Corporation QT2025 PHY driver
+use kernel::c_str;
+use kernel::error::code;
+use kernel::firmware::Firmware;
+use kernel::net::phy::{
+    self,
+    reg::{Mmd, C45},
+    DeviceId, Driver,
+};
+use kernel::prelude::*;
+use kernel::sizes::{SZ_16K, SZ_32K, SZ_8K};
+
+kernel::module_phy_driver! {
+    drivers: [PhyQT2025],
+    device_table: [
+        DeviceId::new_with_driver::<PhyQT2025>(),
+    ],
+    name: "qt2025_phy",
+    author: "FUJITA Tomonori <fujita.tomonori@gmail.com>",
+    description: "AMCC QT2025 PHY driver",
+    license: "GPL",
+    firmware: ["qt2025-2.0.3.3.fw"],
+}
+
+struct PhyQT2025;
+
+#[vtable]
+impl Driver for PhyQT2025 {
+    const NAME: &'static CStr = c_str!("QT2025 10Gpbs SFP+");
+    const PHY_DEVICE_ID: phy::DeviceId = phy::DeviceId::new_with_exact_mask(0x0043A400);
+
+    fn probe(dev: &mut phy::Device) -> Result<()> {
+        // The hardware is configurable?
+        let hw_id = dev.read(C45::new(Mmd::PMAPMD, 0xd001))?;
+        if (hw_id >> 8) & 0xff != 0xb3 {
+            return Ok(());
+        }
+
+        // The 8051 will remain in the reset state.
+        dev.write(C45::new(Mmd::PMAPMD, 0xC300), 0x0000)?;
+        // Configure the 8051 clock frequency.
+        dev.write(C45::new(Mmd::PMAPMD, 0xC302), 0x0004)?;
+        // Non loopback mode.
+        dev.write(C45::new(Mmd::PMAPMD, 0xC319), 0x0038)?;
+        // Global control bit to select between LAN and WAN (WIS) mode.
+        dev.write(C45::new(Mmd::PMAPMD, 0xC31A), 0x0098)?;
+        dev.write(C45::new(Mmd::PCS, 0x0026), 0x0E00)?;
+        dev.write(C45::new(Mmd::PCS, 0x0027), 0x0893)?;
+        dev.write(C45::new(Mmd::PCS, 0x0028), 0xA528)?;
+        dev.write(C45::new(Mmd::PCS, 0x0029), 0x0003)?;
+        // Configure transmit and recovered clock.
+        dev.write(C45::new(Mmd::PMAPMD, 0xC30A), 0x06E1)?;
+        // The 8051 will finish the reset state.
+        dev.write(C45::new(Mmd::PMAPMD, 0xC300), 0x0002)?;
+        // The 8051 will start running from the boot ROM.
+        dev.write(C45::new(Mmd::PCS, 0xE854), 0x00C0)?;
+
+        let fw = Firmware::request(c_str!("qt2025-2.0.3.3.fw"), dev.as_ref())?;
+        if fw.data().len() > SZ_16K + SZ_8K {
+            return Err(code::EFBIG);
+        }
+
+        // The 24kB of program memory space is accessible by MDIO.
+        // The first 16kB of memory is located in the address range 3.8000h - 3.BFFFh.
+        // The next 8kB of memory is located at 4.8000h - 4.9FFFh.
+        let mut j = SZ_32K;
+        for (i, val) in fw.data().iter().enumerate() {
+            if i == SZ_16K {
+                j = SZ_32K;
+            }
+
+            let mmd = if i < SZ_16K { Mmd::PCS } else { Mmd::PHYXS };
+            dev.write(
+                C45::new(mmd, j as u16),
+                <u8 as Into<u16>>::into(*val).to_le(),
+            )?;
+
+            j += 1;
+        }
+        // The 8051 will start running from SRAM.
+        dev.write(C45::new(Mmd::PCS, 0xE854), 0x0040)?;
+
+        Ok(())
+    }
+
+    fn read_status(dev: &mut phy::Device) -> Result<u16> {
+        dev.genphy_read_status::<C45>()
+    }
+}
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH net-next v3 0/6] net: phy: add Applied Micro QT2025 PHY driver
  2024-08-04 23:38 [PATCH net-next v3 0/6] net: phy: add Applied Micro QT2025 PHY driver FUJITA Tomonori
                   ` (5 preceding siblings ...)
  2024-08-04 23:38 ` [PATCH net-next v3 6/6] net: phy: add Applied Micro QT2025 PHY driver FUJITA Tomonori
@ 2024-08-05  1:10 ` Andrew Lunn
  2024-08-14  2:57   ` FUJITA Tomonori
  6 siblings, 1 reply; 23+ messages in thread
From: Andrew Lunn @ 2024-08-05  1:10 UTC (permalink / raw)
  To: FUJITA Tomonori
  Cc: netdev, rust-for-linux, tmgross, miguel.ojeda.sandonis,
	benno.lossin, aliceryhl

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH net-next v3 0/6] net: phy: add Applied Micro QT2025 PHY driver
  2024-08-05  1:10 ` [PATCH net-next v3 0/6] " Andrew Lunn
@ 2024-08-14  2:57   ` FUJITA Tomonori
  0 siblings, 0 replies; 23+ messages in thread
From: FUJITA Tomonori @ 2024-08-14  2:57 UTC (permalink / raw)
  To: andrew
  Cc: fujita.tomonori, netdev, rust-for-linux, tmgross,
	miguel.ojeda.sandonis, benno.lossin, aliceryhl

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?

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH net-next v3 1/6] rust: sizes: add commonly used constants
  2024-08-04 23:38 ` [PATCH net-next v3 1/6] rust: sizes: add commonly used constants FUJITA Tomonori
@ 2024-08-16  0:37   ` Andrew Lunn
  2024-08-16  5:21     ` FUJITA Tomonori
  0 siblings, 1 reply; 23+ messages in thread
From: Andrew Lunn @ 2024-08-16  0:37 UTC (permalink / raw)
  To: FUJITA Tomonori
  Cc: netdev, rust-for-linux, tmgross, miguel.ojeda.sandonis,
	benno.lossin, aliceryhl

On Mon, Aug 05, 2024 at 08:38:30AM +0900, FUJITA Tomonori wrote:
> Add rust equivalent to include/linux/sizes.h, makes code more
> readable.
> 
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
> Reviewed-by: Alice Ryhl <aliceryhl@google.com>

Your Signed-off-by: should come last. That keeps it together with the
others added by Maintainers as they handle the patch on its way to
mainline.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH net-next v3 2/6] rust: net::phy support probe callback
  2024-08-04 23:38 ` [PATCH net-next v3 2/6] rust: net::phy support probe callback FUJITA Tomonori
@ 2024-08-16  0:40   ` Andrew Lunn
  2024-08-16  5:21     ` FUJITA Tomonori
  0 siblings, 1 reply; 23+ messages in thread
From: Andrew Lunn @ 2024-08-16  0:40 UTC (permalink / raw)
  To: FUJITA Tomonori
  Cc: netdev, rust-for-linux, tmgross, miguel.ojeda.sandonis,
	benno.lossin, aliceryhl

> +    /// # Safety
> +    ///
> +    /// `phydev` must be passed by the corresponding callback in `phy_driver`.
> +    unsafe extern "C" fn probe_callback(phydev: *mut bindings::phy_device) -> core::ffi::c_int {
> +        from_result(|| {
> +            // SAFETY: This callback is called only in contexts
> +            // where we can exclusively access to `phy_device` because
> +            // it's not published yet, so the accessors on `Device` are okay
> +            // to call.

Minor English nitpick. Its is normally 'have access to'. Or you can
drop the 'to'.

Otherwise

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH net-next v3 3/6] rust: net::phy implement AsRef<kernel::device::Device> trait
  2024-08-04 23:38 ` [PATCH net-next v3 3/6] rust: net::phy implement AsRef<kernel::device::Device> trait FUJITA Tomonori
@ 2024-08-16  0:41   ` Andrew Lunn
  0 siblings, 0 replies; 23+ messages in thread
From: Andrew Lunn @ 2024-08-16  0:41 UTC (permalink / raw)
  To: FUJITA Tomonori
  Cc: netdev, rust-for-linux, tmgross, miguel.ojeda.sandonis,
	benno.lossin, aliceryhl

On Mon, Aug 05, 2024 at 08:38:32AM +0900, FUJITA Tomonori wrote:
> Implement AsRef<kernel::device::Device> trait for Device. A PHY driver
> needs a reference to device::Device to call the firmware API.
> 
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
> Reviewed-by: Alice Ryhl <aliceryhl@google.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH net-next v3 4/6] rust: net::phy unified read/write API for C22 and C45 registers
  2024-08-04 23:38 ` [PATCH net-next v3 4/6] rust: net::phy unified read/write API for C22 and C45 registers FUJITA Tomonori
@ 2024-08-16  1:09   ` Andrew Lunn
  2024-08-16  5:27     ` FUJITA Tomonori
  0 siblings, 1 reply; 23+ messages in thread
From: Andrew Lunn @ 2024-08-16  1:09 UTC (permalink / raw)
  To: FUJITA Tomonori
  Cc: netdev, rust-for-linux, tmgross, miguel.ojeda.sandonis,
	benno.lossin, aliceryhl

> @@ -0,0 +1,193 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +// Copyright (C) 2024 FUJITA Tomonori <fujita.tomonori@gmail.com>
> +
> +//! PHY register interfaces.
> +//!
> +//! This module provides support for accessing PHY registers via Ethernet
> +//! management interface clause 22 and 45, as defined in IEEE 802.3.

Here we need to be very careful. The word `via` in the sentence above
means we are talking about the access mechanism, c22 transfers, or c45
transfers. A PHY driver should not care about the transfer mechanism,
it should just care about the register in the C22 or C45 register
namespace.

> +impl Register for C22 {
> +    fn read(&self, dev: &mut Device) -> Result<u16> {
> +        let phydev = dev.0.get();
> +        // SAFETY: `phydev` is pointing to a valid object by the type invariant of `Device`.
> +        // So it's just an FFI call, open code of `phy_read()` with a valid `phy_device` pointer
> +        // `phydev`.
> +        let ret = unsafe {
> +            bindings::mdiobus_read((*phydev).mdio.bus, (*phydev).mdio.addr, self.0.into())
> +        };
> +        to_result(ret)?;
> +        Ok(ret as u16)
> +    }
> +
> +    fn write(&self, dev: &mut Device, val: u16) -> Result {
> +        let phydev = dev.0.get();
> +        // SAFETY: `phydev` is pointing to a valid object by the type invariant of `Device`.
> +        // So it's just an FFI call, open code of `phy_write()` with a valid `phy_device` pointer
> +        // `phydev`.
> +        to_result(unsafe {
> +            bindings::mdiobus_write((*phydev).mdio.bus, (*phydev).mdio.addr, self.0.into(), val)
> +        })

These two are O.K. You have to use C22 bus transfers to access the C22
register namespace.

> +impl Register for C45 {
> +    fn read(&self, dev: &mut Device) -> Result<u16> {
> +        let phydev = dev.0.get();
> +        // SAFETY: `phydev` is pointing to a valid object by the type invariant of `Device`.
> +        // So it's just an FFI call.
> +        let ret =
> +            unsafe { bindings::phy_read_mmd(phydev, self.devad.0.into(), self.regnum.into()) };
> +        to_result(ret)?;
> +        Ok(ret as u16)
> +    }
> +
> +    fn write(&self, dev: &mut Device, val: u16) -> Result {
> +        let phydev = dev.0.get();
> +        // SAFETY: `phydev` is pointing to a valid object by the type invariant of `Device`.
> +        // So it's just an FFI call.
> +        to_result(unsafe {
> +            bindings::phy_write_mmd(phydev, self.devad.0.into(), self.regnum.into(), val)
> +        })
> +    }

And these are also O.K. There are two mechanisms to access the C45
register namespace. By calling phy_write_mmd()/phy_write_mmd() you are
leaving it upto the core to decide which mechanism to use. The driver
itself does not care.

So the problem is with the comment above. It would be better to say
something like:

This module provides support for accessing PHY registers in the
Ethernet management interface clauses 22 and 45 register namespaces, as
defined in IEEE 802.3.

Dropping the via, and adding register namespace should make it clear
we are talking about the registers themselves, not how you access
them.


    Andrew

---
pw-bot: cr

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH net-next v3 5/6] rust: net::phy unified genphy_read_status function for C22 and C45 registers
  2024-08-04 23:38 ` [PATCH net-next v3 5/6] rust: net::phy unified genphy_read_status function " FUJITA Tomonori
@ 2024-08-16  1:19   ` Andrew Lunn
  2024-08-16  5:30     ` FUJITA Tomonori
  0 siblings, 1 reply; 23+ messages in thread
From: Andrew Lunn @ 2024-08-16  1:19 UTC (permalink / raw)
  To: FUJITA Tomonori
  Cc: netdev, rust-for-linux, tmgross, miguel.ojeda.sandonis,
	benno.lossin, aliceryhl

> +///
> +///     // Checks the link status and updates current link state via C22.
> +///     dev.genphy_read_status::<phy::C22>();
> +///     // Checks the link status and updates current link state via C45.
> +///     dev.genphy_read_status::<phy::C45>();

Again, the word `via` is wrong here. You are looking at the link state
as reported by registers in the C22 namespace, or the C45 namespace.


    Andrew

---
pw-bot: cr

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH net-next v3 6/6] net: phy: add Applied Micro QT2025 PHY driver
  2024-08-04 23:38 ` [PATCH net-next v3 6/6] net: phy: add Applied Micro QT2025 PHY driver FUJITA Tomonori
@ 2024-08-16  1:45   ` Andrew Lunn
  2024-08-16  6:17     ` FUJITA Tomonori
  0 siblings, 1 reply; 23+ messages in thread
From: Andrew Lunn @ 2024-08-16  1:45 UTC (permalink / raw)
  To: FUJITA Tomonori
  Cc: netdev, rust-for-linux, tmgross, miguel.ojeda.sandonis,
	benno.lossin, aliceryhl

> +#[vtable]
> +impl Driver for PhyQT2025 {
> +    const NAME: &'static CStr = c_str!("QT2025 10Gpbs SFP+");
> +    const PHY_DEVICE_ID: phy::DeviceId = phy::DeviceId::new_with_exact_mask(0x0043A400);
> +
> +    fn probe(dev: &mut phy::Device) -> Result<()> {
> +        // The hardware is configurable?
> +        let hw_id = dev.read(C45::new(Mmd::PMAPMD, 0xd001))?;
> +        if (hw_id >> 8) & 0xff != 0xb3 {
> +            return Ok(());
> +        }

I don't understand this bit of code. At a guess, if the upper bytes of
that register is not 0xb3, the firmware has already been loaded into
the device?

> +
> +        // The 8051 will remain in the reset state.
> +        dev.write(C45::new(Mmd::PMAPMD, 0xC300), 0x0000)?;
> +        // Configure the 8051 clock frequency.
> +        dev.write(C45::new(Mmd::PMAPMD, 0xC302), 0x0004)?;
> +        // Non loopback mode.
> +        dev.write(C45::new(Mmd::PMAPMD, 0xC319), 0x0038)?;
> +        // Global control bit to select between LAN and WAN (WIS) mode.
> +        dev.write(C45::new(Mmd::PMAPMD, 0xC31A), 0x0098)?;
> +        dev.write(C45::new(Mmd::PCS, 0x0026), 0x0E00)?;
> +        dev.write(C45::new(Mmd::PCS, 0x0027), 0x0893)?;
> +        dev.write(C45::new(Mmd::PCS, 0x0028), 0xA528)?;
> +        dev.write(C45::new(Mmd::PCS, 0x0029), 0x0003)?;

802.3 says:

3.38 through 3.4110/25GBASE-R PCS test pattern seed B ????

> +        // Configure transmit and recovered clock.
> +        dev.write(C45::new(Mmd::PMAPMD, 0xC30A), 0x06E1)?;
> +        // The 8051 will finish the reset state.
> +        dev.write(C45::new(Mmd::PMAPMD, 0xC300), 0x0002)?;
> +        // The 8051 will start running from the boot ROM.
> +        dev.write(C45::new(Mmd::PCS, 0xE854), 0x00C0)?;
> +
> +        let fw = Firmware::request(c_str!("qt2025-2.0.3.3.fw"), dev.as_ref())?;
> +        if fw.data().len() > SZ_16K + SZ_8K {
> +            return Err(code::EFBIG);
> +        }
> +
> +        // The 24kB of program memory space is accessible by MDIO.
> +        // The first 16kB of memory is located in the address range 3.8000h - 3.BFFFh.
> +        // The next 8kB of memory is located at 4.8000h - 4.9FFFh.
> +        let mut j = SZ_32K;
> +        for (i, val) in fw.data().iter().enumerate() {
> +            if i == SZ_16K {
> +                j = SZ_32K;
> +            }
> +
> +            let mmd = if i < SZ_16K { Mmd::PCS } else { Mmd::PHYXS };
> +            dev.write(
> +                C45::new(mmd, j as u16),
> +                <u8 as Into<u16>>::into(*val).to_le(),

This is well past my level of Rust. I assume fw.data is a collection
of bytes, and you enumerate it as bytes. A byte has no endiannes, so
why do you need to convert it to little endian?

	Andrew

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH net-next v3 1/6] rust: sizes: add commonly used constants
  2024-08-16  0:37   ` Andrew Lunn
@ 2024-08-16  5:21     ` FUJITA Tomonori
  0 siblings, 0 replies; 23+ messages in thread
From: FUJITA Tomonori @ 2024-08-16  5:21 UTC (permalink / raw)
  To: andrew
  Cc: fujita.tomonori, netdev, rust-for-linux, tmgross,
	miguel.ojeda.sandonis, benno.lossin, aliceryhl

On Fri, 16 Aug 2024 02:37:02 +0200
Andrew Lunn <andrew@lunn.ch> wrote:

>> Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
>> Reviewed-by: Alice Ryhl <aliceryhl@google.com>
> 
> Your Signed-off-by: should come last. That keeps it together with the
> others added by Maintainers as they handle the patch on its way to
> mainline.
> 
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>

Fixed the order, along with the remaining ones.

Thanks!

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH net-next v3 2/6] rust: net::phy support probe callback
  2024-08-16  0:40   ` Andrew Lunn
@ 2024-08-16  5:21     ` FUJITA Tomonori
  0 siblings, 0 replies; 23+ messages in thread
From: FUJITA Tomonori @ 2024-08-16  5:21 UTC (permalink / raw)
  To: andrew
  Cc: fujita.tomonori, netdev, rust-for-linux, tmgross,
	miguel.ojeda.sandonis, benno.lossin, aliceryhl

On Fri, 16 Aug 2024 02:40:12 +0200
Andrew Lunn <andrew@lunn.ch> wrote:

>> +    /// # Safety
>> +    ///
>> +    /// `phydev` must be passed by the corresponding callback in `phy_driver`.
>> +    unsafe extern "C" fn probe_callback(phydev: *mut bindings::phy_device) -> core::ffi::c_int {
>> +        from_result(|| {
>> +            // SAFETY: This callback is called only in contexts
>> +            // where we can exclusively access to `phy_device` because
>> +            // it's not published yet, so the accessors on `Device` are okay
>> +            // to call.
> 
> Minor English nitpick. Its is normally 'have access to'. Or you can
> drop the 'to'.
> 
> Otherwise
> 
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>

Dropped the 'to' and added your Reviewed-by.

Thanks!

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH net-next v3 4/6] rust: net::phy unified read/write API for C22 and C45 registers
  2024-08-16  1:09   ` Andrew Lunn
@ 2024-08-16  5:27     ` FUJITA Tomonori
  0 siblings, 0 replies; 23+ messages in thread
From: FUJITA Tomonori @ 2024-08-16  5:27 UTC (permalink / raw)
  To: andrew
  Cc: fujita.tomonori, netdev, rust-for-linux, tmgross,
	miguel.ojeda.sandonis, benno.lossin, aliceryhl

On Fri, 16 Aug 2024 03:09:31 +0200
Andrew Lunn <andrew@lunn.ch> wrote:

> So the problem is with the comment above. It would be better to say
> something like:
> 
> This module provides support for accessing PHY registers in the
> Ethernet management interface clauses 22 and 45 register namespaces, as
> defined in IEEE 802.3.
> 
> Dropping the via, and adding register namespace should make it clear
> we are talking about the registers themselves, not how you access
> them.

Makes sense. Replaced that comment with your version.

Thanks a lot!

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH net-next v3 5/6] rust: net::phy unified genphy_read_status function for C22 and C45 registers
  2024-08-16  1:19   ` Andrew Lunn
@ 2024-08-16  5:30     ` FUJITA Tomonori
  2024-08-16 20:41       ` Andrew Lunn
  0 siblings, 1 reply; 23+ messages in thread
From: FUJITA Tomonori @ 2024-08-16  5:30 UTC (permalink / raw)
  To: andrew
  Cc: fujita.tomonori, netdev, rust-for-linux, tmgross,
	miguel.ojeda.sandonis, benno.lossin, aliceryhl

On Fri, 16 Aug 2024 03:19:51 +0200
Andrew Lunn <andrew@lunn.ch> wrote:

>> +///
>> +///     // Checks the link status and updates current link state via C22.
>> +///     dev.genphy_read_status::<phy::C22>();
>> +///     // Checks the link status and updates current link state via C45.
>> +///     dev.genphy_read_status::<phy::C45>();
> 
> Again, the word `via` is wrong here. You are looking at the link state
> as reported by registers in the C22 namespace, or the C45 namespace.

Yeah, how about the followings?

///     // Checks the link status as reported by registers in the C22 namespace
///     // and updates current link state.
///     dev.genphy_read_status::<phy::C22>();
///     // Checks the link status as reported by registers in the C45 namespace
///     // and updates current link state.
///     dev.genphy_read_status::<phy::C45>();

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH net-next v3 6/6] net: phy: add Applied Micro QT2025 PHY driver
  2024-08-16  1:45   ` Andrew Lunn
@ 2024-08-16  6:17     ` FUJITA Tomonori
  2024-08-16 20:47       ` Andrew Lunn
  0 siblings, 1 reply; 23+ messages in thread
From: FUJITA Tomonori @ 2024-08-16  6:17 UTC (permalink / raw)
  To: andrew
  Cc: fujita.tomonori, netdev, rust-for-linux, tmgross,
	miguel.ojeda.sandonis, benno.lossin, aliceryhl

On Fri, 16 Aug 2024 03:45:09 +0200
Andrew Lunn <andrew@lunn.ch> wrote:

>> +#[vtable]
>> +impl Driver for PhyQT2025 {
>> +    const NAME: &'static CStr = c_str!("QT2025 10Gpbs SFP+");
>> +    const PHY_DEVICE_ID: phy::DeviceId = phy::DeviceId::new_with_exact_mask(0x0043A400);
>> +
>> +    fn probe(dev: &mut phy::Device) -> Result<()> {
>> +        // The hardware is configurable?
>> +        let hw_id = dev.read(C45::new(Mmd::PMAPMD, 0xd001))?;
>> +        if (hw_id >> 8) & 0xff != 0xb3 {
>> +            return Ok(());
>> +        }
> 
> I don't understand this bit of code. At a guess, if the upper bytes of
> that register is not 0xb3, the firmware has already been loaded into
> the device?

I've just added debug code and found that the upper bytes of the
register is 0xb3 even after loading the firmware.

I checked the original code again and found that if the bytes isn't
0xb3, the driver initialization fails. I guess that the probe should
return an error here (ENODEV?). 

>> +        dev.write(C45::new(Mmd::PCS, 0x0026), 0x0E00)?;
>> +        dev.write(C45::new(Mmd::PCS, 0x0027), 0x0893)?;
>> +        dev.write(C45::new(Mmd::PCS, 0x0028), 0xA528)?;
>> +        dev.write(C45::new(Mmd::PCS, 0x0029), 0x0003)?;
> 
> 802.3 says:
> 
> 3.38 through 3.4110/25GBASE-R PCS test pattern seed B ????

Yeah, strange. But I can't find any hints on them in the datasheet or
the original code.

>> +        let fw = Firmware::request(c_str!("qt2025-2.0.3.3.fw"), dev.as_ref())?;
>> +        if fw.data().len() > SZ_16K + SZ_8K {
>> +            return Err(code::EFBIG);
>> +        }
>> +
>> +        // The 24kB of program memory space is accessible by MDIO.
>> +        // The first 16kB of memory is located in the address range 3.8000h - 3.BFFFh.
>> +        // The next 8kB of memory is located at 4.8000h - 4.9FFFh.
>> +        let mut j = SZ_32K;
>> +        for (i, val) in fw.data().iter().enumerate() {
>> +            if i == SZ_16K {
>> +                j = SZ_32K;
>> +            }
>> +
>> +            let mmd = if i < SZ_16K { Mmd::PCS } else { Mmd::PHYXS };
>> +            dev.write(
>> +                C45::new(mmd, j as u16),
>> +                <u8 as Into<u16>>::into(*val).to_le(),
> 
> This is well past my level of Rust. I assume fw.data is a collection
> of bytes, and you enumerate it as bytes. A byte has no endiannes, so
> why do you need to convert it to little endian?

I messed up here. No need. I'll remove the conversion in the next version.

Thanks!

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH net-next v3 5/6] rust: net::phy unified genphy_read_status function for C22 and C45 registers
  2024-08-16  5:30     ` FUJITA Tomonori
@ 2024-08-16 20:41       ` Andrew Lunn
  0 siblings, 0 replies; 23+ messages in thread
From: Andrew Lunn @ 2024-08-16 20:41 UTC (permalink / raw)
  To: FUJITA Tomonori
  Cc: netdev, rust-for-linux, tmgross, miguel.ojeda.sandonis,
	benno.lossin, aliceryhl

On Fri, Aug 16, 2024 at 05:30:09AM +0000, FUJITA Tomonori wrote:
> On Fri, 16 Aug 2024 03:19:51 +0200
> Andrew Lunn <andrew@lunn.ch> wrote:
> 
> >> +///
> >> +///     // Checks the link status and updates current link state via C22.
> >> +///     dev.genphy_read_status::<phy::C22>();
> >> +///     // Checks the link status and updates current link state via C45.
> >> +///     dev.genphy_read_status::<phy::C45>();
> > 
> > Again, the word `via` is wrong here. You are looking at the link state
> > as reported by registers in the C22 namespace, or the C45 namespace.
> 
> Yeah, how about the followings?
> 
> ///     // Checks the link status as reported by registers in the C22 namespace
> ///     // and updates current link state.
> ///     dev.genphy_read_status::<phy::C22>();
> ///     // Checks the link status as reported by registers in the C45 namespace
> ///     // and updates current link state.
> ///     dev.genphy_read_status::<phy::C45>();

Yes, that is good.

     Andrew

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH net-next v3 6/6] net: phy: add Applied Micro QT2025 PHY driver
  2024-08-16  6:17     ` FUJITA Tomonori
@ 2024-08-16 20:47       ` Andrew Lunn
  2024-08-17  4:50         ` FUJITA Tomonori
  0 siblings, 1 reply; 23+ messages in thread
From: Andrew Lunn @ 2024-08-16 20:47 UTC (permalink / raw)
  To: FUJITA Tomonori
  Cc: netdev, rust-for-linux, tmgross, miguel.ojeda.sandonis,
	benno.lossin, aliceryhl

On Fri, Aug 16, 2024 at 06:17:10AM +0000, FUJITA Tomonori wrote:
> On Fri, 16 Aug 2024 03:45:09 +0200
> Andrew Lunn <andrew@lunn.ch> wrote:
> 
> >> +#[vtable]
> >> +impl Driver for PhyQT2025 {
> >> +    const NAME: &'static CStr = c_str!("QT2025 10Gpbs SFP+");
> >> +    const PHY_DEVICE_ID: phy::DeviceId = phy::DeviceId::new_with_exact_mask(0x0043A400);
> >> +
> >> +    fn probe(dev: &mut phy::Device) -> Result<()> {
> >> +        // The hardware is configurable?
> >> +        let hw_id = dev.read(C45::new(Mmd::PMAPMD, 0xd001))?;
> >> +        if (hw_id >> 8) & 0xff != 0xb3 {
> >> +            return Ok(());
> >> +        }
> > 
> > I don't understand this bit of code. At a guess, if the upper bytes of
> > that register is not 0xb3, the firmware has already been loaded into
> > the device?
> 
> I've just added debug code and found that the upper bytes of the
> register is 0xb3 even after loading the firmware.
> 
> I checked the original code again and found that if the bytes isn't
> 0xb3, the driver initialization fails. I guess that the probe should
> return an error here (ENODEV?). 

O.K. Maybe add a comment that the vendor driver does this, but we have
no idea why.

> 
> >> +        dev.write(C45::new(Mmd::PCS, 0x0026), 0x0E00)?;
> >> +        dev.write(C45::new(Mmd::PCS, 0x0027), 0x0893)?;
> >> +        dev.write(C45::new(Mmd::PCS, 0x0028), 0xA528)?;
> >> +        dev.write(C45::new(Mmd::PCS, 0x0029), 0x0003)?;
> > 
> > 802.3 says:
> > 
> > 3.38 through 3.4110/25GBASE-R PCS test pattern seed B ????
> 
> Yeah, strange. But I can't find any hints on them in the datasheet or
> the original code.

Seems unlikely it is seeding anything. So i guess they have reused the
registers for something else. This is actually a bit odd, because all
the other registers are in the ranges reserved for vendor usage.

If these were legitimate register usage, i would of suggested adding
#define to include/uapi/linux/mdio.h for them.

	Andrew

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH net-next v3 6/6] net: phy: add Applied Micro QT2025 PHY driver
  2024-08-16 20:47       ` Andrew Lunn
@ 2024-08-17  4:50         ` FUJITA Tomonori
  0 siblings, 0 replies; 23+ messages in thread
From: FUJITA Tomonori @ 2024-08-17  4:50 UTC (permalink / raw)
  To: andrew
  Cc: fujita.tomonori, netdev, rust-for-linux, tmgross,
	miguel.ojeda.sandonis, benno.lossin, aliceryhl

On Fri, 16 Aug 2024 22:47:04 +0200
Andrew Lunn <andrew@lunn.ch> wrote:

>> >> +    fn probe(dev: &mut phy::Device) -> Result<()> {
>> >> +        // The hardware is configurable?
>> >> +        let hw_id = dev.read(C45::new(Mmd::PMAPMD, 0xd001))?;
>> >> +        if (hw_id >> 8) & 0xff != 0xb3 {
>> >> +            return Ok(());
>> >> +        }
>> > 
>> > I don't understand this bit of code. At a guess, if the upper bytes of
>> > that register is not 0xb3, the firmware has already been loaded into
>> > the device?
>> 
>> I've just added debug code and found that the upper bytes of the
>> register is 0xb3 even after loading the firmware.
>> 
>> I checked the original code again and found that if the bytes isn't
>> 0xb3, the driver initialization fails. I guess that the probe should
>> return an error here (ENODEV?). 
> 
> O.K. Maybe add a comment that the vendor driver does this, but we have
> no idea why.

Yes, added the comment.

>> >> +        dev.write(C45::new(Mmd::PCS, 0x0026), 0x0E00)?;
>> >> +        dev.write(C45::new(Mmd::PCS, 0x0027), 0x0893)?;
>> >> +        dev.write(C45::new(Mmd::PCS, 0x0028), 0xA528)?;
>> >> +        dev.write(C45::new(Mmd::PCS, 0x0029), 0x0003)?;
>> > 
>> > 802.3 says:
>> > 
>> > 3.38 through 3.4110/25GBASE-R PCS test pattern seed B ????
>> 
>> Yeah, strange. But I can't find any hints on them in the datasheet or
>> the original code.
> 
> Seems unlikely it is seeding anything. So i guess they have reused the
> registers for something else. This is actually a bit odd, because all
> the other registers are in the ranges reserved for vendor usage.
> 
> If these were legitimate register usage, i would of suggested adding
> #define to include/uapi/linux/mdio.h for them.

I see.

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2024-08-17  4:50 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-04 23:38 [PATCH net-next v3 0/6] net: phy: add Applied Micro QT2025 PHY driver FUJITA Tomonori
2024-08-04 23:38 ` [PATCH net-next v3 1/6] rust: sizes: add commonly used constants FUJITA Tomonori
2024-08-16  0:37   ` Andrew Lunn
2024-08-16  5:21     ` FUJITA Tomonori
2024-08-04 23:38 ` [PATCH net-next v3 2/6] rust: net::phy support probe callback FUJITA Tomonori
2024-08-16  0:40   ` Andrew Lunn
2024-08-16  5:21     ` FUJITA Tomonori
2024-08-04 23:38 ` [PATCH net-next v3 3/6] rust: net::phy implement AsRef<kernel::device::Device> trait FUJITA Tomonori
2024-08-16  0:41   ` Andrew Lunn
2024-08-04 23:38 ` [PATCH net-next v3 4/6] rust: net::phy unified read/write API for C22 and C45 registers FUJITA Tomonori
2024-08-16  1:09   ` Andrew Lunn
2024-08-16  5:27     ` FUJITA Tomonori
2024-08-04 23:38 ` [PATCH net-next v3 5/6] rust: net::phy unified genphy_read_status function " FUJITA Tomonori
2024-08-16  1:19   ` Andrew Lunn
2024-08-16  5:30     ` FUJITA Tomonori
2024-08-16 20:41       ` Andrew Lunn
2024-08-04 23:38 ` [PATCH net-next v3 6/6] net: phy: add Applied Micro QT2025 PHY driver FUJITA Tomonori
2024-08-16  1:45   ` Andrew Lunn
2024-08-16  6:17     ` FUJITA Tomonori
2024-08-16 20:47       ` Andrew Lunn
2024-08-17  4:50         ` FUJITA Tomonori
2024-08-05  1:10 ` [PATCH net-next v3 0/6] " Andrew Lunn
2024-08-14  2:57   ` FUJITA Tomonori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox