summaryrefslogtreecommitdiff
path: root/cpu/blackfin
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-03-17 13:58:23 -0400
committerMike Frysinger <vapier@gentoo.org>2009-03-23 15:14:52 -0400
commite82b762f293debc53c5afa90f37264f6b07520f9 (patch)
treeb207f0cedee7789001267274bab53967dc6d0ad6 /cpu/blackfin
parentbc683f58b1f1d8d20546fe019483967a51a49df1 (diff)
downloadu-boot-imx-e82b762f293debc53c5afa90f37264f6b07520f9.zip
u-boot-imx-e82b762f293debc53c5afa90f37264f6b07520f9.tar.gz
u-boot-imx-e82b762f293debc53c5afa90f37264f6b07520f9.tar.bz2
Blackfin: fix jtag console tstc
The jtag tstc operation was checking the hardware to see if data is available from it (which is fine for the jtag getc operation), but the higher layers need to know whether any data is available. Since we have to read up to 4 bytes at a time from the hardware, the higher layers need to know they can consume the cached bytes as well. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'cpu/blackfin')
-rw-r--r--cpu/blackfin/jtag-console.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/cpu/blackfin/jtag-console.c b/cpu/blackfin/jtag-console.c
index 44c0a83..d58582f 100644
--- a/cpu/blackfin/jtag-console.c
+++ b/cpu/blackfin/jtag-console.c
@@ -54,16 +54,23 @@ static void jtag_puts(const char *s)
jtag_send(s, strlen(s));
}
-static int jtag_tstc(void)
+static size_t inbound_len, leftovers_len;
+
+/* Lower layers want to know when jtag has data */
+static int jtag_tstc_dbg(void)
{
return (bfin_read_DBGSTAT() & 0x2);
}
+/* Higher layers want to know when any data is available */
+static int jtag_tstc(void)
+{
+ return jtag_tstc_dbg() || leftovers_len;
+}
+
/* Receive a buffer. The format is:
* [32bit length][actual data]
*/
-static size_t inbound_len;
-static int leftovers_len;
static uint32_t leftovers;
static int jtag_getc(void)
{
@@ -79,7 +86,7 @@ static int jtag_getc(void)
}
/* wait for new data ! */
- while (!jtag_tstc())
+ while (!jtag_tstc_dbg())
continue;
__asm__("%0 = emudat;" : "=d"(emudat));