* [U-Boot] [PATCH 02/14] microblaze: Show return address from exception
2015-01-27 15:20 [U-Boot] [PATCH 01/14] microblaze: Fix stack usage in interrupt handler Michal Simek
@ 2015-01-27 15:20 ` Michal Simek
2015-01-27 15:20 ` [U-Boot] [PATCH 03/14] microblaze: Fix coding style in exception.c Michal Simek
` (11 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Michal Simek @ 2015-01-27 15:20 UTC (permalink / raw)
To: u-boot
Show also return address from exception which should
suggest where the problem is.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
arch/microblaze/cpu/exception.c | 2 ++
arch/microblaze/include/asm/asm.h | 4 ++++
2 files changed, 6 insertions(+)
diff --git a/arch/microblaze/cpu/exception.c b/arch/microblaze/cpu/exception.c
index 227842f6a483..45729331f3d3 100644
--- a/arch/microblaze/cpu/exception.c
+++ b/arch/microblaze/cpu/exception.c
@@ -18,6 +18,8 @@ void _hw_exception_handler (void)
/* loading excetpion state register ESR */
MFS (state, resr);
printf ("Hardware exception at 0x%x address\n", address);
+ R17(address);
+ printf("Return address from exception 0x%x\n", address);
switch (state & 0x1f) { /* mask on exception cause */
case 0x1:
puts ("Unaligned data access exception\n");
diff --git a/arch/microblaze/include/asm/asm.h b/arch/microblaze/include/asm/asm.h
index c1c3b0398579..11f3dd0f0ec0 100644
--- a/arch/microblaze/include/asm/asm.h
+++ b/arch/microblaze/include/asm/asm.h
@@ -43,6 +43,10 @@
#define R14(val) \
__asm__ __volatile__ ("addi %0, r14, 0":"=r" (val));
+/* get return address from interrupt */
+#define R17(val) \
+ __asm__ __volatile__ ("addi %0, r17, 0" : "=r" (val));
+
#define NOP __asm__ __volatile__ ("nop");
/* use machine status registe USE_MSR_REG */
--
1.8.2.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150127/8e8d6552/attachment.pgp>
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH 03/14] microblaze: Fix coding style in exception.c
2015-01-27 15:20 [U-Boot] [PATCH 01/14] microblaze: Fix stack usage in interrupt handler Michal Simek
2015-01-27 15:20 ` [U-Boot] [PATCH 02/14] microblaze: Show return address from exception Michal Simek
@ 2015-01-27 15:20 ` Michal Simek
2015-01-27 15:20 ` [U-Boot] [PATCH 04/14] microblaze: Remove DEBUG_INT macro and use debug() instead Michal Simek
` (10 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Michal Simek @ 2015-01-27 15:20 UTC (permalink / raw)
To: u-boot
Just coding style cleanup - no functional changes.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
arch/microblaze/cpu/exception.c | 33 +++++++++++++++++----------------
1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/arch/microblaze/cpu/exception.c b/arch/microblaze/cpu/exception.c
index 45729331f3d3..aa34f45befe1 100644
--- a/arch/microblaze/cpu/exception.c
+++ b/arch/microblaze/cpu/exception.c
@@ -13,51 +13,52 @@ void _hw_exception_handler (void)
{
int address = 0;
int state = 0;
+
/* loading address of exception EAR */
- MFS (address, rear);
+ MFS(address, rear);
/* loading excetpion state register ESR */
- MFS (state, resr);
- printf ("Hardware exception at 0x%x address\n", address);
+ MFS(state, resr);
+ printf("Hardware exception at 0x%x address\n", address);
R17(address);
printf("Return address from exception 0x%x\n", address);
switch (state & 0x1f) { /* mask on exception cause */
case 0x1:
- puts ("Unaligned data access exception\n");
+ puts("Unaligned data access exception\n");
break;
case 0x2:
- puts ("Illegal op-code exception\n");
+ puts("Illegal op-code exception\n");
break;
case 0x3:
- puts ("Instruction bus error exception\n");
+ puts("Instruction bus error exception\n");
break;
case 0x4:
- puts ("Data bus error exception\n");
+ puts("Data bus error exception\n");
break;
case 0x5:
- puts ("Divide by zero exception\n");
+ puts("Divide by zero exception\n");
break;
#ifdef MICROBLAZE_V5
case 0x7:
puts("Priviledged or stack protection violation exception\n");
break;
case 0x1000:
- puts ("Exception in delay slot\n");
+ puts("Exception in delay slot\n");
break;
#endif
default:
- puts ("Undefined cause\n");
+ puts("Undefined cause\n");
break;
}
- printf ("Unaligned %sword access\n", ((state & 0x800) ? "" : "half"));
- printf ("Unaligned %s access\n", ((state & 0x400) ? "store" : "load"));
- printf ("Register R%x\n", (state & 0x3E) >> 5);
- hang ();
+ printf("Unaligned %sword access\n", ((state & 0x800) ? "" : "half"));
+ printf("Unaligned %s access\n", ((state & 0x400) ? "store" : "load"));
+ printf("Register R%x\n", (state & 0x3E) >> 5);
+ hang();
}
#ifdef CONFIG_SYS_USR_EXCEP
void _exception_handler (void)
{
- puts ("User vector_exception\n");
- hang ();
+ puts("User vector_exception\n");
+ hang();
}
#endif
--
1.8.2.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150127/d0014a71/attachment.pgp>
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH 04/14] microblaze: Remove DEBUG_INT macro and use debug() instead
2015-01-27 15:20 [U-Boot] [PATCH 01/14] microblaze: Fix stack usage in interrupt handler Michal Simek
2015-01-27 15:20 ` [U-Boot] [PATCH 02/14] microblaze: Show return address from exception Michal Simek
2015-01-27 15:20 ` [U-Boot] [PATCH 03/14] microblaze: Fix coding style in exception.c Michal Simek
@ 2015-01-27 15:20 ` Michal Simek
2015-01-27 15:20 ` [U-Boot] [PATCH 05/14] microblaze: Fix coding style Michal Simek
` (9 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Michal Simek @ 2015-01-27 15:20 UTC (permalink / raw)
To: u-boot
Do not use specific macros for debugging.
Also remove compilation warning:
w+../arch/microblaze/cpu/interrupts.c: In function 'interrupt_handler':
w+../arch/microblaze/cpu/interrupts.c:153:2: warning: format '%x'
expects argument of type 'unsigned int', but argument 2 has type 'void
(*)(void *)' [-Wformat]
w+../arch/microblaze/cpu/interrupts.c:153:2: warning: format '%x'
expects argument of type 'unsigned int', but argument 4 has type 'void
*' [-Wformat]
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
arch/microblaze/cpu/interrupts.c | 57 ++++++++++++++++++----------------------
1 file changed, 25 insertions(+), 32 deletions(-)
diff --git a/arch/microblaze/cpu/interrupts.c b/arch/microblaze/cpu/interrupts.c
index 9364e2fa9c9b..030e9147dc40 100644
--- a/arch/microblaze/cpu/interrupts.c
+++ b/arch/microblaze/cpu/interrupts.c
@@ -14,8 +14,6 @@
#include <asm/microblaze_intc.h>
#include <asm/asm.h>
-#undef DEBUG_INT
-
void enable_interrupts(void)
{
MSRSET(0x2);
@@ -50,12 +48,11 @@ static void enable_one_interrupt(int irq)
offset <<= irq;
mask = intc->ier;
intc->ier = (mask | offset);
-#ifdef DEBUG_INT
- printf("Enable one interrupt irq %x - mask %x,ier %x\n", offset, mask,
- intc->ier);
- printf("INTC isr %x, ier %x, iar %x, mer %x\n", intc->isr, intc->ier,
- intc->iar, intc->mer);
-#endif
+
+ debug("Enable one interrupt irq %x - mask %x,ier %x\n", offset, mask,
+ intc->ier);
+ debug("INTC isr %x, ier %x, iar %x, mer %x\n", intc->isr, intc->ier,
+ intc->iar, intc->mer);
}
static void disable_one_interrupt(int irq)
@@ -66,12 +63,11 @@ static void disable_one_interrupt(int irq)
offset <<= irq;
mask = intc->ier;
intc->ier = (mask & ~offset);
-#ifdef DEBUG_INT
- printf("Disable one interrupt irq %x - mask %x,ier %x\n", irq, mask,
- intc->ier);
- printf("INTC isr %x, ier %x, iar %x, mer %x\n", intc->isr, intc->ier,
- intc->iar, intc->mer);
-#endif
+
+ debug("Disable one interrupt irq %x - mask %x,ier %x\n", irq, mask,
+ intc->ier);
+ debug("INTC isr %x, ier %x, iar %x, mer %x\n", intc->isr, intc->ier,
+ intc->iar, intc->mer);
}
int install_interrupt_handler(int irq, interrupt_handler_t *hdlr, void *arg)
@@ -107,10 +103,9 @@ static void intc_init(void)
intc->iar = 0xFFFFFFFF;
/* XIntc_Start - hw_interrupt enable and all interrupt enable */
intc->mer = 0x3;
-#ifdef DEBUG_INT
- printf("INTC isr %x, ier %x, iar %x, mer %x\n", intc->isr, intc->ier,
- intc->iar, intc->mer);
-#endif
+
+ debug("INTC isr %x, ier %x, iar %x, mer %x\n", intc->isr, intc->ier,
+ intc->iar, intc->mer);
}
int interrupts_init(void)
@@ -147,31 +142,29 @@ void interrupt_handler(void)
{
int irqs = intc->ivr; /* find active interrupt */
int mask = 1;
-#ifdef DEBUG_INT
int value;
- printf ("INTC isr %x, ier %x, iar %x, mer %x\n", intc->isr, intc->ier,
- intc->iar, intc->mer);
- R14(value);
- printf ("Interrupt handler on %x line, r14 %x\n", irqs, value);
-#endif
struct irq_action *act = vecs + irqs;
-#ifdef DEBUG_INT
- printf
- ("Jumping to interrupt handler rutine addr %x,count %x,arg %x\n",
- act->handler, act->count, act->arg);
+ debug("INTC isr %x, ier %x, iar %x, mer %x\n", intc->isr, intc->ier,
+ intc->iar, intc->mer);
+#ifdef DEBUG
+ R14(value);
#endif
+ debug("Interrupt handler on %x line, r14 %x\n", irqs, value);
+
+ debug("Jumping to interrupt handler rutine addr %x,count %x,arg %x\n",
+ (u32)act->handler, act->count, (u32)act->arg);
act->handler (act->arg);
act->count++;
intc->iar = mask << irqs;
-#ifdef DEBUG_INT
- printf ("Dump INTC reg, isr %x, ier %x, iar %x, mer %x\n", intc->isr,
- intc->ier, intc->iar, intc->mer);
+ debug("Dump INTC reg, isr %x, ier %x, iar %x, mer %x\n", intc->isr,
+ intc->ier, intc->iar, intc->mer);
+#ifdef DEBUG
R14(value);
- printf ("Interrupt handler on %x line, r14 %x\n", irqs, value);
#endif
+ debug("Interrupt handler on %x line, r14 %x\n", irqs, value);
}
#if defined(CONFIG_CMD_IRQ)
--
1.8.2.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150127/bd5c9a7a/attachment.pgp>
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH 05/14] microblaze: Fix coding style
2015-01-27 15:20 [U-Boot] [PATCH 01/14] microblaze: Fix stack usage in interrupt handler Michal Simek
` (2 preceding siblings ...)
2015-01-27 15:20 ` [U-Boot] [PATCH 04/14] microblaze: Remove DEBUG_INT macro and use debug() instead Michal Simek
@ 2015-01-27 15:20 ` Michal Simek
2015-01-27 15:20 ` [U-Boot] [PATCH 06/14] microblaze: Add debug message about enabling interrupts Michal Simek
` (8 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Michal Simek @ 2015-01-27 15:20 UTC (permalink / raw)
To: u-boot
No functional changes just to pass checkpatch.pl.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
arch/microblaze/cpu/interrupts.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/arch/microblaze/cpu/interrupts.c b/arch/microblaze/cpu/interrupts.c
index 030e9147dc40..771bbd0ca628 100644
--- a/arch/microblaze/cpu/interrupts.c
+++ b/arch/microblaze/cpu/interrupts.c
@@ -84,12 +84,12 @@ int install_interrupt_handler(int irq, interrupt_handler_t *hdlr, void *arg)
act->handler = hdlr;
act->arg = arg;
act->count = 0;
- enable_one_interrupt (irq);
+ enable_one_interrupt(irq);
return 0;
}
/* Disable */
- act->handler = (interrupt_handler_t *) def_hdlr;
+ act->handler = (interrupt_handler_t *)def_hdlr;
act->arg = (void *)irq;
disable_one_interrupt(irq);
return 1;
@@ -113,7 +113,7 @@ int interrupts_init(void)
int i;
#if defined(CONFIG_SYS_INTC_0_ADDR) && defined(CONFIG_SYS_INTC_0_NUM)
- intc = (microblaze_intc_t *) (CONFIG_SYS_INTC_0_ADDR);
+ intc = (microblaze_intc_t *)CONFIG_SYS_INTC_0_ADDR;
irq_no = CONFIG_SYS_INTC_0_NUM;
#endif
if (irq_no) {
@@ -125,7 +125,7 @@ int interrupts_init(void)
/* initialize irq list */
for (i = 0; i < irq_no; i++) {
- vecs[i].handler = (interrupt_handler_t *) def_hdlr;
+ vecs[i].handler = (interrupt_handler_t *)def_hdlr;
vecs[i].arg = (void *)i;
vecs[i].count = 0;
}
@@ -154,7 +154,7 @@ void interrupt_handler(void)
debug("Jumping to interrupt handler rutine addr %x,count %x,arg %x\n",
(u32)act->handler, act->count, (u32)act->arg);
- act->handler (act->arg);
+ act->handler(act->arg);
act->count++;
intc->iar = mask << irqs;
@@ -179,10 +179,10 @@ int do_irqinfo(cmd_tbl_t *cmdtp, int flag, int argc, const char *argv[])
"-----------------------------\n");
for (i = 0; i < irq_no; i++) {
- if (act->handler != (interrupt_handler_t *) def_hdlr) {
+ if (act->handler != (interrupt_handler_t *)def_hdlr) {
printf("%02d %08x %08x %d\n", i,
- (int)act->handler, (int)act->arg,
- act->count);
+ (int)act->handler, (int)act->arg,
+ act->count);
}
act++;
}
--
1.8.2.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150127/bea43aa2/attachment.pgp>
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH 06/14] microblaze: Add debug message about enabling interrupts
2015-01-27 15:20 [U-Boot] [PATCH 01/14] microblaze: Fix stack usage in interrupt handler Michal Simek
` (3 preceding siblings ...)
2015-01-27 15:20 ` [U-Boot] [PATCH 05/14] microblaze: Fix coding style Michal Simek
@ 2015-01-27 15:20 ` Michal Simek
2015-01-27 15:20 ` [U-Boot] [PATCH 07/14] microblaze: Remove unneeded data section adding from DTB Michal Simek
` (7 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Michal Simek @ 2015-01-27 15:20 UTC (permalink / raw)
To: u-boot
Add one more debug message about enabling global interrupts.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
arch/microblaze/cpu/interrupts.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/microblaze/cpu/interrupts.c b/arch/microblaze/cpu/interrupts.c
index 771bbd0ca628..f66ec69ee25e 100644
--- a/arch/microblaze/cpu/interrupts.c
+++ b/arch/microblaze/cpu/interrupts.c
@@ -16,6 +16,7 @@
void enable_interrupts(void)
{
+ debug("Enable interrupts for the whole CPU\n");
MSRSET(0x2);
}
--
1.8.2.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150127/8a44387e/attachment.pgp>
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH 07/14] microblaze: Remove unneeded data section adding from DTB
2015-01-27 15:20 [U-Boot] [PATCH 01/14] microblaze: Fix stack usage in interrupt handler Michal Simek
` (4 preceding siblings ...)
2015-01-27 15:20 ` [U-Boot] [PATCH 06/14] microblaze: Add debug message about enabling interrupts Michal Simek
@ 2015-01-27 15:20 ` Michal Simek
2015-01-27 15:20 ` [U-Boot] [PATCH 08/14] microblaze: Use standard interrupt_init() function Michal Simek
` (6 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Michal Simek @ 2015-01-27 15:20 UTC (permalink / raw)
To: u-boot
DTB is added to rodata section:
[ 2] .rodata PROGBITS 84c5b60c 05c60c 00c618 00 A
0 0 4
[ 3] .dtb.init.rodata PROGBITS 84c67c30 068c30 003c80 00 A
0 0 16
[ 4] .rela.dyn RELA 84c6b8b0 06c8b0 000534 0c A
0 0 4
[ 5] .data PROGBITS 84c6bde4 06cde4 001536 00 WA
0 0 16
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
arch/microblaze/cpu/u-boot.lds | 3 ---
1 file changed, 3 deletions(-)
diff --git a/arch/microblaze/cpu/u-boot.lds b/arch/microblaze/cpu/u-boot.lds
index fdad20753d32..44bc036172f0 100644
--- a/arch/microblaze/cpu/u-boot.lds
+++ b/arch/microblaze/cpu/u-boot.lds
@@ -29,9 +29,6 @@ SECTIONS
.data ALIGN(0x4):
{
__data_start = .;
-#ifdef CONFIG_OF_EMBED
- dts/built-in.o (.data)
-#endif
*(.data)
__data_end = .;
}
--
1.8.2.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150127/d8c4e8c6/attachment.pgp>
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH 08/14] microblaze: Use standard interrupt_init() function
2015-01-27 15:20 [U-Boot] [PATCH 01/14] microblaze: Fix stack usage in interrupt handler Michal Simek
` (5 preceding siblings ...)
2015-01-27 15:20 ` [U-Boot] [PATCH 07/14] microblaze: Remove unneeded data section adding from DTB Michal Simek
@ 2015-01-27 15:20 ` Michal Simek
2015-01-27 15:20 ` [U-Boot] [PATCH 09/14] microblaze: Remove unused asm label Michal Simek
` (5 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Michal Simek @ 2015-01-27 15:20 UTC (permalink / raw)
To: u-boot
Do not use microblaze specific interrupt init function.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
arch/microblaze/cpu/interrupts.c | 2 +-
arch/microblaze/include/asm/microblaze_intc.h | 2 --
arch/microblaze/lib/board.c | 2 +-
3 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/arch/microblaze/cpu/interrupts.c b/arch/microblaze/cpu/interrupts.c
index f66ec69ee25e..b6d6610f2fd7 100644
--- a/arch/microblaze/cpu/interrupts.c
+++ b/arch/microblaze/cpu/interrupts.c
@@ -109,7 +109,7 @@ static void intc_init(void)
intc->iar, intc->mer);
}
-int interrupts_init(void)
+int interrupt_init(void)
{
int i;
diff --git a/arch/microblaze/include/asm/microblaze_intc.h b/arch/microblaze/include/asm/microblaze_intc.h
index 0fb9207882fe..65868386b0d8 100644
--- a/arch/microblaze/include/asm/microblaze_intc.h
+++ b/arch/microblaze/include/asm/microblaze_intc.h
@@ -34,5 +34,3 @@ struct irq_action {
*/
int install_interrupt_handler(int irq, interrupt_handler_t *hdlr,
void *arg);
-
-int interrupts_init(void);
diff --git a/arch/microblaze/lib/board.c b/arch/microblaze/lib/board.c
index 600c80ab7666..bd028a63c078 100644
--- a/arch/microblaze/lib/board.c
+++ b/arch/microblaze/lib/board.c
@@ -55,7 +55,7 @@ init_fnc_t *init_sequence[] = {
#endif
display_banner,
#ifndef CONFIG_SPL_BUILD
- interrupts_init,
+ interrupt_init,
timer_init,
#endif
NULL,
--
1.8.2.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150127/5760fc07/attachment.pgp>
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH 09/14] microblaze: Remove unused asm label
2015-01-27 15:20 [U-Boot] [PATCH 01/14] microblaze: Fix stack usage in interrupt handler Michal Simek
` (6 preceding siblings ...)
2015-01-27 15:20 ` [U-Boot] [PATCH 08/14] microblaze: Use standard interrupt_init() function Michal Simek
@ 2015-01-27 15:20 ` Michal Simek
2015-01-27 15:20 ` [U-Boot] [PATCH 10/14] microblaze: Fix gd_t address which is placed at the end of BRAM Michal Simek
` (4 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Michal Simek @ 2015-01-27 15:20 UTC (permalink / raw)
To: u-boot
It is not used at all that's why remove it.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
arch/microblaze/cpu/start.S | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/microblaze/cpu/start.S b/arch/microblaze/cpu/start.S
index 84c29e54091e..e0e3470a181a 100644
--- a/arch/microblaze/cpu/start.S
+++ b/arch/microblaze/cpu/start.S
@@ -129,7 +129,7 @@ _start:
/* Flush cache before enable cache */
addik r5, r0, 0
addik r6, r0, XILINX_DCACHE_BYTE_SIZE
-flush: bralid r15, flush_cache
+ bralid r15, flush_cache
nop
/* enable instruction and data cache */
--
1.8.2.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150127/44e6cb65/attachment.pgp>
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH 10/14] microblaze: Fix gd_t address which is placed at the end of BRAM
2015-01-27 15:20 [U-Boot] [PATCH 01/14] microblaze: Fix stack usage in interrupt handler Michal Simek
` (7 preceding siblings ...)
2015-01-27 15:20 ` [U-Boot] [PATCH 09/14] microblaze: Remove unused asm label Michal Simek
@ 2015-01-27 15:20 ` Michal Simek
2015-01-27 15:20 ` [U-Boot] [PATCH 11/14] microblaze: Enable SPL_NOR support when FLASH_BASE is setup Michal Simek
` (3 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Michal Simek @ 2015-01-27 15:20 UTC (permalink / raw)
To: u-boot
Setup gd from ASM to be availalbe for board_init_r.
Setting it up in spl_board_init is too late when
MALLOC is used.
Space for gd is located behind MALLOC area at the end of BRAM.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
arch/microblaze/cpu/spl.c | 2 --
arch/microblaze/cpu/start.S | 1 +
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/microblaze/cpu/spl.c b/arch/microblaze/cpu/spl.c
index 091226133e4f..2cc0a2da89e1 100644
--- a/arch/microblaze/cpu/spl.c
+++ b/arch/microblaze/cpu/spl.c
@@ -25,8 +25,6 @@ u32 spl_boot_device(void)
/* Board initialization after bss clearance */
void spl_board_init(void)
{
- gd = (gd_t *)CONFIG_SPL_STACK_ADDR;
-
/* enable console uart printing */
preloader_console_init();
}
diff --git a/arch/microblaze/cpu/start.S b/arch/microblaze/cpu/start.S
index e0e3470a181a..14c2f12da06b 100644
--- a/arch/microblaze/cpu/start.S
+++ b/arch/microblaze/cpu/start.S
@@ -152,6 +152,7 @@ clear_bss:
#ifndef CONFIG_SPL_BUILD
brai board_init_f
#else
+ addi r31, r0, CONFIG_SYS_SPL_MALLOC_END
brai board_init_r
#endif
1: bri 1b
--
1.8.2.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150127/78f3cb44/attachment.pgp>
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH 11/14] microblaze: Enable SPL_NOR support when FLASH_BASE is setup
2015-01-27 15:20 [U-Boot] [PATCH 01/14] microblaze: Fix stack usage in interrupt handler Michal Simek
` (8 preceding siblings ...)
2015-01-27 15:20 ` [U-Boot] [PATCH 10/14] microblaze: Fix gd_t address which is placed at the end of BRAM Michal Simek
@ 2015-01-27 15:20 ` Michal Simek
2015-01-27 15:20 ` [U-Boot] [PATCH 12/14] microblaze: Move architecture to use generic board init Michal Simek
` (2 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Michal Simek @ 2015-01-27 15:20 UTC (permalink / raw)
To: u-boot
Simplify SPL NOR init.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
include/configs/microblaze-generic.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/include/configs/microblaze-generic.h b/include/configs/microblaze-generic.h
index bb070600021b..2e1e64247fe0 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -452,7 +452,10 @@
#define CONFIG_SPL_LDSCRIPT "arch/microblaze/cpu/u-boot-spl.lds"
#define CONFIG_SPL_RAM_DEVICE
-#define CONFIG_SPL_NOR_SUPPORT
+#ifdef CONFIG_SYS_FLASH_BASE
+# define CONFIG_SPL_NOR_SUPPORT
+# define CONFIG_SYS_UBOOT_BASE CONFIG_SYS_FLASH_BASE
+#endif
/* for booting directly linux */
#define CONFIG_SPL_OS_BOOT
@@ -491,7 +494,6 @@
/* Just for sure that there is a space for stack */
#define CONFIG_SPL_STACK_SIZE 0x100
-#define CONFIG_SYS_UBOOT_BASE CONFIG_SYS_FLASH_BASE
#define CONFIG_SYS_UBOOT_START CONFIG_SYS_TEXT_BASE
#define CONFIG_SPL_MAX_FOOTPRINT (CONFIG_SYS_INIT_RAM_SIZE - \
--
1.8.2.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150127/1b69b4a0/attachment.pgp>
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH 12/14] microblaze: Move architecture to use generic board init
2015-01-27 15:20 [U-Boot] [PATCH 01/14] microblaze: Fix stack usage in interrupt handler Michal Simek
` (9 preceding siblings ...)
2015-01-27 15:20 ` [U-Boot] [PATCH 11/14] microblaze: Enable SPL_NOR support when FLASH_BASE is setup Michal Simek
@ 2015-01-27 15:20 ` Michal Simek
2015-01-29 2:15 ` Simon Glass
2015-01-27 15:20 ` [U-Boot] [PATCH 13/14] microblaze: Speedup code copy Michal Simek
2015-01-27 15:20 ` [U-Boot] [PATCH 14/14] bdinfo: Show information about fdt blob via bdinfo Michal Simek
12 siblings, 1 reply; 19+ messages in thread
From: Michal Simek @ 2015-01-27 15:20 UTC (permalink / raw)
To: u-boot
Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
This code requires
"common/board_r: manual relocation for cmd table"
http://lists.denx.de/pipermail/u-boot/2015-January/201965.html
Not fully happy about it because compare to previous solution adds
almost +60k on size for doing the same thing as before.
15: microblaze: Move architecture to use generic board init
microblaze: (for 1/1 boards) all +52268.0 bss -4.0 data +11724.0
rodata -2676.0 spl/u-boot-spl:all +36.0 spl/u-boot-spl:data +36.0
text +43224.0
microblaze-generic: all +52268 bss -4 data +11724 rodata
-2676 spl/u-boot-spl:all +36 spl/u-boot-spl:data +36 text +43224
---
arch/microblaze/config.mk | 5 +
arch/microblaze/cpu/start.S | 103 +++++++++++
arch/microblaze/cpu/u-boot.lds | 9 +
arch/microblaze/include/asm/config.h | 8 +
arch/microblaze/include/asm/u-boot.h | 11 +-
arch/microblaze/lib/Makefile | 1 -
arch/microblaze/lib/board.c | 201 ---------------------
.../xilinx/microblaze-generic/microblaze-generic.c | 46 +++++
common/board_f.c | 6 +-
common/board_r.c | 2 +-
common/cmd_bdinfo.c | 13 +-
include/configs/microblaze-generic.h | 64 +------
12 files changed, 196 insertions(+), 273 deletions(-)
delete mode 100644 arch/microblaze/lib/board.c
diff --git a/arch/microblaze/config.mk b/arch/microblaze/config.mk
index 98bbf794fa7d..2b817be61a5d 100644
--- a/arch/microblaze/config.mk
+++ b/arch/microblaze/config.mk
@@ -15,3 +15,8 @@ endif
CONFIG_STANDALONE_LOAD_ADDR ?= 0x80F00000
PLATFORM_CPPFLAGS += -ffixed-r31 -D__microblaze__
+
+ifeq ($(CONFIG_SPL_BUILD),)
+PLATFORM_CPPFLAGS += -fPIC
+endif
+__HAVE_ARCH_GENERIC_BOARD := y
diff --git a/arch/microblaze/cpu/start.S b/arch/microblaze/cpu/start.S
index 14c2f12da06b..3de0e12090ea 100644
--- a/arch/microblaze/cpu/start.S
+++ b/arch/microblaze/cpu/start.S
@@ -150,6 +150,7 @@ clear_bss:
bnei r6, 2b
3: /* jumping to board_init */
#ifndef CONFIG_SPL_BUILD
+ or r5, r0, r0 /* flags - empty */
brai board_init_f
#else
addi r31, r0, CONFIG_SYS_SPL_MALLOC_END
@@ -190,4 +191,106 @@ out16: bslli r3, r6, 8
rtsd r15, 8
or r0, r0, r0
.end out16
+
+/*
+ * Relocate u-boot
+ */
+ .text
+ .global relocate_code
+ .ent relocate_code
+ .align 2
+relocate_code:
+ /*
+ * r5 - start_addr_sp
+ * r6 - new_gd
+ * r7 - reloc_addr
+ */
+ addi r1, r5, 0 /* Start to use new SP */
+ addi r31, r6, 0 /* Start to use new GD */
+
+ add r23, r0, r7 /* Move reloc addr to r23 */
+ /* Relocate text and data - r12 temp value */
+ addi r21, r0, _start
+ addi r22, r0, __end - 4 /* Include BSS too */
+1: lwi r12, r21, 0 /* Load u-boot data */
+ swi r12, r23, 0 /* Write zero to loc */
+ addi r21, r21, 4 /* Increment to next loc - origin code */
+ cmp r12, r21, r22 /* Check if we have reach the end */
+ bneid r12, 1b
+ addi r23, r23, 4 /* Increment to next loc - relocate code */
+
+ /* R23 points to the base address. */
+ add r23, r0, r7 /* Move reloc addr to r23 */
+ addi r24, r0, CONFIG_SYS_TEXT_BASE /* Get reloc offset */
+ rsub r23, r24, r23 /* keep - this is already here gd->reloc_off */
+
+ addik r6, r0, 0x2 /* BIG/LITTLE endian offset */
+ lwi r7, r0, 0x28
+ swi r6, r0, 0x28 /* used first unused MB vector */
+ lbui r10, r0, 0x28 /* used first unused MB vector */
+ swi r7, r0, 0x28
+
+#ifdef CONFIG_SYS_USR_EXCEP
+ addik r6, r0, _exception_handler
+ addk r6, r6, r23 /* add offset */
+ sw r6, r1, r0
+ lhu r7, r1, r10
+ rsubi r8, r10, 0xa
+ sh r7, r0, r8
+ rsubi r8, r10, 0xe
+ sh r6, r0, r8
+#endif
+ addik r6, r0, _hw_exception_handler
+ addk r6, r6, r23 /* add offset */
+ sw r6, r1, r0
+ lhu r7, r1, r10
+ rsubi r8, r10, 0x22
+ sh r7, r0, r8
+ rsubi r8, r10, 0x26
+ sh r6, r0, r8
+
+ addik r6, r0, _interrupt_handler
+ addk r6, r6, r23 /* add offset */
+ sw r6, r1, r0
+ lhu r7, r1, r10
+ rsubi r8, r10, 0x12
+ sh r7, r0, r8
+ rsubi r8, r10, 0x16
+ sh r6, r0, r8
+
+ /* Check if GOT exist */
+ addik r21, r23, _got_start
+ addik r22, r23, _got_end
+ cmpu r12, r21, r22
+ beqi r12, 2f /* No GOT table - jump over */
+
+ /* Skip last 3 entries plus 1 because of loop boundary below */
+ addik r22, r22, -0x10
+
+ /* Relocate the GOT. */
+3: lw r12, r21, r0 /* Load entry */
+ addk r12, r12, r23 /* Add reloc offset */
+ sw r12, r21, r0 /* Save entry back */
+
+ cmpu r12, r21, r22 /* Check if this cross boundary */
+ bneid r12, 3b
+ addik r21. r21, 4
+
+ /* Update pointer to GOT */
+ mfs r20, rpc
+ addik r20, r20, _GLOBAL_OFFSET_TABLE_ + 8
+ addk r20, r20, r23
+
+ /* Flush caches to ensure consistency */
+ addik r5, r0, 0
+ addik r6, r0, XILINX_DCACHE_BYTE_SIZE
+ bralid r15, flush_cache
+ nop
+
+2: addi r5, r31, 0 /* gd is initialized in board_r.c */
+ addi r6, r0, CONFIG_SYS_TEXT_BASE
+ addi r12, r23, board_init_r
+ bra r12 /* Jump to relocated code */
+
+ .end relocate_code
#endif
diff --git a/arch/microblaze/cpu/u-boot.lds b/arch/microblaze/cpu/u-boot.lds
index 44bc036172f0..2502a0db2b14 100644
--- a/arch/microblaze/cpu/u-boot.lds
+++ b/arch/microblaze/cpu/u-boot.lds
@@ -33,10 +33,19 @@ SECTIONS
__data_end = .;
}
+ .got ALIGN(4):
+ {
+ _got_start = .;
+ *(.got*)
+ . = ALIGN(4);
+ _got_end = .;
+ }
+
. = ALIGN(4);
.u_boot_list : {
KEEP(*(SORT(.u_boot_list*)));
}
+ __init_end = . ;
.bss ALIGN(0x4):
{
diff --git a/arch/microblaze/include/asm/config.h b/arch/microblaze/include/asm/config.h
index cd2973478944..468673460bfb 100644
--- a/arch/microblaze/include/asm/config.h
+++ b/arch/microblaze/include/asm/config.h
@@ -7,4 +7,12 @@
#ifndef _ASM_CONFIG_H_
#define _ASM_CONFIG_H_
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_NEEDS_MANUAL_RELOC
+#endif
+
+#define CONFIG_NR_DRAM_BANKS 1
+#define CONFIG_SYS_GENERIC_BOARD
+#define CONFIG_SYS_GENERIC_GLOBAL_DATA
+
#endif
diff --git a/arch/microblaze/include/asm/u-boot.h b/arch/microblaze/include/asm/u-boot.h
index 54d415ebb5bd..66f8f952c9d0 100644
--- a/arch/microblaze/include/asm/u-boot.h
+++ b/arch/microblaze/include/asm/u-boot.h
@@ -16,16 +16,7 @@
#ifndef _U_BOOT_H_
#define _U_BOOT_H_
-typedef struct bd_info {
- unsigned long bi_memstart; /* start of DRAM memory */
- phys_size_t bi_memsize; /* size of DRAM memory in bytes */
- unsigned long bi_flashstart; /* start of FLASH memory */
- unsigned long bi_flashsize; /* size of FLASH memory */
- unsigned long bi_flashoffset; /* reserved area for startup monitor */
- unsigned long bi_sramstart; /* start of SRAM memory */
- unsigned long bi_sramsize; /* size of SRAM memory */
- ulong bi_boot_params; /* where this board expects params */
-} bd_t;
+#include <asm-generic/u-boot.h>
/* For image.h:image_check_target_arch() */
#define IH_ARCH_DEFAULT IH_ARCH_MICROBLAZE
diff --git a/arch/microblaze/lib/Makefile b/arch/microblaze/lib/Makefile
index 339dd153a0fd..0289d0cd609a 100644
--- a/arch/microblaze/lib/Makefile
+++ b/arch/microblaze/lib/Makefile
@@ -5,6 +5,5 @@
# SPDX-License-Identifier: GPL-2.0+
#
-obj-y += board.o
obj-$(CONFIG_CMD_BOOTM) += bootm.o
obj-y += muldi3.o
diff --git a/arch/microblaze/lib/board.c b/arch/microblaze/lib/board.c
deleted file mode 100644
index bd028a63c078..000000000000
--- a/arch/microblaze/lib/board.c
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * (C) Copyright 2007 Michal Simek
- * (C) Copyright 2004 Atmark Techno, Inc.
- *
- * Michal SIMEK <monstr@monstr.eu>
- * Yasushi SHOJI <yashi@atmark-techno.com>
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-#include <common.h>
-#include <command.h>
-#include <malloc.h>
-#include <version.h>
-#include <watchdog.h>
-#include <stdio_dev.h>
-#include <serial.h>
-#include <net.h>
-#include <spi.h>
-#include <linux/compiler.h>
-#include <asm/processor.h>
-#include <asm/microblaze_intc.h>
-#include <fdtdec.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-static int display_banner(void)
-{
- printf("\n\n%s\n\n", version_string);
- return 0;
-}
-
-/*
- * All attempts to come up with a "common" initialization sequence
- * that works for all boards and architectures failed: some of the
- * requirements are just _too_ different. To get rid of the resulting
- * mess of board dependend #ifdef'ed code we now make the whole
- * initialization sequence configurable to the user.
- *
- * The requirements for any new initalization function is simple: it
- * receives a pointer to the "global data" structure as it's only
- * argument, and returns an integer return code, where 0 means
- * "continue" and != 0 means "fatal error, hang the system".
- */
-typedef int (init_fnc_t) (void);
-
-init_fnc_t *init_sequence[] = {
- env_init,
-#ifdef CONFIG_OF_CONTROL
- fdtdec_check_fdt,
-#endif
- serial_init,
-#ifndef CONFIG_SPL_BUILD
- console_init_f,
-#endif
- display_banner,
-#ifndef CONFIG_SPL_BUILD
- interrupt_init,
- timer_init,
-#endif
- NULL,
-};
-
-unsigned long monitor_flash_len;
-
-void board_init_f(ulong not_used)
-{
- bd_t *bd;
- init_fnc_t **init_fnc_ptr;
- gd = (gd_t *)(CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_GBL_DATA_OFFSET);
- bd = (bd_t *)(CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_GBL_DATA_OFFSET
- - GENERATED_BD_INFO_SIZE);
-#if defined(CONFIG_CMD_FLASH) && !defined(CONFIG_SPL_BUILD)
- ulong flash_size = 0;
-#endif
- asm ("nop"); /* FIXME gd is not initialize - wait */
- memset((void *)gd, 0, GENERATED_GBL_DATA_SIZE);
- memset((void *)bd, 0, GENERATED_BD_INFO_SIZE);
- gd->bd = bd;
- gd->baudrate = CONFIG_BAUDRATE;
- bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
- bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
- gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */
-
- monitor_flash_len = __end - __text_start;
-
-#ifdef CONFIG_OF_EMBED
- /* Get a pointer to the FDT */
- gd->fdt_blob = __dtb_dt_begin;
-#elif defined CONFIG_OF_SEPARATE
- /* FDT is at end of image */
- gd->fdt_blob = (void *)__end;
-#endif
-
-#ifndef CONFIG_SPL_BUILD
- /* Allow the early environment to override the fdt address */
- gd->fdt_blob = (void *)getenv_ulong("fdtcontroladdr", 16,
- (uintptr_t)gd->fdt_blob);
-#endif
-
- /*
- * The Malloc area is immediately below the monitor copy in DRAM
- * aka CONFIG_SYS_MONITOR_BASE - Note there is no need for reloc_off
- * as our monitory code is run from SDRAM
- */
- mem_malloc_init(CONFIG_SYS_MALLOC_BASE, CONFIG_SYS_MALLOC_LEN);
-
- serial_initialize();
-
-#ifdef CONFIG_XILINX_TB_WATCHDOG
- hw_watchdog_init();
-#endif
- for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
- WATCHDOG_RESET();
- if ((*init_fnc_ptr) () != 0)
- hang();
- }
-
-#ifndef CONFIG_SPL_BUILD
-#ifdef CONFIG_OF_CONTROL
- /* For now, put this check after the console is ready */
- if (fdtdec_prepare_fdt())
- panic("** No FDT - please see doc/README.fdt-control");
- else
- printf("DTB: 0x%x\n", (u32)gd->fdt_blob);
-#endif
-
- puts("SDRAM :\n");
- printf("\t\tIcache:%s\n", icache_status() ? "ON" : "OFF");
- printf("\t\tDcache:%s\n", dcache_status() ? "ON" : "OFF");
- printf("\tU-Boot Start:0x%08x\n", CONFIG_SYS_TEXT_BASE);
-
-#if defined(CONFIG_CMD_FLASH)
- puts("Flash: ");
- bd->bi_flashstart = CONFIG_SYS_FLASH_BASE;
- flash_size = flash_init();
- if (bd->bi_flashstart && flash_size > 0) {
-# ifdef CONFIG_SYS_FLASH_CHECKSUM
- print_size(flash_size, "");
- /*
- * Compute and print flash CRC if flashchecksum is set to 'y'
- *
- * NOTE: Maybe we should add some WATCHDOG_RESET()? XXX
- */
- if (getenv_yesno("flashchecksum") == 1) {
- printf(" CRC: %08X",
- crc32(0, (const u8 *)bd->bi_flashstart,
- flash_size)
- );
- }
- putc('\n');
-# else /* !CONFIG_SYS_FLASH_CHECKSUM */
- print_size(flash_size, "\n");
-# endif /* CONFIG_SYS_FLASH_CHECKSUM */
- bd->bi_flashsize = flash_size;
- bd->bi_flashoffset = bd->bi_flashstart + flash_size;
- } else {
- puts("Flash init FAILED");
- bd->bi_flashstart = 0;
- bd->bi_flashsize = 0;
- bd->bi_flashoffset = 0;
- }
-#endif
-
-#ifdef CONFIG_SPI
- spi_init();
-#endif
-
- /* relocate environment function pointers etc. */
- env_relocate();
-
- /* Initialize stdio devices */
- stdio_init();
-
- /* Initialize the jump table for applications */
- jumptable_init();
-
- /* Initialize the console (after the relocation and devices init) */
- console_init_r();
-
- board_init();
-
- /* Initialize from environment */
- load_addr = getenv_ulong("loadaddr", 16, load_addr);
-
-#if defined(CONFIG_CMD_NET)
- printf("Net: ");
- eth_initialize(gd->bd);
-
- uchar enetaddr[6];
- eth_getenv_enetaddr("ethaddr", enetaddr);
- printf("MAC: %pM\n", enetaddr);
-#endif
-
- /* main_loop */
- for (;;) {
- WATCHDOG_RESET();
- main_loop();
- }
-#endif /* CONFIG_SPL_BUILD */
-}
diff --git a/board/xilinx/microblaze-generic/microblaze-generic.c b/board/xilinx/microblaze-generic/microblaze-generic.c
index 42a8d0c400e5..062e678eccb7 100644
--- a/board/xilinx/microblaze-generic/microblaze-generic.c
+++ b/board/xilinx/microblaze-generic/microblaze-generic.c
@@ -11,16 +11,62 @@
#include <common.h>
#include <config.h>
+#include <fdtdec.h>
#include <netdev.h>
#include <asm/processor.h>
#include <asm/microblaze_intc.h>
#include <asm/asm.h>
#include <asm/gpio.h>
+DECLARE_GLOBAL_DATA_PTR;
+
#ifdef CONFIG_XILINX_GPIO
static int reset_pin = -1;
#endif
+#ifdef CONFIG_OF_CONTROL
+ulong ram_base;
+
+ulong board_get_usable_ram_top(ulong total_size)
+{
+ return ram_base + gd->ram_size;
+}
+
+void dram_init_banksize(void)
+{
+ gd->bd->bi_dram[0].start = ram_base;
+ gd->bd->bi_dram[0].size = get_effective_memsize();
+}
+
+phys_size_t initdram(int board_type)
+{
+ int node;
+ fdt_addr_t addr;
+ fdt_size_t size;
+ const void *blob = gd->fdt_blob;
+
+ node = fdt_node_offset_by_prop_value(blob, -1, "device_type",
+ "memory", 7);
+ if (node == -FDT_ERR_NOTFOUND) {
+ debug("DRAM: Can't get memory node\n");
+ return 0;
+ }
+ addr = fdtdec_get_addr_size(blob, node, "reg", &size);
+ if (addr == FDT_ADDR_T_NONE || size == 0) {
+ debug("DRAM: Can't get base address or size\n");
+ return 0;
+ }
+ ram_base = addr;
+
+ return size;
+};
+#else
+phys_size_t initdram(int board_type)
+{
+ return CONFIG_SYS_SDRAM_SIZE;
+}
+#endif
+
int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
#ifdef CONFIG_XILINX_GPIO
diff --git a/common/board_f.c b/common/board_f.c
index 3a4b32c29dc1..64b40aebb508 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -174,7 +174,7 @@ static int announce_dram_init(void)
return 0;
}
-#if defined(CONFIG_MIPS) || defined(CONFIG_PPC)
+#if defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_MICROBLAZE)
static int init_func_ram(void)
{
#ifdef CONFIG_BOARD_TYPES
@@ -262,7 +262,7 @@ static int zero_global_data(void)
static int setup_mon_len(void)
{
-#ifdef __ARM__
+#if defined(__ARM__) || defined(__MICROBLAZE__)
gd->mon_len = (ulong)&__bss_end - (ulong)_start;
#elif defined(CONFIG_SANDBOX)
gd->mon_len = (ulong)&_end - (ulong)_init;
@@ -906,7 +906,7 @@ static init_fnc_t init_sequence_f[] = {
#if defined(CONFIG_ARM) || defined(CONFIG_X86)
dram_init, /* configure available RAM banks */
#endif
-#if defined(CONFIG_MIPS) || defined(CONFIG_PPC)
+#if defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_MICROBLAZE)
init_func_ram,
#endif
#ifdef CONFIG_POST
diff --git a/common/board_r.c b/common/board_r.c
index e712902cff45..3e77720f2acb 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -829,7 +829,7 @@ init_fnc_t init_sequence_r[] = {
#if defined(CONFIG_ARM)
initr_enable_interrupts,
#endif
-#ifdef CONFIG_X86
+#if defined(CONFIG_X86) || defined(CONFIG_MICROBLAZE)
timer_init, /* initialize timer */
#endif
#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
index e6d8a7ae2c50..4c51059c1ba4 100644
--- a/common/cmd_bdinfo.c
+++ b/common/cmd_bdinfo.c
@@ -183,8 +183,14 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
bd_t *bd = gd->bd;
- print_num("mem start ", (ulong)bd->bi_memstart);
- print_lnum("mem size ", (u64)bd->bi_memsize);
+ int i;
+
+ for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
+ print_num("DRAM bank", i);
+ print_num("-> start", bd->bi_dram[i].start);
+ print_num("-> size", bd->bi_dram[i].size);
+ }
+
print_num("flash start ", (ulong)bd->bi_flashstart);
print_num("flash size ", (ulong)bd->bi_flashsize);
print_num("flash offset ", (ulong)bd->bi_flashoffset);
@@ -196,6 +202,9 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
print_eths();
#endif
printf("baudrate = %u bps\n", gd->baudrate);
+ print_num("relocaddr", gd->relocaddr);
+ print_num("reloc off", gd->reloc_off);
+
return 0;
}
diff --git a/include/configs/microblaze-generic.h b/include/configs/microblaze-generic.h
index 2e1e64247fe0..622bc951045b 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -106,62 +106,16 @@
# define CONFIG_XILINX_TB_WATCHDOG
#endif
-/*
- * memory layout - Example
- * CONFIG_SYS_TEXT_BASE = 0x1200_0000; defined in config.mk
- * CONFIG_SYS_SRAM_BASE = 0x1000_0000;
- * CONFIG_SYS_SRAM_SIZE = 0x0400_0000; 64MB
- *
- * CONFIG_SYS_MONITOR_LEN = 0x40000
- * CONFIG_SYS_MALLOC_LEN = 3 * CONFIG_SYS_MONITOR_LEN = 0xC0000
- *
- * CONFIG_SYS_GBL_DATA_OFFSET = 0x1000_0000 + 0x0400_0000 - 0x1000 = 0x13FF_F000
- * CONFIG_SYS_MONITOR_BASE = 0x13FF_F000 - CONFIG_SYS_MONITOR_LEN = 0x13FB_F000
- * CONFIG_SYS_MALLOC_BASE = 0x13FB_F000 - CONFIG_SYS_MALLOC_LEN = 0x13EF_F000
- *
- * 0x1000_0000 CONFIG_SYS_SDRAM_BASE
- * MEMTEST_AREA 64kB
- * FREE
- * 0x1200_0000 CONFIG_SYS_TEXT_BASE
- * U-BOOT code
- * 0x1202_0000
- * FREE
- *
- * STACK
- * 0x13EF_F000 CONFIG_SYS_MALLOC_BASE
- * MALLOC_AREA 768kB Alloc
- * 0x13FB_F000 CONFIG_SYS_MONITOR_BASE
- * MONITOR_CODE 256kB Env
- * 0x13FF_F000 CONFIG_SYS_GBL_DATA_OFFSET
- * GLOBAL_DATA 4kB bd, gd
- * 0x1400_0000 CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_SDRAM_SIZE
- */
-
+#ifndef CONFIG_OF_CONTROL
/* ddr sdram - main memory */
-#define CONFIG_SYS_SDRAM_BASE XILINX_RAM_START
-#define CONFIG_SYS_SDRAM_SIZE XILINX_RAM_SIZE
-#define CONFIG_SYS_MEMTEST_START CONFIG_SYS_SDRAM_BASE
-#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_SDRAM_BASE + 0x1000)
-
-/* global pointer */
-/* start of global data */
-#define CONFIG_SYS_GBL_DATA_OFFSET \
- (CONFIG_SYS_SDRAM_SIZE - GENERATED_GBL_DATA_SIZE)
-
-/* monitor code */
-#define SIZE 0x40000
-#define CONFIG_SYS_MONITOR_LEN SIZE
-#define CONFIG_SYS_MONITOR_BASE \
- (CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_GBL_DATA_OFFSET \
- - CONFIG_SYS_MONITOR_LEN - GENERATED_BD_INFO_SIZE)
-#define CONFIG_SYS_MONITOR_END \
- (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN)
-#define CONFIG_SYS_MALLOC_LEN (SIZE * 3)
-#define CONFIG_SYS_MALLOC_BASE \
- (CONFIG_SYS_MONITOR_BASE - CONFIG_SYS_MALLOC_LEN)
-
-/* stack */
-#define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_MALLOC_BASE
+# define CONFIG_SYS_SDRAM_BASE XILINX_RAM_START
+# define CONFIG_SYS_SDRAM_SIZE XILINX_RAM_SIZE
+#endif
+
+#define CONFIG_SYS_MALLOC_LEN 0xC0000
+
+/* Stack location before relocation */
+#define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_TEXT_BASE
/*
* CFI flash memory layout - Example
--
1.8.2.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150127/5e4b286f/attachment.pgp>
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH 12/14] microblaze: Move architecture to use generic board init
2015-01-27 15:20 ` [U-Boot] [PATCH 12/14] microblaze: Move architecture to use generic board init Michal Simek
@ 2015-01-29 2:15 ` Simon Glass
2015-01-29 14:20 ` Michal Simek
0 siblings, 1 reply; 19+ messages in thread
From: Simon Glass @ 2015-01-29 2:15 UTC (permalink / raw)
To: u-boot
Hi Michal,
On 27 January 2015 at 08:20, Michal Simek <michal.simek@xilinx.com> wrote:
> Compile code with -fPIC to get GOT. Do not build SPL
> with fPIC because it increasing SPL size for nothing.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
> This code requires
> "common/board_r: manual relocation for cmd table"
> http://lists.denx.de/pipermail/u-boot/2015-January/201965.html
>
> Not fully happy about it because compare to previous solution adds
> almost +60k on size for doing the same thing as before.
>
> 15: microblaze: Move architecture to use generic board init
> microblaze: (for 1/1 boards) all +52268.0 bss -4.0 data +11724.0
> rodata -2676.0 spl/u-boot-spl:all +36.0 spl/u-boot-spl:data +36.0
> text +43224.0
> microblaze-generic: all +52268 bss -4 data +11724 rodata
> -2676 spl/u-boot-spl:all +36 spl/u-boot-spl:data +36 text +43224
> ---
> arch/microblaze/config.mk | 5 +
> arch/microblaze/cpu/start.S | 103 +++++++++++
> arch/microblaze/cpu/u-boot.lds | 9 +
> arch/microblaze/include/asm/config.h | 8 +
> arch/microblaze/include/asm/u-boot.h | 11 +-
> arch/microblaze/lib/Makefile | 1 -
> arch/microblaze/lib/board.c | 201 ---------------------
> .../xilinx/microblaze-generic/microblaze-generic.c | 46 +++++
> common/board_f.c | 6 +-
> common/board_r.c | 2 +-
> common/cmd_bdinfo.c | 13 +-
> include/configs/microblaze-generic.h | 64 +------
> 12 files changed, 196 insertions(+), 273 deletions(-)
> delete mode 100644 arch/microblaze/lib/board.c
>
> diff --git a/arch/microblaze/config.mk b/arch/microblaze/config.mk
> index 98bbf794fa7d..2b817be61a5d 100644
> --- a/arch/microblaze/config.mk
> +++ b/arch/microblaze/config.mk
> @@ -15,3 +15,8 @@ endif
> CONFIG_STANDALONE_LOAD_ADDR ?= 0x80F00000
>
> PLATFORM_CPPFLAGS += -ffixed-r31 -D__microblaze__
> +
> +ifeq ($(CONFIG_SPL_BUILD),)
> +PLATFORM_CPPFLAGS += -fPIC
> +endif
> +__HAVE_ARCH_GENERIC_BOARD := y
> diff --git a/arch/microblaze/cpu/start.S b/arch/microblaze/cpu/start.S
> index 14c2f12da06b..3de0e12090ea 100644
> --- a/arch/microblaze/cpu/start.S
> +++ b/arch/microblaze/cpu/start.S
> @@ -150,6 +150,7 @@ clear_bss:
> bnei r6, 2b
> 3: /* jumping to board_init */
> #ifndef CONFIG_SPL_BUILD
> + or r5, r0, r0 /* flags - empty */
> brai board_init_f
> #else
> addi r31, r0, CONFIG_SYS_SPL_MALLOC_END
> @@ -190,4 +191,106 @@ out16: bslli r3, r6, 8
> rtsd r15, 8
> or r0, r0, r0
> .end out16
> +
> +/*
> + * Relocate u-boot
> + */
> + .text
> + .global relocate_code
> + .ent relocate_code
> + .align 2
> +relocate_code:
> + /*
> + * r5 - start_addr_sp
> + * r6 - new_gd
> + * r7 - reloc_addr
> + */
> + addi r1, r5, 0 /* Start to use new SP */
> + addi r31, r6, 0 /* Start to use new GD */
> +
> + add r23, r0, r7 /* Move reloc addr to r23 */
> + /* Relocate text and data - r12 temp value */
> + addi r21, r0, _start
> + addi r22, r0, __end - 4 /* Include BSS too */
> +1: lwi r12, r21, 0 /* Load u-boot data */
> + swi r12, r23, 0 /* Write zero to loc */
> + addi r21, r21, 4 /* Increment to next loc - origin code */
> + cmp r12, r21, r22 /* Check if we have reach the end */
> + bneid r12, 1b
> + addi r23, r23, 4 /* Increment to next loc - relocate code */
> +
> + /* R23 points to the base address. */
> + add r23, r0, r7 /* Move reloc addr to r23 */
> + addi r24, r0, CONFIG_SYS_TEXT_BASE /* Get reloc offset */
> + rsub r23, r24, r23 /* keep - this is already here gd->reloc_off */
> +
> + addik r6, r0, 0x2 /* BIG/LITTLE endian offset */
> + lwi r7, r0, 0x28
> + swi r6, r0, 0x28 /* used first unused MB vector */
> + lbui r10, r0, 0x28 /* used first unused MB vector */
> + swi r7, r0, 0x28
> +
> +#ifdef CONFIG_SYS_USR_EXCEP
> + addik r6, r0, _exception_handler
> + addk r6, r6, r23 /* add offset */
> + sw r6, r1, r0
> + lhu r7, r1, r10
> + rsubi r8, r10, 0xa
> + sh r7, r0, r8
> + rsubi r8, r10, 0xe
> + sh r6, r0, r8
> +#endif
> + addik r6, r0, _hw_exception_handler
> + addk r6, r6, r23 /* add offset */
> + sw r6, r1, r0
> + lhu r7, r1, r10
> + rsubi r8, r10, 0x22
> + sh r7, r0, r8
> + rsubi r8, r10, 0x26
> + sh r6, r0, r8
> +
> + addik r6, r0, _interrupt_handler
> + addk r6, r6, r23 /* add offset */
> + sw r6, r1, r0
> + lhu r7, r1, r10
> + rsubi r8, r10, 0x12
> + sh r7, r0, r8
> + rsubi r8, r10, 0x16
> + sh r6, r0, r8
> +
> + /* Check if GOT exist */
> + addik r21, r23, _got_start
> + addik r22, r23, _got_end
> + cmpu r12, r21, r22
> + beqi r12, 2f /* No GOT table - jump over */
> +
> + /* Skip last 3 entries plus 1 because of loop boundary below */
> + addik r22, r22, -0x10
> +
> + /* Relocate the GOT. */
> +3: lw r12, r21, r0 /* Load entry */
> + addk r12, r12, r23 /* Add reloc offset */
> + sw r12, r21, r0 /* Save entry back */
> +
> + cmpu r12, r21, r22 /* Check if this cross boundary */
> + bneid r12, 3b
> + addik r21. r21, 4
> +
> + /* Update pointer to GOT */
> + mfs r20, rpc
> + addik r20, r20, _GLOBAL_OFFSET_TABLE_ + 8
> + addk r20, r20, r23
> +
> + /* Flush caches to ensure consistency */
> + addik r5, r0, 0
> + addik r6, r0, XILINX_DCACHE_BYTE_SIZE
> + bralid r15, flush_cache
> + nop
> +
> +2: addi r5, r31, 0 /* gd is initialized in board_r.c */
> + addi r6, r0, CONFIG_SYS_TEXT_BASE
> + addi r12, r23, board_init_r
> + bra r12 /* Jump to relocated code */
> +
> + .end relocate_code
> #endif
> diff --git a/arch/microblaze/cpu/u-boot.lds b/arch/microblaze/cpu/u-boot.lds
> index 44bc036172f0..2502a0db2b14 100644
> --- a/arch/microblaze/cpu/u-boot.lds
> +++ b/arch/microblaze/cpu/u-boot.lds
> @@ -33,10 +33,19 @@ SECTIONS
> __data_end = .;
> }
>
> + .got ALIGN(4):
> + {
> + _got_start = .;
> + *(.got*)
> + . = ALIGN(4);
> + _got_end = .;
> + }
> +
> . = ALIGN(4);
> .u_boot_list : {
> KEEP(*(SORT(.u_boot_list*)));
> }
> + __init_end = . ;
>
> .bss ALIGN(0x4):
> {
> diff --git a/arch/microblaze/include/asm/config.h b/arch/microblaze/include/asm/config.h
> index cd2973478944..468673460bfb 100644
> --- a/arch/microblaze/include/asm/config.h
> +++ b/arch/microblaze/include/asm/config.h
> @@ -7,4 +7,12 @@
> #ifndef _ASM_CONFIG_H_
> #define _ASM_CONFIG_H_
>
> +#ifndef CONFIG_SPL_BUILD
> +#define CONFIG_NEEDS_MANUAL_RELOC
> +#endif
> +
> +#define CONFIG_NR_DRAM_BANKS 1
> +#define CONFIG_SYS_GENERIC_BOARD
> +#define CONFIG_SYS_GENERIC_GLOBAL_DATA
> +
> #endif
> diff --git a/arch/microblaze/include/asm/u-boot.h b/arch/microblaze/include/asm/u-boot.h
> index 54d415ebb5bd..66f8f952c9d0 100644
> --- a/arch/microblaze/include/asm/u-boot.h
> +++ b/arch/microblaze/include/asm/u-boot.h
> @@ -16,16 +16,7 @@
> #ifndef _U_BOOT_H_
> #define _U_BOOT_H_
>
> -typedef struct bd_info {
> - unsigned long bi_memstart; /* start of DRAM memory */
> - phys_size_t bi_memsize; /* size of DRAM memory in bytes */
> - unsigned long bi_flashstart; /* start of FLASH memory */
> - unsigned long bi_flashsize; /* size of FLASH memory */
> - unsigned long bi_flashoffset; /* reserved area for startup monitor */
> - unsigned long bi_sramstart; /* start of SRAM memory */
> - unsigned long bi_sramsize; /* size of SRAM memory */
> - ulong bi_boot_params; /* where this board expects params */
> -} bd_t;
> +#include <asm-generic/u-boot.h>
>
> /* For image.h:image_check_target_arch() */
> #define IH_ARCH_DEFAULT IH_ARCH_MICROBLAZE
> diff --git a/arch/microblaze/lib/Makefile b/arch/microblaze/lib/Makefile
> index 339dd153a0fd..0289d0cd609a 100644
> --- a/arch/microblaze/lib/Makefile
> +++ b/arch/microblaze/lib/Makefile
> @@ -5,6 +5,5 @@
> # SPDX-License-Identifier: GPL-2.0+
> #
>
> -obj-y += board.o
> obj-$(CONFIG_CMD_BOOTM) += bootm.o
> obj-y += muldi3.o
> diff --git a/arch/microblaze/lib/board.c b/arch/microblaze/lib/board.c
> deleted file mode 100644
> index bd028a63c078..000000000000
> --- a/arch/microblaze/lib/board.c
> +++ /dev/null
> @@ -1,201 +0,0 @@
> -/*
> - * (C) Copyright 2007 Michal Simek
> - * (C) Copyright 2004 Atmark Techno, Inc.
> - *
> - * Michal SIMEK <monstr@monstr.eu>
> - * Yasushi SHOJI <yashi@atmark-techno.com>
> - *
> - * SPDX-License-Identifier: GPL-2.0+
> - */
> -
> -#include <common.h>
> -#include <command.h>
> -#include <malloc.h>
> -#include <version.h>
> -#include <watchdog.h>
> -#include <stdio_dev.h>
> -#include <serial.h>
> -#include <net.h>
> -#include <spi.h>
> -#include <linux/compiler.h>
> -#include <asm/processor.h>
> -#include <asm/microblaze_intc.h>
> -#include <fdtdec.h>
> -
> -DECLARE_GLOBAL_DATA_PTR;
> -
> -static int display_banner(void)
> -{
> - printf("\n\n%s\n\n", version_string);
> - return 0;
> -}
> -
> -/*
> - * All attempts to come up with a "common" initialization sequence
> - * that works for all boards and architectures failed: some of the
> - * requirements are just _too_ different. To get rid of the resulting
> - * mess of board dependend #ifdef'ed code we now make the whole
> - * initialization sequence configurable to the user.
> - *
> - * The requirements for any new initalization function is simple: it
> - * receives a pointer to the "global data" structure as it's only
> - * argument, and returns an integer return code, where 0 means
> - * "continue" and != 0 means "fatal error, hang the system".
> - */
> -typedef int (init_fnc_t) (void);
> -
> -init_fnc_t *init_sequence[] = {
> - env_init,
> -#ifdef CONFIG_OF_CONTROL
> - fdtdec_check_fdt,
> -#endif
> - serial_init,
> -#ifndef CONFIG_SPL_BUILD
> - console_init_f,
> -#endif
> - display_banner,
> -#ifndef CONFIG_SPL_BUILD
> - interrupt_init,
> - timer_init,
> -#endif
> - NULL,
> -};
> -
> -unsigned long monitor_flash_len;
> -
> -void board_init_f(ulong not_used)
> -{
> - bd_t *bd;
> - init_fnc_t **init_fnc_ptr;
> - gd = (gd_t *)(CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_GBL_DATA_OFFSET);
> - bd = (bd_t *)(CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_GBL_DATA_OFFSET
> - - GENERATED_BD_INFO_SIZE);
> -#if defined(CONFIG_CMD_FLASH) && !defined(CONFIG_SPL_BUILD)
> - ulong flash_size = 0;
> -#endif
> - asm ("nop"); /* FIXME gd is not initialize - wait */
> - memset((void *)gd, 0, GENERATED_GBL_DATA_SIZE);
> - memset((void *)bd, 0, GENERATED_BD_INFO_SIZE);
> - gd->bd = bd;
> - gd->baudrate = CONFIG_BAUDRATE;
> - bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
> - bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
> - gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */
> -
> - monitor_flash_len = __end - __text_start;
> -
> -#ifdef CONFIG_OF_EMBED
> - /* Get a pointer to the FDT */
> - gd->fdt_blob = __dtb_dt_begin;
> -#elif defined CONFIG_OF_SEPARATE
> - /* FDT is at end of image */
> - gd->fdt_blob = (void *)__end;
> -#endif
> -
> -#ifndef CONFIG_SPL_BUILD
> - /* Allow the early environment to override the fdt address */
> - gd->fdt_blob = (void *)getenv_ulong("fdtcontroladdr", 16,
> - (uintptr_t)gd->fdt_blob);
> -#endif
> -
> - /*
> - * The Malloc area is immediately below the monitor copy in DRAM
> - * aka CONFIG_SYS_MONITOR_BASE - Note there is no need for reloc_off
> - * as our monitory code is run from SDRAM
> - */
> - mem_malloc_init(CONFIG_SYS_MALLOC_BASE, CONFIG_SYS_MALLOC_LEN);
> -
> - serial_initialize();
> -
> -#ifdef CONFIG_XILINX_TB_WATCHDOG
> - hw_watchdog_init();
> -#endif
> - for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
> - WATCHDOG_RESET();
> - if ((*init_fnc_ptr) () != 0)
> - hang();
> - }
> -
> -#ifndef CONFIG_SPL_BUILD
> -#ifdef CONFIG_OF_CONTROL
> - /* For now, put this check after the console is ready */
> - if (fdtdec_prepare_fdt())
> - panic("** No FDT - please see doc/README.fdt-control");
> - else
> - printf("DTB: 0x%x\n", (u32)gd->fdt_blob);
> -#endif
> -
> - puts("SDRAM :\n");
> - printf("\t\tIcache:%s\n", icache_status() ? "ON" : "OFF");
> - printf("\t\tDcache:%s\n", dcache_status() ? "ON" : "OFF");
> - printf("\tU-Boot Start:0x%08x\n", CONFIG_SYS_TEXT_BASE);
> -
> -#if defined(CONFIG_CMD_FLASH)
> - puts("Flash: ");
> - bd->bi_flashstart = CONFIG_SYS_FLASH_BASE;
> - flash_size = flash_init();
> - if (bd->bi_flashstart && flash_size > 0) {
> -# ifdef CONFIG_SYS_FLASH_CHECKSUM
> - print_size(flash_size, "");
> - /*
> - * Compute and print flash CRC if flashchecksum is set to 'y'
> - *
> - * NOTE: Maybe we should add some WATCHDOG_RESET()? XXX
> - */
> - if (getenv_yesno("flashchecksum") == 1) {
> - printf(" CRC: %08X",
> - crc32(0, (const u8 *)bd->bi_flashstart,
> - flash_size)
> - );
> - }
> - putc('\n');
> -# else /* !CONFIG_SYS_FLASH_CHECKSUM */
> - print_size(flash_size, "\n");
> -# endif /* CONFIG_SYS_FLASH_CHECKSUM */
> - bd->bi_flashsize = flash_size;
> - bd->bi_flashoffset = bd->bi_flashstart + flash_size;
> - } else {
> - puts("Flash init FAILED");
> - bd->bi_flashstart = 0;
> - bd->bi_flashsize = 0;
> - bd->bi_flashoffset = 0;
> - }
> -#endif
> -
> -#ifdef CONFIG_SPI
> - spi_init();
> -#endif
> -
> - /* relocate environment function pointers etc. */
> - env_relocate();
> -
> - /* Initialize stdio devices */
> - stdio_init();
> -
> - /* Initialize the jump table for applications */
> - jumptable_init();
> -
> - /* Initialize the console (after the relocation and devices init) */
> - console_init_r();
> -
> - board_init();
> -
> - /* Initialize from environment */
> - load_addr = getenv_ulong("loadaddr", 16, load_addr);
> -
> -#if defined(CONFIG_CMD_NET)
> - printf("Net: ");
> - eth_initialize(gd->bd);
> -
> - uchar enetaddr[6];
> - eth_getenv_enetaddr("ethaddr", enetaddr);
> - printf("MAC: %pM\n", enetaddr);
> -#endif
> -
> - /* main_loop */
> - for (;;) {
> - WATCHDOG_RESET();
> - main_loop();
> - }
> -#endif /* CONFIG_SPL_BUILD */
> -}
> diff --git a/board/xilinx/microblaze-generic/microblaze-generic.c b/board/xilinx/microblaze-generic/microblaze-generic.c
> index 42a8d0c400e5..062e678eccb7 100644
> --- a/board/xilinx/microblaze-generic/microblaze-generic.c
> +++ b/board/xilinx/microblaze-generic/microblaze-generic.c
> @@ -11,16 +11,62 @@
>
> #include <common.h>
> #include <config.h>
> +#include <fdtdec.h>
> #include <netdev.h>
> #include <asm/processor.h>
> #include <asm/microblaze_intc.h>
> #include <asm/asm.h>
> #include <asm/gpio.h>
>
> +DECLARE_GLOBAL_DATA_PTR;
> +
> #ifdef CONFIG_XILINX_GPIO
> static int reset_pin = -1;
> #endif
>
> +#ifdef CONFIG_OF_CONTROL
> +ulong ram_base;
> +
> +ulong board_get_usable_ram_top(ulong total_size)
> +{
> + return ram_base + gd->ram_size;
> +}
> +
> +void dram_init_banksize(void)
> +{
> + gd->bd->bi_dram[0].start = ram_base;
> + gd->bd->bi_dram[0].size = get_effective_memsize();
> +}
> +
> +phys_size_t initdram(int board_type)
> +{
> + int node;
> + fdt_addr_t addr;
> + fdt_size_t size;
> + const void *blob = gd->fdt_blob;
> +
> + node = fdt_node_offset_by_prop_value(blob, -1, "device_type",
> + "memory", 7);
> + if (node == -FDT_ERR_NOTFOUND) {
> + debug("DRAM: Can't get memory node\n");
> + return 0;
> + }
> + addr = fdtdec_get_addr_size(blob, node, "reg", &size);
> + if (addr == FDT_ADDR_T_NONE || size == 0) {
> + debug("DRAM: Can't get base address or size\n");
> + return 0;
> + }
> + ram_base = addr;
> +
> + return size;
> +};
> +#else
> +phys_size_t initdram(int board_type)
> +{
> + return CONFIG_SYS_SDRAM_SIZE;
> +}
> +#endif
> +
> int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> {
> #ifdef CONFIG_XILINX_GPIO
> diff --git a/common/board_f.c b/common/board_f.c
> index 3a4b32c29dc1..64b40aebb508 100644
> --- a/common/board_f.c
> +++ b/common/board_f.c
> @@ -174,7 +174,7 @@ static int announce_dram_init(void)
> return 0;
> }
>
> -#if defined(CONFIG_MIPS) || defined(CONFIG_PPC)
> +#if defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_MICROBLAZE)
> static int init_func_ram(void)
> {
Can you use dram_init() instead?
> #ifdef CONFIG_BOARD_TYPES
> @@ -262,7 +262,7 @@ static int zero_global_data(void)
>
> static int setup_mon_len(void)
> {
> -#ifdef __ARM__
> +#if defined(__ARM__) || defined(__MICROBLAZE__)
> gd->mon_len = (ulong)&__bss_end - (ulong)_start;
> #elif defined(CONFIG_SANDBOX)
> gd->mon_len = (ulong)&_end - (ulong)_init;
> @@ -906,7 +906,7 @@ static init_fnc_t init_sequence_f[] = {
> #if defined(CONFIG_ARM) || defined(CONFIG_X86)
> dram_init, /* configure available RAM banks */
> #endif
> -#if defined(CONFIG_MIPS) || defined(CONFIG_PPC)
> +#if defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_MICROBLAZE)
> init_func_ram,
> #endif
> #ifdef CONFIG_POST
> diff --git a/common/board_r.c b/common/board_r.c
> index e712902cff45..3e77720f2acb 100644
> --- a/common/board_r.c
> +++ b/common/board_r.c
> @@ -829,7 +829,7 @@ init_fnc_t init_sequence_r[] = {
> #if defined(CONFIG_ARM)
> initr_enable_interrupts,
> #endif
> -#ifdef CONFIG_X86
> +#if defined(CONFIG_X86) || defined(CONFIG_MICROBLAZE)
> timer_init, /* initialize timer */
> #endif
Could you use interrupt_init() immediately before?
> #if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
> diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
> index e6d8a7ae2c50..4c51059c1ba4 100644
> --- a/common/cmd_bdinfo.c
> +++ b/common/cmd_bdinfo.c
> @@ -183,8 +183,14 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> {
> bd_t *bd = gd->bd;
> - print_num("mem start ", (ulong)bd->bi_memstart);
> - print_lnum("mem size ", (u64)bd->bi_memsize);
> + int i;
> +
> + for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
> + print_num("DRAM bank", i);
> + print_num("-> start", bd->bi_dram[i].start);
> + print_num("-> size", bd->bi_dram[i].size);
> + }
> +
> print_num("flash start ", (ulong)bd->bi_flashstart);
> print_num("flash size ", (ulong)bd->bi_flashsize);
> print_num("flash offset ", (ulong)bd->bi_flashoffset);
> @@ -196,6 +202,9 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> print_eths();
> #endif
> printf("baudrate = %u bps\n", gd->baudrate);
> + print_num("relocaddr", gd->relocaddr);
> + print_num("reloc off", gd->reloc_off);
> +
> return 0;
> }
>
> diff --git a/include/configs/microblaze-generic.h b/include/configs/microblaze-generic.h
> index 2e1e64247fe0..622bc951045b 100644
> --- a/include/configs/microblaze-generic.h
> +++ b/include/configs/microblaze-generic.h
> @@ -106,62 +106,16 @@
> # define CONFIG_XILINX_TB_WATCHDOG
> #endif
>
> -/*
> - * memory layout - Example
> - * CONFIG_SYS_TEXT_BASE = 0x1200_0000; defined in config.mk
> - * CONFIG_SYS_SRAM_BASE = 0x1000_0000;
> - * CONFIG_SYS_SRAM_SIZE = 0x0400_0000; 64MB
> - *
> - * CONFIG_SYS_MONITOR_LEN = 0x40000
> - * CONFIG_SYS_MALLOC_LEN = 3 * CONFIG_SYS_MONITOR_LEN = 0xC0000
> - *
> - * CONFIG_SYS_GBL_DATA_OFFSET = 0x1000_0000 + 0x0400_0000 - 0x1000 = 0x13FF_F000
> - * CONFIG_SYS_MONITOR_BASE = 0x13FF_F000 - CONFIG_SYS_MONITOR_LEN = 0x13FB_F000
> - * CONFIG_SYS_MALLOC_BASE = 0x13FB_F000 - CONFIG_SYS_MALLOC_LEN = 0x13EF_F000
> - *
> - * 0x1000_0000 CONFIG_SYS_SDRAM_BASE
> - * MEMTEST_AREA 64kB
> - * FREE
> - * 0x1200_0000 CONFIG_SYS_TEXT_BASE
> - * U-BOOT code
> - * 0x1202_0000
> - * FREE
> - *
> - * STACK
> - * 0x13EF_F000 CONFIG_SYS_MALLOC_BASE
> - * MALLOC_AREA 768kB Alloc
> - * 0x13FB_F000 CONFIG_SYS_MONITOR_BASE
> - * MONITOR_CODE 256kB Env
> - * 0x13FF_F000 CONFIG_SYS_GBL_DATA_OFFSET
> - * GLOBAL_DATA 4kB bd, gd
> - * 0x1400_0000 CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_SDRAM_SIZE
> - */
> -
> +#ifndef CONFIG_OF_CONTROL
> /* ddr sdram - main memory */
> -#define CONFIG_SYS_SDRAM_BASE XILINX_RAM_START
> -#define CONFIG_SYS_SDRAM_SIZE XILINX_RAM_SIZE
> -#define CONFIG_SYS_MEMTEST_START CONFIG_SYS_SDRAM_BASE
> -#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_SDRAM_BASE + 0x1000)
> -
> -/* global pointer */
> -/* start of global data */
> -#define CONFIG_SYS_GBL_DATA_OFFSET \
> - (CONFIG_SYS_SDRAM_SIZE - GENERATED_GBL_DATA_SIZE)
> -
> -/* monitor code */
> -#define SIZE 0x40000
> -#define CONFIG_SYS_MONITOR_LEN SIZE
> -#define CONFIG_SYS_MONITOR_BASE \
> - (CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_GBL_DATA_OFFSET \
> - - CONFIG_SYS_MONITOR_LEN - GENERATED_BD_INFO_SIZE)
> -#define CONFIG_SYS_MONITOR_END \
> - (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN)
> -#define CONFIG_SYS_MALLOC_LEN (SIZE * 3)
> -#define CONFIG_SYS_MALLOC_BASE \
> - (CONFIG_SYS_MONITOR_BASE - CONFIG_SYS_MALLOC_LEN)
> -
> -/* stack */
> -#define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_MALLOC_BASE
> +# define CONFIG_SYS_SDRAM_BASE XILINX_RAM_START
> +# define CONFIG_SYS_SDRAM_SIZE XILINX_RAM_SIZE
> +#endif
> +
> +#define CONFIG_SYS_MALLOC_LEN 0xC0000
> +
> +/* Stack location before relocation */
> +#define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_TEXT_BASE
>
> /*
> * CFI flash memory layout - Example
> --
> 1.8.2.3
>
Regards,
Simon
^ permalink raw reply [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH 12/14] microblaze: Move architecture to use generic board init
2015-01-29 2:15 ` Simon Glass
@ 2015-01-29 14:20 ` Michal Simek
2015-01-29 15:45 ` Simon Glass
0 siblings, 1 reply; 19+ messages in thread
From: Michal Simek @ 2015-01-29 14:20 UTC (permalink / raw)
To: u-boot
Hi Simon,
On 01/29/2015 03:15 AM, Simon Glass wrote:
> Hi Michal,
>
> On 27 January 2015 at 08:20, Michal Simek <michal.simek@xilinx.com> wrote:
>> Compile code with -fPIC to get GOT. Do not build SPL
>> with fPIC because it increasing SPL size for nothing.
>>
>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>> ---
>>
...
>> -#if defined(CONFIG_MIPS) || defined(CONFIG_PPC)
>> +#if defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_MICROBLAZE)
>> static int init_func_ram(void)
>> {
>
> Can you use dram_init() instead?
No problem will do it in v2.
Where dram_init(void) should be declared?
I see that others have it in arch header. Maybe better to have
it in any shared location.
>> --- a/common/board_r.c
>> +++ b/common/board_r.c
>> @@ -829,7 +829,7 @@ init_fnc_t init_sequence_r[] = {
>> #if defined(CONFIG_ARM)
>> initr_enable_interrupts,
>> #endif
>> -#ifdef CONFIG_X86
>> +#if defined(CONFIG_X86) || defined(CONFIG_MICROBLAZE)
>> timer_init, /* initialize timer */
>> #endif
>
> Could you use interrupt_init() immediately before?
What do you mean by that?
Do you want to do timer_init in interrupt_init()?
Thanks,
Michal
^ permalink raw reply [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH 12/14] microblaze: Move architecture to use generic board init
2015-01-29 14:20 ` Michal Simek
@ 2015-01-29 15:45 ` Simon Glass
2015-01-30 10:13 ` Michal Simek
0 siblings, 1 reply; 19+ messages in thread
From: Simon Glass @ 2015-01-29 15:45 UTC (permalink / raw)
To: u-boot
Hi Michal,
On 29 January 2015 at 07:20, Michal Simek <michal.simek@xilinx.com> wrote:
> Hi Simon,
>
> On 01/29/2015 03:15 AM, Simon Glass wrote:
>> Hi Michal,
>>
>> On 27 January 2015 at 08:20, Michal Simek <michal.simek@xilinx.com> wrote:
>>> Compile code with -fPIC to get GOT. Do not build SPL
>>> with fPIC because it increasing SPL size for nothing.
>>>
>>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>>> ---
>>>
>
> ...
>
>>> -#if defined(CONFIG_MIPS) || defined(CONFIG_PPC)
>>> +#if defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_MICROBLAZE)
>>> static int init_func_ram(void)
>>> {
>>
>> Can you use dram_init() instead?
>
> No problem will do it in v2.
>
> Where dram_init(void) should be declared?
> I see that others have it in arch header. Maybe better to have
> it in any shared location.
Yes a shared location makes sense.
>
>>> --- a/common/board_r.c
>>> +++ b/common/board_r.c
>>> @@ -829,7 +829,7 @@ init_fnc_t init_sequence_r[] = {
>>> #if defined(CONFIG_ARM)
>>> initr_enable_interrupts,
>>> #endif
>>> -#ifdef CONFIG_X86
>>> +#if defined(CONFIG_X86) || defined(CONFIG_MICROBLAZE)
>>> timer_init, /* initialize timer */
>>> #endif
>>
>> Could you use interrupt_init() immediately before?
>
> What do you mean by that?
> Do you want to do timer_init in interrupt_init()?
Yes, then if we remove it from x86 also we can drop both #ifdefs. Do
you see any drawback with that?
Regards,
Simon
^ permalink raw reply [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH 12/14] microblaze: Move architecture to use generic board init
2015-01-29 15:45 ` Simon Glass
@ 2015-01-30 10:13 ` Michal Simek
2015-01-30 16:29 ` Simon Glass
0 siblings, 1 reply; 19+ messages in thread
From: Michal Simek @ 2015-01-30 10:13 UTC (permalink / raw)
To: u-boot
Hi Simon,
On 01/29/2015 04:45 PM, Simon Glass wrote:
> Hi Michal,
>
>
> On 29 January 2015 at 07:20, Michal Simek <michal.simek@xilinx.com> wrote:
>> Hi Simon,
>>
>> On 01/29/2015 03:15 AM, Simon Glass wrote:
>>> Hi Michal,
>>>
>>> On 27 January 2015 at 08:20, Michal Simek <michal.simek@xilinx.com> wrote:
>>>> Compile code with -fPIC to get GOT. Do not build SPL
>>>> with fPIC because it increasing SPL size for nothing.
>>>>
>>>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>>>> ---
>>>>
>>
>> ...
>>
>>>> -#if defined(CONFIG_MIPS) || defined(CONFIG_PPC)
>>>> +#if defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_MICROBLAZE)
>>>> static int init_func_ram(void)
>>>> {
>>>
>>> Can you use dram_init() instead?
>>
>> No problem will do it in v2.
>>
>> Where dram_init(void) should be declared?
>> I see that others have it in arch header. Maybe better to have
>> it in any shared location.
>
> Yes a shared location makes sense.
I have sent patch for it. Please review.
>
>>
>>>> --- a/common/board_r.c
>>>> +++ b/common/board_r.c
>>>> @@ -829,7 +829,7 @@ init_fnc_t init_sequence_r[] = {
>>>> #if defined(CONFIG_ARM)
>>>> initr_enable_interrupts,
>>>> #endif
>>>> -#ifdef CONFIG_X86
>>>> +#if defined(CONFIG_X86) || defined(CONFIG_MICROBLAZE)
>>>> timer_init, /* initialize timer */
>>>> #endif
>>>
>>> Could you use interrupt_init() immediately before?
>>
>> What do you mean by that?
>> Do you want to do timer_init in interrupt_init()?
>
> Yes, then if we remove it from x86 also we can drop both #ifdefs. Do
> you see any drawback with that?
timer_init looks like standard function which is used by x86 (board_r), arm, mips, blackfin.
(board_f)
Based on board_r.c PPC is doing timer_init in cpu_init_r.
For Microblaze my preference is to use this location because timer code is using
interrupts which are initialized above.
Adding timer_init to interrupt_init doesn't look right because then interrupt_init will hide
one init step.
Thanks,
Michal
--
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150130/08b3fadb/attachment.sig>
^ permalink raw reply [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH 12/14] microblaze: Move architecture to use generic board init
2015-01-30 10:13 ` Michal Simek
@ 2015-01-30 16:29 ` Simon Glass
0 siblings, 0 replies; 19+ messages in thread
From: Simon Glass @ 2015-01-30 16:29 UTC (permalink / raw)
To: u-boot
Hi Michal,
On 30 January 2015 at 03:13, Michal Simek <monstr@monstr.eu> wrote:
> Hi Simon,
>
> On 01/29/2015 04:45 PM, Simon Glass wrote:
>> Hi Michal,
>>
>>
>> On 29 January 2015 at 07:20, Michal Simek <michal.simek@xilinx.com> wrote:
>>> Hi Simon,
>>>
>>> On 01/29/2015 03:15 AM, Simon Glass wrote:
>>>> Hi Michal,
>>>>
>>>> On 27 January 2015 at 08:20, Michal Simek <michal.simek@xilinx.com> wrote:
>>>>> Compile code with -fPIC to get GOT. Do not build SPL
>>>>> with fPIC because it increasing SPL size for nothing.
>>>>>
>>>>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>>>>> ---
>>>>>
>>>
>>> ...
>>>
>>>>> -#if defined(CONFIG_MIPS) || defined(CONFIG_PPC)
>>>>> +#if defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_MICROBLAZE)
>>>>> static int init_func_ram(void)
>>>>> {
>>>>
>>>> Can you use dram_init() instead?
>>>
>>> No problem will do it in v2.
>>>
>>> Where dram_init(void) should be declared?
>>> I see that others have it in arch header. Maybe better to have
>>> it in any shared location.
>>
>> Yes a shared location makes sense.
>
> I have sent patch for it. Please review.
>
>>
>>>
>>>>> --- a/common/board_r.c
>>>>> +++ b/common/board_r.c
>>>>> @@ -829,7 +829,7 @@ init_fnc_t init_sequence_r[] = {
>>>>> #if defined(CONFIG_ARM)
>>>>> initr_enable_interrupts,
>>>>> #endif
>>>>> -#ifdef CONFIG_X86
>>>>> +#if defined(CONFIG_X86) || defined(CONFIG_MICROBLAZE)
>>>>> timer_init, /* initialize timer */
>>>>> #endif
>>>>
>>>> Could you use interrupt_init() immediately before?
>>>
>>> What do you mean by that?
>>> Do you want to do timer_init in interrupt_init()?
>>
>> Yes, then if we remove it from x86 also we can drop both #ifdefs. Do
>> you see any drawback with that?
>
> timer_init looks like standard function which is used by x86 (board_r), arm, mips, blackfin.
> (board_f)
>
> Based on board_r.c PPC is doing timer_init in cpu_init_r.
>
> For Microblaze my preference is to use this location because timer code is using
> interrupts which are initialized above.
>
> Adding timer_init to interrupt_init doesn't look right because then interrupt_init will hide
> one init step.
Fair enough, I agree they are different. One way or another we'll get
rid of the #ifdefs in those files one day...
Regards,
Simon
^ permalink raw reply [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH 13/14] microblaze: Speedup code copy
2015-01-27 15:20 [U-Boot] [PATCH 01/14] microblaze: Fix stack usage in interrupt handler Michal Simek
` (10 preceding siblings ...)
2015-01-27 15:20 ` [U-Boot] [PATCH 12/14] microblaze: Move architecture to use generic board init Michal Simek
@ 2015-01-27 15:20 ` Michal Simek
2015-01-27 15:20 ` [U-Boot] [PATCH 14/14] bdinfo: Show information about fdt blob via bdinfo Michal Simek
12 siblings, 0 replies; 19+ messages in thread
From: Michal Simek @ 2015-01-27 15:20 UTC (permalink / raw)
To: u-boot
Remove one instruction in the loop which speedup
code copying.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
arch/microblaze/cpu/start.S | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/arch/microblaze/cpu/start.S b/arch/microblaze/cpu/start.S
index 3de0e12090ea..4023ec067531 100644
--- a/arch/microblaze/cpu/start.S
+++ b/arch/microblaze/cpu/start.S
@@ -212,12 +212,14 @@ relocate_code:
/* Relocate text and data - r12 temp value */
addi r21, r0, _start
addi r22, r0, __end - 4 /* Include BSS too */
-1: lwi r12, r21, 0 /* Load u-boot data */
- swi r12, r23, 0 /* Write zero to loc */
- addi r21, r21, 4 /* Increment to next loc - origin code */
- cmp r12, r21, r22 /* Check if we have reach the end */
+
+ rsub r6, r21, r22
+ or r5, r0, r0
+1: lw r12, r21, r5 /* Load u-boot data */
+ sw r12, r23, r5 /* Write zero to loc */
+ cmp r12, r5, r6 /* Check if we have reach the end */
bneid r12, 1b
- addi r23, r23, 4 /* Increment to next loc - relocate code */
+ addi r5, r5, 4 /* Increment to next loc - relocate code */
/* R23 points to the base address. */
add r23, r0, r7 /* Move reloc addr to r23 */
--
1.8.2.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150127/e0e62dbb/attachment.pgp>
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH 14/14] bdinfo: Show information about fdt blob via bdinfo
2015-01-27 15:20 [U-Boot] [PATCH 01/14] microblaze: Fix stack usage in interrupt handler Michal Simek
` (11 preceding siblings ...)
2015-01-27 15:20 ` [U-Boot] [PATCH 13/14] microblaze: Speedup code copy Michal Simek
@ 2015-01-27 15:20 ` Michal Simek
12 siblings, 0 replies; 19+ messages in thread
From: Michal Simek @ 2015-01-27 15:20 UTC (permalink / raw)
To: u-boot
Microblaze target supports both OF and !OF cases
and from log is not clear which version is running.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
common/cmd_bdinfo.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
index 4c51059c1ba4..e9eab232f961 100644
--- a/common/cmd_bdinfo.c
+++ b/common/cmd_bdinfo.c
@@ -204,6 +204,9 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
printf("baudrate = %u bps\n", gd->baudrate);
print_num("relocaddr", gd->relocaddr);
print_num("reloc off", gd->reloc_off);
+ print_num("fdt_blob", (ulong)gd->fdt_blob);
+ print_num("new_fdt", (ulong)gd->new_fdt);
+ print_num("fdt_size", (ulong)gd->fdt_size);
return 0;
}
--
1.8.2.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150127/79424b56/attachment.pgp>
^ permalink raw reply related [flat|nested] 19+ messages in thread