mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Alexey Galakhov <agalakhov@gmail.com>
To: barebox@lists.infradead.org
Cc: Alexey Galakhov <agalakhov@gmail.com>
Subject: [PATCH 2/3] friendlyarm-tiny210: use LEDs for boot errors
Date: Tue,  9 Jul 2013 21:23:16 +0600	[thread overview]
Message-ID: <1373383397-13205-3-git-send-email-agalakhov@gmail.com> (raw)
In-Reply-To: <1373383397-13205-1-git-send-email-agalakhov@gmail.com>

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

  parent reply	other threads:[~2013-07-09 15:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1373383397-13205-3-git-send-email-agalakhov@gmail.com \
    --to=agalakhov@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox