]> git.sur5r.net Git - u-boot/commitdiff
serial: bfin: Flip the jtag serial console to CONFIG_SERIAL_MULTI
authorMarek Vasut <marex@denx.de>
Wed, 12 Sep 2012 22:02:54 +0000 (00:02 +0200)
committerTom Rini <trini@ti.com>
Mon, 15 Oct 2012 18:53:51 +0000 (11:53 -0700)
Rework the emulation of serial console via JTAG from simple ad-hoc
implementation of serial port routines to CONFIG_SERIAL_MULTI and
enable CONFIG_SERIAL_MULTI unconditionally for blackfin.

In order for the JTAG serial console to take precedence over all
other serial ports available in system, implement override for
default_serial_console call returning this JTAG serial console.

This brings in a bit of a growth of size, but eventually will allow
us to unconditionally enable CONFIG_SERIAL_MULTI throughout the whole
U-Boot and maintain only one serial subsystem.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Mike Frysinger <vapier@gentoo.org>
arch/blackfin/cpu/jtag-console.c
common/serial.c
include/configs/bfin_adi_common.h

index a77358a88ae3c1dea4a952fdc5b3b989c0142e1d..7cddb85a7f3cf779dffeba4811218a48e7e45648 100644 (file)
@@ -194,12 +194,35 @@ int drv_jtag_console_init(void)
 }
 
 #ifdef CONFIG_UART_CONSOLE_IS_JTAG
+#include <serial.h>
 /* Since the JTAG is always available (at power on), allow it to fake a UART */
-void serial_set_baud(uint32_t baud) {}
-void serial_setbrg(void)            {}
-int serial_init(void)               { return 0; }
-void serial_putc(const char c)      __attribute__((alias("jtag_putc")));
-void serial_puts(const char *s)     __attribute__((alias("jtag_puts")));
-int serial_tstc(void)               __attribute__((alias("jtag_tstc")));
-int serial_getc(void)               __attribute__((alias("jtag_getc")));
+void jtag_serial_setbrg(void)
+{
+}
+
+int jtag_serial_init(void)
+{
+       return 0;
+}
+
+static struct serial_device serial_jtag_drv = {
+       .name   = "jtag",
+       .start  = jtag_serial_init,
+       .stop   = NULL,
+       .setbrg = jtag_serial_setbrg,
+       .putc   = jtag_putc,
+       .puts   = jtag_puts,
+       .tstc   = jtag_tstc,
+       .getc   = jtag_getc,
+};
+
+void bfin_jtag_initialize(void)
+{
+       serial_register(&serial_jtag_drv);
+}
+
+struct serial_device *default_serial_console(void)
+{
+       return &serial_jtag_drv;
+}
 #endif
index 545f9e7ec067055e75be2d1c98ff564fd292fe24..dca2dc996632a47d4e26bb6c65864c7f5346d84e 100644 (file)
@@ -47,6 +47,7 @@ serial_initfunc(s3c24xx_serial_initialize);
 serial_initfunc(s5p_serial_initialize);
 serial_initfunc(zynq_serial_initalize);
 serial_initfunc(bfin_serial_initialize);
+serial_initfunc(bfin_jtag_initialize);
 serial_initfunc(mpc512x_serial_initialize);
 serial_initfunc(uartlite_serial_initialize);
 
@@ -74,6 +75,7 @@ void serial_initialize(void)
        s5p_serial_initialize();
        mpc512x_serial_initialize();
        bfin_serial_initialize();
+       bfin_jtag_initialize();
        uartlite_serial_initialize();
        zynq_serial_initalize();
        serial_assign(default_serial_console()->name);
index c98c26d1d8eb7967dc1f9ea4ace282d0c40469f7..063e65e77edae0d5ccdb9bffe528406fb80c9b02 100644 (file)
 #define CONFIG_LOADS_ECHO      1
 #define CONFIG_JTAG_CONSOLE
 #define CONFIG_SILENT_CONSOLE
+#define CONFIG_SERIAL_MULTI
 #ifndef CONFIG_BAUDRATE
 # define CONFIG_BAUDRATE       57600
 #endif
 #ifndef CONFIG_DEBUG_EARLY_SERIAL
-# define CONFIG_SERIAL_MULTI
 # define CONFIG_SYS_BFIN_UART
 #endif