[PATCH 09/22] platform: generic: mips p8700: Add match data for CM info

Vladimir Kondratiev vladimir.kondratiev at mobileye.com
Wed Jan 14 01:21:05 PST 2026


From: Benoît Monin <benoit.monin at bootlin.com>

Introduce a structure p8700_cm_info holding the number of coherence
managers and their base addresses found in a particular SoC.

Declare a global pointer to the structure that is set in
mips_p8700_platform_init(), based on the match data of the platform
compatible.

For the match data of the MIPS P8700, a single coherence manager with
a base address of 0x16100000 is declared, identical to what is found
in mips/board.h.

For now, access to the coherence manager register is still based on
the hard-coded values defined in mips/board.h.

Signed-off-by: Benoît Monin <benoit.monin at bootlin.com>
---
 platform/generic/include/mips/p8700.h | 12 ++++++++++++
 platform/generic/mips/p8700.c         | 21 ++++++++++++++++++++-
 2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/platform/generic/include/mips/p8700.h b/platform/generic/include/mips/p8700.h
index 6644e91dd42d..8281e5e6cef2 100644
--- a/platform/generic/include/mips/p8700.h
+++ b/platform/generic/include/mips/p8700.h
@@ -10,6 +10,18 @@
 
 #include <mips/board.h>
 
+/** Coherence manager information
+ *
+ * @num_cm: Number of coherence manager
+ * @gcr_base: Array of base address of the CM
+ */
+struct p8700_cm_info {
+	unsigned int num_cm;
+	unsigned long *gcr_base;
+};
+
+extern const struct p8700_cm_info *p8700_cm_info;
+
 /* PMA */
 #define CSR_MIPSPMACFG0	0x7e0
 #define CSR_MIPSPMACFG1	0x7e1
diff --git a/platform/generic/mips/p8700.c b/platform/generic/mips/p8700.c
index 94cba1631666..c5bf49f6ff8b 100644
--- a/platform/generic/mips/p8700.c
+++ b/platform/generic/mips/p8700.c
@@ -18,6 +18,8 @@
 #include <mips/p8700.h>
 #include <mips/mips-cm.h>
 
+const struct p8700_cm_info *p8700_cm_info;
+
 extern void mips_warm_boot(void);
 #define MMIO_BASE 0x00000000
 #define MMIO_SIZE 0x80000000
@@ -331,6 +333,14 @@ static int mips_p8700_nascent_init(void)
 
 static int mips_p8700_platform_init(const void *fdt, int nodeoff, const struct fdt_match *match)
 {
+	const struct p8700_cm_info *data = match->data;
+
+	if (!data) {
+		sbi_printf("Missing CM info for %s\n", match->compatible);
+		return SBI_EINVAL;
+	}
+
+	p8700_cm_info = data;
 	generic_platform_ops.early_init = mips_p8700_early_init;
 	generic_platform_ops.final_init = mips_p8700_final_init;
 	generic_platform_ops.nascent_init = mips_p8700_nascent_init;
@@ -339,8 +349,17 @@ static int mips_p8700_platform_init(const void *fdt, int nodeoff, const struct f
 	return 0;
 }
 
+static unsigned long mips_p8700_gcr_base[] = {
+	0x16100000,
+};
+
+static struct p8700_cm_info mips_p8700_cm_info = {
+	.num_cm = array_size(mips_p8700_gcr_base),
+	.gcr_base = mips_p8700_gcr_base,
+};
+
 static const struct fdt_match mips_p8700_match[] = {
-	{ .compatible = "mips,p8700" },
+	{ .compatible = "mips,p8700", .data = &mips_p8700_cm_info },
 	{ },
 };
 
-- 
2.43.0




More information about the opensbi mailing list