Merge branch 'master' of git://git.denx.de/u-boot-mpc85xx
[oweals/u-boot.git] / drivers / serial / serial.c
index 8eda95cd3eddd1e2e3b183cefba3ebc9fe04d569..0d56e78c50b3ad63d8e6264f145d2c9644a53b55 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 #include <common.h>
+#include <linux/compiler.h>
 
 #include <ns16550.h>
 #ifdef CONFIG_NS87308
 #endif
 #ifdef CONFIG_KIRKWOOD
 #include <asm/arch/kirkwood.h>
+#elif defined(CONFIG_ORION5X)
+#include <asm/arch/orion5x.h>
+#elif defined(CONFIG_ARMADA100)
+#include <asm/arch/armada100.h>
+#elif defined(CONFIG_PANTHEON)
+#include <asm/arch/pantheon.h>
 #endif
 
 #if defined (CONFIG_SERIAL_MULTI)
@@ -111,9 +118,8 @@ static NS16550_t serial_ports[4] = {
        serial_puts_dev(port, s);}
 
 /* Serial device descriptor */
-#define INIT_ESERIAL_STRUCTURE(port,name,bus) {\
+#define INIT_ESERIAL_STRUCTURE(port, name) {\
        name,\
-       bus,\
        eserial##port##_init,\
        NULL,\
        eserial##port##_setbrg,\
@@ -319,14 +325,30 @@ serial_setbrg(void)
 
 DECLARE_ESERIAL_FUNCTIONS(1);
 struct serial_device eserial1_device =
-       INIT_ESERIAL_STRUCTURE(1,"eserial0","EUART1");
+       INIT_ESERIAL_STRUCTURE(1, "eserial0");
 DECLARE_ESERIAL_FUNCTIONS(2);
 struct serial_device eserial2_device =
-       INIT_ESERIAL_STRUCTURE(2,"eserial1","EUART2");
+       INIT_ESERIAL_STRUCTURE(2, "eserial1");
 DECLARE_ESERIAL_FUNCTIONS(3);
 struct serial_device eserial3_device =
-       INIT_ESERIAL_STRUCTURE(3,"eserial2","EUART3");
+       INIT_ESERIAL_STRUCTURE(3, "eserial2");
 DECLARE_ESERIAL_FUNCTIONS(4);
 struct serial_device eserial4_device =
-       INIT_ESERIAL_STRUCTURE(4,"eserial3","EUART4");
+       INIT_ESERIAL_STRUCTURE(4, "eserial3");
+
+__weak struct serial_device *default_serial_console(void)
+{
+#if CONFIG_CONS_INDEX == 1
+       return &eserial1_device;
+#elif CONFIG_CONS_INDEX == 2
+       return &eserial2_device;
+#elif CONFIG_CONS_INDEX == 3
+       return &eserial3_device;
+#elif CONFIG_CONS_INDEX == 4
+       return &eserial4_device;
+#else
+#error "Bad CONFIG_CONS_INDEX."
+#endif
+}
+
 #endif /* CONFIG_SERIAL_MULTI */