[openwrt/openwrt] kernel: rtl8367b: detect rtl8367d chip family

LEDE Commits lede-commits at lists.infradead.org
Thu Aug 29 11:50:45 PDT 2024


hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/5c8862a649a09480abc7f46ca5257653597b398d

commit 5c8862a649a09480abc7f46ca5257653597b398d
Author: Mieczyslaw Nalewaj <namiltd at yahoo.com>
AuthorDate: Sat Jul 27 15:41:14 2024 +0200

    kernel: rtl8367b: detect rtl8367d chip family
    
    Detect the RTL8367D chip family and set the appropriate extif
    
    Co-authored-by: Serge Vasilugin <vasilugin at yandex.ru>
    Signed-off-by: Mieczyslaw Nalewaj <namiltd at yahoo.com>
    Link: https://github.com/openwrt/openwrt/pull/14804
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 target/linux/generic/files/drivers/net/phy/rtl8366_smi.h |  4 +++-
 target/linux/generic/files/drivers/net/phy/rtl8367b.c    | 16 ++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366_smi.h b/target/linux/generic/files/drivers/net/phy/rtl8366_smi.h
index 4b3b3fe98c..c81d168ee4 100644
--- a/target/linux/generic/files/drivers/net/phy/rtl8366_smi.h
+++ b/target/linux/generic/files/drivers/net/phy/rtl8366_smi.h
@@ -30,7 +30,9 @@ typedef enum rtl8367b_chip_e {
 	RTL8367B_CHIP_RTL8367R_VB, /* chip with exception in extif assignment */
 /* Family C */
 	RTL8367B_CHIP_RTL8367RB_VB,
-	RTL8367B_CHIP_RTL8367S
+	RTL8367B_CHIP_RTL8367S,
+/* Family D */
+	RTL8367B_CHIP_RTL8367S_VB /* chip with exception in extif assignment */
 } rtl8367b_chip_t;
 
 struct rtl8366_mib_counter {
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8367b.c b/target/linux/generic/files/drivers/net/phy/rtl8367b.c
index 69deaec20c..a80e1c2f80 100644
--- a/target/linux/generic/files/drivers/net/phy/rtl8367b.c
+++ b/target/linux/generic/files/drivers/net/phy/rtl8367b.c
@@ -1,6 +1,7 @@
 /*
  * Platform driver for Realtek RTL8367B family chips, i.e. RTL8367RB and RTL8367R-VB
  * extended with support for RTL8367C family chips, i.e. RTL8367RB-VB and RTL8367S
+ * extended with support for RTL8367D family chips, i.e. RTL8367S-VB
  *
  * Copyright (C) 2012 Gabor Juhos <juhosg at openwrt.org>
  *
@@ -528,6 +529,7 @@ static int rtl8367b_init_regs(struct rtl8366_smi *smi)
 		break;
 	case RTL8367B_CHIP_RTL8367RB_VB:
 	case RTL8367B_CHIP_RTL8367S:
+	case RTL8367B_CHIP_RTL8367S_VB:
 		initvals = rtl8367c_initvals;
 		count = ARRAY_SIZE(rtl8367c_initvals);
 		break;
@@ -741,6 +743,14 @@ static int rtl8367b_extif_init_of(struct rtl8366_smi *smi,
 				err = -EINVAL;
 				goto err_init;
 			}
+		} else if (smi->rtl8367b_chip == RTL8367B_CHIP_RTL8367S_VB) { /* for the RTL8367S-VB chip, cpu_port 7 corresponds to extif1, cpu_port 6 corresponds to extif0 */
+			if (cpu_port != RTL8367B_CPU_PORT_NUM) {
+				id = cpu_port - RTL8367B_CPU_PORT_NUM - 1;
+			} else {
+				dev_err(smi->parent, "wrong cpu_port %u in %s property\n", cpu_port, name);
+				err = -EINVAL;
+				goto err_init;
+			}
 		} else {
 			id = cpu_port - RTL8367B_CPU_PORT_NUM;
 		}
@@ -1348,6 +1358,12 @@ static int rtl8367b_detect(struct rtl8366_smi *smi)
 	}
 
 	switch (chip_ver) {
+	case 0x0010:
+		if (chip_num == 0x6642) {
+			chip_name = "8367S-VB";
+			smi->rtl8367b_chip = RTL8367B_CHIP_RTL8367S_VB;
+		}
+		break;
 	case 0x0020:
 		if (chip_num == 0x6367) {
 			chip_name = "8367RB-VB";




More information about the lede-commits mailing list