From: Anurag Dutta <[email protected]>

When the kernel boots, it invokes sync_state() on the HBMC node, which
powers it down. Due to a power domain dependency between OSPI0 and HBMC,
this also disables the AHB bus, making it inaccessible and causing
indirect writes to the OSPI flash to fail.

Fix this by removing the HBMC node from the DT when switch SW3.1
(WKUP_GPIO0_6) is set to OSPI mode.

Signed-off-by: Anurag Dutta <[email protected]>
Signed-off-by: Udit Kumar <[email protected]>
---
 board/ti/j721e/evm.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c
index 881392bd963..8e2b8f3d47d 100644
--- a/board/ti/j721e/evm.c
+++ b/board/ti/j721e/evm.c
@@ -102,6 +102,7 @@ static void __maybe_unused detect_enable_hyperflash(void 
*blob)
 {
        struct gpio_desc desc = {0};
        char *hypermux_sel_gpio = (board_is_j721e_som()) ? "8" : "6";
+       int offset;
 
        if (dm_gpio_lookup_name(hypermux_sel_gpio, &desc))
                return;
@@ -113,14 +114,16 @@ static void __maybe_unused detect_enable_hyperflash(void 
*blob)
                return;
 
        if (dm_gpio_get_value(&desc)) {
-               int offset;
-
                do_fixup_by_compat(blob, "ti,am654-hbmc", "status",
                                   "okay", sizeof("okay"), 0);
                offset = fdt_node_offset_by_compatible(blob, -1,
                                                       "ti,am654-ospi");
                fdt_setprop(blob, offset, "status", "disabled",
                            sizeof("disabled"));
+       } else {
+               offset = fdt_node_offset_by_compatible(blob, -1,
+                                                      "ti,am654-hbmc");
+               fdt_del_node(blob, offset);
        }
 }
 #endif
-- 
2.34.1

Reply via email to