devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@kernel.org>
To: Biju <biju.das.au@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Magnus Damm <magnus.damm@gmail.com>
Cc: Biju Das <biju.das.jz@bp.renesas.com>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
	devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH v3 13/13] serial: sh-sci: Add support for RZ/G3E RSCI SCI
Date: Tue, 18 Nov 2025 10:06:23 +0100	[thread overview]
Message-ID: <e4bd468f-6d66-4658-b69f-0dacf006d1a8@kernel.org> (raw)
In-Reply-To: <20251114105201.107406-14-biju.das.jz@bp.renesas.com>

Hi,

On 14. 11. 25, 11:51, Biju wrote:
> From: Biju Das <biju.das.jz@bp.renesas.com>
> 
> 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@bp.renesas.com>
...
> @@ -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

  reply	other threads:[~2025-11-18  9:06 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-14 10:51 [PATCH v3 00/13] Add RZ/G3E RSCI support Biju
2025-11-14 10:51 ` [PATCH v3 01/13] dt-bindings: serial: renesas,rsci: Document RZ/G3E support Biju
2025-11-21 16:28   ` Geert Uytterhoeven
2025-11-22 13:48     ` Biju Das
2025-11-22 14:15       ` Biju Das
2025-11-24 12:58         ` Geert Uytterhoeven
2025-11-24 15:35           ` Biju Das
2025-11-14 10:51 ` [PATCH v3 02/13] serial: rsci: Drop rsci_clear_CFC() Biju
2025-11-21 14:52   ` Geert Uytterhoeven
2025-11-22 12:49     ` Biju Das
2025-11-14 10:51 ` [PATCH v3 03/13] serial: sh-sci: Drop extra lines Biju
2025-11-21 14:53   ` Geert Uytterhoeven
2025-11-14 10:51 ` [PATCH v3 04/13] serial: rsci: Drop unused macro DCR Biju
2025-11-21 14:57   ` Geert Uytterhoeven
2025-11-22 12:50     ` Biju Das
2025-11-14 10:51 ` [PATCH v3 05/13] serial: rsci: Drop unused TDR register Biju
2025-11-21 15:00   ` Geert Uytterhoeven
2025-11-22 12:52     ` Biju Das
2025-11-14 10:51 ` [PATCH v3 06/13] serial: sh-sci: Use devm_reset_control_array_get_exclusive() Biju
2025-11-21 15:01   ` Geert Uytterhoeven
2025-11-14 10:51 ` [PATCH v3 07/13] serial: sh-sci: Add RSCI_PORT_{SCI,SCIF} port IDs Biju
2025-11-21 15:14   ` Geert Uytterhoeven
2025-11-22 13:20     ` Biju Das
2025-11-14 10:51 ` [PATCH v3 08/13] serial: sh-sci: Add sci_is_rsci_type() Biju
2025-11-21 15:17   ` Geert Uytterhoeven
2025-11-22 13:32     ` Biju Das
2025-11-14 10:51 ` [PATCH v3 09/13] serial: sh-sci: Add support for RZ/G3E RSCI clks Biju
2025-11-21 16:39   ` Geert Uytterhoeven
2025-11-22 16:50     ` Biju Das
2025-11-14 10:51 ` [PATCH v3 10/13] serial: sh-sci: Make sci_scbrr_calc() public Biju
2025-11-21 16:30   ` Geert Uytterhoeven
2025-11-21 16:30   ` Geert Uytterhoeven
2025-11-14 10:51 ` [PATCH v3 11/13] serial: sh-sci: Add finish_console_write() callback Biju
2025-11-14 10:51 ` [PATCH v3 12/13] serial: sh-sci: Add support for RZ/G3E RSCI SCIF Biju
2025-11-21 14:46   ` Geert Uytterhoeven
2025-11-22 12:30     ` Biju Das
2025-11-14 10:51 ` [PATCH v3 13/13] serial: sh-sci: Add support for RZ/G3E RSCI SCI Biju
2025-11-18  9:06   ` Jiri Slaby [this message]
2025-11-19 11:49     ` Biju Das

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=e4bd468f-6d66-4658-b69f-0dacf006d1a8@kernel.org \
    --to=jirislaby@kernel.org \
    --cc=biju.das.au@gmail.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=gregkh@linuxfoundation.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=robh@kernel.org \
    --cc=wsa+renesas@sang-engineering.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).