Commit 7c263e9d authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'dsa-realtek-MDIO'



Luiz Angelo Daros de Luca says:

====================
net: dsa: realtek: MDIO interface and RTL8367S,RTL8367RB-VB

The old realtek-smi driver was linking subdrivers into a single
realtek-smi.ko After this series, each subdriver will be an independent
module required by either realtek-smi (platform driver) or the new
realtek-mdio (mdio driver). Both interface drivers (SMI or MDIO) are
independent, and they might even work side-by-side, although it will be
difficult to find such device. The subdriver can be individually
selected but only at buildtime, saving some storage space for custom
embedded systems.

Existing realtek-smi devices continue to work untouched during the
tests. The realtek-smi was moved into a realtek subdirectory, but it
normally does not break things.

I couldn't identify a fixed relation between port numbers (0..9) and
external interfaces (0..2), and I'm not sure if it is fixed for each
chip version or a device configuration. Until there is more info about
it, there is a new port property "realtek,ext-int" that can inform the
external interface.

The rtl8365mb might now handle multiple CPU ports and extint ports not
used as CPU ports. RTL8367S has an SGMII external interface, but my test
device (TP-Link Archer C5v4) uses only the second RGMII interface. We
need a test device with more external ports to test these features.
The driver still cannot handle SGMII ports.

RTL8367RB-VB support was added using information from Frank Wunderlich
<frank-w@public-files.de> but I didn't test it myself.

The rtl8365mb was tested with a MDIO-connected RTL8367S (TP-Link Acher
C5v4) and a SMI-connected RTL8365MB-VC switch (Asus RT-AC88U)

The rtl8366rb subdriver was not tested with this patch series, but it
was only slightly touched. It would be nice to test it, especially in an
MDIO-connected switch.

Best,

Luiz

Changelog:

v1-v2)
- formatting fixes
- dropped the rtl8365mb->rtl8367c rename
- other suggestions

v2-v3)
* realtek-mdio.c:
  - cleanup realtek-mdio.c (BUG_ON, comments and includes)
  - check devm_regmap_init return code
  - removed realtek,rtl8366s string from realtek-mdio
* realtek-smi.c:
  - removed void* type cast
* rtl8365mb.c:
  - using macros to identify EXT interfaces
  - rename some extra extport->extint cases
  - allow extint as non cpu (not tested)
  - allow multple cpu ports (not tested)
  - dropped cpu info from struct rtl8365mb
* dropped dt-bindings changes (dealing outside this series)
* formatting issues fixed

v3-v4)
* fix cover message numbering 0/13 -> 0/11
* use static for realtek_mdio_read_reg
  - Reported-by: default avatarkernel test robot <lkp@intel.com>
* use dsa_switch_for_each_cpu_port
* mention realtek_smi_{variant,ops} to realtek_{variant,ops}
  in commit message

v5) sent again v4 branch. Sorry

v4-v6)
- added support for RTL8367RB-VB
- cleanup mdio_{read,write}, removing misterious START_OP, checking and
  returning errors
- renamed priv->phy_id to priv->mdio_addr
- duplicated priv->ds_ops into ds_ops_{smi,mdio}. ds_ops_smi must not
  set
  phy_read or else both dsa and this driver might free slave_mii.
Dropped
  401fd75c92f37
- Map port to extint using code instead of device-tree property. Added
  comment
  about port number, port description and external interfaces. Dropped
  'realtek,ext-int' device-tree property
- Redacted the non-cpu ext port commit message, not highlighting the
  possibility of using multiple CPU ports as it was just a byproduct.
- In a possible case of multiple cpu ports, use the first one as the
  trap port.
  Dropped 'realtek,trap-port' device-tree property
- Some formatting fixes
- BUG: rtl8365mb_phy_mode_supported was still checking for a cpu port
  and not
  an external interface
- BUG: fix trapdoor masking for port>7. Got a compiler error with a
  bigger
  constant value
- WARN: completed kdoc for rtl8366rb_drop_untagged()
- WARN: removed marks from incomplete kdoc
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents a989eb66 078ae1bd
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -16352,8 +16352,7 @@ REALTEK RTL83xx SMI DSA ROUTER CHIPS
M:	Linus Walleij <linus.walleij@linaro.org>
S:	Maintained
F:	Documentation/devicetree/bindings/net/dsa/realtek-smi.txt
F:	drivers/net/dsa/realtek-smi*
F:	drivers/net/dsa/rtl83*
F:	drivers/net/dsa/realtek/*
REALTEK WIRELESS DRIVER (rtlwifi family)
M:	Ping-Ke Shih <pkshih@realtek.com>
+1 −11
Original line number Diff line number Diff line
@@ -67,17 +67,7 @@ config NET_DSA_QCA8K
	  This enables support for the Qualcomm Atheros QCA8K Ethernet
	  switch chips.

config NET_DSA_REALTEK_SMI
	tristate "Realtek SMI Ethernet switch family support"
	select NET_DSA_TAG_RTL4_A
	select NET_DSA_TAG_RTL8_4
	select FIXED_PHY
	select IRQ_DOMAIN
	select REALTEK_PHY
	select REGMAP
	help
	  This enables support for the Realtek SMI-based switch
	  chips, currently only RTL8366RB.
source "drivers/net/dsa/realtek/Kconfig"

config NET_DSA_SMSC_LAN9303
	tristate
+1 −2
Original line number Diff line number Diff line
@@ -9,8 +9,6 @@ obj-$(CONFIG_NET_DSA_LANTIQ_GSWIP) += lantiq_gswip.o
obj-$(CONFIG_NET_DSA_MT7530)	+= mt7530.o
obj-$(CONFIG_NET_DSA_MV88E6060) += mv88e6060.o
obj-$(CONFIG_NET_DSA_QCA8K)	+= qca8k.o
obj-$(CONFIG_NET_DSA_REALTEK_SMI) += realtek-smi.o
realtek-smi-objs		:= realtek-smi-core.o rtl8366.o rtl8366rb.o rtl8365mb.o
obj-$(CONFIG_NET_DSA_SMSC_LAN9303) += lan9303-core.o
obj-$(CONFIG_NET_DSA_SMSC_LAN9303_I2C) += lan9303_i2c.o
obj-$(CONFIG_NET_DSA_SMSC_LAN9303_MDIO) += lan9303_mdio.o
@@ -23,5 +21,6 @@ obj-y += microchip/
obj-y				+= mv88e6xxx/
obj-y				+= ocelot/
obj-y				+= qca/
obj-y				+= realtek/
obj-y				+= sja1105/
obj-y				+= xrs700x/
+44 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only
menuconfig NET_DSA_REALTEK
	tristate "Realtek Ethernet switch family support"
	depends on NET_DSA
	select FIXED_PHY
	select IRQ_DOMAIN
	select REALTEK_PHY
	select REGMAP
	help
	  Select to enable support for Realtek Ethernet switch chips.

config NET_DSA_REALTEK_MDIO
	tristate "Realtek MDIO connected switch driver"
	depends on NET_DSA_REALTEK
	default y
	help
	  Select to enable support for registering switches configured
	  through MDIO.

config NET_DSA_REALTEK_SMI
	tristate "Realtek SMI connected switch driver"
	depends on NET_DSA_REALTEK
	default y
	help
	  Select to enable support for registering switches connected
	  through SMI.

config NET_DSA_REALTEK_RTL8365MB
	tristate "Realtek RTL8365MB switch subdriver"
	default y
	depends on NET_DSA_REALTEK
	depends on NET_DSA_REALTEK_SMI || NET_DSA_REALTEK_MDIO
	select NET_DSA_TAG_RTL8_4
	help
	  Select to enable support for Realtek RTL8365MB-VC and RTL8367S.

config NET_DSA_REALTEK_RTL8366RB
	tristate "Realtek RTL8366RB switch subdriver"
	default y
	depends on NET_DSA_REALTEK
	depends on NET_DSA_REALTEK_SMI || NET_DSA_REALTEK_MDIO
	select NET_DSA_TAG_RTL4_A
	help
	  Select to enable support for Realtek RTL8366RB
+6 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0
obj-$(CONFIG_NET_DSA_REALTEK_MDIO) 	+= realtek-mdio.o
obj-$(CONFIG_NET_DSA_REALTEK_SMI) 	+= realtek-smi.o
obj-$(CONFIG_NET_DSA_REALTEK_RTL8366RB) += rtl8366.o
rtl8366-objs 				:= rtl8366-core.o rtl8366rb.o
obj-$(CONFIG_NET_DSA_REALTEK_RTL8365MB) += rtl8365mb.o
Loading