]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/serial/ns9750_serial.c
Merge branch 'u-boot-imx/master' into 'u-boot-arm/master'
[karo-tx-uboot.git] / drivers / serial / ns9750_serial.c
index e9645a053de19166153314f5fe3b0022d65d3a66..85fc68a07609bf0b7e04a3ba01fbaba6416ee1b6 100644 (file)
@@ -52,7 +52,7 @@ static unsigned int unCharCache; /* unCharCache is only valid if
  * @Descr: configures GPIOs and UART. Requires BBUS Master Reset turned off
  ***********************************************************************/
 
-int serial_init( void )
+static int ns9750_serial_init(void)
 {
        unsigned int aunGPIOTxD[] = { 0, 8, 40, 44 };
        unsigned int aunGPIORxD[] = { 1, 9, 41, 45 };
@@ -85,7 +85,7 @@ int serial_init( void )
  * @Descr: writes one character to the FIFO. Blocks until FIFO is not full
  ***********************************************************************/
 
-void serial_putc( const char c )
+static void ns9750_serial_putc(const char c)
 {
        if (c == '\n')
                serial_putc( '\r' );
@@ -99,26 +99,13 @@ void serial_putc( const char c )
                                                    CONSOLE) = c;
 }
 
-/***********************************************************************
- * @Function: serial_puts
- * @Return: n/a
- * @Descr: writes non-zero string to the FIFO.
- ***********************************************************************/
-
-void serial_puts( const char *s )
-{
-       while (*s) {
-               serial_putc( *s++ );
-       }
-}
-
 /***********************************************************************
  * @Function: serial_getc
  * @Return: the character read
  * @Descr: performs only 8bit accesses to the FIFO. No error handling
  ***********************************************************************/
 
-int serial_getc( void )
+static int ns9750_serial_getc(void)
 {
        int i;
 
@@ -142,7 +129,7 @@ int serial_getc( void )
  *        unCharCache and the numbers of characters in cCharsAvailable
  ***********************************************************************/
 
-int serial_tstc( void )
+static int ns9750_serial_tstc(void)
 {
        unsigned int unRegCache;
 
@@ -171,7 +158,7 @@ int serial_tstc( void )
        return 0;
 }
 
-void serial_setbrg( void )
+static void ns9750_serial_setbrg(void)
 {
        *get_ser_reg_addr_channel( NS9750_SER_BITRATE, CONSOLE ) =
                calcBitrateRegister();
@@ -208,3 +195,24 @@ static unsigned int calcRxCharGapRegister( void )
 {
        return NS9750_SER_RX_CHAR_TIMER_TRUN;
 }
+
+static struct serial_device ns9750_serial_drv = {
+       .name   = "ns9750_serial",
+       .start  = ns9750_serial_init,
+       .stop   = NULL,
+       .setbrg = ns9750_serial_setbrg,
+       .putc   = ns9750_serial_putc,
+       .puts   = default_serial_puts,
+       .getc   = ns9750_serial_getc,
+       .tstc   = ns9750_serial_tstc,
+};
+
+void ns9750_serial_initialize(void)
+{
+       serial_register(&ns9750_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+       return &ns9750_serial_drv;
+}