]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
imx9: scmi: reset GPIO2 according its node status
authorPeng Fan <peng.fan@nxp.com>
Wed, 17 Jun 2026 14:14:46 +0000 (22:14 +0800)
committerFabio Estevam <festevam@gmail.com>
Mon, 27 Jul 2026 14:25:30 +0000 (11:25 -0300)
Check the GPIO2 dts node status to determine reset it or not.
On iMX952 single SPL/U-Boot image is shared for both mx952evk
and mx952evkrpmsg SM configs. GPIO2 is assigned to M7 domain
in mx952evkrpmsg, and there is no active user of GPIO2 for
mx952evk and mx952evkrpmsg in SPL/U-Boot, so it is disabled in
DTS. Otherwise, reset GPIO2 will meet hang when working with
mx952evkrpmsg SM.

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
arch/arm/mach-imx/imx9/scmi/soc.c

index 0cba2d92abb53c0fc0908d03d8abf4383284e90e..6561de205d01264787551aa7c2d09b7028fe5286 100644 (file)
@@ -14,6 +14,7 @@
 #include <asm/setup.h>
 #include <dm/uclass.h>
 #include <dm/device.h>
+#include <dm/ofnode.h>
 #include <env_internal.h>
 #include <fuse.h>
 #include <imx_thermal.h>
@@ -1051,6 +1052,22 @@ static void gpio_reset(ulong gpio_base)
        writel(0, gpio_base + 0x1c);
 }
 
+static int gpio_available(const char *nodes_path)
+{
+       ofnode gpio_node = ofnode_path(nodes_path);
+       const char *status;
+
+       if (!ofnode_valid(gpio_node))
+               return false;
+
+       status = ofnode_read_string(gpio_node, "status");
+
+       if (status && !strcmp(status, "disabled"))
+               return false;
+
+       return true;
+}
+
 int arch_cpu_init(void)
 {
        if (IS_ENABLED(CONFIG_SPL_BUILD)) {
@@ -1066,7 +1083,9 @@ int arch_cpu_init(void)
                        disable_wdog((void __iomem *)base);
                }
 
-               gpio_reset(GPIO2_BASE_ADDR);
+               if (gpio_available("/soc/gpio@43810000"))
+                       gpio_reset(GPIO2_BASE_ADDR);
+
                gpio_reset(GPIO3_BASE_ADDR);
                gpio_reset(GPIO4_BASE_ADDR);
                gpio_reset(GPIO5_BASE_ADDR);