netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next 0/2] net: dsa: realtek: Introduce realtek_common, load variants on demand
@ 2023-11-17 23:49 Luiz Angelo Daros de Luca
  2023-11-17 23:50 ` [net-next 1/2] net: dsa: realtek: create realtek-common Luiz Angelo Daros de Luca
                   ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: Luiz Angelo Daros de Luca @ 2023-11-17 23:49 UTC (permalink / raw)
  To: netdev
  Cc: linus.walleij, alsi, andrew, f.fainelli, olteanv, davem, edumazet,
	kuba, pabeni, arinc.unal

The current driver comprises two interface modules (SMI and MDIO) and
two family/variant modules (RTL8365MB and RTL8366RB). While the
interface modules are independent and can be loaded only when necessary,
the symbols from variant modules are utilized by interface modules. This
requires loading all enabled variants simultaneously or disabling them
at build time. This approach, although simple, does not scale well,
particularly with the addition of more switch variants (e.g., RTL8366B),
resulting in loaded but unused modules.

This patch series refactors the Realtek DSA switch code by introducing a
common module shared by all existing interfaces (SMI or MDIO) and switch
variant modules (RTL8365MB and RTL8366RB). The common module primarily
contains parts of the probe code common to both interfaces, with the
possibility of incorporating more bits from variants in the future.

The relationship between interfaces and variant modules is also
modified. Variant modules now register themselves in realtek_common
using the compatible string as the key, which is also added as the
module alias. When an interface module probes a device, it utilizes the
matching string to both request the module, loading it if necessary, and
obtain the required variant reference.

Tested with a RTL8367S (RTL8365MB) using MDIO interface and a RTL8366RB
(RTL8366) with SMI interface.

Regards,

Luiz

--

Changelog:

RFC->v1
- Drop the reset-controller patches. It will be submitted in a different
  series.
- Renamed 'var' to 'variant'
- Used 'compatible' as MODULE_ALIAS; avoided static module names in
  macros
- Dropped tmp variable in realtek_variant_get()
- realtek_variant_get() now exclusively uses the compatible string
- Removed clk_delay, cmd_{read,write) from realtek_priv as they are
  already in realtek_variant
- Moved mdc/mdio from realtek_common_probe() to realtek_smi_probe()
- Moved module_realtek_variant() macro to realtek-common.h
- module_realtek_variant() now also generates MODULE_ALIAS()
- Avoided repeating error code with dev_err_probe()
- Removed unused realtek_variant.info
- Used realtek_common_(un)lock() in chip variant modules



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

end of thread, other threads:[~2023-12-11 18:01 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-17 23:49 [net-next 0/2] net: dsa: realtek: Introduce realtek_common, load variants on demand Luiz Angelo Daros de Luca
2023-11-17 23:50 ` [net-next 1/2] net: dsa: realtek: create realtek-common Luiz Angelo Daros de Luca
2023-11-19 12:13   ` Vladimir Oltean
2023-11-19 12:20   ` Vladimir Oltean
2023-11-17 23:50 ` [net-next 2/2] net: dsa: realtek: load switch variants on demand Luiz Angelo Daros de Luca
2023-11-19 12:19   ` Vladimir Oltean
2023-11-20  9:20   ` Krzysztof Kozlowski
2023-11-20 13:48     ` Vladimir Oltean
2023-11-20 14:07       ` Krzysztof Kozlowski
2023-11-21 14:40         ` Luiz Angelo Daros de Luca
2023-11-21 22:15           ` Krzysztof Kozlowski
2023-11-21 22:35             ` Krzysztof Kozlowski
2023-11-22 22:44               ` Luiz Angelo Daros de Luca
2023-11-23  2:05                 ` Alvin Šipraga
2023-11-27 22:24                   ` Luiz Angelo Daros de Luca
2023-12-07 17:02                     ` Vladimir Oltean
2023-12-07 20:22                       ` Luiz Angelo Daros de Luca
2023-12-07 17:19                     ` Vladimir Oltean
2023-12-07 19:50                       ` Luiz Angelo Daros de Luca
2023-12-07 22:31                         ` Vladimir Oltean
2023-12-08  2:46                           ` Luiz Angelo Daros de Luca
2023-12-11 18:01                             ` Vladimir Oltean
2023-11-25  7:10   ` Dan Carpenter
2023-11-17 23:57 ` [net-next 0/2] net: dsa: realtek: Introduce realtek_common, load " Luiz Angelo Daros de Luca
2023-11-18  0:44   ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).