From: Sven Eckelmann <se@simonwunderlich.de>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Subject: Re: [PATCH] serial: ar933x: Add polling support
Date: Wed, 01 Oct 2025 14:07:53 +0200 [thread overview]
Message-ID: <7867515.MhkbZ0Pkbq@ripper> (raw)
In-Reply-To: <20251001-ar933x-kgdb-support-v1-1-5fffd9e36a01@simonwunderlich.de>
[-- Attachment #1.1: Type: text/plain, Size: 1059 bytes --]
On Wednesday, 1 October 2025 13:47:26 CEST Sven Eckelmann wrote:
> KGDB requires at least the polling hooks .poll_get_char and .poll_put_char
> to transmit/receive character via the serial driver.
>
> Signed-off-by: Sven Eckelmann <se@simonwunderlich.de>
> ---
> drivers/tty/serial/ar933x_uart.c | 62 ++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 62 insertions(+)
I also had a look at break detection to ease the debugging on our side. Just
to be able to switch to KGDB mode via gdb.
While I got it working, it is more a hack than a good implementation. I've
attached the hack in case someone wants to continue to work on it.
On Wednesday, 1 October 2025 14:05:41 CEST Greg Kroah-Hartman wrote:
> Right now, the development tree you have sent a patch for is "closed"
> due to the timing of the merge window. Don't worry, the patch(es) you
> have sent are not lost, and will be looked at after the merge window is
> over (after the -rc1 kernel is released by Linus).
*looks at the calendar* Oh, yes, there was something.
Regards,
Sven
[-- Attachment #1.2: RFC-0001-serial-ar933x-Handle-break-events.patch --]
[-- Type: text/x-patch, Size: 3956 bytes --]
From 7892ef568d7ca4c1c2a0ed9fb8edbadfe8e70177 Mon Sep 17 00:00:00 2001
From: Sven Eckelmann <se@simonwunderlich.de>
Date: Mon, 15 Sep 2025 15:35:14 +0200
Subject: [PATCH RFC] serial: ar933x: Handle break events
Signed-off-by: Sven Eckelmann <se@simonwunderlich.de>
---
drivers/tty/serial/ar933x_uart.c | 53 ++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)
diff --git a/drivers/tty/serial/ar933x_uart.c b/drivers/tty/serial/ar933x_uart.c
index 5b491db9d2fc..bc0a63e4934b 100644
--- a/drivers/tty/serial/ar933x_uart.c
+++ b/drivers/tty/serial/ar933x_uart.c
@@ -105,6 +105,30 @@ static inline void ar933x_uart_stop_tx_interrupt(struct ar933x_uart_port *up)
ar933x_uart_write(up, AR933X_UART_INT_EN_REG, up->ier);
}
+static inline void ar933x_uart_start_rxbreak_on_interrupt(struct ar933x_uart_port *up)
+{
+ up->ier |= AR933X_UART_INT_RX_BREAK_ON;
+ ar933x_uart_write(up, AR933X_UART_INT_EN_REG, up->ier);
+}
+
+static inline void ar933x_uart_stop_rxbreak_on_interrupt(struct ar933x_uart_port *up)
+{
+ up->ier &= ~AR933X_UART_INT_RX_BREAK_ON;
+ ar933x_uart_write(up, AR933X_UART_INT_EN_REG, up->ier);
+}
+
+static inline void ar933x_uart_start_rxbreak_off_interrupt(struct ar933x_uart_port *up)
+{
+ up->ier |= AR933X_UART_INT_RX_BREAK_OFF;
+ ar933x_uart_write(up, AR933X_UART_INT_EN_REG, up->ier);
+}
+
+static inline void ar933x_uart_stop_rxbreak_off_interrupt(struct ar933x_uart_port *up)
+{
+ up->ier &= ~AR933X_UART_INT_RX_BREAK_OFF;
+ ar933x_uart_write(up, AR933X_UART_INT_EN_REG, up->ier);
+}
+
static inline void ar933x_uart_start_rx_interrupt(struct ar933x_uart_port *up)
{
up->ier |= AR933X_UART_INT_RX_VALID;
@@ -212,6 +236,7 @@ static void ar933x_uart_stop_rx(struct uart_port *port)
container_of(port, struct ar933x_uart_port, port);
ar933x_uart_stop_rx_interrupt(up);
+ ar933x_uart_stop_rxbreak_on_interrupt(up);
}
static void ar933x_uart_break_ctl(struct uart_port *port, int break_state)
@@ -444,11 +469,14 @@ static irqreturn_t ar933x_uart_interrupt(int irq, void *dev_id)
{
struct ar933x_uart_port *up = dev_id;
unsigned int status;
+ bool is_break;
status = ar933x_uart_read(up, AR933X_UART_CS_REG);
if ((status & AR933X_UART_CS_HOST_INT) == 0)
return IRQ_NONE;
+ is_break = status & AR933X_UART_CS_RX_BREAK;
+
uart_port_lock(&up->port);
status = ar933x_uart_read(up, AR933X_UART_INT_REG);
@@ -467,6 +495,29 @@ static irqreturn_t ar933x_uart_interrupt(int irq, void *dev_id)
ar933x_uart_tx_chars(up);
}
+ if (status & AR933X_UART_INT_RX_BREAK_ON)
+ ar933x_uart_write(up, AR933X_UART_INT_REG,
+ AR933X_UART_INT_RX_BREAK_ON);
+
+ if (status & AR933X_UART_INT_RX_BREAK_OFF)
+ ar933x_uart_write(up, AR933X_UART_INT_REG,
+ AR933X_UART_INT_RX_BREAK_OFF);
+
+ if (is_break) {
+ /* disable "active break" interrupt */
+ ar933x_uart_stop_rxbreak_on_interrupt(up);
+ ar933x_uart_start_rxbreak_off_interrupt(up);
+
+ /* inform serial core about break */
+ up->port.icount.brk++;
+ if (!up->port.sysrq)
+ uart_handle_break(&up->port);
+ } else if (!(up->ier & AR933X_UART_INT_RX_BREAK_ON)) {
+ /* enable "active break" interrupt */
+ ar933x_uart_start_rxbreak_on_interrupt(up);
+ ar933x_uart_stop_rxbreak_off_interrupt(up);
+ }
+
uart_unlock_and_check_sysrq(&up->port);
return IRQ_HANDLED;
@@ -496,6 +547,7 @@ static int ar933x_uart_startup(struct uart_port *port)
/* Enable RX interrupts */
ar933x_uart_start_rx_interrupt(up);
+ ar933x_uart_start_rxbreak_on_interrupt(up);
uart_port_unlock_irqrestore(&up->port, flags);
@@ -829,6 +881,7 @@ static int ar933x_uart_probe(struct platform_device *pdev)
port->ops = &ar933x_uart_ops;
port->rs485_config = ar933x_config_rs485;
port->rs485_supported = ar933x_rs485_supported;
+ port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_AR933X_CONSOLE);
baud = ar933x_uart_get_baud(port->uartclk, AR933X_UART_MAX_SCALE, 1);
up->min_baud = max_t(unsigned int, baud, AR933X_UART_MIN_BAUD);
--
2.47.3
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
prev parent reply other threads:[~2025-10-01 12:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-01 11:47 [PATCH] serial: ar933x: Add polling support Sven Eckelmann
2025-10-01 12:07 ` Sven Eckelmann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7867515.MhkbZ0Pkbq@ripper \
--to=se@simonwunderlich.de \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.