serial_initfunc(s3c64xx_serial_initialize);
serial_initfunc(sandbox_serial_initialize);
serial_initfunc(clps7111_serial_initialize);
+serial_initfunc(imx_serial_initialize);
void serial_register(struct serial_device *dev)
{
s3c64xx_serial_initialize();
sandbox_serial_initialize();
clps7111_serial_initialize();
+ imx_serial_initialize();
serial_assign(default_serial_console()->name);
}
#include <common.h>
#include <asm/arch/imx-regs.h>
+#include <serial.h>
+#include <linux/compiler.h>
#if defined CONFIG_IMX_SERIAL1
#define UART_BASE IMX_UART1_BASE
DECLARE_GLOBAL_DATA_PTR;
-void serial_setbrg (void)
+static void imx_serial_setbrg(void)
{
serial_init();
}
* are always 8 data bits, no parity, 1 stop bit, no start bits.
*
*/
-int serial_init (void)
+static int imx_serial_init(void)
{
volatile struct imx_serial* base = (struct imx_serial *)UART_BASE;
unsigned int ufcr_rfdiv;
* otherwise. When the function is successful, the character read is
* written into its argument c.
*/
-int serial_getc (void)
+static int imx_serial_getc(void)
{
volatile struct imx_serial* base = (struct imx_serial *)UART_BASE;
unsigned char ch;
/*
* Output a single byte to the serial port.
*/
-void serial_putc (const char c)
+static void imx_serial_putc(const char c)
{
volatile struct imx_serial* base = (struct imx_serial *)UART_BASE;
/*
* Test whether a character is in the RX buffer
*/
-int serial_tstc (void)
+static int imx_serial_tstc(void)
{
volatile struct imx_serial* base = (struct imx_serial *)UART_BASE;
return 1;
}
-void
-serial_puts (const char *s)
+static void imx_serial_puts(const char *s)
{
while (*s) {
serial_putc (*s++);
}
}
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device imx_serial_drv = {
+ .name = "imx_serial",
+ .start = imx_serial_init,
+ .stop = NULL,
+ .setbrg = imx_serial_setbrg,
+ .putc = imx_serial_putc,
+ .puts = imx_serial_puts,
+ .getc = imx_serial_getc,
+ .tstc = imx_serial_tstc,
+};
+
+void imx_serial_initialize(void)
+{
+ serial_register(&imx_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+ return &imx_serial_drv;
+}
+#else
+int serial_init(void)
+{
+ return imx_serial_init();
+}
+
+void serial_setbrg(void)
+{
+ imx_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+ imx_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+ imx_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+ return imx_serial_getc();
+}
+
+int serial_tstc(void)
+{
+ return imx_serial_tstc();
+}
+#endif