At U-Boot entry point, the r2 register holds the address of the
firmware provided boot param. Let's save it for further processing.

Signed-off-by: Cédric Schieli <cschi...@gmail.com>
---

 board/raspberrypi/rpi/Makefile        |  1 +
 board/raspberrypi/rpi/lowlevel_init.S | 26 ++++++++++++++++++++++++++
 include/configs/rpi.h                 |  4 ++++
 3 files changed, 31 insertions(+)
 create mode 100644 board/raspberrypi/rpi/lowlevel_init.S

diff --git a/board/raspberrypi/rpi/Makefile b/board/raspberrypi/rpi/Makefile
index 4ce2c98..dcb25ac 100644
--- a/board/raspberrypi/rpi/Makefile
+++ b/board/raspberrypi/rpi/Makefile
@@ -5,3 +5,4 @@
 #
 
 obj-y  := rpi.o
+obj-y  += lowlevel_init.o
diff --git a/board/raspberrypi/rpi/lowlevel_init.S 
b/board/raspberrypi/rpi/lowlevel_init.S
new file mode 100644
index 0000000..446a70b
--- /dev/null
+++ b/board/raspberrypi/rpi/lowlevel_init.S
@@ -0,0 +1,26 @@
+/*
+ * (C) Copyright 2016
+ * Cédric Schieli <cschi...@gmail.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <config.h>
+
+.global fw_boot_param
+fw_boot_param:
+       .word 0x00000000
+
+/*
+ * Routine: save_boot_params (called after reset from start.S)
+ * Description: save ATAG/FDT address provided by the firmware at boot time
+ */
+
+.global save_boot_params
+save_boot_params:
+
+       /* The firmware provided ATAG/FDT address can be found in r2 */
+       str     r2, fw_boot_param
+
+       /* Returns */
+       b       save_boot_params_ret
diff --git a/include/configs/rpi.h b/include/configs/rpi.h
index 8d4ad5d..2d1e619 100644
--- a/include/configs/rpi.h
+++ b/include/configs/rpi.h
@@ -208,5 +208,9 @@
        ENV_MEM_LAYOUT_SETTINGS \
        BOOTENV
 
+#ifndef __ASSEMBLY__
+/* Firmware provided boot param */
+extern const void *fw_boot_param;
+#endif
 
 #endif
-- 
2.7.3

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to