On 12/10/2025 7:39 PM, Markus Schneider-Pargmann (TI.com) wrote:
Add a small helper that uses memory regions referenced by the R5
devicetree node to calculate the LPM meta data address.

Tested-by: Anshul Dalal <[email protected]>
Reviewed-by: Kendall Willis <[email protected]>
Signed-off-by: Markus Schneider-Pargmann (TI.com) <[email protected]>
---
  arch/arm/mach-k3/common.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
  arch/arm/mach-k3/common.h |  1 +
  2 files changed, 45 insertions(+)

diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
index 
ee56f0b86ce303e319cfcd2b0db3bade1540635b..f058e973d08e233a458892df86e6da22ba3852fe
 100644
--- a/arch/arm/mach-k3/common.c
+++ b/arch/arm/mach-k3/common.c
@@ -16,6 +16,8 @@
  #include <linux/printk.h>
  #include "common.h"
  #include <dm.h>
+#include <dm/of_access.h>
+#include <dm/ofnode.h>
  #include <remoteproc.h>
  #include <asm/cache.h>
  #include <linux/soc/ti/ti_sci_protocol.h>
@@ -36,6 +38,7 @@
  #include <wait_bit.h>
#define CLKSTOP_TRANSITION_TIMEOUT_MS 10
+#define K3_R5_MEMREGION_LPM_METADATA_OFFSET    0x108000
#define PROC_BOOT_CTRL_FLAG_R5_CORE_HALT 0x00000001
  #define PROC_BOOT_STATUS_FLAG_R5_WFI          0x00000002
@@ -194,6 +197,43 @@ int __maybe_unused 
wkup_ctrl_remove_can_io_isolation_if_set(void)
  }
#if IS_ENABLED(CONFIG_K3_IODDR)
+int wkup_r5f_am62_lpm_meta_data_addr(u64 *meta_data_addr)

looking at function name, looks to be am62 specific, then common.c is not right place for this function .


+{
+       struct ofnode_phandle_args memregion_phandle;
+       ofnode memregion;
+       ofnode wkup_bus;
+       int ret;
+
+       wkup_bus = ofnode_path("/bus@f0000/bus@b00000");
+       if (!ofnode_valid(wkup_bus)) {
+               printf("Failed to find wkup bus\n");
+               return -EINVAL;
+       }
+
+       memregion = ofnode_by_compatible(wkup_bus, "ti,am62-r5f");
+       if (!ofnode_valid(memregion)) {
+               printf("Failed to find r5f devicetree node ti,am62-r5f\n");
+               return -EINVAL;
+       }
+
+       ret = ofnode_parse_phandle_with_args(memregion, "memory-region", NULL,
[..]

Reply via email to