RE: [PATCH v5 03/17] serial: rsci: Add set_rtrg() callback

From: Biju Das

Date: Mon Dec 22 2025 - 09:30:22 EST


Hi Geert,

> -----Original Message-----
> From: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
> Sent: 22 December 2025 14:05
> Subject: Re: [PATCH v5 03/17] serial: rsci: Add set_rtrg() callback
>
> Hi Biju,
>
> On Sat, 29 Nov 2025 at 17:43, Biju <biju.das.au@xxxxxxxxx> wrote:
> > From: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
> >
> > The rtrg variable is populated in sci_init_single() for RZ/T2H. Add
> > set_rtrg() callback for setting the rtrg value.
> >
> > Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
> > ---
> > v5:
> > * New patch.
>
> Thanks for your patch, which is now commit b346e5d7dbf66961 ("serial:
> rsci: Add set_rtrg() callback") in tty/tty-next.
>
> > --- a/drivers/tty/serial/rsci.c
> > +++ b/drivers/tty/serial/rsci.c
> > @@ -151,6 +151,22 @@ static void rsci_start_rx(struct uart_port *port)
> > rsci_serial_out(port, CCR0, ctrl); }
> >
> > +static int rsci_scif_set_rtrg(struct uart_port *port, int rx_trig) {
> > + u32 fcr = rsci_serial_in(port, FCR);
> > +
> > + if (rx_trig >= port->fifosize)
> > + rx_trig = port->fifosize - 1;
> > + else if (rx_trig < 1)
> > + rx_trig = 0;
> > +
> > + fcr &= ~FCR_RTRG4_0;
> > + fcr |= field_prep(FCR_RTRG4_0, rx_trig);
>
> FIELD_PREP(), as FCR_RTRG4_0 is a constant.
> However, this can be combined with the previous line, using FIELD_MODIFY().
>
> I have sent a follow-up patch: "[PATCH] serial: rsci: Convert to FIELD_MODIFY()".
> https://lore.kernel.org/ada3faf4698155a618ae6371b35eab121eb8b19c.1766411924.git.geert+renesas@glider.b
> e

OK, thanks for optimizing it.

Cheers,
Biju