[rtems commit] bsp/imx: Avoid hard-coded GIC base address

Christian Mauderer christianm at rtems.org
Tue Feb 11 08:20:28 UTC 2020


Module:    rtems
Branch:    master
Commit:    8854a2b54be7f9fd74589605d19cae823827eb1b
Changeset: http://git.rtems.org/rtems/commit/?id=8854a2b54be7f9fd74589605d19cae823827eb1b

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Feb 10 10:35:11 2020 +0100

bsp/imx: Avoid hard-coded GIC base address

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 4ed35c6..134b3fd 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 0463366..3a87c43 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,



More information about the vc mailing list