[PATCH 1/7] bsp/imx: Avoid hard-coded GIC base address

Christian Mauderer christian.mauderer at embedded-brains.de
Mon Feb 10 09:35:11 UTC 2020


From: Sebastian Huber <sebastian.huber at embedded-brains.de>

Update #3869.
---
 bsps/arm/imx/include/bsp.h    |  6 ++++--
 bsps/arm/imx/start/bspstart.c | 11 +++++++++++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/bsps/arm/imx/include/bsp.h b/bsps/arm/imx/include/bsp.h
index 4ed35c68fe..134b3fd858 100644
--- a/bsps/arm/imx/include/bsp.h
+++ b/bsps/arm/imx/include/bsp.h
@@ -47,9 +47,11 @@
 extern "C" {
 #endif /* __cplusplus */
 
-#define BSP_ARM_GIC_DIST_BASE 0x31001000
+extern uintptr_t imx_gic_dist_base;
 
-#define BSP_ARM_GIC_CPUIF_BASE 0x31002000
+#define BSP_ARM_GIC_DIST_BASE imx_gic_dist_base
+
+#define BSP_ARM_GIC_CPUIF_BASE (BSP_ARM_GIC_DIST_BASE + 0x1000)
 
 #define BSP_ARM_A9MPCORE_GT_BASE 0
 
diff --git a/bsps/arm/imx/start/bspstart.c b/bsps/arm/imx/start/bspstart.c
index 046336655b..3a87c437d2 100644
--- a/bsps/arm/imx/start/bspstart.c
+++ b/bsps/arm/imx/start/bspstart.c
@@ -82,8 +82,19 @@ void arm_generic_timer_get_config(
   *irq = imx_get_irq_of_node(fdt, node, 0) - 16;
 }
 
+uintptr_t imx_gic_dist_base;
+
+static void imx_find_gic(const void *fdt)
+{
+  int node;
+
+  node = fdt_path_offset(fdt, "/interrupt-controller");
+  imx_gic_dist_base = (uintptr_t) imx_get_reg_of_node(fdt, node);
+}
+
 void bsp_start(void)
 {
+  imx_find_gic(bsp_fdt_get());
   bsp_interrupt_initialize();
   rtems_cache_coherent_add_area(
     bsp_section_nocacheheap_begin,
-- 
2.16.4



More information about the devel mailing list