we use for the serail multi api the struct stdio_dev also which will reduce
and simplify the code and prepare the join of all serial APIs.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
---
 board/esd/pmc440/pmc440.c        |    2 +-
 board/lwmon/lwmon.c              |    2 +-
 board/omap3/zoom2/zoom2_serial.h |   18 +++---
 board/trizepsiv/conxs.c          |    8 ++--
 common/serial.c                  |   89 +++++++++++++++----------------
 common/stdio.c                   |    3 -
 cpu/mpc5xxx/serial.c             |   36 ++++++------
 cpu/mpc8xx/serial.c              |   36 ++++++------
 cpu/ppc4xx/4xx_uart.c            |   38 +++++++-------
 drivers/serial/serial.c          |   24 ++++----
 drivers/serial/serial_pxa.c      |   54 +++++++++---------
 drivers/serial/serial_s3c24x0.c  |   22 ++++----
 include/serial.h                 |  109 ++++++++++++++++---------------------
 include/stdio_dev.h              |    9 +++-
 14 files changed, 218 insertions(+), 232 deletions(-)
 rewrite include/serial.h (65%)

diff --git a/board/esd/pmc440/pmc440.c b/board/esd/pmc440/pmc440.c
index 9ffb08e..de01e93 100644
--- a/board/esd/pmc440/pmc440.c
+++ b/board/esd/pmc440/pmc440.c
@@ -53,7 +53,7 @@ int is_monarch(void);
 int bootstrap_eeprom_read(unsigned dev_addr, unsigned offset,
                          uchar *buffer, unsigned cnt);
 
-struct serial_device *default_serial_console(void)
+struct stdio_dev *default_serial_console(void)
 {
        uchar buf[4];
        ulong delay;
diff --git a/board/lwmon/lwmon.c b/board/lwmon/lwmon.c
index 75b3209..b380c6c 100644
--- a/board/lwmon/lwmon.c
+++ b/board/lwmon/lwmon.c
@@ -469,7 +469,7 @@ int board_postclk_init (void)
        return (0);
 }
 
-struct serial_device * default_serial_console (void)
+struct stdio_dev * default_serial_console (void)
 {
        return gd->do_mdm_init ? &serial_scc_device : &serial_smc_device;
 }
diff --git a/board/omap3/zoom2/zoom2_serial.h b/board/omap3/zoom2/zoom2_serial.h
index c98158f..c963dc2 100644
--- a/board/omap3/zoom2/zoom2_serial.h
+++ b/board/omap3/zoom2/zoom2_serial.h
@@ -60,16 +60,16 @@ int quad_tstc_##n(void)                             \
 {                                              \
        return quad_tstc_dev(QUAD_BASE_##n);    \
 }                                              \
-struct serial_device zoom2_serial_device##n =  \
+struct stdio_dev zoom2_serial_device##n =      \
 {                                              \
-       N(n),                                   \
-       U(n),                                   \
-       quad_init_##n,                          \
-       quad_setbrg_##n,                        \
-       quad_getc_##n,                          \
-       quad_tstc_##n,                          \
-       quad_putc_##n,                          \
-       quad_puts_##n,                          \
+       .name = N(n),                           \
+       .ctlr = U(n),                           \
+       .start = quad_init_##n,                 \
+       .setbrg = quad_setbrg_##n,              \
+       .getc = quad_getc_##n,                  \
+       .tstc = quad_tstc_##n,                  \
+       .putc = quad_putc_##n,                  \
+       .puts = quad_puts_##n,                  \
 };
 
 #endif /* ZOOM2_SERIAL_H */
diff --git a/board/trizepsiv/conxs.c b/board/trizepsiv/conxs.c
index 8c11456..e88c86c 100644
--- a/board/trizepsiv/conxs.c
+++ b/board/trizepsiv/conxs.c
@@ -40,9 +40,9 @@ DECLARE_GLOBAL_DATA_PTR;
 #define                RH_A_PSM        (1 << 8)        /* power switching mode 
*/
 #define                RH_A_NPS        (1 << 9)        /* no power switching */
 
-extern struct serial_device serial_ffuart_device;
-extern struct serial_device serial_btuart_device;
-extern struct serial_device serial_stuart_device;
+extern struct stdio_dev serial_ffuart_device;
+extern struct stdio_dev serial_btuart_device;
+extern struct stdio_dev serial_stuart_device;
 
 #if CONFIG_POLARIS
 #define BOOT_CONSOLE   "serial_stuart"
@@ -130,7 +130,7 @@ int board_late_init(void)
        return 0;
 }
 
-struct serial_device *default_serial_console (void)
+struct stdio_dev *default_serial_console (void)
 {
        return &serial_ffuart_device;
 }
diff --git a/common/serial.c b/common/serial.c
index 41a24c2..f85a52e 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -27,11 +27,10 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static struct serial_device *serial_devices = NULL;
-static struct serial_device *serial_current = NULL;
+static struct stdio_dev *serial_current = NULL;
 
 #if !defined(CONFIG_LWMON) && !defined(CONFIG_PXA27X)
-struct serial_device *__default_serial_console (void)
+struct stdio_dev *__default_serial_console (void)
 {
 #if defined(CONFIG_8xx_CONS_SMC1) || defined(CONFIG_8xx_CONS_SMC2)
        return &serial_smc_device;
@@ -76,20 +75,20 @@ struct serial_device *__default_serial_console (void)
 #endif
 }
 
-struct serial_device *default_serial_console(void) __attribute__((weak, 
alias("__default_serial_console")));
+struct stdio_dev *default_serial_console(void) __attribute__((weak, 
alias("__default_serial_console")));
 #endif
 
-int serial_register (struct serial_device *dev)
+int serial_register (struct stdio_dev *dev)
 {
-       dev->init += gd->reloc_off;
+       dev->flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT | DEV_FLAGS_SERIAL;
+       dev->start += gd->reloc_off;
        dev->setbrg += gd->reloc_off;
        dev->getc += gd->reloc_off;
        dev->tstc += gd->reloc_off;
        dev->putc += gd->reloc_off;
        dev->puts += gd->reloc_off;
 
-       dev->next = serial_devices;
-       serial_devices = dev;
+       stdio_register(dev);
 
        return 0;
 }
@@ -142,67 +141,65 @@ void serial_initialize (void)
        serial_assign (default_serial_console ()->name);
 }
 
-void serial_stdio_init (void)
+static struct stdio_dev* serial_get_by_name(char* name)
 {
-       struct stdio_dev dev;
-       struct serial_device *s = serial_devices;
+       struct stdio_dev *dev = stdio_get_by_name(name);
 
-       while (s) {
-               memset (&dev, 0, sizeof (dev));
+       if (!dev || (dev->flags & DEV_FLAGS_SERIAL) != DEV_FLAGS_SERIAL)
+               return NULL;
 
-               strcpy (dev.name, s->name);
-               dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT;
-
-               dev.start = s->init;
-               dev.putc = s->putc;
-               dev.puts = s->puts;
-               dev.getc = s->getc;
-               dev.tstc = s->tstc;
-
-               stdio_register (&dev);
-
-               s = s->next;
-       }
+       return dev;
 }
 
 int serial_assign (char *name)
 {
-       struct serial_device *s;
+       struct stdio_dev *s = serial_get_by_name(name);
 
-       for (s = serial_devices; s; s = s->next) {
-               if (strcmp (s->name, name) == 0) {
-                       serial_current = s;
-                       return 0;
-               }
-       }
+       if (!s)
+               return 1;
 
-       return 1;
+       serial_current = s;
+       return 0;
 }
 
 void serial_reinit_all (void)
 {
-       struct serial_device *s;
-
-       for (s = serial_devices; s; s = s->next) {
-               s->init ();
+       struct list_head *pos;
+       struct stdio_dev *dev;
+       struct list_head *head = stdio_get_list();
+
+       list_for_each(pos, head) {
+               dev = list_entry(pos, struct stdio_dev, list);
+               if ((dev->flags & DEV_FLAGS_SERIAL) != DEV_FLAGS_SERIAL)
+                       continue;
+               if (dev->stop)
+                       dev->stop ();
+               if (dev->start)
+                       dev->start ();
        }
 }
 
 int serial_init (void)
 {
        if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
-               struct serial_device *dev = default_serial_console ();
+               struct stdio_dev *dev = default_serial_console ();
+
+               if (dev->start)
+                       return dev->start ();
 
-               return dev->init ();
+               return 0;
        }
 
-       return serial_current->init ();
+       if (serial_current->start)
+               return serial_current->start ();
+
+       return 0;
 }
 
 void serial_setbrg (void)
 {
        if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
-               struct serial_device *dev = default_serial_console ();
+               struct stdio_dev *dev = default_serial_console ();
 
                dev->setbrg ();
                return;
@@ -214,7 +211,7 @@ void serial_setbrg (void)
 int serial_getc (void)
 {
        if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
-               struct serial_device *dev = default_serial_console ();
+               struct stdio_dev *dev = default_serial_console ();
 
                return dev->getc ();
        }
@@ -225,7 +222,7 @@ int serial_getc (void)
 int serial_tstc (void)
 {
        if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
-               struct serial_device *dev = default_serial_console ();
+               struct stdio_dev *dev = default_serial_console ();
 
                return dev->tstc ();
        }
@@ -236,7 +233,7 @@ int serial_tstc (void)
 void serial_putc (const char c)
 {
        if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
-               struct serial_device *dev = default_serial_console ();
+               struct stdio_dev *dev = default_serial_console ();
 
                dev->putc (c);
                return;
@@ -248,7 +245,7 @@ void serial_putc (const char c)
 void serial_puts (const char *s)
 {
        if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
-               struct serial_device *dev = default_serial_console ();
+               struct stdio_dev *dev = default_serial_console ();
 
                dev->puts (s);
                return;
diff --git a/common/stdio.c b/common/stdio.c
index 697df5a..7de7d00 100644
--- a/common/stdio.c
+++ b/common/stdio.c
@@ -234,9 +234,6 @@ int stdio_init (void)
        drv_logbuff_init ();
 #endif
        drv_system_init ();
-#ifdef CONFIG_SERIAL_MULTI
-       serial_stdio_init ();
-#endif
 #ifdef CONFIG_USB_TTY
        drv_usbtty_init ();
 #endif
diff --git a/cpu/mpc5xxx/serial.c b/cpu/mpc5xxx/serial.c
index a8a384a..ce543a6 100644
--- a/cpu/mpc5xxx/serial.c
+++ b/cpu/mpc5xxx/serial.c
@@ -352,28 +352,28 @@ int serial1_tstc(void)
        return (serial_tstc_dev(PSC_BASE2));
 }
 
-struct serial_device serial0_device =
+struct stdio_dev serial0_device =
 {
-       "serial0",
-       "UART0",
-       serial0_init,
-       serial0_setbrg,
-       serial0_getc,
-       serial0_tstc,
-       serial0_putc,
-       serial0_puts,
+       .name = "serial0",
+       .ctlr = "UART0",
+       .start = serial0_init,
+       .setbrg = serial0_setbrg,
+       .getc = serial0_getc,
+       .tstc = serial0_tstc,
+       .putc = serial0_putc,
+       .puts = serial0_puts,
 };
 
-struct serial_device serial1_device =
+struct stdio_dev serial1_device =
 {
-       "serial1",
-       "UART1",
-       serial1_init,
-       serial1_setbrg,
-       serial1_getc,
-       serial1_tstc,
-       serial1_putc,
-       serial1_puts,
+       .name = "serial1",
+       .ctlr = "UART1",
+       .start = serial1_init,
+       .setbrg = serial1_setbrg,
+       .getc = serial1_getc,
+       .tstc = serial1_tstc,
+       .putc = serial1_putc,
+       .puts = serial1_puts,
 };
 #endif /* CONFIG_SERIAL_MULTI */
 
diff --git a/cpu/mpc8xx/serial.c b/cpu/mpc8xx/serial.c
index 664db65..7727013 100644
--- a/cpu/mpc8xx/serial.c
+++ b/cpu/mpc8xx/serial.c
@@ -387,16 +387,16 @@ smc_tstc(void)
        return !(rtx->rxbd.cbd_sc & BD_SC_EMPTY);
 }
 
-struct serial_device serial_smc_device =
+struct stdio_dev serial_smc_device =
 {
-       "serial_smc",
-       "SMC",
-       smc_init,
-       smc_setbrg,
-       smc_getc,
-       smc_tstc,
-       smc_putc,
-       smc_puts,
+       .name = "serial_smc",
+       .ctlr = "SMC",
+       .start = smc_init,
+       .setbrg = smc_setbrg,
+       .getc = smc_getc,
+       .tstc = smc_tstc,
+       .putc = smc_putc,
+       .puts = smc_puts,
 };
 
 #endif /* CONFIG_8xx_CONS_SMC1 || CONFIG_8xx_CONS_SMC2 */
@@ -657,16 +657,16 @@ scc_tstc(void)
        return(!(rbdf->cbd_sc & BD_SC_EMPTY));
 }
 
-struct serial_device serial_scc_device =
+struct stdio_dev serial_scc_device =
 {
-       "serial_scc",
-       "SCC",
-       scc_init,
-       scc_setbrg,
-       scc_getc,
-       scc_tstc,
-       scc_putc,
-       scc_puts,
+       .name = "serial_scc",
+       .ctlr = "SCC",
+       .start = scc_init,
+       .setbrg = scc_setbrg,
+       .getc = scc_getc,
+       .tstc = scc_tstc,
+       .putc = scc_putc,
+       .puts = scc_puts,
 };
 
 #endif /* CONFIG_8xx_CONS_SCCx */
diff --git a/cpu/ppc4xx/4xx_uart.c b/cpu/ppc4xx/4xx_uart.c
index 0780624..9c21cce 100644
--- a/cpu/ppc4xx/4xx_uart.c
+++ b/cpu/ppc4xx/4xx_uart.c
@@ -817,28 +817,28 @@ int serial1_tstc(void)
        return (serial_tstc_dev(UART1_BASE));
 }
 
-struct serial_device serial0_device =
-{
-       "serial0",
-       "UART0",
-       serial0_init,
-       serial0_setbrg,
-       serial0_getc,
-       serial0_tstc,
-       serial0_putc,
-       serial0_puts,
+struct stdio_dev serial0_device =
+{
+       .name = "serial0",
+       .ctlr = "UART0",
+       .start = serial0_init,
+       .setbrg = serial0_setbrg,
+       .getc = serial0_getc,
+       .tstc = serial0_tstc,
+       .putc = serial0_putc,
+       .puts = serial0_puts,
 };
 
-struct serial_device serial1_device =
+struct stdio_dev serial1_device =
 {
-       "serial1",
-       "UART1",
-       serial1_init,
-       serial1_setbrg,
-       serial1_getc,
-       serial1_tstc,
-       serial1_putc,
-       serial1_puts,
+       .name = "serial1",
+       .ctlr = "UART1",
+       .start = serial1_init,
+       .setbrg = serial1_setbrg,
+       .getc = serial1_getc,
+       .tstc = serial1_tstc,
+       .putc = serial1_putc,
+       .puts = serial1_puts,
 };
 #else
 /*
diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index dd5f332..d81a5b5 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -112,14 +112,14 @@ static NS16550_t serial_ports[4] = {
 
 /* Serial device descriptor */
 #define INIT_ESERIAL_STRUCTURE(port,name,bus) {\
-       name,\
-       bus,\
-       eserial##port##_init,\
-       eserial##port##_setbrg,\
-       eserial##port##_getc,\
-       eserial##port##_tstc,\
-       eserial##port##_putc,\
-       eserial##port##_puts, }
+       .name = name,\
+       .ctlr = bus,\
+       .start = eserial##port##_init,\
+       .setbrg = eserial##port##_setbrg,\
+       .getc = eserial##port##_getc,\
+       .tstc = eserial##port##_tstc,\
+       .putc = eserial##port##_putc,\
+       .puts = eserial##port##_puts, }
 
 #endif /* CONFIG_SERIAL_MULTI */
 
@@ -317,15 +317,15 @@ serial_setbrg(void)
 #if defined(CONFIG_SERIAL_MULTI)
 
 DECLARE_ESERIAL_FUNCTIONS(1);
-struct serial_device eserial1_device =
+struct stdio_dev eserial1_device =
        INIT_ESERIAL_STRUCTURE(1,"eserial0","EUART1");
 DECLARE_ESERIAL_FUNCTIONS(2);
-struct serial_device eserial2_device =
+struct stdio_dev eserial2_device =
        INIT_ESERIAL_STRUCTURE(2,"eserial1","EUART2");
 DECLARE_ESERIAL_FUNCTIONS(3);
-struct serial_device eserial3_device =
+struct stdio_dev eserial3_device =
        INIT_ESERIAL_STRUCTURE(3,"eserial2","EUART3");
 DECLARE_ESERIAL_FUNCTIONS(4);
-struct serial_device eserial4_device =
+struct stdio_dev eserial4_device =
        INIT_ESERIAL_STRUCTURE(4,"eserial3","EUART4");
 #endif /* CONFIG_SERIAL_MULTI */
diff --git a/drivers/serial/serial_pxa.c b/drivers/serial/serial_pxa.c
index 9ba457e..da3b292 100644
--- a/drivers/serial/serial_pxa.c
+++ b/drivers/serial/serial_pxa.c
@@ -261,16 +261,16 @@ static int ffuart_tstc(void)
        return pxa_tstc_dev(FFUART_INDEX);
 }
 
-struct serial_device serial_ffuart_device =
+struct stdio_dev serial_ffuart_device =
 {
-       "serial_ffuart",
-       "PXA",
-       ffuart_init,
-       ffuart_setbrg,
-       ffuart_getc,
-       ffuart_tstc,
-       ffuart_putc,
-       ffuart_puts,
+       .name = "serial_ffuart",
+       .ctlr = "PXA",
+       .start = ffuart_init,
+       .setbrg = ffuart_setbrg,
+       .getc = ffuart_getc,
+       .tstc = ffuart_tstc,
+       .putc = ffuart_putc,
+       .puts = ffuart_puts,
 };
 #endif
 
@@ -305,16 +305,16 @@ static int btuart_tstc(void)
        return pxa_tstc_dev(BTUART_INDEX);
 }
 
-struct serial_device serial_btuart_device =
+struct stdio_dev serial_btuart_device =
 {
-       "serial_btuart",
-       "PXA",
-       btuart_init,
-       btuart_setbrg,
-       btuart_getc,
-       btuart_tstc,
-       btuart_putc,
-       btuart_puts,
+       .name = "serial_btuart",
+       .ctlr = "PXA",
+       .start = btuart_init,
+       .setbrg = btuart_setbrg,
+       .getc = btuart_getc,
+       .tstc = btuart_tstc,
+       .putc = btuart_putc,
+       .puts = btuart_puts,
 };
 #endif
 
@@ -349,16 +349,16 @@ static int stuart_tstc(void)
        return pxa_tstc_dev(STUART_INDEX);
 }
 
-struct serial_device serial_stuart_device =
+struct stdio_dev serial_stuart_device =
 {
-       "serial_stuart",
-       "PXA",
-       stuart_init,
-       stuart_setbrg,
-       stuart_getc,
-       stuart_tstc,
-       stuart_putc,
-       stuart_puts,
+       .name = "serial_stuart",
+       .ctlr = "PXA",
+       .start = stuart_init,
+       .setbrg = stuart_setbrg,
+       .getc = stuart_getc,
+       .tstc = stuart_tstc,
+       .putc = stuart_putc,
+       .puts = stuart_puts,
 };
 #endif
 
diff --git a/drivers/serial/serial_s3c24x0.c b/drivers/serial/serial_s3c24x0.c
index 6d69c43..dc27e00 100644
--- a/drivers/serial/serial_s3c24x0.c
+++ b/drivers/serial/serial_s3c24x0.c
@@ -65,14 +65,14 @@ DECLARE_GLOBAL_DATA_PTR;
        serial_puts_dev(port, s);}
 
 #define INIT_S3C_SERIAL_STRUCTURE(port,name,bus) {\
-       name,\
-       bus,\
-       s3serial##port##_init,\
-       s3serial##port##_setbrg,\
-       s3serial##port##_getc,\
-       s3serial##port##_tstc,\
-       s3serial##port##_putc,\
-       s3serial##port##_puts, }
+       .name = name,\
+       .ctlr = bus,\
+       .start = s3serial##port##_init,\
+       .setbrg = s3serial##port##_setbrg,\
+       .getc = s3serial##port##_getc,\
+       .tstc = s3serial##port##_tstc,\
+       .putc = s3serial##port##_putc,\
+       .puts = s3serial##port##_puts, }
 
 #endif /* CONFIG_SERIAL_MULTI */
 
@@ -288,13 +288,13 @@ serial_puts (const char *s)
 
 #if defined(CONFIG_SERIAL_MULTI)
 DECLARE_S3C_SERIAL_FUNCTIONS(0);
-struct serial_device s3c24xx_serial0_device =
+struct stdio_dev s3c24xx_serial0_device =
        INIT_S3C_SERIAL_STRUCTURE(0, "s3ser0", "S3UART1");
 DECLARE_S3C_SERIAL_FUNCTIONS(1);
-struct serial_device s3c24xx_serial1_device =
+struct stdio_dev s3c24xx_serial1_device =
        INIT_S3C_SERIAL_STRUCTURE(1, "s3ser1", "S3UART2");
 DECLARE_S3C_SERIAL_FUNCTIONS(2);
-struct serial_device s3c24xx_serial2_device =
+struct stdio_dev s3c24xx_serial2_device =
        INIT_S3C_SERIAL_STRUCTURE(2, "s3ser2", "S3UART3");
 
 #endif /* CONFIG_SERIAL_MULTI */
diff --git a/include/serial.h b/include/serial.h
dissimilarity index 65%
index 821b583..4e9c016 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -1,62 +1,47 @@
-#ifndef __SERIAL_H__
-#define __SERIAL_H__
-
-#define NAMESIZE 16
-#define CTLRSIZE 8
-
-struct serial_device {
-       char name[NAMESIZE];
-       char ctlr[CTLRSIZE];
-
-       int  (*init) (void);
-       void (*setbrg) (void);
-       int (*getc) (void);
-       int (*tstc) (void);
-       void (*putc) (const char c);
-       void (*puts) (const char *s);
-
-       struct serial_device *next;
-};
-
-extern struct serial_device serial_smc_device;
-extern struct serial_device serial_scc_device;
-extern struct serial_device * default_serial_console (void);
-
-#if defined(CONFIG_405GP) || defined(CONFIG_405CR) || defined(CONFIG_440) || \
-    defined(CONFIG_405EP) || defined(CONFIG_405EZ) || defined(CONFIG_405EX) || 
\
-    defined(CONFIG_MPC5xxx) || defined(CONFIG_MPC83xx) || \
-    defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
-extern struct serial_device serial0_device;
-extern struct serial_device serial1_device;
-#if defined(CONFIG_SYS_NS16550_SERIAL)
-extern struct serial_device eserial1_device;
-extern struct serial_device eserial2_device;
-extern struct serial_device eserial3_device;
-extern struct serial_device eserial4_device;
-#endif /* CONFIG_SYS_NS16550_SERIAL */
-
-#endif
-
-#if defined(CONFIG_S3C2410)
-extern struct serial_device s3c24xx_serial0_device;
-extern struct serial_device s3c24xx_serial1_device;
-extern struct serial_device s3c24xx_serial2_device;
-#endif
-
-#if defined(CONFIG_OMAP3_ZOOM2)
-extern struct serial_device zoom2_serial_device0;
-extern struct serial_device zoom2_serial_device1;
-extern struct serial_device zoom2_serial_device2;
-extern struct serial_device zoom2_serial_device3;
-#endif
-
-extern struct serial_device serial_ffuart_device;
-extern struct serial_device serial_btuart_device;
-extern struct serial_device serial_stuart_device;
-
-extern void serial_initialize(void);
-extern void serial_stdio_init(void);
-extern int serial_assign(char * name);
-extern void serial_reinit_all(void);
-
-#endif
+#ifndef __SERIAL_H__
+#define __SERIAL_H__
+
+#include <stdio_dev.h>
+
+extern struct stdio_dev serial_smc_device;
+extern struct stdio_dev serial_scc_device;
+extern struct stdio_dev * default_serial_console (void);
+
+#if defined(CONFIG_405GP) || defined(CONFIG_405CR) || defined(CONFIG_440) || \
+    defined(CONFIG_405EP) || defined(CONFIG_405EZ) || defined(CONFIG_405EX) || 
\
+    defined(CONFIG_MPC5xxx) || defined(CONFIG_MPC83xx) || \
+    defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
+extern struct stdio_dev serial0_device;
+extern struct stdio_dev serial1_device;
+#if defined(CONFIG_SYS_NS16550_SERIAL)
+extern struct stdio_dev eserial1_device;
+extern struct stdio_dev eserial2_device;
+extern struct stdio_dev eserial3_device;
+extern struct stdio_dev eserial4_device;
+#endif /* CONFIG_SYS_NS16550_SERIAL */
+
+#endif
+
+#if defined(CONFIG_S3C2410)
+extern struct stdio_dev s3c24xx_serial0_device;
+extern struct stdio_dev s3c24xx_serial1_device;
+extern struct stdio_dev s3c24xx_serial2_device;
+#endif
+
+#if defined(CONFIG_OMAP3_ZOOM2)
+extern struct stdio_dev zoom2_serial_device0;
+extern struct stdio_dev zoom2_serial_device1;
+extern struct stdio_dev zoom2_serial_device2;
+extern struct stdio_dev zoom2_serial_device3;
+#endif
+
+extern struct stdio_dev serial_ffuart_device;
+extern struct stdio_dev serial_btuart_device;
+extern struct stdio_dev serial_stuart_device;
+
+extern void serial_initialize(void);
+extern void serial_stdio_init(void);
+extern int serial_assign(char * name);
+extern void serial_reinit_all(void);
+
+#endif
diff --git a/include/stdio_dev.h b/include/stdio_dev.h
index 83da4cd..5bb2cad 100644
--- a/include/stdio_dev.h
+++ b/include/stdio_dev.h
@@ -32,14 +32,19 @@
 
 #define DEV_FLAGS_INPUT         0x00000001     /* Device can be used as input  
console */
 #define DEV_FLAGS_OUTPUT 0x00000002    /* Device can be used as output console 
*/
+#define DEV_FLAGS_SERIAL 0x00000003    /* Device is a serial device            
*/
 #define DEV_FLAGS_SYSTEM 0x80000000    /* Device is a system device            
*/
 #define DEV_EXT_VIDEO   0x00000001     /* Video extensions supported           
*/
 
+#define NAMESIZE 16
+#define CTLRSIZE 8
+
 /* Device information */
 struct stdio_dev {
        int     flags;                  /* Device flags: input/output/system    
*/
        int     ext;                    /* Supported extensions                 
*/
-       char    name[16];               /* Device name                          
*/
+       char    name[NAMESIZE];         /* Device name                          
*/
+       char    ctlr[CTLRSIZE];
 
 /* GENERAL functions */
 
@@ -57,6 +62,7 @@ struct stdio_dev {
        int (*getc) (void);             /* To get that char                     
*/
 
 /* Other functions */
+       void (*setbrg) (void);          /* Set baudrate                         
*/
 
        void *priv;                     /* Private extensions                   
*/
        struct list_head list;
@@ -96,6 +102,7 @@ void stdio_print_current_devices(void);
 int    stdio_deregister(char *devname);
 #endif
 struct list_head* stdio_get_list(void);
+struct stdio_dev* stdio_get_devs(void);
 struct stdio_dev* stdio_get_by_name(char* name);
 struct stdio_dev* stdio_clone(struct stdio_dev *dev);
 
-- 
1.6.3.1

_______________________________________________
U-Boot mailing list
[email protected]
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to