Commit ae2d4c39 authored by Nye Liu's avatar Nye Liu Committed by Linus Torvalds

cpm1: don't send break on TX_STOP, don't interrupt RX/TX when adjusting termios parameters

Before setting STOP_TX, set _brkcr to 0 so the SMC does not send a break
character.  The driver appears to properly re-initialize _brkcr when the
SMC is restarted.

Do not interrupt RX/TX when the termios is being adjusted; it results in
corrupted characters appearing on the line.

Cc: Vitaly Bordug <vbordug@ru.mvista.com>
Cc: Scott Wood <scottwood@freescale.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e9a8f4d1
...@@ -435,10 +435,13 @@ static void cpm_uart_shutdown(struct uart_port *port) ...@@ -435,10 +435,13 @@ static void cpm_uart_shutdown(struct uart_port *port)
} }
/* Shut them really down and reinit buffer descriptors */ /* Shut them really down and reinit buffer descriptors */
if (IS_SMC(pinfo)) if (IS_SMC(pinfo)) {
out_be16(&pinfo->smcup->smc_brkcr, 0);
cpm_line_cr_cmd(pinfo, CPM_CR_STOP_TX); cpm_line_cr_cmd(pinfo, CPM_CR_STOP_TX);
else } else {
out_be16(&pinfo->sccup->scc_brkcr, 0);
cpm_line_cr_cmd(pinfo, CPM_CR_GRA_STOP_TX); cpm_line_cr_cmd(pinfo, CPM_CR_GRA_STOP_TX);
}
cpm_uart_initbd(pinfo); cpm_uart_initbd(pinfo);
} }
...@@ -554,9 +557,11 @@ static void cpm_uart_set_termios(struct uart_port *port, ...@@ -554,9 +557,11 @@ static void cpm_uart_set_termios(struct uart_port *port,
* enables, because we want to put them back if they were * enables, because we want to put them back if they were
* present. * present.
*/ */
prev_mode = in_be16(&smcp->smc_smcmr); prev_mode = in_be16(&smcp->smc_smcmr) & (SMCMR_REN | SMCMR_TEN);
out_be16(&smcp->smc_smcmr, smcr_mk_clen(bits) | cval | SMCMR_SM_UART); /* Output in *one* operation, so we don't interrupt RX/TX if they
setbits16(&smcp->smc_smcmr, (prev_mode & (SMCMR_REN | SMCMR_TEN))); * were already enabled. */
out_be16(&smcp->smc_smcmr, smcr_mk_clen(bits) | cval |
SMCMR_SM_UART | prev_mode);
} else { } else {
out_be16(&sccp->scc_psmr, (sbits << 12) | scval); out_be16(&sccp->scc_psmr, (sbits << 12) | scval);
} }
...@@ -1198,12 +1203,14 @@ static int __init cpm_uart_console_setup(struct console *co, char *options) ...@@ -1198,12 +1203,14 @@ static int __init cpm_uart_console_setup(struct console *co, char *options)
udbg_putc = NULL; udbg_putc = NULL;
#endif #endif
cpm_line_cr_cmd(pinfo, CPM_CR_STOP_TX);
if (IS_SMC(pinfo)) { if (IS_SMC(pinfo)) {
out_be16(&pinfo->smcup->smc_brkcr, 0);
cpm_line_cr_cmd(pinfo, CPM_CR_STOP_TX);
clrbits8(&pinfo->smcp->smc_smcm, SMCM_RX | SMCM_TX); clrbits8(&pinfo->smcp->smc_smcm, SMCM_RX | SMCM_TX);
clrbits16(&pinfo->smcp->smc_smcmr, SMCMR_REN | SMCMR_TEN); clrbits16(&pinfo->smcp->smc_smcmr, SMCMR_REN | SMCMR_TEN);
} else { } else {
out_be16(&pinfo->sccup->scc_brkcr, 0);
cpm_line_cr_cmd(pinfo, CPM_CR_GRA_STOP_TX);
clrbits16(&pinfo->sccp->scc_sccm, UART_SCCM_TX | UART_SCCM_RX); clrbits16(&pinfo->sccp->scc_sccm, UART_SCCM_TX | UART_SCCM_RX);
clrbits32(&pinfo->sccp->scc_gsmrl, SCC_GSMRL_ENR | SCC_GSMRL_ENT); clrbits32(&pinfo->sccp->scc_gsmrl, SCC_GSMRL_ENR | SCC_GSMRL_ENT);
} }
......
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