]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/serial/serial_sa1100.c
mtd: nand: omap: fix error-codes returned from omap-elm driver
[karo-tx-uboot.git] / drivers / serial / serial_sa1100.c
index 5d1887580d7f8ed55c75af8c1b994531f33ab9dd..78f241d8508f38d80a82f1aa9f63065a449de51b 100644 (file)
  *
  * Copyright (C) 1999 2000 2001 Erik Mouw (J.A.K.Mouw@its.tudelft.nl)
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
 #include <SA-1100.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void serial_setbrg (void)
+static void sa1100_serial_setbrg(void)
 {
        unsigned int reg = 0;
 
@@ -89,7 +78,7 @@ void serial_setbrg (void)
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  *
  */
-int serial_init (void)
+static int sa1100_serial_init(void)
 {
        serial_setbrg ();
 
@@ -100,7 +89,7 @@ int serial_init (void)
 /*
  * Output a single byte to the serial port.
  */
-void serial_putc (const char c)
+static void sa1100_serial_putc(const char c)
 {
 #ifdef CONFIG_SERIAL1
        /* wait for room in the tx FIFO on SERIAL1 */
@@ -124,7 +113,7 @@ void serial_putc (const char c)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_tstc (void)
+static int sa1100_serial_tstc(void)
 {
 #ifdef CONFIG_SERIAL1
        return Ser1UTSR1 & UTSR1_RNE;
@@ -138,7 +127,7 @@ int serial_tstc (void)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_getc (void)
+static int sa1100_serial_getc(void)
 {
 #ifdef CONFIG_SERIAL1
        while (!(Ser1UTSR1 & UTSR1_RNE));
@@ -151,10 +140,23 @@ int serial_getc (void)
 #endif
 }
 
-void
-serial_puts (const char *s)
+static struct serial_device sa1100_serial_drv = {
+       .name   = "sa1100_serial",
+       .start  = sa1100_serial_init,
+       .stop   = NULL,
+       .setbrg = sa1100_serial_setbrg,
+       .putc   = sa1100_serial_putc,
+       .puts   = default_serial_puts,
+       .getc   = sa1100_serial_getc,
+       .tstc   = sa1100_serial_tstc,
+};
+
+void sa1100_serial_initialize(void)
 {
-       while (*s) {
-               serial_putc (*s++);
-       }
+       serial_register(&sa1100_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+       return &sa1100_serial_drv;
 }