summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaleb Connolly <caleb.connolly@linaro.org>2024-08-09 01:59:33 +0200
committerCaleb Connolly <caleb.connolly@linaro.org>2024-09-06 10:47:46 +0200
commita9cbf76e4dd3c3295ed975a14ae4dfb258aefd4b (patch)
treebeed87941e05c158aa6b22812fc3c4a127466e78
parent75acc51189117b9c42232d0ea5c75cf72e39a4d8 (diff)
soc: qcom: cmd-db: map cmd-db region
On at least SM8650 this region might not be included in the memory map. Use the new mmu_map_region() helper to map it during bind(). Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
-rw-r--r--drivers/soc/qcom/cmd-db.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/soc/qcom/cmd-db.c b/drivers/soc/qcom/cmd-db.c
index c7c5230983d..67be18e89f4 100644
--- a/drivers/soc/qcom/cmd-db.c
+++ b/drivers/soc/qcom/cmd-db.c
@@ -6,6 +6,7 @@
#define pr_fmt(fmt) "cmd-db: " fmt
+#include <asm/system.h>
#include <dm.h>
#include <dm/ofnode.h>
#include <dm/device_compat.h>
@@ -182,9 +183,10 @@ u32 cmd_db_read_addr(const char *id)
}
EXPORT_SYMBOL_GPL(cmd_db_read_addr);
-int cmd_db_bind(struct udevice *dev)
+static int cmd_db_bind(struct udevice *dev)
{
void __iomem *base;
+ fdt_size_t size;
ofnode node;
if (cmd_db_header)
@@ -194,12 +196,15 @@ int cmd_db_bind(struct udevice *dev)
debug("%s(%s)\n", __func__, ofnode_get_name(node));
- base = (void __iomem *)ofnode_get_addr(node);
+ base = (void __iomem *)ofnode_get_addr_size(node, "reg", &size);
if ((fdt_addr_t)base == FDT_ADDR_T_NONE) {
log_err("%s: Failed to read base address\n", __func__);
return -ENOENT;
}
+ /* On SM8550/SM8650 and newer SoCs cmd-db might not be mapped */
+ mmu_map_region((phys_addr_t)base, (phys_size_t)size, false);
+
cmd_db_header = base;
if (!cmd_db_magic_matches(cmd_db_header)) {
log_err("%s: Invalid Command DB Magic\n", __func__);