diff options
| author | Christophe Leroy <christophe.leroy@c-s.fr> | 2012-09-24 02:39:44 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-09-26 16:39:39 -0400 |
| commit | 6e62bdc07e1b397704354cf3bd58950943ecaaf1 (patch) | |
| tree | 71f6170d74ffa166ad1e70a22c066eda76412788 /drivers/tty/serial/cpm_uart | |
| parent | fbbb9d9646f04768d0176f75e7fc93d29457b5db (diff) | |
Powerpc 8xx CPM_UART setting MAXIDL register proportionaly to baud rate
MAXIDL is the timeout after which a receive buffer is closed when not full if
no more characters are received. We calculate it from the baudrate so that the
duration is always the same at standard rates: about 4ms. At 9600 bauds it gives
a timeout of 4 characters, which is the timeout on the 8250 UART.
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/cpm_uart')
| -rw-r--r-- | drivers/tty/serial/cpm_uart/cpm_uart_core.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c index 7f6a1c7cb3de..d0dd9194cecc 100644 --- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c | |||
| @@ -501,6 +501,7 @@ static void cpm_uart_set_termios(struct uart_port *port, | |||
| 501 | struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port; | 501 | struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port; |
| 502 | smc_t __iomem *smcp = pinfo->smcp; | 502 | smc_t __iomem *smcp = pinfo->smcp; |
| 503 | scc_t __iomem *sccp = pinfo->sccp; | 503 | scc_t __iomem *sccp = pinfo->sccp; |
| 504 | int maxidl; | ||
| 504 | 505 | ||
| 505 | pr_debug("CPM uart[%d]:set_termios\n", port->line); | 506 | pr_debug("CPM uart[%d]:set_termios\n", port->line); |
| 506 | 507 | ||
| @@ -511,6 +512,17 @@ static void cpm_uart_set_termios(struct uart_port *port, | |||
| 511 | else | 512 | else |
| 512 | pinfo->rx_fifosize = RX_BUF_SIZE; | 513 | pinfo->rx_fifosize = RX_BUF_SIZE; |
| 513 | 514 | ||
| 515 | /* MAXIDL is the timeout after which a receive buffer is closed | ||
| 516 | * when not full if no more characters are received. | ||
| 517 | * We calculate it from the baudrate so that the duration is | ||
| 518 | * always the same at standard rates: about 4ms. | ||
| 519 | */ | ||
| 520 | maxidl = baud / 2400; | ||
| 521 | if (maxidl < 1) | ||
| 522 | maxidl = 1; | ||
| 523 | if (maxidl > 0x10) | ||
| 524 | maxidl = 0x10; | ||
| 525 | |||
| 514 | /* Character length programmed into the mode register is the | 526 | /* Character length programmed into the mode register is the |
| 515 | * sum of: 1 start bit, number of data bits, 0 or 1 parity bit, | 527 | * sum of: 1 start bit, number of data bits, 0 or 1 parity bit, |
| 516 | * 1 or 2 stop bits, minus 1. | 528 | * 1 or 2 stop bits, minus 1. |
| @@ -611,6 +623,7 @@ static void cpm_uart_set_termios(struct uart_port *port, | |||
| 611 | * SMC/SCC receiver is disabled. | 623 | * SMC/SCC receiver is disabled. |
| 612 | */ | 624 | */ |
| 613 | out_be16(&pinfo->smcup->smc_mrblr, pinfo->rx_fifosize); | 625 | out_be16(&pinfo->smcup->smc_mrblr, pinfo->rx_fifosize); |
| 626 | out_be16(&pinfo->smcup->smc_maxidl, maxidl); | ||
| 614 | 627 | ||
| 615 | /* Set the mode register. We want to keep a copy of the | 628 | /* Set the mode register. We want to keep a copy of the |
| 616 | * enables, because we want to put them back if they were | 629 | * enables, because we want to put them back if they were |
| @@ -623,6 +636,7 @@ static void cpm_uart_set_termios(struct uart_port *port, | |||
| 623 | SMCMR_SM_UART | prev_mode); | 636 | SMCMR_SM_UART | prev_mode); |
| 624 | } else { | 637 | } else { |
| 625 | out_be16(&pinfo->sccup->scc_genscc.scc_mrblr, pinfo->rx_fifosize); | 638 | out_be16(&pinfo->sccup->scc_genscc.scc_mrblr, pinfo->rx_fifosize); |
| 639 | out_be16(&pinfo->sccup->scc_maxidl, maxidl); | ||
| 626 | out_be16(&sccp->scc_psmr, (sbits << 12) | scval); | 640 | out_be16(&sccp->scc_psmr, (sbits << 12) | scval); |
| 627 | } | 641 | } |
| 628 | 642 | ||
