From fe31e5c82ad6fbabd44969ac075c57a57c9f796b Mon Sep 17 00:00:00 2001 From: Mikhail Kshevetskiy Date: Fri, 10 Oct 2025 03:15:42 +0300 Subject: [PATCH] airoha: net: fix building for en7523 Latest an7581/an7583 improvements breaks en7523. This patch just fixes en7523 building. Signed-off-by: Mikhail Kshevetskiy Link: https://github.com/openwrt/openwrt/pull/20365 Signed-off-by: Robert Marko --- target/linux/airoha/en7523/config-6.12 | 3 + ...le-external-phy-code-if-PCS_AIROHA-i.patch | 145 ++++++++++++++++++ 2 files changed, 148 insertions(+) create mode 100644 target/linux/airoha/patches-6.12/606-net-airoha-disable-external-phy-code-if-PCS_AIROHA-i.patch diff --git a/target/linux/airoha/en7523/config-6.12 b/target/linux/airoha/en7523/config-6.12 index f434955a92..9a2eb1e4d6 100644 --- a/target/linux/airoha/en7523/config-6.12 +++ b/target/linux/airoha/en7523/config-6.12 @@ -215,6 +215,9 @@ CONFIG_OF_GPIO=y CONFIG_OF_IRQ=y CONFIG_OF_KOBJ=y CONFIG_OF_MDIO=y +# CONFIG_MDIO_AIROHA is not set +# CONFIG_PCS_AIROHA_AN7581 is not set +# CONFIG_PCS_AIROHA_AN7583 is not set CONFIG_OLD_SIGACTION=y CONFIG_OLD_SIGSUSPEND3=y CONFIG_OUTER_CACHE=y diff --git a/target/linux/airoha/patches-6.12/606-net-airoha-disable-external-phy-code-if-PCS_AIROHA-i.patch b/target/linux/airoha/patches-6.12/606-net-airoha-disable-external-phy-code-if-PCS_AIROHA-i.patch new file mode 100644 index 0000000000..370e9a7550 --- /dev/null +++ b/target/linux/airoha/patches-6.12/606-net-airoha-disable-external-phy-code-if-PCS_AIROHA-i.patch @@ -0,0 +1,145 @@ +From 843e2892f2d9353bf039e0dfb5442a600e75009e Mon Sep 17 00:00:00 2001 +From: Mikhail Kshevetskiy +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 +--- + 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) + { +@@ -1649,6 +1651,7 @@ static int airoha_dev_open(struct net_de + struct airoha_gdm_port *port = netdev_priv(dev); + struct airoha_qdma *qdma = port->qdma; + ++#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) { +@@ -1659,6 +1662,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); +@@ -1713,10 +1717,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; + } +@@ -2806,6 +2812,7 @@ static const struct ethtool_ops airoha_e + .get_rmon_stats = airoha_ethtool_get_rmon_stats, + }; + ++#if defined(CONFIG_PCS_AIROHA) + static struct phylink_pcs *airoha_phylink_mac_select_pcs(struct phylink_config *config, + phy_interface_t interface) + { +@@ -2819,6 +2826,7 @@ static void airoha_mac_config(struct phy + const struct phylink_link_state *state) + { + } ++#endif + + static int airoha_metadata_dst_alloc(struct airoha_gdm_port *port) + { +@@ -2864,6 +2872,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) +@@ -2956,6 +2965,7 @@ static int airoha_setup_phylink(struct n + + return 0; + } ++#endif + + static int airoha_alloc_gdm_port(struct airoha_eth *eth, + struct device_node *np, int index) +@@ -3035,11 +3045,13 @@ static int airoha_alloc_gdm_port(struct + if (err) + return err; + ++#if defined(CONFIG_PCS_AIROHA) + if (airhoa_is_phy_external(port)) { + err = airoha_setup_phylink(dev); + if (err) + goto free_metadata_dst; + } ++#endif + + err = register_netdev(dev); + if (err) +@@ -3144,10 +3156,12 @@ error_hw_cleanup: + if (port && port->dev->reg_state == NETREG_REGISTERED) { + unregister_netdev(port->dev); + airoha_metadata_dst_free(port); ++#if defined(CONFIG_PCS_AIROHA) + if (airhoa_is_phy_external(port)) { + phylink_destroy(port->phylink); + airoha_pcs_destroy(port->pcs); + } ++#endif + } + } + free_netdev(eth->napi_dev); +@@ -3175,10 +3189,12 @@ static void airoha_remove(struct platfor + airoha_dev_stop(port->dev); + unregister_netdev(port->dev); + airoha_metadata_dst_free(port); ++#if defined(CONFIG_PCS_AIROHA) + if (airhoa_is_phy_external(port)) { + phylink_destroy(port->phylink); + airoha_pcs_destroy(port->pcs); + } ++#endif + } + free_netdev(eth->napi_dev); + +--- a/drivers/net/ethernet/airoha/airoha_eth.h ++++ b/drivers/net/ethernet/airoha/airoha_eth.h +@@ -528,9 +528,11 @@ struct airoha_gdm_port { + struct net_device *dev; + int id; + ++#if defined(CONFIG_PCS_AIROHA) + struct phylink *phylink; + struct phylink_config phylink_config; + struct phylink_pcs *pcs; ++#endif + + struct airoha_hw_stats stats; + -- 2.30.2