OpenCloudOS-Kernel/drivers/net/dsa/realtek
Alvin Šipraga a48b6e44a9 net: dsa: realtek: rtl8365mb: handle PHY interface modes correctly
Realtek switches in the rtl8365mb family always have at least one port
with a so-called external interface, supporting PHY interface modes such
as RGMII or SGMII. The purpose of this patch is to improve the driver's
handling of these ports.

A new struct rtl8365mb_chip_info is introduced together with a static
array of such structs. An instance of this struct is added for each
supported switch, distinguished by its chip ID and version. Embedded in
each chip_info struct is an array of struct rtl8365mb_extint, describing
the external interfaces available. This is more specific than the old
rtl8365mb_extint_port_map, which was only valid for switches with up to
6 ports.

The struct rtl8365mb_extint also contains a bitmask of supported PHY
interface modes, which allows the driver to distinguish which ports
support RGMII. This corrects a previous mistake in the driver whereby it
was assumed that any port with an external interface supports RGMII.
This is not actually the case: for example, the RTL8367S has two
external interfaces, only the second of which supports RGMII. The first
supports only SGMII and HSGMII. This new design will make it easier to
add support for other interface modes.

Finally, rtl8365mb_phylink_get_caps() is fixed up to return supported
capabilities based on the external interface properties described above.
This addresses Vladimir's point in the linked thread that the
capabilities are not actually a function of the DSA port type: Although
most typical applications will treat the ports with internal PHY as user
ports, there is no actual hardware limitation preventing one from using
them as a CPU port. Equally, ports with external interface(s) may well
be treated as user ports, even though it is typical to use those ports
as CPU ports.

Link: https://lore.kernel.org/netdev/20220510192301.5djdt3ghoavxulhl@bang-olufsen.dk/
Signed-off-by: Alvin Šipraga <alsi@bang-olufsen.dk>
Acked-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Acked-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-06-16 20:44:47 -07:00
..
Kconfig net: dsa: realtek: fix Kconfig to assure consistent driver linkage 2022-04-13 14:30:31 +01:00
Makefile net: dsa: realtek: add new mdio interface for drivers 2022-01-28 15:02:49 +00:00
realtek-mdio.c net: dsa: realtek: remove realtek,rtl8367s string 2022-04-20 11:02:28 +01:00
realtek-smi.c net: dsa: realtek: remove realtek,rtl8367s string 2022-04-20 11:02:28 +01:00
realtek.h net: dsa: realtek: allow subdrivers to externally lock regmap 2022-02-23 12:24:29 +00:00
rtl8365mb.c net: dsa: realtek: rtl8365mb: handle PHY interface modes correctly 2022-06-16 20:44:47 -07:00
rtl8366-core.c net: dsa: realtek: convert subdrivers into modules 2022-01-28 15:02:49 +00:00
rtl8366rb.c net: dsa: realtek: rtl8366rb: Serialize indirect PHY register access 2022-05-16 13:09:46 -07:00