Re: [PATCH v2 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info

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

 



Hi Biju,

On Fri, Feb 10, 2023 at 5:01 PM Biju Das <biju.das.jz@xxxxxxxxxxxxxx> wrote:
> > On Fri, 10 Feb 2023, Biju Das wrote:
> > > As per HW manual section 40.6.1, we need to perform FIFO reset + SW
> > > reset before updating the below registers.
> > >
> > > FCR[7:5], FCR[3:0], LCR[7][5:0], MCR[6:4], DLL[7:0], DLM[7:0] and
> > > HCR0[6:5][3:2].
> > >
> > > This patch adds serial_out() to struct serial8250_em_hw_info to handle
> > > this difference between emma mobile and rz/v2m.
> > >
> > > DLL/DLM register can be updated only by setting LCR[7]. So the
> > > updation of LCR[7] will perform reset for DLL/DLM register changes.
> > >
> > > Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>

> > > --- a/drivers/tty/serial/8250/8250_em.c
> > > +++ b/drivers/tty/serial/8250/8250_em.c
> > > @@ -31,6 +35,40 @@ struct serial8250_em_priv {
> > >     const struct serial8250_em_hw_info *info;  };
> > >
> > > +static void serial8250_rzv2m_reg_update(struct uart_port *p, int off,
> > > +int value) {
> > > +   unsigned int ier, fcr, lcr, mcr, hcr0;
> > > +
> > > +   ier = readl(p->membase + (UART_IER << 2));
> > > +   hcr0 = readl(p->membase + (UART_HCR0 << 2));
> > > +   fcr = readl(p->membase + ((UART_FCR + 1) << 2));
> > > +   lcr = readl(p->membase + ((UART_LCR + 1) << 2));
> > > +   mcr = readl(p->membase + ((UART_MCR + 1) << 2));
> > > +
> > > +   writel(fcr | UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT,
> > > +          p->membase + ((UART_FCR + 1) << 2));
> > > +   writel(hcr0 | UART_HCR0_SW_RESET, p->membase + (UART_HCR0 << 2));
> > > +   writel(hcr0 & ~UART_HCR0_SW_RESET, p->membase + (UART_HCR0 << 2));
> > > +
> > > +   switch (off) {
> > > +   case UART_FCR:
> > > +           fcr = value;
> > > +           break;
> > > +   case UART_LCR:
> > > +           lcr = value;
> > > +           break;
> > > +   case UART_MCR:
> > > +           mcr = value;
> > > +           break;
> > > +   }
> > > +
> > > +   writel(ier, p->membase + (UART_IER << 2));
> > > +   writel(fcr, p->membase + ((UART_FCR + 1) << 2));
> > > +   writel(mcr, p->membase + ((UART_MCR + 1) << 2));
> > > +   writel(lcr, p->membase + ((UART_LCR + 1) << 2));
> > > +   writel(hcr0, p->membase + (UART_HCR0 << 2));
> >
> > Perhaps it would make sense to instead of using readl/writel() directly to
> > call serial8250_em_serial_in/out() so all the offset trickery wouldn't need
> > to be duplicated inside this function?
>
> HCR0 register is not available for emma mobile. Is it ok if I just do readl/writel for
> that register and rest will use serial8250_em_serial_in/out()??

According to R19UH0040EJ0400 Rev.4.00 it is available on EMEV2,
and the layout looks identical to RZ/V2M.

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