Commit 8bc3c234 authored by Christian Marangi's avatar Christian Marangi Committed by Jakub Kicinski
Browse files

net: phy: mediatek: Add Airoha AN7583 PHY support



Add Airoha AN7583 PHY support based on Airoha AN7581 with the small
difference that BMCR_PDOWN is enabled by default and needs to be cleared
to make the internal PHY correctly work.

Signed-off-by: default avatarChristian Marangi <ansuelsmth@gmail.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20250522165313.6411-4-ansuelsmth@gmail.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent d76556db
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#define MTK_GPHY_ID_MT7981			0x03a29461
#define MTK_GPHY_ID_MT7988			0x03a29481
#define MTK_GPHY_ID_AN7581			0x03a294c1
#define MTK_GPHY_ID_AN7583			0xc0ff0420

#define MTK_EXT_PAGE_ACCESS			0x1f
#define MTK_PHY_PAGE_STANDARD			0x0000
@@ -1463,6 +1464,12 @@ static int an7581_phy_led_polarity_set(struct phy_device *phydev, int index,
			      MTK_PHY_LED_ON_POLARITY, val);
}

static int an7583_phy_config_init(struct phy_device *phydev)
{
	/* BMCR_PDOWN is enabled by default */
	return phy_clear_bits(phydev, MII_BMCR, BMCR_PDOWN);
}

static struct phy_driver mtk_socphy_driver[] = {
	{
		PHY_ID_MATCH_EXACT(MTK_GPHY_ID_MT7981),
@@ -1509,6 +1516,18 @@ static struct phy_driver mtk_socphy_driver[] = {
		.led_hw_control_get = mt798x_phy_led_hw_control_get,
		.led_polarity_set = an7581_phy_led_polarity_set,
	},
	{
		PHY_ID_MATCH_EXACT(MTK_GPHY_ID_AN7583),
		.name		= "Airoha AN7583 PHY",
		.config_init	= an7583_phy_config_init,
		.probe		= an7581_phy_probe,
		.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,
		.led_hw_control_set = mt798x_phy_led_hw_control_set,
		.led_hw_control_get = mt798x_phy_led_hw_control_get,
		.led_polarity_set = an7581_phy_led_polarity_set,
	},
};

module_phy_driver(mtk_socphy_driver);
@@ -1517,6 +1536,7 @@ static const struct mdio_device_id __maybe_unused mtk_socphy_tbl[] = {
	{ PHY_ID_MATCH_EXACT(MTK_GPHY_ID_MT7981) },
	{ PHY_ID_MATCH_EXACT(MTK_GPHY_ID_MT7988) },
	{ PHY_ID_MATCH_EXACT(MTK_GPHY_ID_AN7581) },
	{ PHY_ID_MATCH_EXACT(MTK_GPHY_ID_AN7583) },
	{ }
};