diff options
Diffstat (limited to 'arch/mips/cpu')
-rw-r--r-- | arch/mips/cpu/mips32/au1x00/au1x00_serial.c | 42 | ||||
-rw-r--r-- | arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c | 4 | ||||
-rw-r--r-- | arch/mips/cpu/mips32/incaip/asc_serial.c | 35 | ||||
-rw-r--r-- | arch/mips/cpu/xburst/jz_serial.c | 35 |
4 files changed, 92 insertions, 24 deletions
diff --git a/arch/mips/cpu/mips32/au1x00/au1x00_serial.c b/arch/mips/cpu/mips32/au1x00/au1x00_serial.c index c25ba5a5b3..0beac98fde 100644 --- a/arch/mips/cpu/mips32/au1x00/au1x00_serial.c +++ b/arch/mips/cpu/mips32/au1x00/au1x00_serial.c @@ -28,6 +28,8 @@ #include <config.h> #include <common.h> #include <asm/au1x00.h> +#include <serial.h> +#include <linux/compiler.h> /****************************************************************************** * @@ -40,7 +42,7 @@ * RETURNS: N/A */ -int serial_init (void) +static int au1x00_serial_init(void) { volatile u32 *uart_fifoctl = (volatile u32*)(UART0_ADDR+UART_FCR); volatile u32 *uart_enable = (volatile u32*)(UART0_ADDR+UART_ENABLE); @@ -63,7 +65,7 @@ int serial_init (void) } -void serial_setbrg (void) +static void au1x00_serial_setbrg(void) { volatile u32 *uart_clk = (volatile u32*)(UART0_ADDR+UART_CLK); volatile u32 *uart_lcr = (volatile u32*)(UART0_ADDR+UART_LCR); @@ -87,12 +89,13 @@ void serial_setbrg (void) *uart_lcr = UART_LCR_WLEN8; } -void serial_putc (const char c) +static void au1x00_serial_putc(const char c) { volatile u32 *uart_lsr = (volatile u32*)(UART0_ADDR+UART_LSR); volatile u32 *uart_tx = (volatile u32*)(UART0_ADDR+UART_TX); - if (c == '\n') serial_putc ('\r'); + if (c == '\n') + au1x00_serial_putc('\r'); /* Wait for fifo to shift out some bytes */ while((*uart_lsr&UART_LSR_THRE)==0); @@ -100,15 +103,13 @@ void serial_putc (const char c) *uart_tx = (u32)c; } -void serial_puts (const char *s) +static void au1x00_serial_puts(const char *s) { while (*s) - { - serial_putc (*s++); - } + serial_putc(*s++); } -int serial_getc (void) +static int au1x00_serial_getc(void) { volatile u32 *uart_rx = (volatile u32*)(UART0_ADDR+UART_RX); char c; @@ -119,7 +120,7 @@ int serial_getc (void) return c; } -int serial_tstc (void) +static int au1x00_serial_tstc(void) { volatile u32 *uart_lsr = (volatile u32*)(UART0_ADDR+UART_LSR); @@ -129,3 +130,24 @@ int serial_tstc (void) } return 0; } + +static struct serial_device au1x00_serial_drv = { + .name = "au1x00_serial", + .start = au1x00_serial_init, + .stop = NULL, + .setbrg = au1x00_serial_setbrg, + .putc = au1x00_serial_putc, + .puts = au1x00_serial_puts, + .getc = au1x00_serial_getc, + .tstc = au1x00_serial_tstc, +}; + +void au1x00_serial_initialize(void) +{ + serial_register(&au1x00_serial_drv); +} + +__weak struct serial_device *default_serial_console(void) +{ + return &au1x00_serial_drv; +} diff --git a/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c b/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c index 7647e11841..c747767e1e 100644 --- a/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c +++ b/arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c @@ -1565,7 +1565,7 @@ static void hc_release_ohci (ohci_t *ohci) */ static char ohci_inited = 0; -int usb_lowlevel_init(void) +int usb_lowlevel_init(int index, void **controller) { u32 pin_func; u32 sys_freqctrl, sys_clksrc; @@ -1707,7 +1707,7 @@ int usb_lowlevel_init(void) return -1; } -int usb_lowlevel_stop(void) +int usb_lowlevel_stop(int index) { /* this gets called really early - before the controller has */ /* even been initialized! */ diff --git a/arch/mips/cpu/mips32/incaip/asc_serial.c b/arch/mips/cpu/mips32/incaip/asc_serial.c index 7239804b9d..08949f4fb0 100644 --- a/arch/mips/cpu/mips32/incaip/asc_serial.c +++ b/arch/mips/cpu/mips32/incaip/asc_serial.c @@ -5,6 +5,8 @@ #include <config.h> #include <common.h> #include <asm/inca-ip.h> +#include <serial.h> +#include <linux/compiler.h> #include "asc_serial.h" @@ -32,7 +34,7 @@ static volatile incaAsc_t *pAsc = (incaAsc_t *)INCA_IP_ASC; * RETURNS: N/A */ -int serial_init (void) +static int asc_serial_init(void) { /* we have to set PMU.EN13 bit to enable an ASC device*/ INCAASC_PMU_ENABLE(13); @@ -82,7 +84,7 @@ int serial_init (void) return 0; } -void serial_setbrg (void) +static void asc_serial_setbrg(void) { ulong uiReloadValue, fdv; ulong f_ASC; @@ -210,7 +212,7 @@ static int serial_setopt (void) return 0; } -void serial_putc (const char c) +static void asc_serial_putc(const char c) { uint txFl = 0; @@ -234,7 +236,7 @@ void serial_putc (const char c) } } -void serial_puts (const char *s) +static void asc_serial_puts(const char *s) { while (*s) { @@ -242,7 +244,7 @@ void serial_puts (const char *s) } } -int serial_getc (void) +static int asc_serial_getc(void) { ulong symbol_mask; char c; @@ -257,7 +259,7 @@ int serial_getc (void) return c; } -int serial_tstc (void) +static int asc_serial_tstc(void) { int res = 1; @@ -283,3 +285,24 @@ int serial_tstc (void) return res; } + +static struct serial_device asc_serial_drv = { + .name = "asc_serial", + .start = asc_serial_init, + .stop = NULL, + .setbrg = asc_serial_setbrg, + .putc = asc_serial_putc, + .puts = asc_serial_puts, + .getc = asc_serial_getc, + .tstc = asc_serial_tstc, +}; + +void asc_serial_initialize(void) +{ + serial_register(&asc_serial_drv); +} + +__weak struct serial_device *default_serial_console(void) +{ + return &asc_serial_drv; +} diff --git a/arch/mips/cpu/xburst/jz_serial.c b/arch/mips/cpu/xburst/jz_serial.c index e6c48e0890..3199007757 100644 --- a/arch/mips/cpu/xburst/jz_serial.c +++ b/arch/mips/cpu/xburst/jz_serial.c @@ -23,6 +23,8 @@ #include <common.h> #include <asm/io.h> #include <asm/jz4740.h> +#include <serial.h> +#include <linux/compiler.h> /* * serial_init - initialize a channel @@ -35,7 +37,7 @@ */ struct jz4740_uart *uart = (struct jz4740_uart *)CONFIG_SYS_UART_BASE; -int serial_init(void) +static int jz_serial_init(void) { /* Disable port interrupts while changing hardware */ writeb(0, &uart->dlhr_ier); @@ -62,7 +64,7 @@ int serial_init(void) return 0; } -void serial_setbrg(void) +static void jz_serial_setbrg(void) { u32 baud_div, tmp; @@ -79,7 +81,7 @@ void serial_setbrg(void) writeb(tmp, &uart->lcr); } -int serial_tstc(void) +static int jz_serial_tstc(void) { if (readb(&uart->lsr) & UART_LSR_DR) return 1; @@ -87,7 +89,7 @@ int serial_tstc(void) return 0; } -void serial_putc(const char c) +static void jz_serial_putc(const char c) { if (c == '\n') serial_putc('\r'); @@ -99,7 +101,7 @@ void serial_putc(const char c) writeb((u8)c, &uart->rbr_thr_dllr); } -int serial_getc(void) +static int jz_serial_getc(void) { while (!serial_tstc()) ; @@ -107,8 +109,29 @@ int serial_getc(void) return readb(&uart->rbr_thr_dllr); } -void serial_puts(const char *s) +static void jz_serial_puts(const char *s) { while (*s) serial_putc(*s++); } + +static struct serial_device jz_serial_drv = { + .name = "jz_serial", + .start = jz_serial_init, + .stop = NULL, + .setbrg = jz_serial_setbrg, + .putc = jz_serial_putc, + .puts = jz_serial_puts, + .getc = jz_serial_getc, + .tstc = jz_serial_tstc, +}; + +void jz_serial_initialize(void) +{ + serial_register(&jz_serial_drv); +} + +__weak struct serial_device *default_serial_console(void) +{ + return &jz_serial_drv; +} |