Skip to contentSkip to conversation

MIPS: ath79: pbl: use more lowlevel init code from U-Boot_mod

PATCH Applied Antony Pavlov 3 participants 10 messages Feb 25, 2016 – Feb 26, 2016 MIPS

lore
Share & tools
lore
#0 lore raw

cover MIPS: ath79: pbl: use more lowlevel init code from U-Boot_mod

U-Boot_mod is a popular bootloader for Atheros AR93xx chips, please see https://github.com/pepe2k/u-boot_mod for details.

It's reasonable to import some lowlevel AR9331 initialization code from U-Boot_mod.

Antony Pavlov (4):
MIPS: ath79: pbl: import AR9331 CP0 init routine from U-Boot_mod
MIPS: ath79: pbl: import hornet_1_1_war routine from U-Boot_mod
MIPS: tplink-mr3020: pbl: use more lowlevel init code from U-Boot_mod
MIPS: black-swift: pbl: use more lowlevel init code from U-Boot_mod

 .../black-swift/include/board/board_pbl_start.h    |  4 +-
 .../tplink-mr3020/include/board/board_pbl_start.h  |  4 +-
 arch/mips/mach-ath79/include/mach/pbl_macros.h     | 87 ++++++++++++++++++++++
 3 files changed, 93 insertions(+), 2 deletions(-)
Signature · 7 lines
2.7.0


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

PATCH 4/4 MIPS: black-swift: pbl: use more lowlevel init code from U-Boot_mod

---
 arch/mips/boards/black-swift/include/board/board_pbl_start.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/mips/boards/black-swift/include/board/board_pbl_start.h +3 -1
index 7394092..3f2caa0 100644
@@ -26,10 +26,12 @@
 
 	mips_barebox_10h
 
-	mips_disable_interrupts
+	hornet_mips24k_cp0_setup
 
 	pbl_blt 0xbf000000 skip_pll_ram_config t8
 
+	hornet_1_1_war
+
 	pbl_ar9331_pll
 	pbl_ar9331_ddr2_config
 
Signature · 7 lines
2.7.0


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

PATCH 1/4 MIPS: ath79: pbl: import AR9331 CP0 init routine from U-Boot_mod

In reply to Antony Pavlov

U-Boot_mod is a popular bootloader for Atheros AR93xx chips, please see https://github.com/pepe2k/u-boot_mod for details.

It's reasonable to import some lowlevel AR9331 initialization code from U-Boot_mod.

This patch imports AR9331 MIPS24K coprocessor0 initialization code from u-boot_mod/u-boot/cpu/mips/start_bootstrap.S.

---
 arch/mips/mach-ath79/include/mach/pbl_macros.h | 44 ++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
arch/mips/mach-ath79/include/mach/pbl_macros.h +44 -0
index c00dd28..810f49d 100644
@@ -179,4 +179,48 @@
 			| AR933X_GPIO_FUNC_RSRV15, GPIO_FUNC
 .endm
 
+.macro	hornet_mips24k_cp0_setup
+	.set push
+	.set noreorder
+
+	/*
+	 * Clearing CP0 registers - This is generally required for the MIPS-24k
+	 * core used by Atheros.
+	 */
+	mtc0	zero, CP0_INDEX
+	mtc0	zero, CP0_ENTRYLO0
+	mtc0	zero, CP0_ENTRYLO1
+	mtc0	zero, CP0_CONTEXT
+	mtc0	zero, CP0_PAGEMASK
+	mtc0	zero, CP0_WIRED
+	mtc0	zero, CP0_INFO
+	mtc0	zero, CP0_COUNT
+	mtc0	zero, CP0_ENTRYHI
+	mtc0	zero, CP0_COMPARE
+
+	li	t0, ST0_CU0 | ST0_ERL
+	mtc0	t0, CP0_STATUS
+
+	mtc0	zero, CP0_CAUSE
+	mtc0	zero, CP0_EPC
+
+	li	t0, CONF_CM_UNCACHED
+	mtc0	t0, CP0_CONFIG
+
+	mtc0	zero, CP0_LLADDR
+	mtc0	zero, CP0_WATCHLO
+	mtc0	zero, CP0_WATCHHI
+	mtc0	zero, CP0_XCONTEXT
+	mtc0	zero, CP0_FRAMEMASK
+	mtc0	zero, CP0_DIAGNOSTIC
+	mtc0	zero, CP0_DEBUG
+	mtc0	zero, CP0_DEPC
+	mtc0	zero, CP0_PERFORMANCE
+	mtc0	zero, CP0_ECC
+	mtc0	zero, CP0_CACHEERR
+	mtc0	zero, CP0_TAGLO
+
+	.set	pop
+.endm
+
 #endif /* __ASM_MACH_ATH79_PBL_MACROS_H */
Signature · 7 lines
2.7.0


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

PATCH 2/4 MIPS: ath79: pbl: import hornet_1_1_war routine from U-Boot_mod

In reply to Antony Pavlov

U-Boot_mod is a popular bootloader for Atheros AR93xx chips, please see https://github.com/pepe2k/u-boot_mod for details.

It's reasonable to import some lowlevel AR9331 initialization code from U-Boot_mod.

AR9331 (Hornet) 1.1 currently needs an additional reset at 1st boot. This patch imports necessary code from u-boot_mod/u-boot/cpu/mips/start_bootstrap.S.

---
 arch/mips/mach-ath79/include/mach/pbl_macros.h | 43 ++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
arch/mips/mach-ath79/include/mach/pbl_macros.h +43 -0
index 810f49d..24cfd60 100644
@@ -223,4 +223,47 @@
 	.set	pop
 .endm
 
+.macro	hornet_1_1_war
+	.set push
+	.set noreorder
+
+/*
+ * WAR: Hornet 1.1 currently need a reset once we boot to let the resetb has
+ *      enough time to stable, so that trigger reset at 1st boot, system team
+ *      is investigaing the issue, will remove in short
+ */
+
+	li  t7, 0xbd000000
+	lw  t8, 0(t7)
+	li  t9, 0x12345678
+
+	/* if value of 0xbd000000 != 0x12345678, go to do_reset */
+	bne t8, t9, do_reset
+	 nop
+
+	li  t9, 0xffffffff
+	sw  t9, 0(t7)
+	b   normal_path
+	 nop
+
+do_reset:
+	/* put 0x12345678 into 0xbd000000 */
+	sw  t9, 0(t7)
+
+	/* reset register 0x1806001c */
+	li  t7, 0xb806001c
+	lw  t8, 0(t7)
+	/* bit24, fullchip reset */
+	li  t9, 0x1000000
+	or  t8, t8, t9
+	sw  t8, 0(t7)
+
+do_reset_loop:
+	b   do_reset_loop
+	 nop
+
+normal_path:
+	.set	pop
+.endm
+
 #endif /* __ASM_MACH_ATH79_PBL_MACROS_H */
Signature · 7 lines
2.7.0


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

PATCH 3/4 MIPS: tplink-mr3020: pbl: use more lowlevel init code from U-Boot_mod

In reply to Antony Pavlov
---
 arch/mips/boards/tplink-mr3020/include/board/board_pbl_start.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/mips/boards/tplink-mr3020/include/board/board_pbl_start.h +3 -1
index d25f5aa..ae548c9 100644
@@ -26,10 +26,12 @@
 
 	mips_barebox_10h
 
-	mips_disable_interrupts
+	hornet_mips24k_cp0_setup
 
 	pbl_blt 0xbf000000 skip_pll_ram_config t8
 
+	hornet_1_1_war
+
 	pbl_ar9331_pll
 	pbl_ar9331_ddr1_config
 
Signature · 7 lines
2.7.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Reviewed-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] MIPS: ath79: pbl: import AR9331 CP0 init routine from U-Boot_mod

In reply to Antony Pavlov
Quoted 10 lines · Antony Pavlov

U-Boot_mod is a popular bootloader for Atheros AR93xx chips, please see https://github.com/pepe2k/u-boot_mod for details.

It's reasonable to import some lowlevel AR9331 initialization code from U-Boot_mod.

This patch imports AR9331 MIPS24K coprocessor0 initialization code from u-boot_mod/u-boot/cpu/mips/start_bootstrap.S.

Quoted 58 lines
---
 arch/mips/mach-ath79/include/mach/pbl_macros.h | 44 ++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
arch/mips/mach-ath79/include/mach/pbl_macros.h +44 -1
index c00dd28..810f49d 100644
@@ -179,4 +179,48 @@
                        | AR933X_GPIO_FUNC_RSRV15, GPIO_FUNC
 .endm
 
+.macro hornet_mips24k_cp0_setup
+       .set push
+       .set noreorder
+
+       /*
+        * Clearing CP0 registers - This is generally required for the MIPS-24k
+        * core used by Atheros.
+        */
+       mtc0    zero, CP0_INDEX
+       mtc0    zero, CP0_ENTRYLO0
+       mtc0    zero, CP0_ENTRYLO1
+       mtc0    zero, CP0_CONTEXT
+       mtc0    zero, CP0_PAGEMASK
+       mtc0    zero, CP0_WIRED
+       mtc0    zero, CP0_INFO
+       mtc0    zero, CP0_COUNT
+       mtc0    zero, CP0_ENTRYHI
+       mtc0    zero, CP0_COMPARE
+
+       li      t0, ST0_CU0 | ST0_ERL
+       mtc0    t0, CP0_STATUS
+
+       mtc0    zero, CP0_CAUSE
+       mtc0    zero, CP0_EPC
+
+       li      t0, CONF_CM_UNCACHED
+       mtc0    t0, CP0_CONFIG
+
+       mtc0    zero, CP0_LLADDR
+       mtc0    zero, CP0_WATCHLO
+       mtc0    zero, CP0_WATCHHI
+       mtc0    zero, CP0_XCONTEXT
+       mtc0    zero, CP0_FRAMEMASK
+       mtc0    zero, CP0_DIAGNOSTIC
+       mtc0    zero, CP0_DEBUG
+       mtc0    zero, CP0_DEPC
+       mtc0    zero, CP0_PERFORMANCE
+       mtc0    zero, CP0_ECC
+       mtc0    zero, CP0_CACHEERR
+       mtc0    zero, CP0_TAGLO
+
+       .set    pop
+.endm
+
 #endif /* __ASM_MACH_ATH79_PBL_MACROS_H */
--
Quoted 2 lines

2.7.0

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

Reviewed-by on v1 2/4
#4 lore raw

Re: [PATCH 2/4] MIPS: ath79: pbl: import hornet_1_1_war routine from U-Boot_mod

In reply to Antony Pavlov
Quoted 11 lines · Antony Pavlov

U-Boot_mod is a popular bootloader for Atheros AR93xx chips, please see https://github.com/pepe2k/u-boot_mod for details.

It's reasonable to import some lowlevel AR9331 initialization code from U-Boot_mod.

AR9331 (Hornet) 1.1 currently needs an additional reset at 1st boot. This patch imports necessary code from u-boot_mod/u-boot/cpu/mips/start_bootstrap.S.

Quoted 57 lines
---
 arch/mips/mach-ath79/include/mach/pbl_macros.h | 43 ++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
arch/mips/mach-ath79/include/mach/pbl_macros.h +43 -1
index 810f49d..24cfd60 100644
@@ -223,4 +223,47 @@
        .set    pop
 .endm
 
+.macro hornet_1_1_war
+       .set push
+       .set noreorder
+
+/*
+ * WAR: Hornet 1.1 currently need a reset once we boot to let the resetb has
+ *      enough time to stable, so that trigger reset at 1st boot, system team
+ *      is investigaing the issue, will remove in short
+ */
+
+       li  t7, 0xbd000000
+       lw  t8, 0(t7)
+       li  t9, 0x12345678
+
+       /* if value of 0xbd000000 != 0x12345678, go to do_reset */
+       bne t8, t9, do_reset
+        nop
+
+       li  t9, 0xffffffff
+       sw  t9, 0(t7)
+       b   normal_path
+        nop
+
+do_reset:
+       /* put 0x12345678 into 0xbd000000 */
+       sw  t9, 0(t7)
+
+       /* reset register 0x1806001c */
+       li  t7, 0xb806001c
+       lw  t8, 0(t7)
+       /* bit24, fullchip reset */
+       li  t9, 0x1000000
+       or  t8, t8, t9
+       sw  t8, 0(t7)
+
+do_reset_loop:
+       b   do_reset_loop
+        nop
+
+normal_path:
+       .set    pop
+.endm
+
 #endif /* __ASM_MACH_ATH79_PBL_MACROS_H */
--
Quoted 2 lines

2.7.0

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

Reviewed-by on v1 3/4
#6 lore raw

Re: [PATCH 3/4] MIPS: tplink-mr3020: pbl: use more lowlevel init code from U-Boot_mod

In reply to Antony Pavlov
Quoted 1 line · Antony Pavlov
Quoted 23 lines
---
 arch/mips/boards/tplink-mr3020/include/board/board_pbl_start.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/mips/boards/tplink-mr3020/include/board/board_pbl_start.h +3 -2
index d25f5aa..ae548c9 100644
@@ -26,10 +26,12 @@
 
        mips_barebox_10h
 
-       mips_disable_interrupts
+       hornet_mips24k_cp0_setup
 
        pbl_blt 0xbf000000 skip_pll_ram_config t8
 
+       hornet_1_1_war
+
        pbl_ar9331_pll
        pbl_ar9331_ddr1_config
 
--
Quoted 2 lines

2.7.0

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

Reviewed-by on v1 4/4
#8 lore raw

Re: [PATCH 4/4] MIPS: black-swift: pbl: use more lowlevel init code from U-Boot_mod

In reply to Antony Pavlov
Quoted 1 line · Antony Pavlov
Quoted 23 lines
---
 arch/mips/boards/black-swift/include/board/board_pbl_start.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/mips/boards/black-swift/include/board/board_pbl_start.h +3 -2
index 7394092..3f2caa0 100644
@@ -26,10 +26,12 @@
 
        mips_barebox_10h
 
-       mips_disable_interrupts
+       hornet_mips24k_cp0_setup
 
        pbl_blt 0xbf000000 skip_pll_ram_config t8
 
+       hornet_1_1_war
+
        pbl_ar9331_pll
        pbl_ar9331_ddr2_config
 
--
Quoted 2 lines

2.7.0

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

Applied
#9 lore raw
In reply to Antony Pavlov
Quoted 11 lines · Antony Pavlov

U-Boot_mod is a popular bootloader for Atheros AR93xx chips, please see https://github.com/pepe2k/u-boot_mod for details.

It's reasonable to import some lowlevel AR9331 initialization code from U-Boot_mod.

Antony Pavlov (4):
MIPS: ath79: pbl: import AR9331 CP0 init routine from U-Boot_mod
MIPS: ath79: pbl: import hornet_1_1_war routine from U-Boot_mod
MIPS: tplink-mr3020: pbl: use more lowlevel init code from U-Boot_mod
MIPS: black-swift: pbl: use more lowlevel init code from U-Boot_mod

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