From: Guenter Roeck <linux@roeck-us.net>
To: linux-kernel@vger.kernel.org
Cc: Waldemar Brodkorb <mail@waldemar-brodkorb.de>,
Jesper Nilsson <jespern@axis.com>,
Mikael Starvik <starvik@axis.com>,
linux-cris-kernel@axis.com, Guenter Roeck <linux@roeck-us.net>
Subject: [RFC PATCH 1/8] cris: Add support for early console
Date: Sun, 21 Sep 2014 09:27:11 -0700 [thread overview]
Message-ID: <1411316838-15135-2-git-send-email-linux@roeck-us.net> (raw)
In-Reply-To: <1411316838-15135-1-git-send-email-linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
arch/cris/arch-v32/kernel/debugport.c | 41 +++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/arch/cris/arch-v32/kernel/debugport.c b/arch/cris/arch-v32/kernel/debugport.c
index 610909b..7e46d87 100644
--- a/arch/cris/arch-v32/kernel/debugport.c
+++ b/arch/cris/arch-v32/kernel/debugport.c
@@ -4,6 +4,7 @@
#include <linux/console.h>
#include <linux/init.h>
+
#include <hwregs/reg_rdwr.h>
#include <hwregs/reg_map.h>
#include <hwregs/ser_defs.h>
@@ -190,12 +191,52 @@ putDebugChar(int val)
}
#endif /* CONFIG_ETRAX_KGDB */
+static void __init early_putch(int c)
+{
+ reg_ser_r_stat_din stat;
+ /* Wait until transmitter is ready and send. */
+ do
+ stat = REG_RD(ser, port->instance, r_stat_din);
+ while (!stat.tr_rdy);
+ REG_WR_INT(ser, port->instance, rw_dout, c);
+}
+
+static void __init
+early_console_write(struct console *con, const char *s, unsigned n)
+{
+ extern void reset_watchdog(void);
+ int i;
+
+ /* Send data. */
+ for (i = 0; i < n; i++) {
+ /*
+ * TODO: the '\n' -> '\n\r' translation should be done at the
+ * receiver. Remove it when the serial driver removes it.
+ */
+ if (s[i] == '\n')
+ early_putch('\r');
+ early_putch(s[i]);
+ reset_watchdog();
+ }
+}
+
+static struct console early_console_dev __initdata = {
+ .name = "early",
+ .write = early_console_write,
+ .flags = CON_PRINTBUFFER | CON_BOOT,
+ .index = -1
+};
+
/* Register console for printk's, etc. */
int __init
init_etrax_debug(void)
{
start_port(port);
+ /* Register an early console if a debug port was chosen */
+ if (port)
+ register_console(&early_console_dev);
+
#ifdef CONFIG_ETRAX_KGDB
start_port(kgdb_port);
#endif /* CONFIG_ETRAX_KGDB */
--
1.9.1
next prev parent reply other threads:[~2014-09-21 16:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-21 16:27 [RFC PATCH 0/8] cris: Patches needed on top of v3.17-rc5 Guenter Roeck
2014-09-21 16:27 ` Guenter Roeck [this message]
2014-09-21 16:27 ` [RFC PATCH 2/8] cris: Add serial driver for Cris v32 Guenter Roeck
2014-09-21 16:27 ` [RFC PATCH 3/8] cris: Add dummy free_initrd_mem Guenter Roeck
2014-09-21 16:27 ` [RFC PATCH 4/8] cris: time.c: Add missing include file to fix compile error Guenter Roeck
2014-09-21 16:27 ` [RFC PATCH 5/8] cris: Add basic qemu_defconfig Guenter Roeck
2014-09-21 16:27 ` [RFC PATCH 6/8] tty: crisv32: Coding style cleanup, delete dead code Guenter Roeck
2014-09-21 16:27 ` [RFC PATCH 7/8] resource: Add NULL check in next_resource Guenter Roeck
2014-09-21 16:27 ` [RFC PATCH 8/8] Revert "percpu: free percpu allocation info for uniprocessor system" Guenter Roeck
2014-09-21 17:23 ` Mikael Starvik
2014-09-21 18:37 ` Guenter Roeck
2014-09-21 19:19 ` Waldemar Brodkorb
2014-09-21 20:08 ` Guenter Roeck
2014-09-21 21:12 ` Tejun Heo
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=1411316838-15135-2-git-send-email-linux@roeck-us.net \
--to=linux@roeck-us.net \
--cc=jespern@axis.com \
--cc=linux-cris-kernel@axis.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mail@waldemar-brodkorb.de \
--cc=starvik@axis.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.