From: Primoz Fiser <primoz.fiser@norik.com>
Date: Tue, 30 Jan 2024 12:43:37 +0000 (+0100)
Subject: imx9: clock: Fix board_interface_eth_init for FEC
X-Git-Tag: v2025.01-rc5-pxa1908~660^2~11
X-Git-Url: http://git.dujemihanovic.xyz/%22http:/www.sics.se/static/git-favicon.png?a=commitdiff_plain;h=259e1012713f788dc595c5a6960520d48c1bbf1b;p=u-boot.git

imx9: clock: Fix board_interface_eth_init for FEC

Commit d5eae216d833 ("net: dwc_eth_qos: Add board_interface_eth_init()
for i.MX93") implemented board_interface_eth_init for i.MX9 platforms.
However it only accounted for the EQOS interface while any board using
FEC as primary Ethernet interface was left out as return value -EINVAL
is always returned from the function in such case.

Fix this by returning 0 (success) when FEC interface is primarily used
instead of EQOS interface on i.MX93.

Fixes: d5eae216d833 ("net: dwc_eth_qos: Add board_interface_eth_init() for i.MX93")
Signed-off-by: Primoz Fiser <primoz.fiser@norik.com>
Tested-by: Mathieu Othacehe <m.othacehe@gmail.com>
---

diff --git a/arch/arm/mach-imx/imx9/clock.c b/arch/arm/mach-imx/imx9/clock.c
index 92c41e9a67..75d92af036 100644
--- a/arch/arm/mach-imx/imx9/clock.c
+++ b/arch/arm/mach-imx/imx9/clock.c
@@ -882,6 +882,11 @@ int board_interface_eth_init(struct udevice *dev, phy_interface_t interface_type
 	    device_is_compatible(dev, "nxp,imx93-dwmac-eqos"))
 		return imx93_eqos_interface_init(dev, interface_type);
 
+	if (IS_ENABLED(CONFIG_IMX93) &&
+	    IS_ENABLED(CONFIG_FEC_MXC) &&
+	    device_is_compatible(dev, "fsl,imx93-fec"))
+		return 0;
+
 	return -EINVAL;
 }