[PATCH 15/15] serial: 8250_mxpcie: implement rx_trig_bytes callbacks via MUEx50 RTL
From: Crescent Hsieh
Date: Mon May 04 2026 - 04:53:47 EST
The MUEx50 UART exposes a programmable RX trigger level via the RTL
register.
Implement uart_port RX trigger set/get callbacks for the mxpcie driver
and wire them up to the generic rx_trig_bytes sysfs interface. Store the
configured trigger level in the per-port private data.
Signed-off-by: Crescent Hsieh <crescentcy.hsieh@xxxxxxxx>
---
drivers/tty/serial/8250/8250_mxpcie.c | 28 ++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/serial/8250/8250_mxpcie.c b/drivers/tty/serial/8250/8250_mxpcie.c
index 5bf15ca78228..cc317202b658 100644
--- a/drivers/tty/serial/8250/8250_mxpcie.c
+++ b/drivers/tty/serial/8250/8250_mxpcie.c
@@ -111,6 +111,7 @@
struct mxpcie8250_port {
int line;
+ u8 rx_trig_level;
unsigned long event_flags;
struct uart_port *port;
struct work_struct work;
@@ -262,6 +263,7 @@ static void mxpcie8250_set_termios(struct uart_port *port,
static int mxpcie8250_startup(struct uart_port *port)
{
+ struct mxpcie8250 *priv = dev_get_drvdata(port->dev);
struct uart_8250_port *up = up_to_u8250p(port);
unsigned int i;
int ret;
@@ -277,7 +279,7 @@ static int mxpcie8250_startup(struct uart_port *port)
serial_out(up, MOXA_PUART_SFR, MOXA_PUART_SFR_950);
serial_out(up, MOXA_PUART_TTL, 0);
- serial_out(up, MOXA_PUART_RTL, 96);
+ serial_out(up, MOXA_PUART_RTL, priv->port[port->port_id].rx_trig_level);
serial_out(up, MOXA_PUART_FCL, 16);
serial_out(up, MOXA_PUART_FCH, 110);
@@ -477,6 +479,27 @@ static void mxpcie8250_break_ctl(struct uart_port *port, int break_state)
serial8250_do_break_ctl(port, break_state);
}
+static int mxpcie8250_set_rxtrig(struct uart_port *port, unsigned char bytes)
+{
+ struct mxpcie8250 *priv = dev_get_drvdata(port->dev);
+ struct uart_8250_port *up = up_to_u8250p(port);
+
+ if (bytes > 128)
+ return -EINVAL;
+
+ serial_out(up, MOXA_PUART_RTL, bytes);
+ priv->port[port->port_id].rx_trig_level = bytes;
+
+ return 0;
+}
+
+static int mxpcie8250_get_rxtrig(struct uart_port *port)
+{
+ struct uart_8250_port *up = up_to_u8250p(port);
+
+ return serial_in(up, MOXA_PUART_RTL);
+}
+
static void mxpcie8250_work_handler(struct work_struct *work)
{
struct mxpcie8250_port *priv_port = container_of(work, struct mxpcie8250_port, work);
@@ -591,6 +614,8 @@ static int mxpcie8250_probe(struct pci_dev *pdev, const struct pci_device_id *id
up.port.unthrottle = mxpcie8250_unthrottle;
up.port.handle_irq = mxpcie8250_handle_irq;
up.port.break_ctl = mxpcie8250_break_ctl;
+ up.port.set_rxtrig = mxpcie8250_set_rxtrig;
+ up.port.get_rxtrig = mxpcie8250_get_rxtrig;
for (i = 0; i < num_ports; i++) {
mxpcie8250_setup_port(pdev, priv, &up, i);
@@ -608,6 +633,7 @@ static int mxpcie8250_probe(struct pci_dev *pdev, const struct pci_device_id *id
}
new_port = serial8250_get_port(priv->port[i].line);
+ priv->port[i].rx_trig_level = 96;
priv->port[i].port = &new_port->port;
INIT_WORK(&priv->port[i].work, mxpcie8250_work_handler);
--
2.43.0