From nobody Thu Nov 28 07:49:13 2024 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 268FF156678; Fri, 4 Oct 2024 10:26:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.61.82.184 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728037617; cv=none; b=f0PxGb6/rFTPgNX7uUfdTIvDGea5OAhKj6ZrWP67A5i0aXgbK9yVaXjeHbrD8AdwLG2gFC4F2F3D4J47WhhF5yh7nO1S1aFUi4jR7CVdcgHNFFgO9LssDaeA72Zqrg2E4eD+5gSE5o14Z408Uy6M2ZDpwlKvt+DIVmAsfiEzPD8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728037617; c=relaxed/simple; bh=kB/X5jx+Mnp8/tTSkkG9AvcR7Buv/jl/C8LhP9gWogg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RVJnUeDMGylz3MfTfww4UeOGg7x9+8fHxsTFvA6uuJ4KFbAgJlTvVxhbaHO5cwsAmg2lbP3CXoeIBlfRneCDSRJVqHhDa1ugK6RN1AfjY75PjlQVrMesa9GDxlIAQnCSwrF6axQuOpOT8mtTVnUmo/1aSMq91zmK1nR1xFzXqi4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com; spf=pass smtp.mailfrom=mediatek.com; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b=CpW8iJGk; arc=none smtp.client-ip=210.61.82.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mediatek.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="CpW8iJGk" X-UUID: 2afbb700823b11ef8b96093e013ec31c-20241004 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=CamSP/8HgrGYNJsAnIhmbgqVa/CkiN+Y+j0nD3c++8s=; b=CpW8iJGkHFI/Jg/MyXfQvnIJbXmvN5psCazHdnXbgm2lTtutXVl+2bp/VJIhecFQsiCUecwVZyFHrz2OilN4aAZmnz5615hm3oB3EolvsuI0SppHdOzdtp8TAFjArQ+ETnl+enIHlPB1qC3HANf6NRJAagDcuG81QDhi77h8aiI=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.41,REQID:afbc96ae-900a-4d12-9f5b-5e268302f98d,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:6dc6a47,CLOUDID:a8e6c040-8751-41b2-98dd-475503d45150,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1, SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 2afbb700823b11ef8b96093e013ec31c-20241004 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1438573019; Fri, 04 Oct 2024 18:26:50 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs11n2.mediatek.inc (172.21.101.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Fri, 4 Oct 2024 18:26:49 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Fri, 4 Oct 2024 18:26:49 +0800 From: Sky Huang To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Daniel Golle , Qingfang Deng , SkyLake Huang , Matthias Brugger , AngeloGioacchino Del Regno , , , , CC: Steven Liu , SkyLake.Huang Subject: [PATCH net-next 5/9] net: phy: mediatek: Integrate read/write page helper functions Date: Fri, 4 Oct 2024 18:24:09 +0800 Message-ID: <20241004102413.5838-6-SkyLake.Huang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20241004102413.5838-1-SkyLake.Huang@mediatek.com> References: <20241004102413.5838-1-SkyLake.Huang@mediatek.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MTK: N Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: "SkyLake.Huang" 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 Reviewed-by: Andrew Lunn --- 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(-) diff --git a/drivers/net/phy/mediatek/mtk-ge-soc.c b/drivers/net/phy/mediat= ek/mtk-ge-soc.c index 970bf35..26c2183 100644 --- 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]; }; =20 -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_driver[] =3D { .probe =3D mt7981_phy_probe, .suspend =3D genphy_suspend, .resume =3D genphy_resume, - .read_page =3D mtk_socphy_read_page, - .write_page =3D mtk_socphy_write_page, + .read_page =3D mtk_phy_read_page, + .write_page =3D mtk_phy_write_page, .led_blink_set =3D mt798x_phy_led_blink_set, .led_brightness_set =3D mt798x_phy_led_brightness_set, .led_hw_is_supported =3D mt798x_phy_led_hw_is_supported, @@ -1322,8 +1312,8 @@ static struct phy_driver mtk_socphy_driver[] =3D { .probe =3D mt7988_phy_probe, .suspend =3D genphy_suspend, .resume =3D genphy_resume, - .read_page =3D mtk_socphy_read_page, - .write_page =3D mtk_socphy_write_page, + .read_page =3D mtk_phy_read_page, + .write_page =3D mtk_phy_write_page, .led_blink_set =3D mt798x_phy_led_blink_set, .led_brightness_set =3D mt798x_phy_led_brightness_set, .led_hw_is_supported =3D mt798x_phy_led_hw_is_supported, diff --git a/drivers/net/phy/mediatek/mtk-ge.c b/drivers/net/phy/mediatek/m= tk-ge.c index 54ea64a..9122899 100644 --- a/drivers/net/phy/mediatek/mtk-ge.c +++ b/drivers/net/phy/mediatek/mtk-ge.c @@ -3,6 +3,8 @@ #include #include =20 +#include "mtk.h" + #define MTK_EXT_PAGE_ACCESS 0x1f #define MTK_PHY_PAGE_STANDARD 0x0000 #define MTK_PHY_PAGE_EXTENDED 0x0001 @@ -11,16 +13,6 @@ #define MTK_PHY_PAGE_EXTENDED_2A30 0x2a30 #define MTK_PHY_PAGE_EXTENDED_52B5 0x52b5 =20 -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) { /* Enable HW auto downshift */ @@ -77,8 +69,8 @@ static struct phy_driver mtk_gephy_driver[] =3D { .handle_interrupt =3D genphy_handle_interrupt_no_ack, .suspend =3D genphy_suspend, .resume =3D genphy_resume, - .read_page =3D mtk_gephy_read_page, - .write_page =3D mtk_gephy_write_page, + .read_page =3D mtk_phy_read_page, + .write_page =3D mtk_phy_write_page, }, { PHY_ID_MATCH_EXACT(0x03a29441), @@ -91,8 +83,8 @@ static struct phy_driver mtk_gephy_driver[] =3D { .handle_interrupt =3D genphy_handle_interrupt_no_ack, .suspend =3D genphy_suspend, .resume =3D genphy_resume, - .read_page =3D mtk_gephy_read_page, - .write_page =3D mtk_gephy_write_page, + .read_page =3D mtk_phy_read_page, + .write_page =3D mtk_phy_write_page, }, }; =20 diff --git a/drivers/net/phy/mediatek/mtk-phy-lib.c b/drivers/net/phy/media= tek/mtk-phy-lib.c index 20796ae..e55a432 100644 --- a/drivers/net/phy/mediatek/mtk-phy-lib.c +++ b/drivers/net/phy/mediatek/mtk-phy-lib.c @@ -6,6 +6,18 @@ =20 #include "mtk.h" =20 +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) diff --git a/drivers/net/phy/mediatek/mtk.h b/drivers/net/phy/mediatek/mtk.h index 2fc89e3..5986aaa 100644 --- 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 =20 +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); --=20 2.45.2