aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/plat-omap/common.c')
-rw-r--r--arch/arm/plat-omap/common.c50
1 files changed, 37 insertions, 13 deletions
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index 02bcc6c1cd1b..ccdb452630cf 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -31,7 +31,7 @@
31#include <asm/arch/mux.h> 31#include <asm/arch/mux.h>
32#include <asm/arch/fpga.h> 32#include <asm/arch/fpga.h>
33 33
34#include "clock.h" 34#include <asm/arch/clock.h>
35 35
36#define NO_LENGTH_CHECK 0xffffffff 36#define NO_LENGTH_CHECK 0xffffffff
37 37
@@ -117,19 +117,43 @@ EXPORT_SYMBOL(omap_get_var_config);
117 117
118static int __init omap_add_serial_console(void) 118static int __init omap_add_serial_console(void)
119{ 119{
120 const struct omap_serial_console_config *info; 120 const struct omap_serial_console_config *con_info;
121 121 const struct omap_uart_config *uart_info;
122 info = omap_get_config(OMAP_TAG_SERIAL_CONSOLE, 122 static char speed[11], *opt = NULL;
123 struct omap_serial_console_config); 123 int line, i, uart_idx;
124 if (info != NULL && info->console_uart) { 124
125 static char speed[11], *opt = NULL; 125 uart_info = omap_get_config(OMAP_TAG_UART, struct omap_uart_config);
126 con_info = omap_get_config(OMAP_TAG_SERIAL_CONSOLE,
127 struct omap_serial_console_config);
128 if (uart_info == NULL || con_info == NULL)
129 return 0;
130
131 if (con_info->console_uart == 0)
132 return 0;
133
134 if (con_info->console_speed) {
135 snprintf(speed, sizeof(speed), "%u", con_info->console_speed);
136 opt = speed;
137 }
126 138
127 if (info->console_speed) { 139 uart_idx = con_info->console_uart - 1;
128 snprintf(speed, sizeof(speed), "%u", info->console_speed); 140 if (uart_idx >= OMAP_MAX_NR_PORTS) {
129 opt = speed; 141 printk(KERN_INFO "Console: external UART#%d. "
130 } 142 "Not adding it as console this time.\n",
131 return add_preferred_console("ttyS", info->console_uart - 1, opt); 143 uart_idx + 1);
144 return 0;
145 }
146 if (!(uart_info->enabled_uarts & (1 << uart_idx))) {
147 printk(KERN_ERR "Console: Selected UART#%d is "
148 "not enabled for this platform\n",
149 uart_idx + 1);
150 return -1;
151 }
152 line = 0;
153 for (i = 0; i < uart_idx; i++) {
154 if (uart_info->enabled_uarts & (1 << i))
155 line++;
132 } 156 }
133 return 0; 157 return add_preferred_console("ttyS", line, opt);
134} 158}
135console_initcall(omap_add_serial_console); 159console_initcall(omap_add_serial_console);