summaryrefslogtreecommitdiffstats
path: root/arch/mips/include
diff options
context:
space:
mode:
authorOleksij Rempel <linux@rempel-privat.de>2015-11-11 11:35:40 +0300
committerSascha Hauer <s.hauer@pengutronix.de>2015-11-13 07:52:44 +0100
commit8891fcc9dbb1cc2ef660ec47890b9f2431b6087c (patch)
tree25c6b1060fe7c4c14c869b12034ecea55927e1d8 /arch/mips/include
parenta919cac585e8849b539af2b273eda3d3d27408a6 (diff)
downloadbarebox-8891fcc9dbb1cc2ef660ec47890b9f2431b6087c.tar.gz
barebox-8891fcc9dbb1cc2ef660ec47890b9f2431b6087c.tar.xz
MIPS: pbl: add pbl_blt macro
Barebox' PBL is able to initialize SoC's memory controller, but it can be used only if PBL runs from ROM or on-chip SRAM. MIPS architecture standard boot vector is 0xbfc00000 so on most MIPS SoCs all addresses higher than 0xbfc00000 belong to boot ROM or on-chip SRAM. Thus there's a simple criterion to check if PBL runs from ROM: just check if current PC is higher than 0xbfc00000. Some MIPS boards have ROM start address lower than 0xbfc00000 so it's reasonable to make ROM start address checking board-dependant. The pbl_blt macro checks if current pc is lower than the first argument (ROM start address). If so then next instruction executed is defined by the second argument of the macro. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Tested-by: Yegor Yefremov <yegorslists@googlemail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/mips/include')
-rw-r--r--arch/mips/include/asm/pbl_macros.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/mips/include/asm/pbl_macros.h b/arch/mips/include/asm/pbl_macros.h
index c4ae6a2417..dbe3410632 100644
--- a/arch/mips/include/asm/pbl_macros.h
+++ b/arch/mips/include/asm/pbl_macros.h
@@ -60,6 +60,18 @@
.set pop
.endm
+ .macro pbl_blt addr label tmp
+ .set push
+ .set noreorder
+ move \tmp, ra # preserve ra beforehand
+ bal 253f
+ nop
+253:
+ bltu ra, \addr, \label
+ move ra, \tmp # restore ra
+ .set pop
+ .endm
+
.macro pbl_sleep reg count
.set push
.set noreorder