All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luiz Angelo Daros de Luca <luizluca@gmail.com>
To: netdev@vger.kernel.org
Cc: linus.walleij@linaro.org, alsi@bang-olufsen.dk, andrew@lunn.ch,
	f.fainelli@gmail.com, olteanv@gmail.com, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	arinc.unal@arinc9.com
Subject: [PATCH net-next v2 0/7] net: dsa: realtek: variants to drivers, interfaces to a common module
Date: Wed, 20 Dec 2023 01:24:23 -0300	[thread overview]
Message-ID: <20231220042632.26825-1-luizluca@gmail.com> (raw)

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 to be upside down, as the specific driver code normally depends on the more generic functions and not the other way around.

The series begins by removing an unused function pointer at realtek_ops->cleanup.

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 common. 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 searches for either a child named "mdio" (compatible with realtek-mdio and binding docs) or a child with the compatible string (compatible with realtek-smi).

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:

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."



             reply	other threads:[~2023-12-20  4:26 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-20  4:24 Luiz Angelo Daros de Luca [this message]
2023-12-20  4:24 ` [PATCH net-next v2 1/7] net: dsa: realtek: drop cleanup from realtek_ops Luiz Angelo Daros de Luca
2023-12-20 13:57   ` Alvin Šipraga
2023-12-21 17:04     ` Vladimir Oltean
2023-12-21 20:05       ` Alvin Šipraga
2023-12-22 22:32         ` Luiz Angelo Daros de Luca
2023-12-20  4:24 ` [PATCH net-next v2 2/7] net: dsa: realtek: convert variants into real drivers Luiz Angelo Daros de Luca
2023-12-21 17:08   ` Vladimir Oltean
2023-12-20  4:24 ` [PATCH net-next v2 3/7] net: dsa: realtek: common realtek-dsa module Luiz Angelo Daros de Luca
2023-12-20 10:40   ` Alvin Šipraga
2023-12-20 15:50     ` Alvin Šipraga
2023-12-21  3:25       ` Luiz Angelo Daros de Luca
2023-12-21  3:11     ` Luiz Angelo Daros de Luca
2023-12-20  4:24 ` [PATCH net-next v2 4/7] net: dsa: realtek: merge common and interface modules into realtek-dsa Luiz Angelo Daros de Luca
2023-12-20  4:24 ` [PATCH net-next v2 5/7] net: dsa: realtek: Migrate user_mii_bus setup to realtek-dsa Luiz Angelo Daros de Luca
2023-12-20  4:51   ` Luiz Angelo Daros de Luca
2023-12-21 17:47     ` Vladimir Oltean
2023-12-21 18:34       ` Arınç ÜNAL
2023-12-22 10:48         ` Vladimir Oltean
2023-12-22 11:13           ` Alvin Šipraga
2023-12-22 17:04             ` Arınç ÜNAL
2023-12-22 20:28               ` Luiz Angelo Daros de Luca
2023-12-22 20:59                 ` Arınç ÜNAL
2023-12-22 16:56           ` Arınç ÜNAL
2024-01-03 18:44             ` Vladimir Oltean
2024-01-05 18:43               ` Arınç ÜNAL
2023-12-22 20:03       ` Luiz Angelo Daros de Luca
2023-12-22 22:09         ` Vladimir Oltean
2023-12-22 22:12           ` Luiz Angelo Daros de Luca
2023-12-20 13:17   ` Alvin Šipraga
2023-12-21  3:03     ` Luiz Angelo Daros de Luca
2023-12-20  4:24 ` [PATCH net-next v2 6/7] net: dsa: realtek: embed dsa_switch into realtek_priv Luiz Angelo Daros de Luca
2023-12-20  4:24 ` [PATCH net-next v2 7/7] Revert "net: dsa: OF-ware slave_mii_bus" Luiz Angelo Daros de Luca
2023-12-20 13:19   ` Alvin Šipraga
2023-12-21  3:45     ` Luiz Angelo Daros de Luca
2023-12-21  0:41   ` kernel test robot
2023-12-21 15:21 ` [PATCH net-next v2 0/7] net: dsa: realtek: variants to drivers, interfaces to a common module Vladimir Oltean
2023-12-22 21:32   ` Luiz Angelo Daros de Luca

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231220042632.26825-1-luizluca@gmail.com \
    --to=luizluca@gmail.com \
    --cc=alsi@bang-olufsen.dk \
    --cc=andrew@lunn.ch \
    --cc=arinc.unal@arinc9.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.