142 lines
4.6 KiB
Diff
142 lines
4.6 KiB
Diff
From 59e7082cb8c8e89bceb44cc60df156d818c8da96 Mon Sep 17 00:00:00 2001
|
|
From: "SkyLake.Huang" <skylake.huang@mediatek.com>
|
|
Date: Fri, 4 Oct 2024 18:24:09 +0800
|
|
Subject: [PATCH 5/9] net: phy: mediatek: Integrate read/write page helper
|
|
functions
|
|
|
|
This patch integrates read/write page helper functions as MTK phy lib.
|
|
They are basically the same in mtk-ge.c & mtk-ge-soc.c.
|
|
|
|
Signed-off-by: SkyLake.Huang <skylake.huang@mediatek.com>
|
|
---
|
|
drivers/net/phy/mediatek/mtk-ge-soc.c | 18 ++++--------------
|
|
drivers/net/phy/mediatek/mtk-ge.c | 20 ++++++--------------
|
|
drivers/net/phy/mediatek/mtk-phy-lib.c | 12 ++++++++++++
|
|
drivers/net/phy/mediatek/mtk.h | 3 +++
|
|
4 files changed, 25 insertions(+), 28 deletions(-)
|
|
|
|
--- a/drivers/net/phy/mediatek/mtk-ge-soc.c
|
|
+++ b/drivers/net/phy/mediatek/mtk-ge-soc.c
|
|
@@ -275,16 +275,6 @@ struct mtk_socphy_shared {
|
|
struct mtk_socphy_priv priv[4];
|
|
};
|
|
|
|
-static int mtk_socphy_read_page(struct phy_device *phydev)
|
|
-{
|
|
- return __phy_read(phydev, MTK_EXT_PAGE_ACCESS);
|
|
-}
|
|
-
|
|
-static int mtk_socphy_write_page(struct phy_device *phydev, int page)
|
|
-{
|
|
- return __phy_write(phydev, MTK_EXT_PAGE_ACCESS, page);
|
|
-}
|
|
-
|
|
/* One calibration cycle consists of:
|
|
* 1.Set DA_CALIN_FLAG high to start calibration. Keep it high
|
|
* until AD_CAL_COMP is ready to output calibration result.
|
|
@@ -1305,8 +1295,8 @@ static struct phy_driver mtk_socphy_driv
|
|
.probe = mt7981_phy_probe,
|
|
.suspend = genphy_suspend,
|
|
.resume = genphy_resume,
|
|
- .read_page = mtk_socphy_read_page,
|
|
- .write_page = mtk_socphy_write_page,
|
|
+ .read_page = mtk_phy_read_page,
|
|
+ .write_page = mtk_phy_write_page,
|
|
.led_blink_set = mt798x_phy_led_blink_set,
|
|
.led_brightness_set = mt798x_phy_led_brightness_set,
|
|
.led_hw_is_supported = mt798x_phy_led_hw_is_supported,
|
|
@@ -1322,8 +1312,8 @@ static struct phy_driver mtk_socphy_driv
|
|
.probe = mt7988_phy_probe,
|
|
.suspend = genphy_suspend,
|
|
.resume = genphy_resume,
|
|
- .read_page = mtk_socphy_read_page,
|
|
- .write_page = mtk_socphy_write_page,
|
|
+ .read_page = mtk_phy_read_page,
|
|
+ .write_page = mtk_phy_write_page,
|
|
.led_blink_set = mt798x_phy_led_blink_set,
|
|
.led_brightness_set = mt798x_phy_led_brightness_set,
|
|
.led_hw_is_supported = mt798x_phy_led_hw_is_supported,
|
|
--- a/drivers/net/phy/mediatek/mtk-ge.c
|
|
+++ b/drivers/net/phy/mediatek/mtk-ge.c
|
|
@@ -4,6 +4,8 @@
|
|
#include <linux/module.h>
|
|
#include <linux/phy.h>
|
|
|
|
+#include "mtk.h"
|
|
+
|
|
#define MTK_EXT_PAGE_ACCESS 0x1f
|
|
#define MTK_PHY_PAGE_STANDARD 0x0000
|
|
#define MTK_PHY_PAGE_EXTENDED 0x0001
|
|
@@ -12,16 +14,6 @@
|
|
#define MTK_PHY_PAGE_EXTENDED_2A30 0x2a30
|
|
#define MTK_PHY_PAGE_EXTENDED_52B5 0x52b5
|
|
|
|
-static int mtk_gephy_read_page(struct phy_device *phydev)
|
|
-{
|
|
- return __phy_read(phydev, MTK_EXT_PAGE_ACCESS);
|
|
-}
|
|
-
|
|
-static int mtk_gephy_write_page(struct phy_device *phydev, int page)
|
|
-{
|
|
- return __phy_write(phydev, MTK_EXT_PAGE_ACCESS, page);
|
|
-}
|
|
-
|
|
static void mtk_gephy_config_init(struct phy_device *phydev)
|
|
{
|
|
/* Disable EEE */
|
|
@@ -114,8 +106,8 @@ static struct phy_driver mtk_gephy_drive
|
|
.handle_interrupt = genphy_handle_interrupt_no_ack,
|
|
.suspend = genphy_suspend,
|
|
.resume = genphy_resume,
|
|
- .read_page = mtk_gephy_read_page,
|
|
- .write_page = mtk_gephy_write_page,
|
|
+ .read_page = mtk_phy_read_page,
|
|
+ .write_page = mtk_phy_write_page,
|
|
},
|
|
{
|
|
PHY_ID_MATCH_EXACT(0x03a29441),
|
|
@@ -128,8 +120,8 @@ static struct phy_driver mtk_gephy_drive
|
|
.handle_interrupt = genphy_handle_interrupt_no_ack,
|
|
.suspend = genphy_suspend,
|
|
.resume = genphy_resume,
|
|
- .read_page = mtk_gephy_read_page,
|
|
- .write_page = mtk_gephy_write_page,
|
|
+ .read_page = mtk_phy_read_page,
|
|
+ .write_page = mtk_phy_write_page,
|
|
},
|
|
};
|
|
|
|
--- a/drivers/net/phy/mediatek/mtk-phy-lib.c
|
|
+++ b/drivers/net/phy/mediatek/mtk-phy-lib.c
|
|
@@ -6,6 +6,18 @@
|
|
|
|
#include "mtk.h"
|
|
|
|
+int mtk_phy_read_page(struct phy_device *phydev)
|
|
+{
|
|
+ return __phy_read(phydev, MTK_EXT_PAGE_ACCESS);
|
|
+}
|
|
+EXPORT_SYMBOL_GPL(mtk_phy_read_page);
|
|
+
|
|
+int mtk_phy_write_page(struct phy_device *phydev, int page)
|
|
+{
|
|
+ return __phy_write(phydev, MTK_EXT_PAGE_ACCESS, page);
|
|
+}
|
|
+EXPORT_SYMBOL_GPL(mtk_phy_write_page);
|
|
+
|
|
int mtk_phy_led_hw_is_supported(struct phy_device *phydev, u8 index,
|
|
unsigned long rules,
|
|
unsigned long supported_triggers)
|
|
--- a/drivers/net/phy/mediatek/mtk.h
|
|
+++ b/drivers/net/phy/mediatek/mtk.h
|
|
@@ -62,6 +62,9 @@
|
|
#define MTK_PHY_LED_STATE_FORCE_BLINK 1
|
|
#define MTK_PHY_LED_STATE_NETDEV 2
|
|
|
|
+int mtk_phy_read_page(struct phy_device *phydev);
|
|
+int mtk_phy_write_page(struct phy_device *phydev, int page);
|
|
+
|
|
int mtk_phy_led_hw_is_supported(struct phy_device *phydev, u8 index,
|
|
unsigned long rules,
|
|
unsigned long supported_triggers);
|