* [PATCH 2/5] MIPS: black-swift: use ar9331_pbl_generic_start
2019-01-19 16:36 [PATCH 1/5] MIPS: tplink-mr3020: use ar9331_pbl_generic_start Oleksij Rempel
@ 2019-01-19 16:36 ` Oleksij Rempel
2019-01-19 16:36 ` [PATCH 3/5] MIPS: add ENTRY_FUNCTION_SRAM_END define Oleksij Rempel
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Oleksij Rempel @ 2019-01-19 16:36 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel
From: Oleksij Rempel <linux@rempel-privat.de>
most ar9331 boards are almost identical. Remove as match duplicate code
as possible.
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
---
arch/mips/boards/black-swift/lowlevel.S | 29 +------------------------
1 file changed, 1 insertion(+), 28 deletions(-)
diff --git a/arch/mips/boards/black-swift/lowlevel.S b/arch/mips/boards/black-swift/lowlevel.S
index 104dd26d1c..0ba77435f8 100644
--- a/arch/mips/boards/black-swift/lowlevel.S
+++ b/arch/mips/boards/black-swift/lowlevel.S
@@ -14,33 +14,6 @@
ENTRY_FUNCTION(BOARD_PBL_START)
- mips_barebox_10h
-
- pbl_ar9331_wmac_enable
-
- hornet_mips24k_cp0_setup
-
- pbl_blt 0xbf000000 skip_pll_ram_config t8
-
- hornet_1_1_war
-
- pbl_ar9331_pll
- pbl_ar9331_ddr2_config
-
- /* Initialize caches... */
- mips_cache_reset
-
- /* ... and enable them */
- dcache_enable
-
-skip_pll_ram_config:
- pbl_ar9331_uart_enable
- debug_ll_ath79_init
-
- /*
- * It is amazing but we have to enable MDIO on GPIO
- * to use GPIO27 for LED1.
- */
- pbl_ar9331_mdio_gpio_enable
+ ar9331_pbl_generic_start
ENTRY_FUNCTION_END(BOARD_PBL_START, black_swift)
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/5] MIPS: add ENTRY_FUNCTION_SRAM_END define
2019-01-19 16:36 [PATCH 1/5] MIPS: tplink-mr3020: use ar9331_pbl_generic_start Oleksij Rempel
2019-01-19 16:36 ` [PATCH 2/5] MIPS: black-swift: " Oleksij Rempel
@ 2019-01-19 16:36 ` Oleksij Rempel
2019-01-19 16:36 ` [PATCH 4/5] MIPS: ath79: add spi trap Oleksij Rempel
2019-01-19 16:36 ` [PATCH 5/5] MIPS: ath79: add SRAM support Oleksij Rempel
3 siblings, 0 replies; 5+ messages in thread
From: Oleksij Rempel @ 2019-01-19 16:36 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel
From: Oleksij Rempel <linux@rempel-privat.de>
currently, the only difference is the end if entry function.
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
---
arch/mips/include/asm/asm.h | 15 +++++++++++++++
arch/mips/lib/Makefile | 1 +
arch/mips/lib/end.S | 16 ++++++++++++++++
3 files changed, 32 insertions(+)
create mode 100644 arch/mips/lib/end.S
diff --git a/arch/mips/include/asm/asm.h b/arch/mips/include/asm/asm.h
index 7a23f4ed82..4260ea4503 100644
--- a/arch/mips/include/asm/asm.h
+++ b/arch/mips/include/asm/asm.h
@@ -105,6 +105,21 @@ __error: \
b __error; \
nop;
+/*
+ * ENTRY_FUNCTION_SRAM_END - mark end of sram entry function
+ */
+#define ENTRY_FUNCTION_SRAM_END \
+ /* trigger a soft breakpoint for OpenOCD */ \
+ SDBBP; \
+ /* position independent variant of dead loop */ \
+ __error: \
+ b __error; \
+ nop; \
+ /* call some code from .text section */ \
+ la v0, mips_dead_end; \
+ jal v0; \
+ nop;
+
/*
* FEXPORT - export definition of a function symbol
*/
diff --git a/arch/mips/lib/Makefile b/arch/mips/lib/Makefile
index 1a049c7914..7372e8dc27 100644
--- a/arch/mips/lib/Makefile
+++ b/arch/mips/lib/Makefile
@@ -1,6 +1,7 @@
extra-$(CONFIG_GENERIC_LINKER_SCRIPT) += barebox.lds
obj-$(CONFIG_CSRC_R4K_LIB) += csrc-r4k.o
obj-y += cpu-probe.o
+lwl-y += end.o
obj-y += traps.o
obj-y += genex.o
obj-y += shutdown.o
diff --git a/arch/mips/lib/end.S b/arch/mips/lib/end.S
new file mode 100644
index 0000000000..78bd15ec17
--- /dev/null
+++ b/arch/mips/lib/end.S
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (C) 2018 Oleksij Rempel <linux@rempel-privat.de>
+ */
+
+#include <asm/asm.h>
+#include <asm/regdef.h>
+
+ .text
+ .set noreorder
+LEAF(mips_dead_end)
+__error:
+ b __error;
+ nop;
+
+ END(mips_dead_end)
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 4/5] MIPS: ath79: add spi trap
2019-01-19 16:36 [PATCH 1/5] MIPS: tplink-mr3020: use ar9331_pbl_generic_start Oleksij Rempel
2019-01-19 16:36 ` [PATCH 2/5] MIPS: black-swift: " Oleksij Rempel
2019-01-19 16:36 ` [PATCH 3/5] MIPS: add ENTRY_FUNCTION_SRAM_END define Oleksij Rempel
@ 2019-01-19 16:36 ` Oleksij Rempel
2019-01-19 16:36 ` [PATCH 5/5] MIPS: ath79: add SRAM support Oleksij Rempel
3 siblings, 0 replies; 5+ messages in thread
From: Oleksij Rempel @ 2019-01-19 16:36 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel
From: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
---
arch/mips/mach-ath79/Makefile | 2 ++
.../mips/mach-ath79/lowlevel_ar9331_spi_trap.S | 18 ++++++++++++++++++
images/Makefile.ath79 | 4 ++++
3 files changed, 24 insertions(+)
create mode 100644 arch/mips/mach-ath79/lowlevel_ar9331_spi_trap.S
diff --git a/arch/mips/mach-ath79/Makefile b/arch/mips/mach-ath79/Makefile
index b827b363cf..c12444ff47 100644
--- a/arch/mips/mach-ath79/Makefile
+++ b/arch/mips/mach-ath79/Makefile
@@ -1,3 +1,5 @@
+lwl-y += lowlevel_ar9331_spi_trap.o
+
obj-y += reset.o
obj-y += bbu.o
obj-y += art.o
diff --git a/arch/mips/mach-ath79/lowlevel_ar9331_spi_trap.S b/arch/mips/mach-ath79/lowlevel_ar9331_spi_trap.S
new file mode 100644
index 0000000000..eb51f7366b
--- /dev/null
+++ b/arch/mips/mach-ath79/lowlevel_ar9331_spi_trap.S
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (C) 2018 Oleksij Rempel <linux@rempel-privat.de>
+ */
+
+#define BOARD_PBL_START start_ar9331_spi_trap
+
+#include <mach/debug_ll.h>
+#include <asm/asm.h>
+#include <asm/pbl_macros.h>
+#include <mach/pbl_macros.h>
+#include <asm/pbl_nmon.h>
+
+ENTRY_FUNCTION(BOARD_PBL_START)
+
+ /* nothing should be done here */
+
+ENTRY_FUNCTION_SRAM_END
diff --git a/images/Makefile.ath79 b/images/Makefile.ath79
index c7e97f0ac3..181f951595 100644
--- a/images/Makefile.ath79
+++ b/images/Makefile.ath79
@@ -1,3 +1,7 @@
+pblb-$(CONFIG_SOC_QCA_AR9331) += start_ar9331_spi_trap
+FILE_barebox-ar9331-spi-trap.img = start_ar9331_spi_trap.pblb
+image-$(CONFIG_SOC_QCA_AR9331) += barebox-ar9331-spi-trap.img
+
pblb-$(CONFIG_BOARD_8DEVICES_LIMA) += start_8devices_lima
FILE_barebox-8devices-lima.img = start_8devices_lima.pblb
image-$(CONFIG_BOARD_8DEVICES_LIMA) += barebox-8devices-lima.img
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 5/5] MIPS: ath79: add SRAM support
2019-01-19 16:36 [PATCH 1/5] MIPS: tplink-mr3020: use ar9331_pbl_generic_start Oleksij Rempel
` (2 preceding siblings ...)
2019-01-19 16:36 ` [PATCH 4/5] MIPS: ath79: add spi trap Oleksij Rempel
@ 2019-01-19 16:36 ` Oleksij Rempel
3 siblings, 0 replies; 5+ messages in thread
From: Oleksij Rempel @ 2019-01-19 16:36 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel
From: Oleksij Rempel <linux@rempel-privat.de>
At least some ath79 SoC have build in 32K RAM. It allow us to use
lowlevel portion of barebox for OpenOCD and reduce code duplication
between this projects. The workflow should be as follow:
- Load reduced barebox to SRAM by using OpenOCD and execute it.
This part will do all needed low level initialization - PLL, RAM.
- Load complete barebox to the main RAM (DDR or what ever technology is
used).
It can be used for recovery and for bring-up, so no flashing is needed.
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
---
arch/mips/mach-ath79/Makefile | 1 +
.../mips/mach-ath79/include/mach/pbl_macros.h | 21 +++++++++++++++++++
arch/mips/mach-ath79/lowlevel_ar9331_sram.S | 18 ++++++++++++++++
images/Makefile.ath79 | 4 ++++
4 files changed, 44 insertions(+)
create mode 100644 arch/mips/mach-ath79/lowlevel_ar9331_sram.S
diff --git a/arch/mips/mach-ath79/Makefile b/arch/mips/mach-ath79/Makefile
index c12444ff47..396df66bf1 100644
--- a/arch/mips/mach-ath79/Makefile
+++ b/arch/mips/mach-ath79/Makefile
@@ -1,4 +1,5 @@
lwl-y += lowlevel_ar9331_spi_trap.o
+lwl-y += lowlevel_ar9331_sram.o
obj-y += reset.o
obj-y += bbu.o
diff --git a/arch/mips/mach-ath79/include/mach/pbl_macros.h b/arch/mips/mach-ath79/include/mach/pbl_macros.h
index 70736b3680..c5f3d4150e 100644
--- a/arch/mips/mach-ath79/include/mach/pbl_macros.h
+++ b/arch/mips/mach-ath79/include/mach/pbl_macros.h
@@ -400,4 +400,25 @@ skip_pll_ram_config:
.set pop
.endm
+ .macro ar9331_pbl_generic_sram_start
+ .set push
+ .set noreorder
+
+ mips_barebox_10h
+
+ hornet_mips24k_cp0_setup
+
+ hornet_1_1_war
+
+ pbl_ar9331_pll
+ pbl_ar9331_ram_generic_config
+
+ pbl_ar9331_uart_enable
+ debug_ll_ath79_init
+
+ pbl_ar9331_mdio_gpio_enable
+
+ .set pop
+ .endm
+
#endif /* __ASM_MACH_ATH79_PBL_MACROS_H */
diff --git a/arch/mips/mach-ath79/lowlevel_ar9331_sram.S b/arch/mips/mach-ath79/lowlevel_ar9331_sram.S
new file mode 100644
index 0000000000..7c25d8765c
--- /dev/null
+++ b/arch/mips/mach-ath79/lowlevel_ar9331_sram.S
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (C) 2018 Oleksij Rempel <linux@rempel-privat.de>
+ */
+
+#define BOARD_PBL_START start_ar9331_sram
+
+#include <mach/debug_ll.h>
+#include <asm/asm.h>
+#include <asm/pbl_macros.h>
+#include <mach/pbl_macros.h>
+#include <asm/pbl_nmon.h>
+
+ENTRY_FUNCTION(BOARD_PBL_START)
+
+ ar9331_pbl_generic_sram_start
+
+ENTRY_FUNCTION_SRAM_END
diff --git a/images/Makefile.ath79 b/images/Makefile.ath79
index 181f951595..5dda411d8f 100644
--- a/images/Makefile.ath79
+++ b/images/Makefile.ath79
@@ -2,6 +2,10 @@ pblb-$(CONFIG_SOC_QCA_AR9331) += start_ar9331_spi_trap
FILE_barebox-ar9331-spi-trap.img = start_ar9331_spi_trap.pblb
image-$(CONFIG_SOC_QCA_AR9331) += barebox-ar9331-spi-trap.img
+pblb-$(CONFIG_SOC_QCA_AR9331) += start_ar9331_sram
+FILE_barebox-ar9331-sram.img = start_ar9331_sram.pblb
+image-$(CONFIG_SOC_QCA_AR9331) += barebox-ar9331-sram.img
+
pblb-$(CONFIG_BOARD_8DEVICES_LIMA) += start_8devices_lima
FILE_barebox-8devices-lima.img = start_8devices_lima.pblb
image-$(CONFIG_BOARD_8DEVICES_LIMA) += barebox-8devices-lima.img
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread