Skip to content

Commit

Permalink
atmel_serial: use existing console options only if BRG is running
Browse files Browse the repository at this point in the history
If BRGR is zero, the baud rate generator isn't running, so the boot loader
can't have initialized the port.

Signed-off-by: Haavard Skinnemoen <[email protected]>
Acked-by: Andrew Victor <[email protected]>
Tested-by: Marc Pignat <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Haavard Skinnemoen authored and Linus Torvalds committed Feb 8, 2008
1 parent 829dd81 commit 1c0fd82
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions drivers/serial/atmel_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -834,13 +834,13 @@ static void __init atmel_console_get_options(struct uart_port *port, int *baud,
{
unsigned int mr, quot;

// TODO: CR is a write-only register
// unsigned int cr;
//
// cr = UART_GET_CR(port) & (ATMEL_US_RXEN | ATMEL_US_TXEN);
// if (cr == (ATMEL_US_RXEN | ATMEL_US_TXEN)) {
// /* ok, the port was enabled */
// }
/*
* If the baud rate generator isn't running, the port wasn't
* initialized by the boot loader.
*/
quot = UART_GET_BRGR(port);
if (!quot)
return;

mr = UART_GET_MR(port) & ATMEL_US_CHRL;
if (mr == ATMEL_US_CHRL_8)
Expand All @@ -860,7 +860,6 @@ static void __init atmel_console_get_options(struct uart_port *port, int *baud,
* lower than one of those, as it would make us fall through
* to a much lower baud rate than we really want.
*/
quot = UART_GET_BRGR(port);
*baud = port->uartclk / (16 * (quot - 1));
}

Expand Down

0 comments on commit 1c0fd82

Please sign in to comment.