diff mbox series

[4/4] imx8m: soc: drop phy-reset-gpios for fec

Message ID 20220214125525.26954-4-peng.fan@oss.nxp.com
State Superseded
Delegated to: Stefano Babic
Headers show
Series [1/4] imx: imx8mp: detect i.MX8MP UltraLite when get cpu rev | expand

Commit Message

Peng Fan (OSS) Feb. 14, 2022, 12:55 p.m. UTC
From: Peng Fan <peng.fan@nxp.com>

Need to drop phy-reset-gpios before booting linux, this property
is legacy property and replaced with reset-gpios.

If provide both, kernel would failed to request the same gpio twice
and cause fec not work.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 arch/arm/mach-imx/imx8m/soc.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)
diff mbox series

Patch

diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c
index 6802b6e478..f1b998c5c5 100644
--- a/arch/arm/mach-imx/imx8m/soc.c
+++ b/arch/arm/mach-imx/imx8m/soc.c
@@ -1149,28 +1149,30 @@  static int disable_cpu_nodes(void *blob, u32 disabled_cores)
 #if defined(CONFIG_IMX8MM)
 static int cleanup_nodes_for_efi(void *blob)
 {
-	static const char * const usbotg_path[] = {
-		"/soc@0/bus@32c00000/usb@32e40000",
-		"/soc@0/bus@32c00000/usb@32e50000"
-		};
+	static const char * const path[][2] = {
+		{ "/soc@0/bus@32c00000/usb@32e40000", "extcon" },
+		{ "/soc@0/bus@32c00000/usb@32e50000", "extcon" },
+		{ "/soc@0/bus@30800000/ethernet@30be0000", "phy-reset-gpios" },
+		{ "/soc@0/bus@30800000/ethernet@30bf0000", "phy-reset-gpios" }
+	};
 	int nodeoff, i, rc;
 
-	for (i = 0; i < ARRAY_SIZE(usbotg_path); i++) {
-		nodeoff = fdt_path_offset(blob, usbotg_path[i]);
+	for (i = 0; i < ARRAY_SIZE(path); i++) {
+		nodeoff = fdt_path_offset(blob, path[i][0]);
 		if (nodeoff < 0)
 			continue; /* Not found, skip it */
-		debug("Found %s node\n", usbotg_path[i]);
+		debug("Found %s node\n", path[i][0]);
 
-		rc = fdt_delprop(blob, nodeoff, "extcon");
+		rc = fdt_delprop(blob, nodeoff, path[i][1]);
 		if (rc == -FDT_ERR_NOTFOUND)
 			continue;
 		if (rc) {
 			printf("Unable to update property %s:%s, err=%s\n",
-			       usbotg_path[i], "extcon", fdt_strerror(rc));
+			       path[i][0], path[i][1], fdt_strerror(rc));
 			return rc;
 		}
 
-		printf("Remove %s:%s\n", usbotg_path[i], "extcon");
+		printf("Remove %s:%s\n", path[i][0], path[i][1]);
 	}
 
 	return 0;
@@ -1271,8 +1273,6 @@  usb_modify_speed:
 	else if (is_imx8mms() || is_imx8mmsl())
 		disable_cpu_nodes(blob, 3);
 
-	cleanup_nodes_for_efi(blob);
-
 #elif defined(CONFIG_IMX8MN)
 	if (is_imx8mnl() || is_imx8mndl() ||  is_imx8mnsl())
 		disable_gpu_nodes(blob);
@@ -1320,6 +1320,7 @@  usb_modify_speed:
 		disable_cpu_nodes(blob, 2);
 #endif
 
+	cleanup_nodes_for_efi(blob);
 	return 0;
 }
 #endif