From: luizluca@gmail.com
To: netdev@vger.kernel.org
Cc: linus.walleij@linaro.org, andrew@lunn.ch,
vivien.didelot@gmail.com, f.fainelli@gmail.com,
olteanv@gmail.com, alsi@bang-olufsen.dk, arinc.unal@arinc9.com,
Luiz Angelo Daros de Luca <luizluca@gmail.com>
Subject: [PATCH net-next 13/13] net: dsa: realtek: rtl8367c: add RTL8367S support
Date: Thu, 16 Dec 2021 17:13:42 -0300 [thread overview]
Message-ID: <20211216201342.25587-14-luizluca@gmail.com> (raw)
In-Reply-To: <20211216201342.25587-1-luizluca@gmail.com>
From: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Realtek's RTL8367S, a 5+2 port 10/100/1000M Ethernet switch.
It shares the same driver family (RTL8367C) with other models
as the RTL8365MB-VC. Its compatible string is "realtek,rtl8367s".
It was tested only with MDIO interface (realtek-mdio), although it might
work out-of-the-box with SMI interface (using realtek-smi).
This patch was based on an unpublished patch from Alvin Šipraga
<alsi@bang-olufsen.dk>.
Tested-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
---
.../bindings/net/dsa/realtek-mdio.txt | 1 +
.../bindings/net/dsa/realtek-smi.txt | 1 +
drivers/net/dsa/realtek/Kconfig | 4 +--
drivers/net/dsa/realtek/realtek-mdio.c | 1 +
drivers/net/dsa/realtek/realtek-smi.c | 4 +++
drivers/net/dsa/realtek/rtl8367c.c | 33 +++++++++++++++----
6 files changed, 35 insertions(+), 9 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/dsa/realtek-mdio.txt b/Documentation/devicetree/bindings/net/dsa/realtek-mdio.txt
index 01b0463b808f..48aa263792ac 100644
--- a/Documentation/devicetree/bindings/net/dsa/realtek-mdio.txt
+++ b/Documentation/devicetree/bindings/net/dsa/realtek-mdio.txt
@@ -11,6 +11,7 @@ Required properties:
"realtek,rtl8365mb" (4+1 ports)
"realtek,rtl8366rb" (4+1 ports)
"realtek,rtl8366s" (4+1 ports)
+ "realtek,rtl8367s" (5+2 ports)
Required properties:
- reg: MDIO PHY ID to access the switch
diff --git a/Documentation/devicetree/bindings/net/dsa/realtek-smi.txt b/Documentation/devicetree/bindings/net/dsa/realtek-smi.txt
index acdb026e5307..b295b8c0d5fc 100644
--- a/Documentation/devicetree/bindings/net/dsa/realtek-smi.txt
+++ b/Documentation/devicetree/bindings/net/dsa/realtek-smi.txt
@@ -13,6 +13,7 @@ Required properties:
"realtek,rtl8365mb" (4+1 ports)
"realtek,rtl8366rb" (4+1 ports)
"realtek,rtl8366s" (4+1 ports)
+ "realtek,rtl8367s" (5+2 ports)
Required properties:
- mdc-gpios: GPIO line for the MDC clock line.
diff --git a/drivers/net/dsa/realtek/Kconfig b/drivers/net/dsa/realtek/Kconfig
index 48194d0dd51f..25de1107732d 100644
--- a/drivers/net/dsa/realtek/Kconfig
+++ b/drivers/net/dsa/realtek/Kconfig
@@ -30,9 +30,9 @@ config NET_DSA_REALTEK_RTL8367C
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. This subdriver
+ Select to enable support for Realtek RTL8365MB-VC and RTL8367S. This subdriver
might also support RTL8363NB, RTL8363NB-VB, RTL8363SC, RTL8363SC-VB, RTL8364NB,
- RTL8364NB-VB, RTL8366SC, RTL8367RB-VB, RTL8367S, RTL8367SB, RTL8370MB, RTL8310SR
+ RTL8364NB-VB, RTL8366SC, RTL8367RB-VB, RTL8367SB, RTL8370MB, RTL8310SR
in the future.
config NET_DSA_REALTEK_RTL8366RB
diff --git a/drivers/net/dsa/realtek/realtek-mdio.c b/drivers/net/dsa/realtek/realtek-mdio.c
index b7febd63e04f..1f80b6bdbe5b 100644
--- a/drivers/net/dsa/realtek/realtek-mdio.c
+++ b/drivers/net/dsa/realtek/realtek-mdio.c
@@ -265,6 +265,7 @@ static const struct of_device_id realtek_mdio_of_match[] = {
{ .compatible = "realtek,rtl8366s", .data = NULL, },
#if IS_ENABLED(CONFIG_NET_DSA_REALTEK_RTL8367C)
{ .compatible = "realtek,rtl8365mb", .data = &rtl8367c_variant, },
+ { .compatible = "realtek,rtl8367s", .data = &rtl8367c_variant, },
#endif
{ /* sentinel */ },
};
diff --git a/drivers/net/dsa/realtek/realtek-smi.c b/drivers/net/dsa/realtek/realtek-smi.c
index 258f90956cec..ecb68a216595 100644
--- a/drivers/net/dsa/realtek/realtek-smi.c
+++ b/drivers/net/dsa/realtek/realtek-smi.c
@@ -511,6 +511,10 @@ static const struct of_device_id realtek_smi_of_match[] = {
.compatible = "realtek,rtl8365mb",
.data = &rtl8367c_variant,
},
+ {
+ .compatible = "realtek,rtl8367s",
+ .data = &rtl8367c_variant,
+ },
#endif
{ /* sentinel */ },
};
diff --git a/drivers/net/dsa/realtek/rtl8367c.c b/drivers/net/dsa/realtek/rtl8367c.c
index a478ddc33a9e..c192ede6ca88 100644
--- a/drivers/net/dsa/realtek/rtl8367c.c
+++ b/drivers/net/dsa/realtek/rtl8367c.c
@@ -90,15 +90,23 @@
#include "realtek.h"
/* Chip-specific data and limits */
-#define RTL8367C_CHIP_ID_8365MB_VC 0x6367
+#define RTL8367C_CHIP_ID_8367C 0x6367
+/* 0x0276 and 0x0597 as well */
-#define RTL8367C_LEARN_LIMIT_MAX 2112
+#define RTL8367C_CHIP_ID_8365MB_VC RTL8367C_CHIP_ID_8367C
+#define RTL8367C_CHIP_VER_8365MB_VC 0x0040
+
+#define RTL8367C_CHIP_ID_8367S RTL8367C_CHIP_ID_8367C
+#define RTL8367C_CHIP_VER_8367S 0x00A0
+
+#define RTL8367C_LEARN_LIMIT_MAX 2112
/* Family-specific data and limits */
#define RTL8367C_PHYADDRMAX 7
#define RTL8367C_NUM_PHYREGS 32
#define RTL8367C_PHYREGMAX (RTL8367C_NUM_PHYREGS - 1)
-#define RTL8367C_MAX_NUM_PORTS 7
+// RTL8370MB and RTL8310SR, possibly suportable by this driver, have 10 ports
+#define RTL8367C_MAX_NUM_PORTS 10
/* Chip identification registers */
#define RTL8367C_CHIP_ID_REG 0x1300
@@ -1952,10 +1960,21 @@ static int rtl8367c_detect(struct realtek_priv *priv)
}
switch (chip_id) {
- case RTL8367C_CHIP_ID_8365MB_VC:
- dev_info(priv->dev,
- "found an RTL8365MB-VC switch (ver=0x%04x)\n",
- chip_ver);
+ case RTL8367C_CHIP_ID_8367C:
+ if (chip_ver == RTL8367C_CHIP_VER_8365MB_VC) {
+ dev_info(priv->dev,
+ "found an RTL8365MB-VC switch (ver=0x%04x)\n",
+ chip_ver);
+ } else if (chip_ver == RTL8367C_CHIP_VER_8367S) {
+ dev_info(priv->dev,
+ "found an RTL8367S switch (ver=0x%04x)\n",
+ chip_ver);
+ } else {
+ dev_err(priv->dev, "found an RTL8367C switch with "
+ "unrecognized chip version (ver=0x%04x)\n",
+ chip_ver);
+ return -ENODEV;
+ }
priv->num_ports = RTL8367C_MAX_NUM_PORTS;
--
2.34.0
next prev parent reply other threads:[~2021-12-16 20:14 UTC|newest]
Thread overview: 90+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-16 20:13 [PATCH net-next 00/13] net: dsa: realtek: MDIO interface and RTL8367S luizluca
2021-12-16 20:13 ` [PATCH net-next 01/13] dt-bindings: net: dsa: realtek-smi: remove unsupported switches luizluca
2021-12-16 23:20 ` Alvin Šipraga
2021-12-18 2:41 ` Linus Walleij
2021-12-18 6:12 ` Luiz Angelo Daros de Luca
2021-12-19 22:27 ` Linus Walleij
2021-12-16 20:13 ` [PATCH net-next 02/13] net: dsa: realtek-smi: move to subdirectory luizluca
2021-12-16 23:21 ` Alvin Šipraga
2021-12-18 2:41 ` Linus Walleij
2021-12-16 20:13 ` [PATCH net-next 03/13] net: dsa: realtek: rename realtek_smi to realtek_priv luizluca
2021-12-16 23:22 ` Alvin Šipraga
2021-12-17 6:21 ` Luiz Angelo Daros de Luca
2021-12-18 2:45 ` Linus Walleij
2021-12-18 6:15 ` Luiz Angelo Daros de Luca
2021-12-17 9:21 ` Andrew Lunn
2021-12-16 20:13 ` [PATCH net-next 04/13] net: dsa: realtek: convert subdrivers into modules luizluca
2021-12-16 23:29 ` Alvin Šipraga
2021-12-17 6:50 ` Luiz Angelo Daros de Luca
2021-12-17 2:31 ` kernel test robot
2021-12-16 20:13 ` [PATCH net-next 05/13] net: dsa: realtek: use phy_read in ds->ops luizluca
2021-12-18 2:50 ` Linus Walleij
2021-12-18 6:24 ` Luiz Angelo Daros de Luca
2021-12-16 20:13 ` [PATCH net-next 06/13] net: dsa: rtl8365mb: move rtl8365mb.c to rtl8367c.c luizluca
2021-12-19 22:29 ` Linus Walleij
2021-12-19 23:21 ` Alvin Šipraga
2021-12-16 20:13 ` [PATCH net-next 07/13] net: dsa: rtl8365mb: rename rtl8365mb to rtl8367c luizluca
2021-12-16 23:41 ` Alvin Šipraga
2021-12-17 7:24 ` Luiz Angelo Daros de Luca
2021-12-17 12:15 ` Alvin Šipraga
2021-12-17 22:50 ` Arınç ÜNAL
2021-12-18 6:08 ` Luiz Angelo Daros de Luca
2021-12-17 10:57 ` Arınç ÜNAL
2021-12-16 20:13 ` [PATCH net-next 08/13] net: dsa: realtek: add new mdio interface for drivers luizluca
2021-12-17 0:11 ` Alvin Šipraga
2021-12-17 3:33 ` kernel test robot
2021-12-18 2:54 ` Linus Walleij
2021-12-16 20:13 ` [PATCH net-next 09/13] dt-bindings: net: dsa: realtek-mdio: document new interface luizluca
2021-12-18 2:57 ` Linus Walleij
2021-12-18 6:26 ` Luiz Angelo Daros de Luca
2021-12-16 20:13 ` [PATCH net-next 10/13] net: dsa: realtek: rtl8367c: rename extport to extint, add "realtek,ext-int" luizluca
2021-12-16 20:13 ` [PATCH net-next 11/13] net: dsa: realtek: rtl8367c: use GENMASK(n-1,0) instead of BIT(n)-1 luizluca
2021-12-18 2:59 ` Linus Walleij
2021-12-19 20:06 ` Florian Fainelli
2021-12-19 20:28 ` Luiz Angelo Daros de Luca
2021-12-16 20:13 ` [PATCH net-next 12/13] net: dsa: realtek: rtl8367c: use DSA CPU port luizluca
2021-12-16 20:13 ` luizluca [this message]
2021-12-16 22:30 ` [PATCH net-next 00/13] net: dsa: realtek: MDIO interface and RTL8367S Arınç ÜNAL
2021-12-17 0:25 ` Jakub Kicinski
2021-12-17 8:53 ` Luiz Angelo Daros de Luca
2021-12-17 9:26 ` Andrew Lunn
2021-12-17 10:19 ` Luiz Angelo Daros de Luca
2021-12-18 8:14 ` Luiz Angelo Daros de Luca
2021-12-18 8:14 ` [PATCH net-next v2 01/13] dt-bindings: net: dsa: realtek-smi: mark unsupported switches Luiz Angelo Daros de Luca
2021-12-19 19:46 ` Linus Walleij
2021-12-18 8:14 ` [PATCH net-next v2 02/13] net: dsa: realtek-smi: move to subdirectory Luiz Angelo Daros de Luca
2021-12-19 21:43 ` Alvin Šipraga
2021-12-18 8:14 ` [PATCH net-next v2 03/13] net: dsa: realtek: rename realtek_smi to realtek_priv Luiz Angelo Daros de Luca
2021-12-19 22:24 ` Linus Walleij
2021-12-18 8:14 ` [PATCH net-next v2 04/13] net: dsa: realtek: remove direct calls to realtek-smi Luiz Angelo Daros de Luca
2021-12-18 8:14 ` [PATCH net-next v2 05/13] net: dsa: realtek: convert subdrivers into modules Luiz Angelo Daros de Luca
2021-12-19 22:25 ` Linus Walleij
2021-12-18 8:14 ` [PATCH net-next v2 06/13] net: dsa: realtek: use phy_read in ds->ops Luiz Angelo Daros de Luca
2021-12-19 19:58 ` Florian Fainelli
2021-12-30 19:44 ` Luiz Angelo Daros de Luca
2021-12-30 20:00 ` Andrew Lunn
2021-12-31 2:30 ` Luiz Angelo Daros de Luca
2021-12-18 8:14 ` [PATCH net-next v2 07/13] net: dsa: realtek: add new mdio interface for drivers Luiz Angelo Daros de Luca
2021-12-19 21:17 ` Alvin Šipraga
2021-12-19 21:44 ` Andrew Lunn
2021-12-19 22:32 ` Linus Walleij
2021-12-28 8:21 ` Luiz Angelo Daros de Luca
2021-12-28 9:57 ` Andrew Lunn
2021-12-31 3:10 ` Luiz Angelo Daros de Luca
2021-12-18 8:14 ` [PATCH net-next v2 08/13] dt-bindings: net: dsa: realtek-mdio: document new interface Luiz Angelo Daros de Luca
2021-12-19 19:57 ` Florian Fainelli
2021-12-19 21:53 ` Arınç ÜNAL
2021-12-20 7:50 ` Arınç ÜNAL
2021-12-18 8:14 ` [PATCH net-next v2 09/13] net: dsa: realtek: rtl8365mb: rename extport to extint, add "realtek,ext-int" Luiz Angelo Daros de Luca
2021-12-19 22:45 ` Alvin Šipraga
2021-12-18 8:14 ` [PATCH net-next v2 10/13] net: dsa: realtek: rtl8365mb: use GENMASK(n-1,0) instead of BIT(n)-1 Luiz Angelo Daros de Luca
2021-12-18 8:14 ` [PATCH net-next v2 11/13] net: dsa: realtek: rtl8365mb: use DSA CPU port Luiz Angelo Daros de Luca
2021-12-19 22:19 ` Vladimir Oltean
2021-12-19 23:19 ` Alvin Šipraga
2021-12-28 8:48 ` Luiz Angelo Daros de Luca
2021-12-18 8:14 ` [PATCH net-next v2 12/13] net: dsa: realtek: rtl8365mb: add RTL8367S support Luiz Angelo Daros de Luca
2021-12-19 21:43 ` Alvin Šipraga
2021-12-31 0:18 ` Luiz Angelo Daros de Luca
2021-12-18 8:14 ` [PATCH net-next v2 13/13] dt-bindings: net: dsa: realtek-{smi,mdio}: add rtl8367s Luiz Angelo Daros de Luca
2021-12-18 8:19 ` net: dsa: realtek: MDIO interface and RTL8367S Luiz Angelo Daros de Luca
2021-12-19 23:28 ` Alvin Šipraga
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=20211216201342.25587-14-luizluca@gmail.com \
--to=luizluca@gmail.com \
--cc=alsi@bang-olufsen.dk \
--cc=andrew@lunn.ch \
--cc=arinc.unal@arinc9.com \
--cc=f.fainelli@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=vivien.didelot@gmail.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 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).