#include <common.h>
#include <serial.h>
-#include <devices.h>
+#include <stdio_dev.h>
DECLARE_GLOBAL_DATA_PTR;
static struct serial_device *serial_devices = NULL;
static struct serial_device *serial_current = NULL;
-#if !defined(CONFIG_LWMON) && !defined(CONFIG_PXA27X)
+#if !defined(CONFIG_LWMON) && !defined(CONFIG_PXA250) && !defined(CONFIG_PXA27X)
struct serial_device *__default_serial_console (void)
{
#if defined(CONFIG_8xx_CONS_SMC1) || defined(CONFIG_8xx_CONS_SMC2)
#elif defined(CONFIG_8xx_CONS_SCC1) || defined(CONFIG_8xx_CONS_SCC2) \
|| defined(CONFIG_8xx_CONS_SCC3) || defined(CONFIG_8xx_CONS_SCC4)
return &serial_scc_device;
-#elif 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)
+#elif defined(CONFIG_4xx) \
+ || defined(CONFIG_MB86R0x) || defined(CONFIG_MPC5xxx) \
+ || defined(CONFIG_MPC83xx) || defined(CONFIG_MPC85xx) \
+ || defined(CONFIG_MPC86xx) || defined(CONFIG_SYS_SC520)
#if defined(CONFIG_CONS_INDEX) && defined(CONFIG_SYS_NS16550_SERIAL)
#if (CONFIG_CONS_INDEX==1)
return &eserial1_device;
#else
#error "Bad CONFIG_CONS_INDEX."
#endif
-#elif defined(CONFIG_UART1_CONSOLE)
- return &serial1_device;
#else
- return &serial0_device;
+ return &serial0_device;
+#endif
+#elif defined(CONFIG_MPC512X)
+#if (CONFIG_PSC_CONSOLE == 3)
+ return &serial3_device;
+#elif (CONFIG_PSC_CONSOLE == 6)
+ return &serial6_device;
+#else
+#error "Bad CONFIG_PSC_CONSOLE."
#endif
#elif defined(CONFIG_S3C2410)
#if defined(CONFIG_SERIAL1)
#else
#error "CONFIG_SERIAL? missing."
#endif
+#elif defined(CONFIG_S5P)
+#if defined(CONFIG_SERIAL0)
+ return &s5p_serial0_device;
+#elif defined(CONFIG_SERIAL1)
+ return &s5p_serial1_device;
+#elif defined(CONFIG_SERIAL2)
+ return &s5p_serial2_device;
+#elif defined(CONFIG_SERIAL3)
+ return &s5p_serial3_device;
+#else
+#error "CONFIG_SERIAL? missing."
+#endif
#elif defined(CONFIG_OMAP3_ZOOM2)
return ZOOM2_DEFAULT_SERIAL_DEVICE;
#else
int serial_register (struct serial_device *dev)
{
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
dev->init += 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;
+#endif
dev->next = serial_devices;
serial_devices = dev;
serial_register (&serial_scc_device);
#endif
-#if defined(CONFIG_405GP) || defined(CONFIG_405CR) || defined(CONFIG_440) \
- || defined(CONFIG_405EP) || defined(CONFIG_405EZ) || defined(CONFIG_405EX) \
- || defined(CONFIG_MPC5xxx)
- serial_register(&serial0_device);
- serial_register(&serial1_device);
-#endif
-
#if defined(CONFIG_SYS_NS16550_SERIAL)
#if defined(CONFIG_SYS_NS16550_COM1)
serial_register(&eserial1_device);
serial_register(&s3c24xx_serial1_device);
serial_register(&s3c24xx_serial2_device);
#endif
+#if defined(CONFIG_S5P)
+ serial_register(&s5p_serial0_device);
+ serial_register(&s5p_serial1_device);
+ serial_register(&s5p_serial2_device);
+ serial_register(&s5p_serial3_device);
+#endif
+#if defined(CONFIG_MPC512X)
+#if defined(CONFIG_SYS_PSC1)
+ serial_register(&serial1_device);
+#endif
+#if defined(CONFIG_SYS_PSC3)
+ serial_register(&serial3_device);
+#endif
+#if defined(CONFIG_SYS_PSC4)
+ serial_register(&serial4_device);
+#endif
+#if defined(CONFIG_SYS_PSC6)
+ serial_register(&serial6_device);
+#endif
+#endif
serial_assign (default_serial_console ()->name);
}
-void serial_devices_init (void)
+void serial_stdio_init (void)
{
- device_t dev;
+ struct stdio_dev dev;
struct serial_device *s = serial_devices;
while (s) {
dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT;
dev.start = s->init;
+ dev.stop = s->uninit;
dev.putc = s->putc;
dev.puts = s->puts;
dev.getc = s->getc;
dev.tstc = s->tstc;
- device_register (&dev);
+ stdio_register (&dev);
s = s->next;
}