[openwrt/openwrt] mediatek: mt7622: prepare legacy rtl8367c driver for Linux 6.12
LEDE Commits
lede-commits at lists.infradead.org
Mon May 26 08:58:40 PDT 2025
dangole pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/78db7780d05de6862ac2571ab8576e1eb7054294
commit 78db7780d05de6862ac2571ab8576e1eb7054294
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Thu May 8 20:16:39 2025 +0100
mediatek: mt7622: prepare legacy rtl8367c driver for Linux 6.12
Do the minimum necessary to get the legacy rtl8367c driver to build
with Linux 6.12.
Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
.../net/phy/rtk/rtl8367c/include/rtk_switch.h | 4 ++++
.../rtl8367c/include/rtl8367c_asicdrv_mii_mgr.h | 26 ++++++++++++++++++++++
.../drivers/net/phy/rtk/rtl8367c/rtk_switch.c | 10 ++++-----
.../files/drivers/net/phy/rtk/rtl8367c/smi.c | 6 ++---
.../files/drivers/net/phy/rtk/rtl8367s_mdio.c | 11 +++------
5 files changed, 39 insertions(+), 18 deletions(-)
diff --git a/target/linux/mediatek/files/drivers/net/phy/rtk/rtl8367c/include/rtk_switch.h b/target/linux/mediatek/files/drivers/net/phy/rtk/rtl8367c/include/rtk_switch.h
index 0a43c0dbd3..1c92188d6b 100644
--- a/target/linux/mediatek/files/drivers/net/phy/rtk/rtl8367c/include/rtk_switch.h
+++ b/target/linux/mediatek/files/drivers/net/phy/rtk/rtl8367c/include/rtk_switch.h
@@ -734,4 +734,8 @@ extern rtk_uint32 rtk_switch_maxLutAddrNumber_get(void);
*/
rtk_uint32 rtk_switch_isValidTrunkGrpId(rtk_uint32 grpId);
+int gsw_debug_proc_init(void);
+void gsw_debug_proc_exit(void);
+int rtl8367s_swconfig_init(void (*reset_func)(void));
+
#endif
diff --git a/target/linux/mediatek/files/drivers/net/phy/rtk/rtl8367c/include/rtl8367c_asicdrv_mii_mgr.h b/target/linux/mediatek/files/drivers/net/phy/rtk/rtl8367c/include/rtl8367c_asicdrv_mii_mgr.h
new file mode 100644
index 0000000000..816763fae1
--- /dev/null
+++ b/target/linux/mediatek/files/drivers/net/phy/rtk/rtl8367c/include/rtl8367c_asicdrv_mii_mgr.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2013 Realtek Semiconductor Corp.
+ * All Rights Reserved.
+ *
+ * Unless you and Realtek execute a separate written software license
+ * agreement governing use of this software, this software is licensed
+ * to you under the terms of the GNU General Public License version 2,
+ * available at https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
+ *
+ * $Revision: 76333 $
+ * $Date: 2017-03-09 09:33:15 +0800 (�g�|, 09 �T�� 2017) $
+ *
+ * Purpose : RTL8367C switch MII access
+ * Feature : MII access functions
+ *
+ */
+
+#ifndef _RTL8367C_ASICDRV_MII_MGR_H_
+#define _RTL8367C_ASICDRV_MII_MGR_H_
+
+#define u32 unsigned int
+extern u32 mii_mgr_read(u32 phy_addr, u32 phy_register, u32 *read_data);
+extern u32 mii_mgr_write(u32 phy_addr, u32 phy_register, u32 write_data);
+
+#endif /*_RTL8367C_ASICDRV_MII_MGR_H_*/
+
diff --git a/target/linux/mediatek/files/drivers/net/phy/rtk/rtl8367c/rtk_switch.c b/target/linux/mediatek/files/drivers/net/phy/rtk/rtl8367c/rtk_switch.c
index 20542f259f..afa3385f30 100644
--- a/target/linux/mediatek/files/drivers/net/phy/rtk/rtl8367c/rtk_switch.c
+++ b/target/linux/mediatek/files/drivers/net/phy/rtk/rtl8367c/rtk_switch.c
@@ -38,9 +38,7 @@ static init_state_t init_state = INIT_COMPLETED;
static init_state_t init_state = INIT_NOT_COMPLETED;
#endif
-#define AUTO_PROBE (!defined(FORCE_PROBE_RTL8367C) && !defined(FORCE_PROBE_RTL8370B) && !defined(FORCE_PROBE_RTL8364B) && !defined(FORCE_PROBE_RTL8363SC_VB))
-
-#if (AUTO_PROBE || defined(FORCE_PROBE_RTL8367C))
+#if ((!defined(FORCE_PROBE_RTL8367C) && !defined(FORCE_PROBE_RTL8370B) && !defined(FORCE_PROBE_RTL8364B) && !defined(FORCE_PROBE_RTL8363SC_VB)) || defined(FORCE_PROBE_RTL8367C))
static rtk_switch_halCtrl_t rtl8367c_hal_Ctrl =
{
/* Switch Chip */
@@ -109,7 +107,7 @@ static rtk_switch_halCtrl_t rtl8367c_hal_Ctrl =
};
#endif
-#if (AUTO_PROBE || defined(FORCE_PROBE_RTL8370B))
+#if ((!defined(FORCE_PROBE_RTL8367C) && !defined(FORCE_PROBE_RTL8370B) && !defined(FORCE_PROBE_RTL8364B) && !defined(FORCE_PROBE_RTL8363SC_VB)) || defined(FORCE_PROBE_RTL8370B))
static rtk_switch_halCtrl_t rtl8370b_hal_Ctrl =
{
/* Switch Chip */
@@ -178,7 +176,7 @@ static rtk_switch_halCtrl_t rtl8370b_hal_Ctrl =
};
#endif
-#if (AUTO_PROBE || defined(FORCE_PROBE_RTL8364B))
+#if ((!defined(FORCE_PROBE_RTL8367C) && !defined(FORCE_PROBE_RTL8370B) && !defined(FORCE_PROBE_RTL8364B) && !defined(FORCE_PROBE_RTL8363SC_VB)) || defined(FORCE_PROBE_RTL8364B))
static rtk_switch_halCtrl_t rtl8364b_hal_Ctrl =
{
/* Switch Chip */
@@ -247,7 +245,7 @@ static rtk_switch_halCtrl_t rtl8364b_hal_Ctrl =
};
#endif
-#if (AUTO_PROBE || defined(FORCE_PROBE_RTL8363SC_VB))
+#if ((!defined(FORCE_PROBE_RTL8367C) && !defined(FORCE_PROBE_RTL8370B) && !defined(FORCE_PROBE_RTL8364B) && !defined(FORCE_PROBE_RTL8363SC_VB)) || defined(FORCE_PROBE_RTL8363SC_VB))
static rtk_switch_halCtrl_t rtl8363sc_vb_hal_Ctrl =
{
/* Switch Chip */
diff --git a/target/linux/mediatek/files/drivers/net/phy/rtk/rtl8367c/smi.c b/target/linux/mediatek/files/drivers/net/phy/rtk/rtl8367c/smi.c
index 70e767f422..e707e4b9c5 100644
--- a/target/linux/mediatek/files/drivers/net/phy/rtk/rtl8367c/smi.c
+++ b/target/linux/mediatek/files/drivers/net/phy/rtk/rtl8367c/smi.c
@@ -15,6 +15,8 @@
#include <rtk_types.h>
#include <smi.h>
+#include <rtl8367c_asicdrv_mii_mgr.h>
+
#include "rtk_error.h"
@@ -35,10 +37,6 @@
#define MDC_MDIO_WRITE(preamableLength, phyID, regID, data)
#define MDC_MDIO_READ(preamableLength, phyID, regID, pData)
#else
-#define u32 unsigned int
-extern u32 mii_mgr_read(u32 phy_addr, u32 phy_register, u32 *read_data);
-extern u32 mii_mgr_write(u32 phy_addr, u32 phy_register, u32 write_data);
-
#define MDC_MDIO_WRITE(preamableLength, phyID, regID, data) mii_mgr_write(phyID, regID, data)
#define MDC_MDIO_READ(preamableLength, phyID, regID, pData) mii_mgr_read(phyID, regID, pData)
#endif
diff --git a/target/linux/mediatek/files/drivers/net/phy/rtk/rtl8367s_mdio.c b/target/linux/mediatek/files/drivers/net/phy/rtk/rtl8367s_mdio.c
index 52cd4de394..2f9dc0da6b 100644
--- a/target/linux/mediatek/files/drivers/net/phy/rtk/rtl8367s_mdio.c
+++ b/target/linux/mediatek/files/drivers/net/phy/rtk/rtl8367s_mdio.c
@@ -19,12 +19,14 @@
#include <linux/of_mdio.h>
#include <linux/of_platform.h>
#include <linux/of_gpio.h>
+#include <linux/platform_device.h>
#include "./rtl8367c/include/rtk_switch.h"
#include "./rtl8367c/include/port.h"
#include "./rtl8367c/include/vlan.h"
#include "./rtl8367c/include/rtl8367c_asicdrv_port.h"
+#include "./rtl8367c/include/rtl8367c_asicdrv_mii_mgr.h"
struct rtk_gsw {
struct device *dev;
@@ -34,13 +36,6 @@ struct rtk_gsw {
static struct rtk_gsw *_gsw;
-extern int gsw_debug_proc_init(void);
-extern void gsw_debug_proc_exit(void);
-
-#ifdef CONFIG_SWCONFIG
-extern int rtl8367s_swconfig_init( void (*reset_func)(void) );
-#endif
-
/*mii_mgr_read/mii_mgr_write is the callback API for rtl8367 driver*/
unsigned int mii_mgr_read(unsigned int phy_addr,unsigned int phy_register,unsigned int *read_data)
{
@@ -204,7 +199,7 @@ static void set_rtl8367s_rgmii(void)
}
-void init_gsw(void)
+static void init_gsw(void)
{
rtl8367s_hw_init();
set_rtl8367s_sgmii();
More information about the lede-commits
mailing list