Re: [PATCH v2 3/3] tty: serial: sh-sci: Add RZ/G2L SCIF DMA rx support

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

 



Hi Biju,

On Fri, Mar 24, 2023 at 11:02 AM Biju Das <biju.das.jz@xxxxxxxxxxxxxx> wrote:
> Add SCIF DMA rx support for RZ/G2L alike SoCs.
>
> RZ/G2L alike SoCs use the same signal for both interrupt and DMA transfer
> requests, so we must disable line interrupt while transferring DMA.
>
> We must set FIFO trigger to 1 so that SCIF will request DMA when there is
> a character as SCIF DMA request is based on FIFO data full RDF.
>
> Based on a patch in the BSP by Long Luu
> <long.luu.ur@xxxxxxxxxxx>
>
> 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
> @@ -1312,9 +1312,13 @@ static void sci_dma_rx_reenable_irq(struct sci_port *s)
>
>         /* Direct new serial port interrupts back to CPU */
>         scr = serial_port_in(port, SCSCR);
> -       if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) {
> -               scr &= ~SCSCR_RDRQE;
> +       if (port->type == PORT_SCIFA || port->type == PORT_SCIFB ||
> +           is_rz_scif_port(port, s)) {
>                 enable_irq(s->irqs[SCIx_RXI_IRQ]);
> +               if (port->type == PORT_SCIF)
> +                       scif_set_rtrg(port, s->rx_trigger);
> +               else
> +                       scr &= ~SCSCR_RDRQE;
>         }
>         serial_port_out(port, SCSCR, scr | SCSCR_RIE);
>  }
> @@ -1735,7 +1739,15 @@ static irqreturn_t sci_rx_interrupt(int irq, void *ptr)
>                         if (sci_dma_rx_submit(s, false) < 0)
>                                 goto handle_pio;
>
> -                       scr &= ~SCSCR_RIE;
> +                       if (is_rz_scif_port(port, s)) {
> +                               /* Switch irq from SCIF to DMA */
> +                               disable_irq_nosync(s->irqs[SCIx_RXI_IRQ]);

Perhaps this can be combined with the disable_irq_nosync() above?

> +                               scif_set_rtrg(port, 1);
> +                               /* DMA need RIE enable */
> +                               scr |= SCSCR_RIE;
> +                       } else {
> +                               scr &= ~SCSCR_RIE;
> +                       }

... and this with some other SCIFA code path?

Looks like RZ/A2 and RZ/G2L "SCIFA" does have some resemblance with
SCIFA, contrary to earlier statements?
Perhaps the code can be simplified by treating it even more like
a SCIFA?

>                 }
>                 serial_port_out(port, SCSCR, scr);
>                 /* Clear current interrupt */

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]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux