The Greybus UART protocol supports only 8 data bits, no parity, one stop bit, and no hardware flow control. Mask out unsupported termios flags before applying settings and force the supported configuration. This removes the old FIXME and aligns the driver with TTY subsystem expectations.
Signed-off-by: Ayaan Mirza Baig ayaanmirzabaig85@gmail.com --- drivers/staging/greybus/uart.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c index 10df5c37c83e..cc7337bf5088 100644 --- a/drivers/staging/greybus/uart.c +++ b/drivers/staging/greybus/uart.c @@ -495,8 +495,14 @@ static void gb_tty_set_termios(struct tty_struct *tty,
newline.data_bits = tty_get_char_size(termios->c_cflag);
- /* FIXME: needs to clear unsupported bits in the termios */ - gb_tty->clocal = ((termios->c_cflag & CLOCAL) != 0); + /* Mask out unsupported termios flags for Greybus UART */ + termios->c_cflag &= ~(CSIZE | CSTOPB | PARENB | PARODD | + CRTSCTS | CMSPAR | CBAUD | CBAUDEX); + termios->c_cflag |= CS8; /* Force 8 data bits */ + termios->c_cflag &= ~PARENB; /* No parity */ + termios->c_cflag &= ~CSTOPB; /* One stop bit */ + + gb_tty->clocal = (termios->c_cflag & CLOCAL);
if (C_BAUD(tty) == B0) { newline.rate = gb_tty->line_coding.rate;