Skip to content

Commit

Permalink
tty: serial: msm: Remove 115.2 Kbps maximum baud rate limitation
Browse files Browse the repository at this point in the history
UART controller is capable to perform transfers up to 4 Mbps.
Remove artificial 115.2 Kbps limitation.

Signed-off-by: Ivan T. Ivanov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Ivan T. Ivanov authored and gregkh committed Oct 4, 2015
1 parent 9969394 commit 850b37a
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions drivers/tty/serial/msm_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,7 @@ msm_find_best_baud(struct uart_port *port, unsigned int baud)
{ 3, 0xdd, 8 },
{ 2, 0xee, 16 },
{ 1, 0xff, 31 },
{ 0, 0xff, 31 },
};

divisor = uart_get_divisor(port, baud);
Expand All @@ -893,16 +894,29 @@ msm_find_best_baud(struct uart_port *port, unsigned int baud)
return entry; /* Default to smallest divider */
}

static int msm_set_baud_rate(struct uart_port *port, unsigned int baud)
static int msm_set_baud_rate(struct uart_port *port, unsigned int baud,
unsigned long *saved_flags)
{
unsigned int rxstale, watermark, mask;
struct msm_port *msm_port = UART_TO_MSM(port);
const struct msm_baud_map *entry;
unsigned long flags;

entry = msm_find_best_baud(port, baud);

msm_write(port, entry->code, UART_CSR);

if (baud > 460800)
port->uartclk = baud * 16;

flags = *saved_flags;
spin_unlock_irqrestore(&port->lock, flags);

clk_set_rate(msm_port->clk, port->uartclk);

spin_lock_irqsave(&port->lock, flags);
*saved_flags = flags;

/* RX stale watermark */
rxstale = entry->rxstale;
watermark = UART_IPR_STALE_LSB & rxstale;
Expand Down Expand Up @@ -1026,8 +1040,8 @@ static void msm_set_termios(struct uart_port *port, struct ktermios *termios,
msm_stop_dma(port, dma);

/* calculate and set baud rate */
baud = uart_get_baud_rate(port, termios, old, 300, 115200);
baud = msm_set_baud_rate(port, baud);
baud = uart_get_baud_rate(port, termios, old, 300, 4000000);
baud = msm_set_baud_rate(port, baud, &flags);
if (tty_termios_baud_rate(termios))
tty_termios_encode_baud_rate(termios, baud, baud);

Expand Down

0 comments on commit 850b37a

Please sign in to comment.