Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9ab92120 authored by Xiaotian Feng's avatar Xiaotian Feng Committed by Kumar Gala
Browse files

cpm_uart: fix non-console port startup bug



After UART interrupt handler is installed and rx is enabled, if an rx
interrupt comes before hardware init, rx->cur will be updated. Then the
hardware init will reset BD and make rx->cur out of sync, move the hardware
init code before request_irq.

Signed-off-by: default avatarXiaotian Feng <xiaotian.feng@windriver.com>
Signed-off-by: default avatarKumar Gala <galak@kernel.crashing.org>
parent 0bcd783c
Loading
Loading
Loading
Loading
+12 −2
Original line number Original line Diff line number Diff line
@@ -406,6 +406,18 @@ static int cpm_uart_startup(struct uart_port *port)


	pr_debug("CPM uart[%d]:startup\n", port->line);
	pr_debug("CPM uart[%d]:startup\n", port->line);


	/* If the port is not the console, make sure rx is disabled. */
	if (!(pinfo->flags & FLAG_CONSOLE)) {
		/* Disable UART rx */
		if (IS_SMC(pinfo)) {
			clrbits16(&pinfo->smcp->smc_smcmr, SMCMR_REN);
			clrbits8(&pinfo->smcp->smc_smcm, SMCM_RX);
		} else {
			clrbits32(&pinfo->sccp->scc_gsmrl, SCC_GSMRL_ENR);
			clrbits16(&pinfo->sccp->scc_sccm, UART_SCCM_RX);
		}
		cpm_line_cr_cmd(pinfo, CPM_CR_INIT_TRX);
	}
	/* Install interrupt handler. */
	/* Install interrupt handler. */
	retval = request_irq(port->irq, cpm_uart_int, 0, "cpm_uart", port);
	retval = request_irq(port->irq, cpm_uart_int, 0, "cpm_uart", port);
	if (retval)
	if (retval)
@@ -420,8 +432,6 @@ static int cpm_uart_startup(struct uart_port *port)
		setbits32(&pinfo->sccp->scc_gsmrl, (SCC_GSMRL_ENR | SCC_GSMRL_ENT));
		setbits32(&pinfo->sccp->scc_gsmrl, (SCC_GSMRL_ENR | SCC_GSMRL_ENT));
	}
	}


	if (!(pinfo->flags & FLAG_CONSOLE))
		cpm_line_cr_cmd(pinfo, CPM_CR_INIT_TRX);
	return 0;
	return 0;
}
}