Browse Source

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 <[email protected]>
Daniel Golle 10 months ago
parent
commit
78db7780d0

+ 4 - 0
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

+ 26 - 0
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_*/
+

+ 4 - 6
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 */

+ 2 - 4
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

+ 3 - 8
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();