[PATCH v1 28/31] serial: 8250_mxpcie: Track current serial interface for later feature gating

Crescent Hsieh posted 31 patches 1 day, 11 hours ago
[PATCH v1 28/31] serial: 8250_mxpcie: Track current serial interface for later feature gating
Posted by Crescent Hsieh 1 day, 11 hours ago
Introduce an `interface` field in struct mxpcie8250_port and update it
whenever the serial interface is switched via mxpcie8250_set_interface().

This allows runtime checks based on the active interface (e.g. RS-232 vs
RS-422/485) in later patches, where features such as terminator, pull
state, or auto mode must only be enabled for differential modes.

Signed-off-by: Crescent Hsieh <crescentcy.hsieh@moxa.com>
---
 drivers/tty/serial/8250/8250_mxpcie.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/tty/serial/8250/8250_mxpcie.c b/drivers/tty/serial/8250/8250_mxpcie.c
index 88ab918fd000..7a1030a47b00 100644
--- a/drivers/tty/serial/8250/8250_mxpcie.c
+++ b/drivers/tty/serial/8250/8250_mxpcie.c
@@ -128,6 +128,7 @@
 
 struct mxpcie8250_port {
 	int line;
+	int interface;
 	unsigned long event_flags;
 	u8 rx_trig_level;
 	struct uart_port *uport;
@@ -505,6 +506,8 @@ static int mxpcie8250_set_interface(struct mxpcie8250 *priv,
 	}
 	outb(cval, UIR_addr);
 
+	priv->port[port_idx].interface = mode;
+
 	return 0;
 }
 
-- 
2.45.2