Skip to content

Commit 4bef7c6

Browse files
jhovoldgregkh
authored andcommitted
serial: qcom-geni: fix polled console initialisation
The polled console (KGDB/KDB) implementation must not call port setup unconditionally as the port may already be in use by the console or a getty. Only make sure that the receiver is enabled, but do not enable any device interrupts. Fixes: d8851a9 ("tty: serial: qcom-geni-serial: Add a poll_init() function") Cc: [email protected] # 6.4 Cc: Douglas Anderson <[email protected]> Signed-off-by: Johan Hovold <[email protected]> Reviewed-by: Douglas Anderson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 40d7903 commit 4bef7c6

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

drivers/tty/serial/qcom_geni_serial.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ static struct uart_driver qcom_geni_uart_driver;
147147

148148
static void __qcom_geni_serial_cancel_tx_cmd(struct uart_port *uport);
149149
static void qcom_geni_serial_cancel_tx_cmd(struct uart_port *uport);
150+
static int qcom_geni_serial_port_setup(struct uart_port *uport);
150151

151152
static inline struct qcom_geni_serial_port *to_dev_port(struct uart_port *uport)
152153
{
@@ -395,6 +396,23 @@ static void qcom_geni_serial_poll_put_char(struct uart_port *uport,
395396
writel(c, uport->membase + SE_GENI_TX_FIFOn);
396397
qcom_geni_serial_poll_tx_done(uport);
397398
}
399+
400+
static int qcom_geni_serial_poll_init(struct uart_port *uport)
401+
{
402+
struct qcom_geni_serial_port *port = to_dev_port(uport);
403+
int ret;
404+
405+
if (!port->setup) {
406+
ret = qcom_geni_serial_port_setup(uport);
407+
if (ret)
408+
return ret;
409+
}
410+
411+
if (!qcom_geni_serial_secondary_active(uport))
412+
geni_se_setup_s_cmd(&port->se, UART_START_READ, 0);
413+
414+
return 0;
415+
}
398416
#endif
399417

400418
#ifdef CONFIG_SERIAL_QCOM_GENI_CONSOLE
@@ -1582,7 +1600,7 @@ static const struct uart_ops qcom_geni_console_pops = {
15821600
#ifdef CONFIG_CONSOLE_POLL
15831601
.poll_get_char = qcom_geni_serial_get_char,
15841602
.poll_put_char = qcom_geni_serial_poll_put_char,
1585-
.poll_init = qcom_geni_serial_port_setup,
1603+
.poll_init = qcom_geni_serial_poll_init,
15861604
#endif
15871605
.pm = qcom_geni_serial_pm,
15881606
};

0 commit comments

Comments
 (0)