[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250821152022.1065237-1-vladimir.oltean@nxp.com>
Date: Thu, 21 Aug 2025 18:20:07 +0300
From: Vladimir Oltean <vladimir.oltean@....com>
To: netdev@...r.kernel.org
Cc: Andrew Lunn <andrew@...n.ch>,
Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Daniel Golle <daniel@...rotopia.org>,
linux-kernel@...r.kernel.org,
Nikita Yushchenko <nikita.yoush@...entembedded.com>,
Bartosz Golaszewski <bartosz.golaszewski@...aro.org>,
Robert Marko <robimarko@...il.com>,
Paweł Owoc <frut3k7@...il.com>,
Sean Anderson <sean.anderson@...o.com>,
Jon Hunter <jonathanh@...dia.com>
Subject: [PATCH net-next 00/15] Aquantia PHY driver consolidation - part 1
This started out as an effort to add some new features hinging on the
VEND1_GLOBAL_CFG_* registers, but I quickly started to notice that the
Aquantia PHY driver has a large code base, but individual PHYs only
implement arbitrary subsets of it.
The table below lists the PHYs known to me to have the
VEND1_GLOBAL_CFG_* registers.
PHY Access from Access from
aqr107_read_rate() aqr113c_fill_interface_modes()
------------------------------------------------------------------
AQR107 y n
AQCS109 y n
AQR111 y n
AQR111B0 y n
AQR112 y n
AQR412 y n
AQR113 y y
AQR113C y y
AQR813 y n
AQR114C y n
AQR115C y y
Maybe you're wondering, after reading this, why don't more Aquantia PHYs
populate phydev->possible_interfaces based on the registers that they
are known to have? And why do AQR114C and AQR115C, PHYs from the same
generation, just having different max speeds, differ in this behaviour?
And why does AQR813, the 8-port variant of AQR113, not call
aqr113c_config_init(), but aqr107_config_init()?
I did wonder, and I don't know either, but I suspect it has to do with
developers not wanting to break what they can't test, and only touching
what they are interested in. Multiplied at a large enough scale, this
tends to result in unmaintainable code.
The tendency might also be encouraged by the slightly strange and
inconsistent naming scheme in this driver.
The set proposes a naming scheme based on generations, and feature
inheritance from Gen X to Gen X+1. This helps fill in missing
software functionalities where the hardware feature should be present.
I had to put a hard stop at 15 patches, so I've picked the more
meaningful functions to consolidate, rather than going through the
entire driver. Depending on review feedback, I can do more or I can
stop.
Furthermore, the set adds generation-appropriate support for two more
PHY IDs: AQR412 and AQR115, and fixes the improper reporting of AQR412C
as AQR412.
The changes were tested on AQR107, AQR112, AQR412C and AQR115.
Cc: Nikita Yushchenko <nikita.yoush@...entembedded.com>
Cc: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Cc: Robert Marko <robimarko@...il.com>
Cc: Paweł Owoc <frut3k7@...il.com>
Cc: Sean Anderson <sean.anderson@...o.com>
Camelia Groza (1):
net: phy: aquantia: add support for AQR115
Vladimir Oltean (14):
net: phy: aquantia: rename AQR412 to AQR412C and add real AQR412
net: phy: aquantia: merge aqr113c_fill_interface_modes() into
aqr107_fill_interface_modes()
net: phy: aquantia: reorder AQR113C PMD Global Transmit Disable bit
clearing with supported_interfaces
net: phy: aquantia: rename some aqr107 functions according to
generation
net: phy: aquantia: fill supported_interfaces for all
aqr_gen2_config_init() callers
net: phy: aquantia: save a local shadow of GLOBAL_CFG register values
net: phy: aquantia: remove handling for
get_rate_matching(PHY_INTERFACE_MODE_NA)
net: phy: aquantia: use cached GLOBAL_CFG registers in
aqr107_read_rate()
net: phy: aquantia: merge and rename aqr105_read_status() and
aqr107_read_status()
net: phy: aquantia: call aqr_gen2_fill_interface_modes() for AQCS109
net: phy: aquantia: call aqr_gen3_config_init() for AQR112 and
AQR412(C)
net: phy: aquantia: reimplement aqcs109_config_init() as
aqr_gen2_config_init()
net: phy: aquantia: rename aqr113c_config_init() to
aqr_gen4_config_init()
net: phy: aquantia: promote AQR813 and AQR114C to
aqr_gen4_config_init()
drivers/net/phy/aquantia/aquantia.h | 28 ++
drivers/net/phy/aquantia/aquantia_main.c | 531 +++++++++++------------
2 files changed, 289 insertions(+), 270 deletions(-)
--
2.34.1
Powered by blists - more mailing lists