mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v3 1/3] MIPS: reloc: remove init of relocated bss
@ 2019-10-21 11:50 Oleksij Rempel
  2019-10-21 11:50 ` [PATCH v3 2/3] MIPS: move r4k_cache_init in to cpu_probe function Oleksij Rempel
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Oleksij Rempel @ 2019-10-21 11:50 UTC (permalink / raw)
  To: barebox; +Cc: Oleksij Rempel

It will be done in main_entry() any way.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 arch/mips/lib/reloc.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/arch/mips/lib/reloc.c b/arch/mips/lib/reloc.c
index 9a9e404f7e..798a68680d 100644
--- a/arch/mips/lib/reloc.c
+++ b/arch/mips/lib/reloc.c
@@ -110,7 +110,7 @@ void relocate_code(void *fdt, u32 fdt_size, u32 ram_size)
 {
 	unsigned long addr, length, bss_len;
 	u32 relocaddr, new_stack;
-	uint8_t *buf, *bss_start;
+	uint8_t *buf;
 	unsigned int type;
 	long off;
 
@@ -149,10 +149,6 @@ void relocate_code(void *fdt, u32 fdt_size, u32 ram_size)
 	/* Ensure the icache is coherent */
 	flush_cache_all();
 
-	/* Clear the .bss section */
-	bss_start = (uint8_t *)((unsigned long)__bss_start + off);
-	memset(bss_start, 0, bss_len);
-
 	 __asm__ __volatile__ (
 			"move	$a0, %0\n"
 		"	move	$a1, %1\n"
-- 
2.23.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v3 2/3] MIPS: move r4k_cache_init in to cpu_probe function
  2019-10-21 11:50 [PATCH v3 1/3] MIPS: reloc: remove init of relocated bss Oleksij Rempel
@ 2019-10-21 11:50 ` Oleksij Rempel
  2019-10-21 11:50 ` [PATCH v3 3/3] MIPS: reloc: init bss and cpu Oleksij Rempel
  2019-10-23  7:06 ` [PATCH v3 1/3] MIPS: reloc: remove init of relocated bss Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Oleksij Rempel @ 2019-10-21 11:50 UTC (permalink / raw)
  To: barebox; +Cc: Oleksij Rempel

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 arch/mips/boot/main_entry.c   | 6 ------
 arch/mips/include/asm/cache.h | 1 +
 arch/mips/lib/cpu-probe.c     | 5 +++++
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/mips/boot/main_entry.c b/arch/mips/boot/main_entry.c
index 4ae4457e7e..2c18bc81c3 100644
--- a/arch/mips/boot/main_entry.c
+++ b/arch/mips/boot/main_entry.c
@@ -77,12 +77,6 @@ void __bare_init main_entry(void *fdt, u32 fdt_size)
 
 	cpu_probe();
 
-	if (cpu_has_4k_cache) {
-		extern void r4k_cache_init(void);
-
-		r4k_cache_init();
-	}
-
 	trap_init();
 
 	malloc_end = (unsigned long)_stext;
diff --git a/arch/mips/include/asm/cache.h b/arch/mips/include/asm/cache.h
index cceba0acc0..4bb39b1cd4 100644
--- a/arch/mips/include/asm/cache.h
+++ b/arch/mips/include/asm/cache.h
@@ -2,5 +2,6 @@
 #define _ASM_MIPS_CACHE_H
 
 void flush_cache_all(void);
+void r4k_cache_init(void);
 
 #endif /* _ASM_MIPS_CACHE_H */
diff --git a/arch/mips/lib/cpu-probe.c b/arch/mips/lib/cpu-probe.c
index 2556a8b240..ddabddd466 100644
--- a/arch/mips/lib/cpu-probe.c
+++ b/arch/mips/lib/cpu-probe.c
@@ -9,6 +9,8 @@
  */
 #include <common.h>
 #include <asm/mipsregs.h>
+#include <asm/cache.h>
+#include <asm/cpu-features.h>
 #include <asm/cpu-info.h>
 #include <asm/cpu.h>
 #include <memory.h>
@@ -163,6 +165,9 @@ void cpu_probe(void)
 		cpu_probe_ingenic(c);
 		break;
 	}
+
+	if (cpu_has_4k_cache)
+		r4k_cache_init();
 }
 
 unsigned long mips_stack_top;
-- 
2.23.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v3 3/3] MIPS: reloc: init bss and cpu
  2019-10-21 11:50 [PATCH v3 1/3] MIPS: reloc: remove init of relocated bss Oleksij Rempel
  2019-10-21 11:50 ` [PATCH v3 2/3] MIPS: move r4k_cache_init in to cpu_probe function Oleksij Rempel
@ 2019-10-21 11:50 ` Oleksij Rempel
  2019-10-23  7:06 ` [PATCH v3 1/3] MIPS: reloc: remove init of relocated bss Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Oleksij Rempel @ 2019-10-21 11:50 UTC (permalink / raw)
  To: barebox; +Cc: Oleksij Rempel

We need it to make flush_cache_all() work properly.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 arch/mips/lib/reloc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/mips/lib/reloc.c b/arch/mips/lib/reloc.c
index 798a68680d..df9760e38c 100644
--- a/arch/mips/lib/reloc.c
+++ b/arch/mips/lib/reloc.c
@@ -115,6 +115,8 @@ void relocate_code(void *fdt, u32 fdt_size, u32 ram_size)
 	long off;
 
 	bss_len = (unsigned long)&__bss_stop - (unsigned long)__bss_start;
+	memset(__bss_start, 0, bss_len);
+	cpu_probe();
 
 	length = barebox_image_size + bss_len;
 	relocaddr = ALIGN_DOWN(ram_size - length, SZ_64K);
-- 
2.23.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 1/3] MIPS: reloc: remove init of relocated bss
  2019-10-21 11:50 [PATCH v3 1/3] MIPS: reloc: remove init of relocated bss Oleksij Rempel
  2019-10-21 11:50 ` [PATCH v3 2/3] MIPS: move r4k_cache_init in to cpu_probe function Oleksij Rempel
  2019-10-21 11:50 ` [PATCH v3 3/3] MIPS: reloc: init bss and cpu Oleksij Rempel
@ 2019-10-23  7:06 ` Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2019-10-23  7:06 UTC (permalink / raw)
  To: Oleksij Rempel; +Cc: barebox

On Mon, Oct 21, 2019 at 01:50:19PM +0200, Oleksij Rempel wrote:
> It will be done in main_entry() any way.
> 
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
>  arch/mips/lib/reloc.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)

Applied, thanks

Sascha

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-23  7:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-21 11:50 [PATCH v3 1/3] MIPS: reloc: remove init of relocated bss Oleksij Rempel
2019-10-21 11:50 ` [PATCH v3 2/3] MIPS: move r4k_cache_init in to cpu_probe function Oleksij Rempel
2019-10-21 11:50 ` [PATCH v3 3/3] MIPS: reloc: init bss and cpu Oleksij Rempel
2019-10-23  7:06 ` [PATCH v3 1/3] MIPS: reloc: remove init of relocated bss Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox