]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/serial/serial_netarm.c
Merge remote-tracking branch 'u-boot-ti/master'
[karo-tx-uboot.git] / drivers / serial / serial_netarm.c
index 2eb5393404a2a114bfcb053af1f185bd0b288df9..44d7c500c798d9f436a399673b0dd8bb18563a5b 100644 (file)
@@ -51,20 +51,15 @@ DECLARE_GLOBAL_DATA_PTR;
 }
 
 
-#ifndef CONFIG_UART1_CONSOLE
 volatile netarm_serial_channel_t *serial_reg_ch1 = get_serial_channel(0);
 volatile netarm_serial_channel_t *serial_reg_ch2 = get_serial_channel(1);
-#else
-volatile netarm_serial_channel_t *serial_reg_ch1 = get_serial_channel(1);
-volatile netarm_serial_channel_t *serial_reg_ch2 = get_serial_channel(0);
-#endif
 
 extern void _netarm_led_FAIL1(void);
 
 /*
  * Setup both serial i/f with given baudrate
  */
-void serial_setbrg (void)
+static void netarm_serial_setbrg(void)
 {
        /* set 0 ... make sure pins are configured for serial */
 #if !defined(CONFIG_NETARM_NS7520)
@@ -113,7 +108,7 @@ void serial_setbrg (void)
  * Initialise the serial port with the given baudrate. The settings
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  */
-int serial_init (void)
+static int netarm_serial_init(void)
 {
        serial_setbrg ();
        return 0;
@@ -123,7 +118,7 @@ int serial_init (void)
 /*
  * Output a single byte to the serial port.
  */
-void serial_putc (const char c)
+static void netarm_serial_putc(const char c)
 {
        volatile unsigned char *fifo;
 
@@ -140,7 +135,7 @@ void serial_putc (const char c)
  * Test of a single byte from the serial port. Returns 1 on success, 0
  * otherwise.
  */
-int serial_tstc(void)
+static int netarm_serial_tstc(void)
 {
        return serial_reg_ch1->status_a & NETARM_SER_STATA_RX_RDY;
 }
@@ -149,7 +144,7 @@ int serial_tstc(void)
  * Read a single byte from the serial port. Returns 1 on success, 0
  * otherwise.
  */
-int serial_getc (void)
+static int netarm_serial_getc(void)
 {
        unsigned int ch_uint;
        volatile unsigned int *fifo;
@@ -187,9 +182,23 @@ int serial_getc (void)
        return ch_uint & 0xff;
 }
 
-void serial_puts (const char *s)
+static struct serial_device netarm_serial_drv = {
+       .name   = "netarm_serial",
+       .start  = netarm_serial_init,
+       .stop   = NULL,
+       .setbrg = netarm_serial_setbrg,
+       .putc   = netarm_serial_putc,
+       .puts   = default_serial_puts,
+       .getc   = netarm_serial_getc,
+       .tstc   = netarm_serial_tstc,
+};
+
+void netarm_serial_initialize(void)
 {
-       while (*s) {
-               serial_putc (*s++);
-       }
+       serial_register(&netarm_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+       return &netarm_serial_drv;
 }