Re: [PATCH v3 13/13] serial: sh-sci: Add support for RZ/G3E RSCI SCI
From: Jiri Slaby
Date: Tue Nov 18 2025 - 04:08:14 EST
Hi,
On 14. 11. 25, 11:51, Biju wrote:
From: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
Add support for RZ/G3E RSCI SCI(a.k.a non FIFO mode).
"a.k.a. non-FIFO"
Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>...
@@ -496,34 +521,40 @@ static void rsci_receive_chars(struct uart_port *port)
if (count == 0)
break;
- for (i = 0; i < count; i++) {
- char c;
-
- rdat = rsci_serial_in(port, RDR);
- /* 9-bits data is not supported yet */
- c = rdat & RDR_RDAT_MSK;
-
- if (uart_handle_sysrq_char(port, c)) {
- count--;
- i--;
- continue;
- }
-
- /*
- * Store data and status.
- * Non FIFO mode is not supported
- */
- if (rdat & RDR_FFER) {
- flag = TTY_FRAME;
- port->icount.frame++;
- } else if (rdat & RDR_FPER) {
- flag = TTY_PARITY;
- port->icount.parity++;
- } else {
- flag = TTY_NORMAL;
+ if (s->type == RSCI_PORT_SCI) {
+ char c = rsci_serial_in(port, RDR) & RDR_RDAT_MSK;
+
+ if (uart_handle_sysrq_char(port, c))
+ count = 0;
+ else
+ tty_insert_flip_char(tport, c, TTY_NORMAL);
+ } else {
+ for (i = 0; i < count; i++) {
+ char c;
+
+ rdat = rsci_serial_in(port, RDR);
+ /* 9-bits data is not supported yet */
+ c = rdat & RDR_RDAT_MSK;
+
+ if (uart_handle_sysrq_char(port, c)) {
+ count--;
+ i--;
+ continue;
+ }
+
+ /* Store data and status */
+ if (rdat & RDR_FFER) {
+ flag = TTY_FRAME;
+ port->icount.frame++;
+ } else if (rdat & RDR_FPER) {
+ flag = TTY_PARITY;
+ port->icount.parity++;
+ } else {
+ flag = TTY_NORMAL;
+ }
+
+ tty_insert_flip_char(tport, c, flag);
}
Instead of this shuffle and introducing the 'if', can't you just set count to 1 and introduce a mask like:
if (SCI) {
count = 1;
read_mask = RDR_RDAT_MSK;
} else {
read_mask = ~0U;
}
for (...) {
...
rdat = rsci_serial_in(port, RDR) & read_mask;
}
and that's it?
thanks,
--
js
suse labs