* [PATCH 1/3] friendlyarm-tiny210: do not restart barebox twice
2013-07-09 15:23 [PATCH 0/3] Fix friendlyarm-tiny210 regression Alexey Galakhov
@ 2013-07-09 15:23 ` Alexey Galakhov
2013-07-09 15:23 ` [PATCH 2/3] friendlyarm-tiny210: use LEDs for boot errors Alexey Galakhov
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Alexey Galakhov @ 2013-07-09 15:23 UTC (permalink / raw)
To: barebox; +Cc: Alexey Galakhov
The old way to boot tiny210 was to restart barebox after loading stage2 image.
This turned out to be unstable and stopped working after barebox refactoring.
Now jump to the same position in the loaded code instead of starting it from
the very beginning.
Signed-off-by: Alexey Galakhov <agalakhov@gmail.com>
---
arch/arm/boards/friendlyarm-tiny210/lowlevel.c | 31 ++++++++++++++++++------
1 file changed, 23 insertions(+), 8 deletions(-)
diff --git a/arch/arm/boards/friendlyarm-tiny210/lowlevel.c b/arch/arm/boards/friendlyarm-tiny210/lowlevel.c
index 3bd1379..0c7fbf3 100644
--- a/arch/arm/boards/friendlyarm-tiny210/lowlevel.c
+++ b/arch/arm/boards/friendlyarm-tiny210/lowlevel.c
@@ -31,6 +31,8 @@
#include <mach/s3c-clocks.h>
#include <mach/s3c-generic.h>
+#define IRAM_CODE_BASE 0xD0020010
+
/*
* iROM boot from MMC
* TODO: replace this by native boot
@@ -50,6 +52,19 @@ int __bare_init s5p_irom_load_mmc(void *dest, uint32_t start_block, uint16_t blo
return func(chan, start_block, block_count, (uint32_t*)dest, 0) ? 1 : 0;
}
+static __bare_init __naked void jump_sdram(unsigned long offset)
+{
+ __asm__ __volatile__ (
+ "sub lr, lr, %0;"
+ "mov pc, lr;" : : "r"(offset)
+ );
+}
+
+static __bare_init bool load_stage2(void *dest, size_t size)
+{
+ /* TODO add other ways to boot */
+ return s5p_irom_load_mmc(dest, 1, (size+ 511) / 512);
+}
void __bare_init barebox_arm_reset_vector(void)
{
@@ -61,18 +76,18 @@ void __bare_init barebox_arm_reset_vector(void)
s5p_init_pll();
#endif
- if (get_pc() < 0xD0000000) /* Are we running from iRAM? */
+ if (get_pc() < IRAM_CODE_BASE) /* Are we running from iRAM? */
/* No, we don't. */
- barebox_arm_entry(S3C_SDRAM_BASE, SZ_64M, 0);
+ goto boot;
s5p_init_dram_bank_ddr2(S5P_DMC0_BASE, 0x20E00323, 0, 0);
- if (! s5p_irom_load_mmc((void*)TEXT_BASE - 16, 1,
- (ld_var(_barebox_image_size) + 16 + 511) / 512))
+ if (! load_stage2((void*)(ld_var(_text) - 16),
+ ld_var(_barebox_image_size) + 16))
while (1) { } /* hang */
- /* Jump to SDRAM */
- r = (unsigned)TEXT_BASE;
- __asm__ __volatile__("mov pc, %0" : : "r"(r));
- while (1) { } /* hang */
+ jump_sdram(IRAM_CODE_BASE - ld_var(_text));
+
+boot:
+ barebox_arm_entry(S3C_SDRAM_BASE, SZ_256M, 0);
}
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/3] friendlyarm-tiny210: use LEDs for boot errors
2013-07-09 15:23 [PATCH 0/3] Fix friendlyarm-tiny210 regression Alexey Galakhov
2013-07-09 15:23 ` [PATCH 1/3] friendlyarm-tiny210: do not restart barebox twice Alexey Galakhov
@ 2013-07-09 15:23 ` Alexey Galakhov
2013-07-09 15:23 ` [PATCH 3/3] friendlyarm-tiny210: add heartbeat LED Alexey Galakhov
2013-07-09 17:50 ` [PATCH 0/3] Fix friendlyarm-tiny210 regression Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Alexey Galakhov @ 2013-07-09 15:23 UTC (permalink / raw)
To: barebox; +Cc: Alexey Galakhov
Signed-off-by: Alexey Galakhov <agalakhov@gmail.com>
---
arch/arm/boards/friendlyarm-tiny210/lowlevel.c | 28 +++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/arch/arm/boards/friendlyarm-tiny210/lowlevel.c b/arch/arm/boards/friendlyarm-tiny210/lowlevel.c
index 0c7fbf3..9676094 100644
--- a/arch/arm/boards/friendlyarm-tiny210/lowlevel.c
+++ b/arch/arm/boards/friendlyarm-tiny210/lowlevel.c
@@ -33,6 +33,22 @@
#define IRAM_CODE_BASE 0xD0020010
+/* Tiny210 has 4 leds numbered from 0 to 3 at GPJ2 */
+static inline void __bare_init debug_led(int led, bool state)
+{
+ uint32_t r;
+ /* GPJ2CON: mode 0001=output */
+ r = readl(0xE0200280);
+ r &= ~(0xF << (4 * led));
+ r |= (0x1 << (4 * led));
+ writel(r, 0xE0200280);
+ /* GPJ2DAT: active low */
+ r = readl(0xE0200284);
+ r &= ~(1 << led);
+ r |= (state ? 0 : 1) << led;
+ writel(r, 0xE0200284);
+}
+
/*
* iROM boot from MMC
* TODO: replace this by native boot
@@ -76,18 +92,28 @@ void __bare_init barebox_arm_reset_vector(void)
s5p_init_pll();
#endif
+ debug_led(0, 1);
+
if (get_pc() < IRAM_CODE_BASE) /* Are we running from iRAM? */
/* No, we don't. */
goto boot;
s5p_init_dram_bank_ddr2(S5P_DMC0_BASE, 0x20E00323, 0, 0);
+ debug_led(1, 1);
+
if (! load_stage2((void*)(ld_var(_text) - 16),
- ld_var(_barebox_image_size) + 16))
+ ld_var(_barebox_image_size) + 16)) {
+ debug_led(3, 1);
while (1) { } /* hang */
+ }
+
+ debug_led(2, 1);
jump_sdram(IRAM_CODE_BASE - ld_var(_text));
+ debug_led(1, 0);
+
boot:
barebox_arm_entry(S3C_SDRAM_BASE, SZ_256M, 0);
}
--
1.7.10.4
_______________________________________________
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/3] friendlyarm-tiny210: add heartbeat LED
2013-07-09 15:23 [PATCH 0/3] Fix friendlyarm-tiny210 regression Alexey Galakhov
2013-07-09 15:23 ` [PATCH 1/3] friendlyarm-tiny210: do not restart barebox twice Alexey Galakhov
2013-07-09 15:23 ` [PATCH 2/3] friendlyarm-tiny210: use LEDs for boot errors Alexey Galakhov
@ 2013-07-09 15:23 ` Alexey Galakhov
2013-07-09 17:50 ` [PATCH 0/3] Fix friendlyarm-tiny210 regression Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Alexey Galakhov @ 2013-07-09 15:23 UTC (permalink / raw)
To: barebox; +Cc: Alexey Galakhov
Signed-off-by: Alexey Galakhov <agalakhov@gmail.com>
---
arch/arm/boards/friendlyarm-tiny210/tiny210.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/boards/friendlyarm-tiny210/tiny210.c b/arch/arm/boards/friendlyarm-tiny210/tiny210.c
index 18494b0..fb144f5 100644
--- a/arch/arm/boards/friendlyarm-tiny210/tiny210.c
+++ b/arch/arm/boards/friendlyarm-tiny210/tiny210.c
@@ -105,6 +105,8 @@ static int tiny210_devices_init(void)
led_gpio_register(&leds[i]);
}
+ led_set_trigger(LED_TRIGGER_HEARTBEAT, &leds[0].led);
+
armlinux_set_bootparams((void*)S3C_SDRAM_BASE + 0x100);
armlinux_set_architecture(MACH_TYPE_MINI210);
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] Fix friendlyarm-tiny210 regression
2013-07-09 15:23 [PATCH 0/3] Fix friendlyarm-tiny210 regression Alexey Galakhov
` (2 preceding siblings ...)
2013-07-09 15:23 ` [PATCH 3/3] friendlyarm-tiny210: add heartbeat LED Alexey Galakhov
@ 2013-07-09 17:50 ` Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2013-07-09 17:50 UTC (permalink / raw)
To: Alexey Galakhov; +Cc: barebox
On Tue, Jul 09, 2013 at 09:23:14PM +0600, Alexey Galakhov wrote:
> Tiny210 was broken in the most recent releases of barebox. This is the fix.
>
> Alexey Galakhov (3):
> friendlyarm-tiny210: do not restart barebox twice
> friendlyarm-tiny210: use LEDs for boot errors
> friendlyarm-tiny210: add heartbeat LED
Applied the first one to master and stable/v2013.07 and the remaining
to next.
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] 5+ messages in thread