Commit 8612bd22 authored by Govindraj.R's avatar Govindraj.R Committed by Kevin Hilman

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.htmlSigned-off-by: default avatarGovindraj.R <govindraj.raja@ti.com>
Signed-off-by: default avatarKevin Hilman <khilman@ti.com>
parent 969996a5
...@@ -63,6 +63,7 @@ struct omap_uart_state { ...@@ -63,6 +63,7 @@ struct omap_uart_state {
static LIST_HEAD(uart_list); static LIST_HEAD(uart_list);
static u8 num_uarts; static u8 num_uarts;
static u8 console_uart_id = -1;
#define DEFAULT_RXDMA_POLLRATE 1 /* RX DMA polling rate (us) */ #define DEFAULT_RXDMA_POLLRATE 1 /* RX DMA polling rate (us) */
#define DEFAULT_RXDMA_BUFSIZE 4096 /* RX DMA buffer size */ #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) ...@@ -264,12 +265,20 @@ static void omap_serial_fill_default_pads(struct omap_board_data *bdata)
static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {} static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {}
#endif #endif
char *cmdline_find_option(char *str)
{
extern char *saved_command_line;
return strstr(saved_command_line, str);
}
static int __init omap_serial_early_init(void) static int __init omap_serial_early_init(void)
{ {
do { do {
char oh_name[MAX_UART_HWMOD_NAME_LEN]; char oh_name[MAX_UART_HWMOD_NAME_LEN];
struct omap_hwmod *oh; struct omap_hwmod *oh;
struct omap_uart_state *uart; struct omap_uart_state *uart;
char uart_name[MAX_UART_HWMOD_NAME_LEN];
snprintf(oh_name, MAX_UART_HWMOD_NAME_LEN, snprintf(oh_name, MAX_UART_HWMOD_NAME_LEN,
"uart%d", num_uarts + 1); "uart%d", num_uarts + 1);
...@@ -284,18 +293,22 @@ static int __init omap_serial_early_init(void) ...@@ -284,18 +293,22 @@ static int __init omap_serial_early_init(void)
uart->oh = oh; uart->oh = oh;
uart->num = num_uarts++; uart->num = num_uarts++;
list_add_tail(&uart->node, &uart_list); list_add_tail(&uart->node, &uart_list);
snprintf(uart_name, MAX_UART_HWMOD_NAME_LEN,
/* "%s%d", OMAP_SERIAL_NAME, uart->num);
* NOTE: omap_hwmod_setup*() has not yet been called,
* so no hwmod functions will work yet. if (cmdline_find_option(uart_name)) {
*/ console_uart_id = uart->num;
/*
/* * omap-uart can be used for earlyprintk logs
* During UART early init, device need to be probed * So if omap-uart is used as console then prevent
* to determine SoC specific init before omap_device * uart reset and idle to get logs from omap-uart
* is ready. Therefore, don't allow idle here * until uart console driver is available to take
*/ * care for console messages.
uart->oh->flags |= HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET; * Idling or resetting omap-uart while printing logs
* early boot logs can stall the boot-up.
*/
oh->flags |= HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET;
}
} while (1); } while (1);
return 0; return 0;
...@@ -379,20 +392,6 @@ void __init omap_serial_init_port(struct omap_board_data *bdata, ...@@ -379,20 +392,6 @@ void __init omap_serial_init_port(struct omap_board_data *bdata,
oh->dev_attr = uart; oh->dev_attr = uart;
console_lock(); /* in case the earlycon is on the UART */
/*
* Because of early UART probing, UART did not get idled
* on init. Now that omap_device is ready, ensure full idle
* before doing omap_device_enable().
*/
omap_hwmod_idle(uart->oh);
omap_device_enable(uart->pdev);
omap_device_idle(uart->pdev);
console_unlock();
if ((cpu_is_omap34xx() || cpu_is_omap44xx()) && bdata->pads) if ((cpu_is_omap34xx() || cpu_is_omap44xx()) && bdata->pads)
device_init_wakeup(&pdev->dev, true); device_init_wakeup(&pdev->dev, true);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment