aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/serial.c
diff options
context:
space:
mode:
authorGovindraj.R <govindraj.raja@ti.com>2011-11-07 08:35:44 -0500
committerKevin Hilman <khilman@ti.com>2011-12-14 19:05:25 -0500
commit8612bd22f30369745d0fda0d540aca39ab591cc5 (patch)
treed01e96866f707acb25fff0865eede5de3efab8b7 /arch/arm/mach-omap2/serial.c
parent969996a57fd2345a1141280dddcf9e10fa5f6690 (diff)
ARM: OMAP2+: UART: Avoid console uart idling during bootup
Omap-uart can be used as console uart to print early boot messages using earlyprintk so for console uart prevent hwmod reset or idling during bootup. Identify omap-uart used as console and avoid idling rather than preventing all omap-uarts from idling during bootup. Update the comments for the same. Remove the uart idling and enabling back using hwmod_idle/omap_device_enable for all uarts that where left enabled from boot to set the hwmod framework state machine right. This need not be taken care any more serial.c rather can be handled within the hwmod framework. Reference: http://www.spinics.net/lists/linux-omap/msg60300.html Signed-off-by: Govindraj.R <govindraj.raja@ti.com> Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'arch/arm/mach-omap2/serial.c')
-rw-r--r--arch/arm/mach-omap2/serial.c51
1 files changed, 25 insertions, 26 deletions
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 8e0d0062cb15..85516c946ef0 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -63,6 +63,7 @@ struct omap_uart_state {
63 63
64static LIST_HEAD(uart_list); 64static LIST_HEAD(uart_list);
65static u8 num_uarts; 65static u8 num_uarts;
66static u8 console_uart_id = -1;
66 67
67#define DEFAULT_RXDMA_POLLRATE 1 /* RX DMA polling rate (us) */ 68#define DEFAULT_RXDMA_POLLRATE 1 /* RX DMA polling rate (us) */
68#define DEFAULT_RXDMA_BUFSIZE 4096 /* RX DMA buffer size */ 69#define DEFAULT_RXDMA_BUFSIZE 4096 /* RX DMA buffer size */
@@ -264,12 +265,20 @@ static void omap_serial_fill_default_pads(struct omap_board_data *bdata)
264static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {} 265static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {}
265#endif 266#endif
266 267
268char *cmdline_find_option(char *str)
269{
270 extern char *saved_command_line;
271
272 return strstr(saved_command_line, str);
273}
274
267static int __init omap_serial_early_init(void) 275static int __init omap_serial_early_init(void)
268{ 276{
269 do { 277 do {
270 char oh_name[MAX_UART_HWMOD_NAME_LEN]; 278 char oh_name[MAX_UART_HWMOD_NAME_LEN];
271 struct omap_hwmod *oh; 279 struct omap_hwmod *oh;
272 struct omap_uart_state *uart; 280 struct omap_uart_state *uart;
281 char uart_name[MAX_UART_HWMOD_NAME_LEN];
273 282
274 snprintf(oh_name, MAX_UART_HWMOD_NAME_LEN, 283 snprintf(oh_name, MAX_UART_HWMOD_NAME_LEN,
275 "uart%d", num_uarts + 1); 284 "uart%d", num_uarts + 1);
@@ -284,18 +293,22 @@ static int __init omap_serial_early_init(void)
284 uart->oh = oh; 293 uart->oh = oh;
285 uart->num = num_uarts++; 294 uart->num = num_uarts++;
286 list_add_tail(&uart->node, &uart_list); 295 list_add_tail(&uart->node, &uart_list);
287 296 snprintf(uart_name, MAX_UART_HWMOD_NAME_LEN,
288 /* 297 "%s%d", OMAP_SERIAL_NAME, uart->num);
289 * NOTE: omap_hwmod_setup*() has not yet been called, 298
290 * so no hwmod functions will work yet. 299 if (cmdline_find_option(uart_name)) {
291 */ 300 console_uart_id = uart->num;
292 301 /*
293 /* 302 * omap-uart can be used for earlyprintk logs
294 * During UART early init, device need to be probed 303 * So if omap-uart is used as console then prevent
295 * to determine SoC specific init before omap_device 304 * uart reset and idle to get logs from omap-uart
296 * is ready. Therefore, don't allow idle here 305 * until uart console driver is available to take
297 */ 306 * care for console messages.
298 uart->oh->flags |= HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET; 307 * Idling or resetting omap-uart while printing logs
308 * early boot logs can stall the boot-up.
309 */
310 oh->flags |= HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET;
311 }
299 } while (1); 312 } while (1);
300 313
301 return 0; 314 return 0;
@@ -379,20 +392,6 @@ void __init omap_serial_init_port(struct omap_board_data *bdata,
379 392
380 oh->dev_attr = uart; 393 oh->dev_attr = uart;
381 394
382 console_lock(); /* in case the earlycon is on the UART */
383
384 /*
385 * Because of early UART probing, UART did not get idled
386 * on init. Now that omap_device is ready, ensure full idle
387 * before doing omap_device_enable().
388 */
389 omap_hwmod_idle(uart->oh);
390
391 omap_device_enable(uart->pdev);
392 omap_device_idle(uart->pdev);
393
394 console_unlock();
395
396 if ((cpu_is_omap34xx() || cpu_is_omap44xx()) && bdata->pads) 395 if ((cpu_is_omap34xx() || cpu_is_omap44xx()) && bdata->pads)
397 device_init_wakeup(&pdev->dev, true); 396 device_init_wakeup(&pdev->dev, true);
398} 397}