net: dsa: mt7530: Add AN7583 support + PHY
Subsystems (8)
cover net: dsa: mt7530: Add AN7583 support + PHY
This small series add the required changes to make Airoha AN7583 Switch and Internal PHY work due to strange default configuration.
Christian Marangi (3):
dt-bindings: net: dsa: mediatek,mt7530: Add airoha,an7583-switch
net: dsa: mt7530: Add AN7583 support
net: phy: mediatek: Add Airoha AN7583 PHY support
.../bindings/net/dsa/mediatek,mt7530.yaml | 5 ++++ drivers/net/dsa/mt7530-mmio.c | 1 + drivers/net/dsa/mt7530.c | 24 +++++++++++++++++-- drivers/net/dsa/mt7530.h | 18 ++++++++++---- drivers/net/phy/mediatek/mtk-ge-soc.c | 20 ++++++++++++++++ 5 files changed, 62 insertions(+), 6 deletions(-)
Signature · 1 line
2.48.1
PATCH 1/3 dt-bindings: net: dsa: mediatek,mt7530: Add airoha,an7583-switch
Add airoha,an7583-switch additional compatible to the mt7530 DSA Switch Family. This is an exact match of the airoha,en7581-switch (based on mt7988-switch) with the additional requirement of tweak on the GEPHY_CONN_CFG registers to make the internal PHY actually work.
--- .../devicetree/bindings/net/dsa/mediatek,mt7530.yaml | 5 +++++ 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml +5 -0
@@ -96,6 +96,10 @@ properties: Built-in switch of the Airoha EN7581 SoC const: airoha,en7581-switch + - description: + Built-in switch of the Airoha AN7583 SoC + const: airoha,an7583-switch + reg: maxItems: 1
@@ -291,6 +295,7 @@ allOf: enum: - mediatek,mt7988-switch - airoha,en7581-switch + - airoha,an7583-switch then: $ref: "#/$defs/mt7530-dsa-port" properties:
Signature · 1 line
2.48.1
Re: [net-next PATCH 1/3] dt-bindings: net: dsa: mediatek,mt7530: Add airoha,an7583-switch
Quoted 6 lines · Christian Marangi
Add airoha,an7583-switch additional compatible to the mt7530 DSA Switch Family. This is an exact match of the airoha,en7581-switch (based on mt7988-switch) with the additional requirement of tweak on the
GEPHY_CONN_CFGregisters to make the internal PHY actually work.Signed-off-by Christian Marangi <[email protected]>
PATCH 2/3 net: dsa: mt7530: Add AN7583 support
In reply to Christian MarangiAdd Airoha AN7583 Switch support. This is based on Airoha EN7581 that is based on Mediatek MT7988 Switch.
Airoha AN7583 require additional tweak to the GEPHY_CONN_CFG register to make the internal PHY work.
--- drivers/net/dsa/mt7530-mmio.c | 1 + drivers/net/dsa/mt7530.c | 24 ++++++++++++++++++++++-- drivers/net/dsa/mt7530.h | 18 ++++++++++++++---- 3 files changed, 37 insertions(+), 6 deletions(-)
drivers/net/dsa/mt7530-mmio.c +1 -0
@@ -11,6 +11,7 @@#include "mt7530.h" static const struct of_device_id mt7988_of_match[] = { + { .compatible ="airoha,an7583-switch" , .data = &mt753x_table[ID_AN7583 ], }, { .compatible ="airoha,en7581-switch" , .data = &mt753x_table[ID_EN7581 ], }, { .compatible ="mediatek,mt7988-switch" , .data = &mt753x_table[ID_MT7988 ], }, {/* sentinel */ },
drivers/net/dsa/mt7530.c +22 -2
@@ -1298,7 +1298,7 @@ mt753x_cpu_port_enable(struct dsa_switch *ds, int port)* is affine to the inbound user port. */ if (priv->id ==ID_MT7531 || priv->id ==ID_MT7988 || - priv->id ==ID_EN7581 ) + priv->id ==ID_EN7581 || priv->id ==ID_AN7583 )mt7530_set (priv,MT7531_CFC ,MT7531_CPU_PMAP (BIT (port)));/* CPU port gets connected to all user ports of
@@ -2612,7 +2612,7 @@ mt7531_setup_common(struct dsa_switch *ds)mt7530_set (priv,MT753X_AGC ,LOCAL_EN );/* Enable Special Tag for rx frames */ -if (priv->id ==ID_EN7581 ) +if (priv->id ==ID_EN7581 || priv->id ==ID_AN7583 )mt7530_write (priv,MT753X_CPORT_SPTAG_CFG ,CPORT_SW2FE_STAG_EN |CPORT_FE2SW_STAG_EN );
@@ -3236,6 +3236,16 @@ static int mt7988_setup(struct dsa_switch *ds)reset_control_deassert (priv->rstc);usleep_range (20 ,50 ); +/* AN7583 require additional tweak to CONN_CFG */ +if (priv->id ==ID_AN7583 ) +mt7530_rmw (priv,AN7583_GEPHY_CONN_CFG , +AN7583_CSR_DPHY_CKIN_SEL | +AN7583_CSR_PHY_CORE_REG_CLK_SEL | +AN7583_CSR_ETHER_AFE_PWD , +AN7583_CSR_DPHY_CKIN_SEL | +AN7583_CSR_PHY_CORE_REG_CLK_SEL | +FIELD_PREP (AN7583_CSR_ETHER_AFE_PWD ,0 )); +/* Reset the switch PHYs */ mt7530_write (priv,MT7530_SYS_CTRL ,SYS_CTRL_PHY_RST );
@@ -3344,6 +3354,16 @@ const struct mt753x_info mt753x_table[] = { .phy_write_c45 = mt7531_ind_c45_phy_write, .mac_port_get_caps = en7581_mac_port_get_caps, }, + [ID_AN7583] = { + .id = ID_AN7583, + .pcs_ops = &mt7530_pcs_ops, + .sw_setup = mt7988_setup, + .phy_read_c22 = mt7531_ind_c22_phy_read, + .phy_write_c22 = mt7531_ind_c22_phy_write, + .phy_read_c45 = mt7531_ind_c45_phy_read, + .phy_write_c45 = mt7531_ind_c45_phy_write, + .mac_port_get_caps = en7581_mac_port_get_caps, + }, };EXPORT_SYMBOL_GPL (mt753x_table);
drivers/net/dsa/mt7530.h +14 -4
@@ -20,6 +20,7 @@ enum mt753x_id {ID_MT7531 =2 ,ID_MT7988 =3 ,ID_EN7581 =4 , + ID_AN7583 = 5, };#define NUM_TRGMII_CTRL 5
@@ -66,7 +67,8 @@ enum mt753x_id {#define MT753X_MIRROR_REG (id) ((id == ID_MT7531 || \ id == ID_MT7988 || \ - id == ID_EN7581) ? \ + id == ID_EN7581 || \ + id == ID_AN7583) ? \ MT7531_CFC : MT753X_MFC)#define MT753X_MIRROR_EN (id) ((id == ID_MT7531 || \
@@ -76,19 +78,22 @@ enum mt753x_id {#define MT753X_MIRROR_PORT_MASK (id) ((id == ID_MT7531 || \ id == ID_MT7988 || \ - id == ID_EN7581) ? \ + id == ID_EN7581 || \ + id == ID_AN7583) ? \ MT7531_MIRROR_PORT_MASK : \ MT7530_MIRROR_PORT_MASK)#define MT753X_MIRROR_PORT_GET (id, val) ((id == ID_MT7531 || \ id == ID_MT7988 || \ - id == ID_EN7581) ? \ + id == ID_EN7581 || \ + id == ID_AN7583) ? \ MT7531_MIRROR_PORT_GET(val) : \ MT7530_MIRROR_PORT_GET(val))#define MT753X_MIRROR_PORT_SET (id, val) ((id == ID_MT7531 || \ id == ID_MT7988 || \ - id == ID_EN7581) ? \ + id == ID_EN7581 || \ + id == ID_AN7583) ? \ MT7531_MIRROR_PORT_SET(val) : \ MT7530_MIRROR_PORT_SET(val))
@@ -673,6 +678,11 @@ enum mt7531_xtal_fsel {#define CPORT_SW2FE_STAG_EN BIT(1)#define CPORT_FE2SW_STAG_EN BIT(0) +#define AN7583_GEPHY_CONN_CFG 0x7c14 +#define AN7583_CSR_DPHY_CKIN_SEL BIT(31) +#define AN7583_CSR_PHY_CORE_REG_CLK_SEL BIT(30) +#define AN7583_CSR_ETHER_AFE_PWD GENMASK(28, 24) +/* Registers for LED GPIO control (MT7530 only) * All registers follow this pattern: * [ 2: 0] port 0
Signature · 1 line
2.48.1
Re: [net-next PATCH 2/3] net: dsa: mt7530: Add AN7583 support
Quoted 7 lines · Christian Marangi
Add Airoha AN7583 Switch support. This is based on Airoha EN7581 that is based on Mediatek MT7988 Switch.
Airoha AN7583 require additional tweak to the
GEPHY_CONN_CFGregister to make the internal PHY work.Signed-off-by Christian Marangi <[email protected]>
Andrew
PATCH 3/3 net: phy: mediatek: Add Airoha AN7583 PHY support
In reply to Christian MarangiAdd 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.
--- drivers/net/phy/mediatek/mtk-ge-soc.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/net/phy/mediatek/mtk-ge-soc.c +20 -0
@@ -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) }, { } };
Signature · 1 line
2.48.1
Re: [net-next PATCH 3/3] net: phy: mediatek: Add Airoha AN7583 PHY support
Quoted 5 lines · Christian Marangi
Add Airoha AN7583 PHY support based on Airoha AN7581 with the small difference that
BMCR_PDOWNis enabled by default and needs to be cleared to make the internal PHY correctly work.Signed-off-by Christian Marangi <[email protected]>
Andrew
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Thu, 22 May 2025 18:53:08 +0200 you wrote:
This small series add the required changes to make Airoha AN7583 Switch and Internal PHY work due to strange default configuration.
Christian Marangi (3):
dt-bindings: net: dsa: mediatek,mt7530: Add airoha,an7583-switch
net: dsa: mt7530: Add AN7583 support
net: phy: mediatek: Add Airoha AN7583 PHY support[...]
Here is the summary with links:
- [net-next,1/3] dt-bindings: net: dsa: mediatek,mt7530: Add airoha,an7583-switch
https://git.kernel.org/netdev/net-next/c/fef184880923 - [net-next,2/3] net: dsa: mt7530: Add AN7583 support https://git.kernel.org/netdev/net-next/c/d76556db10bf - [net-next,3/3] net: phy: mediatek: Add Airoha AN7583 PHY support https://git.kernel.org/netdev/net-next/c/8bc3c234dcb6
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html