Files
openwrt/target/linux/airoha/patches-6.12/606-net-airoha-disable-external-phy-code-if-PCS_AIROHA-i.patch
T
Christian Marangi 5b25d4235d airoha: backport GDM2 loopback fixup for Ethernet driver
Backport GDM2 loopback fixup for Ethernet driver. This should be the last
patch before introduction of Multi-Serdes support series.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2026-05-22 12:43:00 +02:00

125 lines
3.4 KiB
Diff

From 843e2892f2d9353bf039e0dfb5442a600e75009e Mon Sep 17 00:00:00 2001
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Date: Thu, 9 Oct 2025 23:46:08 +0300
Subject: [PATCH] net: airoha: disable external phy code if PCS_AIROHA is not
enabled
External phy code breaks building for EN7523, so disable it if
PCS_AIROHA is not selected.
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
---
drivers/net/ethernet/airoha/airoha_eth.c | 16 ++++++++++++++++
drivers/net/ethernet/airoha/airoha_eth.h | 2 ++
2 files changed, 18 insertions(+)
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
@@ -72,10 +72,12 @@ static void airoha_qdma_irq_disable(stru
airoha_qdma_set_irqmask(irq_bank, index, mask, 0);
}
+#if defined(CONFIG_PCS_AIROHA)
static bool airhoa_is_phy_external(struct airoha_gdm_port *port)
{
return port->id != 1;
}
+#endif
static void airoha_set_macaddr(struct airoha_gdm_port *port, const u8 *addr)
{
@@ -1725,6 +1727,7 @@ static int airoha_dev_open(struct net_de
struct airoha_qdma *qdma = port->qdma;
u32 pse_port = FE_PSE_PORT_PPE1;
+#if defined(CONFIG_PCS_AIROHA)
if (airhoa_is_phy_external(port)) {
err = phylink_of_phy_connect(port->phylink, dev->dev.of_node, 0);
if (err) {
@@ -1735,6 +1738,7 @@ static int airoha_dev_open(struct net_de
phylink_start(port->phylink);
}
+#endif
netif_tx_start_all_queues(dev);
err = airoha_set_vip_for_gdm_port(port, true);
@@ -1797,10 +1801,12 @@ static int airoha_dev_stop(struct net_de
}
}
+#if defined(CONFIG_PCS_AIROHA)
if (airhoa_is_phy_external(port)) {
phylink_stop(port->phylink);
phylink_disconnect_phy(port->phylink);
}
+#endif
return 0;
}
@@ -2990,6 +2996,7 @@ bool airoha_is_valid_gdm_port(struct air
return false;
}
+#if defined(CONFIG_PCS_AIROHA)
static void airoha_mac_link_up(struct phylink_config *config, struct phy_device *phy,
unsigned int mode, phy_interface_t interface,
int speed, int duplex, bool tx_pause, bool rx_pause)
@@ -3102,6 +3109,7 @@ static int airoha_setup_phylink(struct n
return err;
}
+#endif
static int airoha_alloc_gdm_port(struct airoha_eth *eth,
struct device_node *np)
@@ -3176,11 +3184,13 @@ static int airoha_alloc_gdm_port(struct
port->nbq = id == AIROHA_GDM3_IDX && airoha_is_7581(eth) ? 4 : 0;
eth->ports[p] = port;
+#if defined(CONFIG_PCS_AIROHA)
if (airhoa_is_phy_external(port)) {
err = airoha_setup_phylink(dev);
if (err)
return err;
}
+#endif
return airoha_metadata_dst_alloc(port);
}
@@ -3310,8 +3320,10 @@ error_napi_stop:
continue;
if (port->dev->reg_state == NETREG_REGISTERED) {
+#if defined(CONFIG_PCS_AIROHA)
if (airhoa_is_phy_external(port))
phylink_destroy(port->phylink);
+#endif
unregister_netdev(port->dev);
}
airoha_metadata_dst_free(port);
@@ -3338,8 +3350,10 @@ static void airoha_remove(struct platfor
if (!port)
continue;
+#if defined(CONFIG_PCS_AIROHA)
if (airhoa_is_phy_external(port))
phylink_destroy(port->phylink);
+#endif
unregister_netdev(port->dev);
airoha_metadata_dst_free(port);
}
--- a/drivers/net/ethernet/airoha/airoha_eth.h
+++ b/drivers/net/ethernet/airoha/airoha_eth.h
@@ -542,8 +542,10 @@ struct airoha_gdm_port {
int id;
int nbq;
+#if defined(CONFIG_PCS_AIROHA)
struct phylink *phylink;
struct phylink_config phylink_config;
+#endif
struct airoha_hw_stats stats;