Skip to contentSkip to conversation

MIPS: ath79: skip pbl lowlevel init if running from RAM

PATCH Applied Antony Pavlov 2 participants 5 messages Nov 11, 2015 – Nov 13, 2015 MIPS

lore
Share & tools
lore
#0 lore raw

v2 cover MIPS: ath79: skip pbl lowlevel init if running from RAM

Changes since v1:

* fix commit messages (thanks to Dmitry Smagin);
* assume that tplink-mr3020's ROM start address is 0xbf000000;
* add 'Tested-by: Yegor Yefremov <[email protected]>'.

Antony Pavlov (2):
MIPS: black-swift: skip pbl lowlevel init if running from RAM
MIPS: tplink-mr3020: skip pbl lowlevel init if running from RAM

Oleksij Rempel (1):
MIPS: pbl: add pbl_blt macro

 arch/mips/boards/black-swift/include/board/board_pbl_start.h |  3 +++
 .../boards/tplink-mr3020/include/board/board_pbl_start.h     |  3 +++
 arch/mips/include/asm/pbl_macros.h                           | 12 ++++++++++++
 3 files changed, 18 insertions(+)
Signature · 7 lines
2.6.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH v2 1/3 MIPS: pbl: add pbl_blt macro

From: Oleksij Rempel <[email protected]>

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.

---
 arch/mips/include/asm/pbl_macros.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/mips/include/asm/pbl_macros.h +12 -0
index c4ae6a2..dbe3410 100644
@@ -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
Signature · 7 lines
2.6.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH v2 2/3 MIPS: black-swift: skip pbl lowlevel init if running from RAM

In reply to Antony Pavlov

Black Swift has 16 MiB flash boot ROM. The standard board's bootloader (U-Boot_mod) remaps boot ROM to 0xbf000000.

---
 arch/mips/boards/black-swift/include/board/board_pbl_start.h | 3 +++
 1 file changed, 3 insertions(+)
arch/mips/boards/black-swift/include/board/board_pbl_start.h +3 -0
index f78e0d9..7394092 100644
@@ -28,9 +28,12 @@
 
 	mips_disable_interrupts
 
+	pbl_blt 0xbf000000 skip_pll_ram_config t8
+
 	pbl_ar9331_pll
 	pbl_ar9331_ddr2_config
 
+skip_pll_ram_config:
 	pbl_ar9331_uart_enable
 	debug_ll_ar9331_init
 	mips_nmon
Signature · 7 lines
2.6.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

PATCH v2 3/3 MIPS: tplink-mr3020: skip pbl lowlevel init if running from RAM

In reply to Antony Pavlov

TP-Link MR3020 has 4 MiB flash boot ROM.
Usually boot ROM is mapped to 0xbfc00000. However, as AR9331 allows to remap boot ROM to 0xbf000000 it's better to assume that boot ROM starts at 0xbf000000.

---
 arch/mips/boards/tplink-mr3020/include/board/board_pbl_start.h | 3 +++
 1 file changed, 3 insertions(+)
arch/mips/boards/tplink-mr3020/include/board/board_pbl_start.h +3 -0
index 08204fe..d25f5aa 100644
@@ -28,9 +28,12 @@
 
 	mips_disable_interrupts
 
+	pbl_blt 0xbf000000 skip_pll_ram_config t8
+
 	pbl_ar9331_pll
 	pbl_ar9331_ddr1_config
 
+skip_pll_ram_config:
 	pbl_ar9331_uart_enable
 	debug_ll_ar9331_init
 	mips_nmon
Signature · 7 lines
2.6.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#4 lore raw
In reply to Antony Pavlov
Quoted 10 lines · Antony Pavlov

Changes since v1:

* fix commit messages (thanks to Dmitry Smagin);
* assume that tplink-mr3020's ROM start address is 0xbf000000;
* add 'Tested-by: Yegor Yefremov <[email protected]>'.

Antony Pavlov (2):
MIPS: black-swift: skip pbl lowlevel init if running from RAM
MIPS: tplink-mr3020: skip pbl lowlevel init if running from RAM

Quoted 7 lines

Oleksij Rempel (1):
MIPS: pbl: add pbl_blt macro

 arch/mips/boards/black-swift/include/board/board_pbl_start.h |  3 +++
 .../boards/tplink-mr3020/include/board/board_pbl_start.h     |  3 +++
 arch/mips/include/asm/pbl_macros.h                           | 12 ++++++++++++
 3 files changed, 18 insertions(+)

Applied, thanks

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox