Hi Geert,
On Sunday, July 29, 2018, Geert Uytterhoeven wrote:
> I've accidentally discovered this breaks SCIF on SH7751R2D (QEMU), as the
> board code doesn't fill in regtype, so it is 0 = SCIx_PROBE_REGTYPE.
Oh that pesky SH7751!!
On Monday, July 30, 2018, Geert Uytterhoeven wrote:
> > I made it work by changing the check to:
> >
> > - if (p->regtype == SCIx_SH4_SCIF_REGTYPE)
> > + if (p->regtype == SCIx_SH4_SCIF_REGTYPE ||
> > + (p->regtype == SCIx_PROBE_REGTYPE && port->type ==
> PORT_SCIF))
> >
> > Perhaps there's a better way?
>
> Like (whitespace-damaged-gmail):
>
> --- a/drivers/tty/serial/sh-sci.c
> +++ b/drivers/tty/serial/sh-sci.c
> @@ -3340,7 +3340,7 @@ static int sci_init_single(struct platform_device
> *dev,
> {
> struct uart_port *port = &sci_port->port;
> const struct resource *res;
> - unsigned int i;
> + unsigned int i, regtype;
> int ret;
>
> sci_port->cfg = p;
> @@ -3381,6 +3381,7 @@ static int sci_init_single(struct platform_device
> *dev,
> if (unlikely(sci_port->params == NULL))
> return -EINVAL;
>
> + regtype = sci_port->params - sci_port_params;
> switch (p->type) {
> case PORT_SCIFB:
> sci_port->rx_trigger = 48;
> @@ -3435,7 +3436,7 @@ static int sci_init_single(struct platform_device
> *dev,
> port->regshift = 1;
> }
>
> - if (p->regtype == SCIx_SH4_SCIF_REGTYPE)
> + if (regtype == SCIx_SH4_SCIF_REGTYPE)
> if (sci_port->reg_size >= 0x20)
> port->regshift = 1;
That's clever.
If it worked for SH7751, I'll go test it on RZ/A2 as well and resubmit
the patch.
Chris