[U-Boot] [PATCH 4/6] console & omap-common/spl: Enable use of eserial
Andrew Bradford
andrew at bradfordembedded.com
Wed Sep 26 22:04:17 CEST 2012
Enable use of eserial devices for common and omap-common/spl.
This probably isn't the right way to do this as the changes aren't
needed for 'common' configurations, just for one case.
Signed-off-by: Andrew Bradford <andrew at bradfordembedded.com>
---
arch/arm/cpu/armv7/omap-common/spl.c | 7 ++++++-
common/console.c | 24 ++++++++++++++++++++----
include/common.h | 5 +++++
3 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/arch/arm/cpu/armv7/omap-common/spl.c b/arch/arm/cpu/armv7/omap-common/spl.c
index 4d1ac85..6258c0e 100644
--- a/arch/arm/cpu/armv7/omap-common/spl.c
+++ b/arch/arm/cpu/armv7/omap-common/spl.c
@@ -210,7 +210,12 @@ void preloader_console_init(void)
gd->flags |= GD_FLG_RELOC;
gd->baudrate = CONFIG_BAUDRATE;
- serial_init(); /* serial communications setup */
+ /* serial communications setup */
+#ifdef CONFIG_SERIAL_MULTI
+ ESERIAL_FUNC(CONFIG_CONS_INDEX, init)();
+#else
+ serial_init();
+#endif /* CONFIG_SERIAL_MULTI */
gd->have_console = 1;
diff --git a/common/console.c b/common/console.c
index 1177f7d..5670ce1 100644
--- a/common/console.c
+++ b/common/console.c
@@ -302,12 +302,16 @@ int getc(void)
return 0;
if (gd->flags & GD_FLG_DEVINIT) {
- /* Get from the standard input */
- return fgetc(stdin);
+ /* Get from the standard input */
+ return fgetc(stdin);
}
/* Send directly to the handler */
+#ifdef CONFIG_SERIAL_MULTI
+ return ESERIAL_FUNC(CONFIG_CONS_INDEX, getc)();
+#else
return serial_getc();
+#endif /* CONFIG_SERIAL_MULTI */
}
int tstc(void)
@@ -321,12 +325,16 @@ int tstc(void)
return 0;
if (gd->flags & GD_FLG_DEVINIT) {
- /* Test the standard input */
- return ftstc(stdin);
+ /* Test the standard input */
+ return ftstc(stdin);
}
/* Send directly to the handler */
+#ifdef CONFIG_SERIAL_MULTI
+ return ESERIAL_FUNC(CONFIG_CONS_INDEX, tstc)();
+#else
return serial_tstc();
+#endif /* CONFIG_SERIAL_MULTI */
}
#ifdef CONFIG_PRE_CONSOLE_BUFFER
@@ -382,7 +390,11 @@ void putc(const char c)
fputc(stdout, c);
} else {
/* Send directly to the handler */
+#ifdef CONFIG_SERIAL_MULTI
+ ESERIAL_FUNC(CONFIG_CONS_INDEX, putc)(c);
+#else
serial_putc(c);
+#endif /* CONFIG_SERIAL_MULTI */
}
}
@@ -406,7 +418,11 @@ void puts(const char *s)
fputs(stdout, s);
} else {
/* Send directly to the handler */
+#ifdef CONFIG_SERIAL_MULTI
+ ESERIAL_FUNC(CONFIG_CONS_INDEX, puts)(s);
+#else
serial_puts(s);
+#endif /* CONFIG_SERIAL_MULTI */
}
}
diff --git a/include/common.h b/include/common.h
index 55025c0..b4ebbfb 100644
--- a/include/common.h
+++ b/include/common.h
@@ -206,6 +206,11 @@ typedef void (interrupt_handler_t)(void *);
#endif /* CONFIG_SERIAL_MULTI */
+#ifdef CONFIG_SERIAL_MULTI
+#define EXPAND_ESERIAL(x, func) eserial ## x ## _ ## func
+#define ESERIAL_FUNC(x, func) EXPAND_ESERIAL(x, func)
+#endif /* CONFIG_SERIAL_MULTI */
+
/*
* General Purpose Utilities
*/
--
1.7.10
More information about the U-Boot
mailing list