net: dsa: realtek: variants to drivers, interfaces to a common module
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest11 patches 5 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/11 | net: dsa: realtek: drop cleanup from realtek_opsdrivers/ | +0 | 0 replies | |
| 2/11 | net: dsa: realtek: introduce REALTEK_DSA namespacedrivers/ drivers/ drivers/ +2 more | +19 | 0 replies | |
| 3/11 | net: dsa: realtek: convert variants into real driversdrivers/ drivers/ drivers/ +4 more | +294 | 1 reply | |
| 4/11 | net: dsa: realtek: keep variant reference in realtek_privdrivers/ drivers/ drivers/ | +7 | 0 replies | |
| 5/11 | net: dsa: realtek: common rtl83xx moduledrivers/ drivers/ drivers/ +5 more | +279 | 0 replies | |
| 6/11 | net: dsa: realtek: merge rtl83xx and interface modules into realtek-dsadrivers/ drivers/ drivers/ +2 more | +12 | 0 replies | |
| 7/11 | net: dsa: realtek: get internal MDIO node by namedrivers/ | +1 | 0 replies | |
| 8/11 | net: dsa: realtek: clean user_mii_bus setupdrivers/ drivers/ drivers/ | +4 | 0 replies | |
| 9/11 | net: dsa: realtek: migrate user_mii_bus setup to realtek-dsadrivers/ drivers/ drivers/ | +69 | 0 replies | |
| 10/11 | net: dsa: realtek: use the same mii bus driver for both interfacesdrivers/ drivers/ drivers/ +3 more | +14 | 0 replies | |
| 11/11 | net: dsa: realtek: embed dsa_switch into realtek_privdrivers/ drivers/ drivers/ +3 more | +16 | 1 reply |
Reviews trailers per patch
2 of 11 patches have a Reviewed-by or Acked-by.
| Patch | Alvin Šipraga | Florian Fainelli | Linus Walleij | Vladimir Oltean |
|---|---|---|---|---|
| 1/11 | R-b | R-b | R-b | |
| 2/11 | ||||
| 3/11 | ||||
| 4/11 | ||||
| 5/11 | ||||
| 6/11 | ||||
| 7/11 | R-b | |||
| 8/11 | ||||
| 9/11 | ||||
| 10/11 | ||||
| 11/11 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.
Cover letter [PATCH 00/11] net: dsa: realtek: variants to drivers, interfaces to a common module
The current driver consists of two interface modules (SMI and MDIO) and two family/variant modules (RTL8365MB and RTL8366RB). The SMI and MDIO modules serve as the platform and MDIO drivers, respectively, calling functions from the variant modules. In this setup, one interface module can be loaded independently of the other, but both variants must be loaded (if not disabled at build time) for any type of interface. This approach doesn't scale well, especially with the addition of more switch variants (e.g., RTL8366B), leading to loaded but unused modules. Additionally, this also seems upside down, as the specific driver code normally depends on the more generic functions and not the other way around.
Each variant module was converted into real drivers, serving as both a platform driver (for switches connected using the SMI interface) and an MDIO driver (for MDIO-connected switches). The relationship between the variant and interface modules is reversed, with the variant module now calling both interface functions (if not disabled at build time). While in most devices only one interface is likely used, the interface code is significantly smaller than a variant module, consuming fewer resources than the previous code. With variant modules now functioning as real drivers, compatible strings are published only in a single variant module, preventing conflicts.
The patch series introduces a new common module for functions shared by both variants. This module also absorbs the two previous interface modules, as they would always be loaded anyway.
The series relocates the user MII driver from realtek-smi to rtl83xx. It is now used by MDIO-connected switches instead of the generic DSA driver. There's a change in how this driver locates the MDIO node. It now only searches for a child node named "mdio".
The dsa_switch in realtek_priv->ds is now embedded in the struct. It is always in use and avoids dynamic memory allocation.
Testing has been performed with an RTL8367S (rtl8365mb) using MDIO interface and an RTL8366RB (rtl8366) with SMI interface.
Luiz
---
Changes:
v3-v4:
1) Changed Makefile to use ifdef instead of dynamic variable names.
2) Added comments for all exported symbols.
3) Migrated exported symbols to REALTEK_DSA namespace.
4) renamed realtek_common to rtl83xx.
5) put the mdio node just after registration and not in driver remove.
6) rtl83xx_probe now receives a struct with regmap read/write functions and build regmap_config dynamically.
7) pulled into a new patch the realtek_priv change from "common realtek-dsa module".
8) pulled into a new patch the user_mii_bus setup changes from "migrate user_mii_bus setup to realtek-dsa".
9) removed the revert "net: dsa: OF-ware slave_mii_bus" patch from the series.
v2-v3:
1) Look for the MDIO bus searching for a child node named "mdio" instead of the compatible string.
2) Removed the check for a phy-handle in ports. ds->user_mii_bus will not be used anymore.
3) Dropped comments for realtek_common_{probe,register_switch}.
4) Fixed a compile error in "net: dsa: OF-ware slave_mii_bus".
5) Used the wrapper realtek_smi_driver_register instead of platform_driver_register.
v1-v2:
1) Renamed realtek_common module to realtek-dsa. 2) Removed the warning when the MDIO node is not named "mdio." 3) ds->user_mii_bus is only assigned if all user ports do not have a
phy-handle.
4) of_node_put is now back to the driver remove method.
5) Renamed realtek_common_probe_{pre,post} to realtek_common_{probe,register_switch}.
6) Added some comments for realtek_common_{probe,register_switch}.
7) Using dev_err_probe whenever possible.
8) Embedded priv->ds into realtek_priv, removing its dynamic allocation.
9) Fixed realtek-common.h macros.
10) Save and check the return value in functions, even when it is the last one.
11) Added the #if expression as a comment to #else and #endif in header files.
12) Unregister the platform and the MDIO driver in the reverse order they are registered.
13) Unregister the first driver if the second one failed to register.
14) Added the revert patch for "net: dsa: OF-ware slave_mii_bus."
Luiz Angelo Daros de Luca (11):
net: dsa: realtek: drop cleanup from realtek_ops
net: dsa: realtek: introduce REALTEK_DSA namespace
net: dsa: realtek: convert variants into real drivers
net: dsa: realtek: keep variant reference in realtek_priv
net: dsa: realtek: common rtl83xx module
net: dsa: realtek: merge rtl83xx and interface modules into
realtek-dsa
net: dsa: realtek: get internal MDIO node by name
net: dsa: realtek: clean user_mii_bus setup
net: dsa: realtek: migrate user_mii_bus setup to realtek-dsa
net: dsa: realtek: use the same mii bus driver for both interfaces
net: dsa: realtek: embed dsa_switch into realtek_priv
drivers/net/dsa/realtek/Kconfig | 20 +- drivers/net/dsa/realtek/Makefile | 13 +- drivers/net/dsa/realtek/realtek-mdio.c | 211 +++++-------------- drivers/net/dsa/realtek/realtek-mdio.h | 48 +++++ drivers/net/dsa/realtek/realtek-smi.c | 277 +++++-------------------- drivers/net/dsa/realtek/realtek-smi.h | 48 +++++ drivers/net/dsa/realtek/realtek.h | 12 +- drivers/net/dsa/realtek/rtl8365mb.c | 126 ++++++----- drivers/net/dsa/realtek/rtl8366-core.c | 22 +- drivers/net/dsa/realtek/rtl8366rb.c | 119 ++++++----- drivers/net/dsa/realtek/rtl83xx.c | 267 ++++++++++++++++++++++++ drivers/net/dsa/realtek/rtl83xx.h | 22 ++ 12 files changed, 667 insertions(+), 518 deletions(-) create mode 100644 drivers/net/dsa/realtek/realtek-mdio.h create mode 100644 drivers/net/dsa/realtek/realtek-smi.h create mode 100644 drivers/net/dsa/realtek/rtl83xx.c create mode 100644 drivers/net/dsa/realtek/rtl83xx.h
Signature · 1 line
2.43.0