[PATCH 1/2] Fix init of non-console serial lines
Harald Welte
laforge at openmoko.org
Tue Oct 7 19:25:27 CEST 2008
[serial]: Fix initialization of non-console serial lines
When using a serial port for something that is not console operation
(like the 'terminal' mode with GSM or GPS on Openmoko GTA02), then
the serial port needs to be initialized properly.
Signed-off-by: Harald Welte <laforge at openmoko.org>
diff --git a/common/cmd_terminal.c b/common/cmd_terminal.c
index 762c3ea..882cefa 100644
--- a/common/cmd_terminal.c
+++ b/common/cmd_terminal.c
@@ -27,9 +27,21 @@
#include <common.h>
#include <command.h>
#include <devices.h>
+#include <serial.h>
#if defined(CONFIG_CMD_TERMINAL)
+static void init_serial_by_name(char *name)
+{
+ struct serial_device *ser;
+ for (ser = serial_devices; ser; ser = ser->next) {
+ if (!strcmp(ser->name, name)) {
+ ser->init();
+ return;
+ }
+ }
+}
+
int do_terminal(cmd_tbl_t * cmd, int flag, int argc, char *argv[])
{
int i, l;
@@ -58,6 +70,7 @@ int do_terminal(cmd_tbl_t * cmd, int flag, int argc, char *argv[])
neo1973_gta01_serial0_gsm(1);
#endif
+ init_serial_by_name(dev->name);
//serial_reinit_all();
printf("Entering terminal mode for port %s\n", dev->name);
puts("Use '~.' to leave the terminal and get back to u-boot\n");
diff --git a/common/serial.c b/common/serial.c
index dbf0a86..efda612 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -29,7 +29,7 @@ DECLARE_GLOBAL_DATA_PTR;
#if defined(CONFIG_SERIAL_MULTI)
-static struct serial_device *serial_devices = NULL;
+struct serial_device *serial_devices = NULL;
static struct serial_device *serial_current = NULL;
#if !defined(CONFIG_LWMON) && !defined(CONFIG_PXA27X)
diff --git a/include/serial.h b/include/serial.h
index 043410c..926c63e 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -52,4 +52,8 @@ extern void serial_devices_init(void);
extern int serial_assign(char * name);
extern void serial_reinit_all(void);
+#if defined(CONFIG_SERIAL_MULTI)
+extern struct serial_device *serial_devices;
+#endif /* CONFIG_SERIAL_MULTI */
+
#endif
--
- Harald Welte <laforge at openmoko.org> http://openmoko.org/
============================================================================
Software for the world's first truly open Free Software mobile phone
More information about the openmoko-kernel
mailing list