summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2012-09-13 12:34:49 +0200
committerTom Rini <trini@ti.com>2012-10-15 11:53:53 -0700
commit26d8eaaa48a9fda94a1bbbf02610dcec5eb8bf9f (patch)
tree5af9ea0026921157bc6d1a2227fd9a7f1d38f088 /board
parentd126f2850fb6dc3d828332c9fceb408128871fa3 (diff)
downloadu-boot-imx-26d8eaaa48a9fda94a1bbbf02610dcec5eb8bf9f.zip
u-boot-imx-26d8eaaa48a9fda94a1bbbf02610dcec5eb8bf9f.tar.gz
u-boot-imx-26d8eaaa48a9fda94a1bbbf02610dcec5eb8bf9f.tar.bz2
serial: powerpc: Implement CONFIG_SERIAL_MULTI into sconsole serial driver
Implement support for CONFIG_SERIAL_MULTI into sconsole serial driver. This driver was so far only usable directly, but this patch also adds support for the multi method. This allows using more than one serial driver alongside the sconsole driver. Also, add a weak implementation of default_serial_console() returning this driver. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Marek Vasut <marek.vasut@gmail.com> Cc: Tom Rini <trini@ti.com> Cc: Anatolij Gustschin <agust@denx.de> Cc: Stefan Roese <sr@denx.de>
Diffstat (limited to 'board')
-rw-r--r--board/pcippc2/sconsole.c66
1 files changed, 60 insertions, 6 deletions
diff --git a/board/pcippc2/sconsole.c b/board/pcippc2/sconsole.c
index 6ef38f4..0a31963 100644
--- a/board/pcippc2/sconsole.c
+++ b/board/pcippc2/sconsole.c
@@ -23,6 +23,8 @@
#include <config.h>
#include <common.h>
+#include <serial.h>
+#include <linux/compiler.h>
#include "sconsole.h"
@@ -34,7 +36,7 @@ int (*sconsole_getc) (void) = 0;
int (*sconsole_tstc) (void) = 0;
void (*sconsole_setbrg) (void) = 0;
-int serial_init (void)
+static int sconsole_serial_init(void)
{
sconsole_buffer_t *sb = SCONSOLE_BUFFER;
@@ -46,7 +48,7 @@ int serial_init (void)
return (0);
}
-void serial_putc (char c)
+static void sconsole_serial_putc(char c)
{
if (sconsole_putc) {
(*sconsole_putc) (c);
@@ -65,7 +67,7 @@ void serial_putc (char c)
}
}
-void serial_puts (const char *s)
+static void sconsole_serial_puts(const char *s)
{
if (sconsole_puts) {
(*sconsole_puts) (s);
@@ -84,7 +86,7 @@ void serial_puts (const char *s)
}
}
-int serial_getc (void)
+static int sconsole_serial_getc(void)
{
if (sconsole_getc) {
return (*sconsole_getc) ();
@@ -93,7 +95,7 @@ int serial_getc (void)
}
}
-int serial_tstc (void)
+static int sconsole_serial_tstc(void)
{
if (sconsole_tstc) {
return (*sconsole_tstc) ();
@@ -102,7 +104,7 @@ int serial_tstc (void)
}
}
-void serial_setbrg (void)
+static void sconsole_serial_setbrg(void)
{
if (sconsole_setbrg) {
(*sconsole_setbrg) ();
@@ -113,6 +115,58 @@ void serial_setbrg (void)
}
}
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device sconsole_serial_drv = {
+ .name = "sconsole_serial",
+ .start = sconsole_serial_init,
+ .stop = NULL,
+ .setbrg = sconsole_serial_setbrg,
+ .putc = sconsole_serial_putc,
+ .puts = sconsole_serial_puts,
+ .getc = sconsole_serial_getc,
+ .tstc = sconsole_serial_tstc,
+};
+
+void sconsole_serial_initialize(void)
+{
+ serial_register(&sconsole_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+ return &sconsole_serial_drv;
+}
+#else
+int serial_init(void)
+{
+ return sconsole_serial_init();
+}
+
+void serial_setbrg(void)
+{
+ sconsole_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+ sconsole_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+ sconsole_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+ return sconsole_serial_getc();
+}
+
+int serial_tstc(void)
+{
+ return sconsole_serial_tstc();
+}
+#endif
int sconsole_get_baudrate (void)
{
sconsole_buffer_t *sb = SCONSOLE_BUFFER;