Re: [PATCH v4 4/5] tty: serial: sh-sci: Add support for tx end interrupt handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Biju,

On Wed, Apr 12, 2023 at 4:57 PM Biju Das <biju.das.jz@xxxxxxxxxxxxxx> wrote:
> As per the RZ/G2L users hardware manual (Rev.1.20 Sep, 2022), section
> 23.3.7 Serial Data Transmission (Asynchronous Mode), it is mentioned
> that, set the SCR.TIE bit to 0 and SCR.TEIE bit to 1, after the last
> data to be transmitted are written to the TDR.
>
> This will generate tx end interrupt and in the handler set SCR.TE and
> SCR.TEIE to 0.
>
> Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>

Thanks for your patch!

> --- a/drivers/tty/serial/sh-sci.c
> +++ b/drivers/tty/serial/sh-sci.c
> @@ -860,9 +860,16 @@ static void sci_transmit_chars(struct uart_port *port)
>
>         if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
>                 uart_write_wakeup(port);
> -       if (uart_circ_empty(xmit))
> -               sci_stop_tx(port);
> +       if (uart_circ_empty(xmit)) {
> +               if (port->type == PORT_SCI) {
> +                       ctrl = serial_port_in(port, SCSCR);
> +                       ctrl &= ~SCSCR_TIE;
> +                       ctrl |= SCSCR_TEIE;
> +                       serial_port_out(port, SCSCR, ctrl);

Clearing SCSCR_TIE is already done in sci_stop_tx() below,
so I think it would be better to just add

    if (port->type == PORT_SCI)
            ctrl |= SCSCR_TEIE

to sci_stop_tx() instead.

> +               }
>
> +               sci_stop_tx(port);
> +       }
>  }

The rest LGTM.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux