Skip to content

Commit 3321944

Browse files
jhovoldgregkh
authored andcommitted
serial: qcom-geni: fix polled console initialisation
commit 4bef7c6 upstream. 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: stable@vger.kernel.org # 6.4 Cc: Douglas Anderson <dianders@chromium.org> Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Reviewed-by: Douglas Anderson <dianders@chromium.org> Link: https://lore.kernel.org/r/20241009145110.16847-2-johan+linaro@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent dc08030 commit 3321944

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

drivers/tty/serial/qcom_geni_serial.c

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

148148
static void qcom_geni_serial_cancel_tx_cmd(struct uart_port *uport);
149+
static int qcom_geni_serial_port_setup(struct uart_port *uport);
149150

150151
static inline struct qcom_geni_serial_port *to_dev_port(struct uart_port *uport)
151152
{
@@ -393,6 +394,23 @@ static void qcom_geni_serial_poll_put_char(struct uart_port *uport,
393394
writel(M_TX_FIFO_WATERMARK_EN, uport->membase + SE_GENI_M_IRQ_CLEAR);
394395
qcom_geni_serial_poll_tx_done(uport);
395396
}
397+
398+
static int qcom_geni_serial_poll_init(struct uart_port *uport)
399+
{
400+
struct qcom_geni_serial_port *port = to_dev_port(uport);
401+
int ret;
402+
403+
if (!port->setup) {
404+
ret = qcom_geni_serial_port_setup(uport);
405+
if (ret)
406+
return ret;
407+
}
408+
409+
if (!qcom_geni_serial_secondary_active(uport))
410+
geni_se_setup_s_cmd(&port->se, UART_START_READ, 0);
411+
412+
return 0;
413+
}
396414
#endif
397415

398416
#ifdef CONFIG_SERIAL_QCOM_GENI_CONSOLE
@@ -1564,7 +1582,7 @@ static const struct uart_ops qcom_geni_console_pops = {
15641582
#ifdef CONFIG_CONSOLE_POLL
15651583
.poll_get_char = qcom_geni_serial_get_char,
15661584
.poll_put_char = qcom_geni_serial_poll_put_char,
1567-
.poll_init = qcom_geni_serial_port_setup,
1585+
.poll_init = qcom_geni_serial_poll_init,
15681586
#endif
15691587
.pm = qcom_geni_serial_pm,
15701588
};

0 commit comments

Comments
 (0)