diff mbox

sh-sci: add R8A7743/5 support

Message ID 2017044.9fZNuWa2OZ@wasted.cogentembedded.com (mailing list archive)
State Superseded
Delegated to: Geert Uytterhoeven
Headers show

Commit Message

Sergei Shtylyov Sept. 29, 2016, 9:37 p.m. UTC
Renesas  RZ/G SoC also have the SCIF, SCIFA, SCIFB, and HSCIF ports.
Document RZ/G1[ME] (also known as R8A774[35]) SoC bindings along with
the RZ/G family bindings.  The driver itself also needs to recognize
the latter binding for the SCIF ports, so teach it...

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

---
This patch is against the 'tty-next' branch of GregKH's 'tty.git' repo.

 Documentation/devicetree/bindings/serial/renesas,sci-serial.txt |   12 ++++++++++
 drivers/tty/serial/sh-sci.c                                     |    3 ++
 2 files changed, 15 insertions(+)

Comments

Simon Horman Sept. 30, 2016, 6:35 a.m. UTC | #1
On Fri, Sep 30, 2016 at 12:37:13AM +0300, Sergei Shtylyov wrote:
> Renesas  RZ/G SoC also have the SCIF, SCIFA, SCIFB, and HSCIF ports.
> Document RZ/G1[ME] (also known as R8A774[35]) SoC bindings along with
> the RZ/G family bindings.  The driver itself also needs to recognize
> the latter binding for the SCIF ports, so teach it...
> 
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

Acked-by: Simon Horman <horms+renesas@verge.net.au>
Geert Uytterhoeven Sept. 30, 2016, 8:38 a.m. UTC | #2
Hi Sergei,

On Thu, Sep 29, 2016 at 11:37 PM, Sergei Shtylyov
<sergei.shtylyov@cogentembedded.com> wrote:
> Renesas  RZ/G SoC also have the SCIF, SCIFA, SCIFB, and HSCIF ports.
> Document RZ/G1[ME] (also known as R8A774[35]) SoC bindings along with
> the RZ/G family bindings.  The driver itself also needs to recognize
> the latter binding for the SCIF ports, so teach it...
>
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>
> ---
> This patch is against the 'tty-next' branch of GregKH's 'tty.git' repo.
>
>  Documentation/devicetree/bindings/serial/renesas,sci-serial.txt |   12 ++++++++++
>  drivers/tty/serial/sh-sci.c                                     |    3 ++
>  2 files changed, 15 insertions(+)
>
> Index: tty/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
> ===================================================================
> --- tty.orig/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
> +++ tty/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
> @@ -9,6 +9,14 @@ Required properties:
>      - "renesas,scifb-r8a73a4" for R8A73A4 (R-Mobile APE6) SCIFB compatible UART.
>      - "renesas,scifa-r8a7740" for R8A7740 (R-Mobile A1) SCIFA compatible UART.
>      - "renesas,scifb-r8a7740" for R8A7740 (R-Mobile A1) SCIFB compatible UART.
> +    - "renesas,scif-r8a7743" for R8A7743 (RZ/G1M) SCIF compatible UART.
> +    - "renesas,scifa-r8a7743" for R8A7743 (RZ/G1M) SCIFA compatible UART.
> +    - "renesas,scifb-r8a7743" for R8A7743 (RZ/G1M) SCIFB compatible UART.
> +    - "renesas,hscif-r8a7743" for R8A7743 (RZ/G1M) HSCIF compatible UART.
> +    - "renesas,scif-r8a7745" for R8A7745 (RZ/G1E) SCIF compatible UART.
> +    - "renesas,scifa-r8a7745" for R8A7745 (RZ/G1E) SCIFA compatible UART.
> +    - "renesas,scifb-r8a7745" for R8A7745 (RZ/G1E) SCIFB compatible UART.
> +    - "renesas,hscif-r8a7745" for R8A7745 (RZ/G1E) HSCIF compatible UART.
>      - "renesas,scif-r8a7778" for R8A7778 (R-Car M1) SCIF compatible UART.
>      - "renesas,scif-r8a7779" for R8A7779 (R-Car H1) SCIF compatible UART.
>      - "renesas,scif-r8a7790" for R8A7790 (R-Car H2) SCIF compatible UART.

For the part above:
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>

> @@ -38,11 +46,15 @@ Required properties:
>      - "renesas,rcar-gen1-scif" for R-Car Gen1 SCIF compatible UART,
>      - "renesas,rcar-gen2-scif" for R-Car Gen2 SCIF compatible UART,
>      - "renesas,rcar-gen3-scif" for R-Car Gen3 SCIF compatible UART,
> +    - "renesas,rzg-scif" for RZ/G SCIF compatible UART.
>      - "renesas,rcar-gen2-scifa" for R-Car Gen2 SCIFA compatible UART,
> +    - "renesas,rzg-scifa" for RZ/G SCIFA compatible UART.
>      - "renesas,rcar-gen2-scifb" for R-Car Gen2 SCIFB compatible UART,
> +    - "renesas,rzg-scifb" for RZ/G SCIFB compatible UART.
>      - "renesas,rcar-gen1-hscif" for R-Car Gen1 HSCIF compatible UART,
>      - "renesas,rcar-gen2-hscif" for R-Car Gen2 HSCIF compatible UART,
>      - "renesas,rcar-gen3-hscif" for R-Car Gen3 HSCIF compatible UART,
> +    - "renesas,rzg-hscif" for RZ/G HSCIF compatible UART.
>      - "renesas,scif" for generic SCIF compatible UART.
>      - "renesas,scifa" for generic SCIFA compatible UART.
>      - "renesas,scifb" for generic SCIFB compatible UART.
> Index: tty/drivers/tty/serial/sh-sci.c
> ===================================================================
> --- tty.orig/drivers/tty/serial/sh-sci.c
> +++ tty/drivers/tty/serial/sh-sci.c
> @@ -2950,6 +2950,9 @@ static const struct of_device_id of_sci_
>         }, {
>                 .compatible = "renesas,rcar-gen3-scif",
>                 .data = SCI_OF_DATA(PORT_SCIF, SCIx_SH4_SCIF_BRG_REGTYPE),
> +       }, {
> +               .compatible = "renesas,rzg-scif",
> +               .data = SCI_OF_DATA(PORT_SCIF, SCIx_SH4_SCIF_BRG_REGTYPE),
>         },
>         /* Generic types */
>         {

However, I wouldn't bother adding RZ/G family-specific DT bindings, as
RZ/G is a derivative of R-Car Gen2.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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
Sergei Shtylyov Sept. 30, 2016, 3:06 p.m. UTC | #3
On 09/30/2016 11:38 AM, Geert Uytterhoeven wrote:

>> Renesas  RZ/G SoC also have the SCIF, SCIFA, SCIFB, and HSCIF ports.
>> Document RZ/G1[ME] (also known as R8A774[35]) SoC bindings along with
>> the RZ/G family bindings.  The driver itself also needs to recognize
>> the latter binding for the SCIF ports, so teach it...
>>
>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
[...]

>> ===================================================================
>> --- tty.orig/drivers/tty/serial/sh-sci.c
>> +++ tty/drivers/tty/serial/sh-sci.c
>> @@ -2950,6 +2950,9 @@ static const struct of_device_id of_sci_
>>         }, {
>>                 .compatible = "renesas,rcar-gen3-scif",
>>                 .data = SCI_OF_DATA(PORT_SCIF, SCIx_SH4_SCIF_BRG_REGTYPE),
>> +       }, {
>> +               .compatible = "renesas,rzg-scif",
>> +               .data = SCI_OF_DATA(PORT_SCIF, SCIx_SH4_SCIF_BRG_REGTYPE),
>>         },
>>         /* Generic types */
>>         {
>
> However, I wouldn't bother adding RZ/G family-specific DT bindings, as
> RZ/G is a derivative of R-Car Gen2.

    Then we shouldn't have added gen2/3 bindings too since they resolve to the 
same register mapping as gen1. :-)

> Gr{oetje,eeting}s,
>
>                         Geert

MBR, Sergei
Laurent Pinchart Oct. 5, 2016, 9:55 a.m. UTC | #4
On Friday 30 Sep 2016 10:38:48 Geert Uytterhoeven wrote:
> On Thu, Sep 29, 2016 at 11:37 PM, Sergei Shtylyov wrote:
> > Renesas  RZ/G SoC also have the SCIF, SCIFA, SCIFB, and HSCIF ports.
> > Document RZ/G1[ME] (also known as R8A774[35]) SoC bindings along with
> > the RZ/G family bindings.  The driver itself also needs to recognize
> > the latter binding for the SCIF ports, so teach it...
> > 
> > Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> > 
> > ---
> > This patch is against the 'tty-next' branch of GregKH's 'tty.git' repo.
> > 
> >  Documentation/devicetree/bindings/serial/renesas,sci-serial.txt |   12
> >  ++++++++++
> >  drivers/tty/serial/sh-sci.c                                     |    3 ++
> >  2 files changed, 15 insertions(+)
> > 
> > Index: tty/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
> > ===================================================================
> > ---
> > tty.orig/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
> > +++ tty/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt> 
> > @@ -9,6 +9,14 @@ Required properties:
> >      - "renesas,scifb-r8a73a4" for R8A73A4 (R-Mobile APE6) SCIFB
> >      compatible UART. - "renesas,scifa-r8a7740" for R8A7740 (R-Mobile A1)
> >      SCIFA compatible UART. - "renesas,scifb-r8a7740" for R8A7740
> >      (R-Mobile A1) SCIFB compatible UART.> 
> > +    - "renesas,scif-r8a7743" for R8A7743 (RZ/G1M) SCIF compatible UART.
> > +    - "renesas,scifa-r8a7743" for R8A7743 (RZ/G1M) SCIFA compatible UART.
> > +    - "renesas,scifb-r8a7743" for R8A7743 (RZ/G1M) SCIFB compatible UART.
> > +    - "renesas,hscif-r8a7743" for R8A7743 (RZ/G1M) HSCIF compatible UART.
> > +    - "renesas,scif-r8a7745" for R8A7745 (RZ/G1E) SCIF compatible UART.
> > +    - "renesas,scifa-r8a7745" for R8A7745 (RZ/G1E) SCIFA compatible UART.
> > +    - "renesas,scifb-r8a7745" for R8A7745 (RZ/G1E) SCIFB compatible UART.
> > +    - "renesas,hscif-r8a7745" for R8A7745 (RZ/G1E) HSCIF compatible UART.

Are we *really* going to add four compat string for each RZ/G* SoC ? We're 
reaching the limit of sanity...

> >      - "renesas,scif-r8a7778" for R8A7778 (R-Car M1) SCIF compatible UART.
> >      - "renesas,scif-r8a7779" for R8A7779 (R-Car H1) SCIF compatible UART.
> >      - "renesas,scif-r8a7790" for R8A7790 (R-Car H2) SCIF compatible UART.
> 
> For the part above:
> Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
> 
> > @@ -38,11 +46,15 @@ Required properties:
> >      - "renesas,rcar-gen1-scif" for R-Car Gen1 SCIF compatible UART,
> >      - "renesas,rcar-gen2-scif" for R-Car Gen2 SCIF compatible UART,
> >      - "renesas,rcar-gen3-scif" for R-Car Gen3 SCIF compatible UART,
> > +    - "renesas,rzg-scif" for RZ/G SCIF compatible UART.
> >      - "renesas,rcar-gen2-scifa" for R-Car Gen2 SCIFA compatible UART,
> > +    - "renesas,rzg-scifa" for RZ/G SCIFA compatible UART.
> >      - "renesas,rcar-gen2-scifb" for R-Car Gen2 SCIFB compatible UART,
> > +    - "renesas,rzg-scifb" for RZ/G SCIFB compatible UART.
> >      - "renesas,rcar-gen1-hscif" for R-Car Gen1 HSCIF compatible UART,
> >      - "renesas,rcar-gen2-hscif" for R-Car Gen2 HSCIF compatible UART,
> >      - "renesas,rcar-gen3-hscif" for R-Car Gen3 HSCIF compatible UART,
> > +    - "renesas,rzg-hscif" for RZ/G HSCIF compatible UART.
> >      - "renesas,scif" for generic SCIF compatible UART.
> >      - "renesas,scifa" for generic SCIFA compatible UART.
> >      - "renesas,scifb" for generic SCIFB compatible UART.
> > 
> > Index: tty/drivers/tty/serial/sh-sci.c
> > ===================================================================
> > --- tty.orig/drivers/tty/serial/sh-sci.c
> > +++ tty/drivers/tty/serial/sh-sci.c
> > @@ -2950,6 +2950,9 @@ static const struct of_device_id of_sci_
> >         }, {
> >                 .compatible = "renesas,rcar-gen3-scif",
> >                 .data = SCI_OF_DATA(PORT_SCIF, SCIx_SH4_SCIF_BRG_REGTYPE),
> > 
> > +       }, {
> > +               .compatible = "renesas,rzg-scif",
> > +               .data = SCI_OF_DATA(PORT_SCIF, SCIx_SH4_SCIF_BRG_REGTYPE),
> >         },
> >         /* Generic types */
> >         {
> 
> However, I wouldn't bother adding RZ/G family-specific DT bindings, as
> RZ/G is a derivative of R-Car Gen2.

I agree, we need to stop the compat string proliferation madness.
Geert Uytterhoeven Oct. 5, 2016, 10:03 a.m. UTC | #5
Hi Laurent,

On Wed, Oct 5, 2016 at 11:55 AM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> On Friday 30 Sep 2016 10:38:48 Geert Uytterhoeven wrote:
>> On Thu, Sep 29, 2016 at 11:37 PM, Sergei Shtylyov wrote:
>> > Renesas  RZ/G SoC also have the SCIF, SCIFA, SCIFB, and HSCIF ports.
>> > Document RZ/G1[ME] (also known as R8A774[35]) SoC bindings along with
>> > the RZ/G family bindings.  The driver itself also needs to recognize
>> > the latter binding for the SCIF ports, so teach it...
>> >
>> > Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>> >
>> > ---
>> > This patch is against the 'tty-next' branch of GregKH's 'tty.git' repo.
>> >
>> >  Documentation/devicetree/bindings/serial/renesas,sci-serial.txt |   12
>> >  ++++++++++
>> >  drivers/tty/serial/sh-sci.c                                     |    3 ++
>> >  2 files changed, 15 insertions(+)
>> >
>> > Index: tty/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
>> > ===================================================================
>> > ---
>> > tty.orig/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
>> > +++ tty/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt>
>> > @@ -9,6 +9,14 @@ Required properties:
>> >      - "renesas,scifb-r8a73a4" for R8A73A4 (R-Mobile APE6) SCIFB
>> >      compatible UART. - "renesas,scifa-r8a7740" for R8A7740 (R-Mobile A1)
>> >      SCIFA compatible UART. - "renesas,scifb-r8a7740" for R8A7740
>> >      (R-Mobile A1) SCIFB compatible UART.>
>> > +    - "renesas,scif-r8a7743" for R8A7743 (RZ/G1M) SCIF compatible UART.
>> > +    - "renesas,scifa-r8a7743" for R8A7743 (RZ/G1M) SCIFA compatible UART.
>> > +    - "renesas,scifb-r8a7743" for R8A7743 (RZ/G1M) SCIFB compatible UART.
>> > +    - "renesas,hscif-r8a7743" for R8A7743 (RZ/G1M) HSCIF compatible UART.
>> > +    - "renesas,scif-r8a7745" for R8A7745 (RZ/G1E) SCIF compatible UART.
>> > +    - "renesas,scifa-r8a7745" for R8A7745 (RZ/G1E) SCIFA compatible UART.
>> > +    - "renesas,scifb-r8a7745" for R8A7745 (RZ/G1E) SCIFB compatible UART.
>> > +    - "renesas,hscif-r8a7745" for R8A7745 (RZ/G1E) HSCIF compatible UART.
>
> Are we *really* going to add four compat string for each RZ/G* SoC ? We're
> reaching the limit of sanity...

Soon we can use soc_device_match(), if we ever need to handle r8a7743 or
r8a7745 quirks?

Declaring it is compatible with renesas,rcar-gen2-scif is still good/needed for
the BRG (Baud Rate Generator for External Clock), which is not present on e.g.
RZ/A1H.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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
Rob Herring Oct. 5, 2016, 1:28 p.m. UTC | #6
On Wed, Oct 5, 2016 at 4:55 AM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> On Friday 30 Sep 2016 10:38:48 Geert Uytterhoeven wrote:
>> On Thu, Sep 29, 2016 at 11:37 PM, Sergei Shtylyov wrote:
>> > Renesas  RZ/G SoC also have the SCIF, SCIFA, SCIFB, and HSCIF ports.
>> > Document RZ/G1[ME] (also known as R8A774[35]) SoC bindings along with
>> > the RZ/G family bindings.  The driver itself also needs to recognize
>> > the latter binding for the SCIF ports, so teach it...
>> >
>> > Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>> >
>> > ---
>> > This patch is against the 'tty-next' branch of GregKH's 'tty.git' repo.
>> >
>> >  Documentation/devicetree/bindings/serial/renesas,sci-serial.txt |   12
>> >  ++++++++++
>> >  drivers/tty/serial/sh-sci.c                                     |    3 ++
>> >  2 files changed, 15 insertions(+)
>> >
>> > Index: tty/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
>> > ===================================================================
>> > ---
>> > tty.orig/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
>> > +++ tty/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt>
>> > @@ -9,6 +9,14 @@ Required properties:
>> >      - "renesas,scifb-r8a73a4" for R8A73A4 (R-Mobile APE6) SCIFB
>> >      compatible UART. - "renesas,scifa-r8a7740" for R8A7740 (R-Mobile A1)
>> >      SCIFA compatible UART. - "renesas,scifb-r8a7740" for R8A7740
>> >      (R-Mobile A1) SCIFB compatible UART.>
>> > +    - "renesas,scif-r8a7743" for R8A7743 (RZ/G1M) SCIF compatible UART.
>> > +    - "renesas,scifa-r8a7743" for R8A7743 (RZ/G1M) SCIFA compatible UART.
>> > +    - "renesas,scifb-r8a7743" for R8A7743 (RZ/G1M) SCIFB compatible UART.
>> > +    - "renesas,hscif-r8a7743" for R8A7743 (RZ/G1M) HSCIF compatible UART.
>> > +    - "renesas,scif-r8a7745" for R8A7745 (RZ/G1E) SCIF compatible UART.
>> > +    - "renesas,scifa-r8a7745" for R8A7745 (RZ/G1E) SCIFA compatible UART.
>> > +    - "renesas,scifb-r8a7745" for R8A7745 (RZ/G1E) SCIFB compatible UART.
>> > +    - "renesas,hscif-r8a7745" for R8A7745 (RZ/G1E) HSCIF compatible UART.
>
> Are we *really* going to add four compat string for each RZ/G* SoC ? We're
> reaching the limit of sanity...

Is it really 4 distinct UARTs on a chip? DT can't fix that insanity.

Rob
Laurent Pinchart Oct. 5, 2016, 1:28 p.m. UTC | #7
On Wednesday 05 Oct 2016 12:03:24 Geert Uytterhoeven wrote:
> Hi Laurent,
> 
> On Wed, Oct 5, 2016 at 11:55 AM, Laurent Pinchart
> 
> <laurent.pinchart@ideasonboard.com> wrote:
> > On Friday 30 Sep 2016 10:38:48 Geert Uytterhoeven wrote:
> >> On Thu, Sep 29, 2016 at 11:37 PM, Sergei Shtylyov wrote:
> >> > Renesas  RZ/G SoC also have the SCIF, SCIFA, SCIFB, and HSCIF ports.
> >> > Document RZ/G1[ME] (also known as R8A774[35]) SoC bindings along with
> >> > the RZ/G family bindings.  The driver itself also needs to recognize
> >> > the latter binding for the SCIF ports, so teach it...
> >> > 
> >> > Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> >> > 
> >> > ---
> >> > This patch is against the 'tty-next' branch of GregKH's 'tty.git' repo.
> >> > 
> >> >  Documentation/devicetree/bindings/serial/renesas,sci-serial.txt |   12
> >> >  ++++++++++
> >> >  drivers/tty/serial/sh-sci.c                                     |    3
> >> >  ++
> >> >  2 files changed, 15 insertions(+)
> >> > 
> >> > Index:
> >> > tty/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
> >> > ===================================================================
> >> > ---
> >> > tty.orig/Documentation/devicetree/bindings/serial/renesas,sci-serial.tx
> >> > t
> >> > +++
> >> > tty/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt>
> >> > 
> >> > @@ -9,6 +9,14 @@ Required properties:
> >> >      - "renesas,scifb-r8a73a4" for R8A73A4 (R-Mobile APE6) SCIFB
> >> >      compatible UART. - "renesas,scifa-r8a7740" for R8A7740 (R-Mobile
> >> >      A1)
> >> >      SCIFA compatible UART. - "renesas,scifb-r8a7740" for R8A7740
> >> >      (R-Mobile A1) SCIFB compatible UART.>
> >> > 
> >> > +    - "renesas,scif-r8a7743" for R8A7743 (RZ/G1M) SCIF compatible
> >> > UART.
> >> > +    - "renesas,scifa-r8a7743" for R8A7743 (RZ/G1M) SCIFA compatible
> >> > UART.
> >> > +    - "renesas,scifb-r8a7743" for R8A7743 (RZ/G1M) SCIFB compatible
> >> > UART.
> >> > +    - "renesas,hscif-r8a7743" for R8A7743 (RZ/G1M) HSCIF compatible
> >> > UART.
> >> > +    - "renesas,scif-r8a7745" for R8A7745 (RZ/G1E) SCIF compatible
> >> > UART.
> >> > +    - "renesas,scifa-r8a7745" for R8A7745 (RZ/G1E) SCIFA compatible
> >> > UART.
> >> > +    - "renesas,scifb-r8a7745" for R8A7745 (RZ/G1E) SCIFB compatible
> >> > UART.
> >> > +    - "renesas,hscif-r8a7745" for R8A7745 (RZ/G1E) HSCIF compatible
> >> > UART.
> > 
> > Are we *really* going to add four compat string for each RZ/G* SoC ? We're
> > reaching the limit of sanity...
> 
> Soon we can use soc_device_match(), if we ever need to handle r8a7743 or
> r8a7745 quirks?

We could, but I believe usage of soc_device_match() should be kept minimal, 
otherwise we could remove all compat strings but one and handle all 
differences in the driver with soc_device_match(). That's a topic I'd like to 
discuss face to face in Berlin. The recent new compatible strings show we have 
a problem, and we need to agree on how to address it.

> Declaring it is compatible with renesas,rcar-gen2-scif is still good/needed
> for the BRG (Baud Rate Generator for External Clock), which is not present
> on e.g. RZ/A1H.

Given that the RZ/G1[ME] SCIFs seem to be compatible with the Gen2 SCIFs using 
the renesas,rcar-gen2-scif compat string seems fine to me.
Laurent Pinchart Oct. 5, 2016, 1:37 p.m. UTC | #8
On Wednesday 05 Oct 2016 08:28:05 Rob Herring wrote:
> On Wed, Oct 5, 2016 at 4:55 AM, Laurent Pinchart
> 
> <laurent.pinchart@ideasonboard.com> wrote:
> > On Friday 30 Sep 2016 10:38:48 Geert Uytterhoeven wrote:
> >> On Thu, Sep 29, 2016 at 11:37 PM, Sergei Shtylyov wrote:
> >> > Renesas  RZ/G SoC also have the SCIF, SCIFA, SCIFB, and HSCIF ports.
> >> > Document RZ/G1[ME] (also known as R8A774[35]) SoC bindings along with
> >> > the RZ/G family bindings.  The driver itself also needs to recognize
> >> > the latter binding for the SCIF ports, so teach it...
> >> > 
> >> > Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> >> > 
> >> > ---
> >> > This patch is against the 'tty-next' branch of GregKH's 'tty.git' repo.
> >> > 
> >> >  Documentation/devicetree/bindings/serial/renesas,sci-serial.txt |   12
> >> >  ++++++++++
> >> >  drivers/tty/serial/sh-sci.c                                     |    3
> >> >  ++
> >> >  2 files changed, 15 insertions(+)
> >> > 
> >> > Index:
> >> > tty/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
> >> > ===================================================================
> >> > ---
> >> > tty.orig/Documentation/devicetree/bindings/serial/renesas,sci-serial.tx
> >> > t
> >> > +++
> >> > tty/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt>
> >> > 
> >> > @@ -9,6 +9,14 @@ Required properties:
> >> >      - "renesas,scifb-r8a73a4" for R8A73A4 (R-Mobile APE6) SCIFB
> >> >      compatible UART. - "renesas,scifa-r8a7740" for R8A7740 (R-Mobile
> >> >      A1)
> >> >      SCIFA compatible UART. - "renesas,scifb-r8a7740" for R8A7740
> >> >      (R-Mobile A1) SCIFB compatible UART.>
> >> > 
> >> > +    - "renesas,scif-r8a7743" for R8A7743 (RZ/G1M) SCIF compatible
> >> > UART.
> >> > +    - "renesas,scifa-r8a7743" for R8A7743 (RZ/G1M) SCIFA compatible
> >> > UART.
> >> > +    - "renesas,scifb-r8a7743" for R8A7743 (RZ/G1M) SCIFB compatible
> >> > UART.
> >> > +    - "renesas,hscif-r8a7743" for R8A7743 (RZ/G1M) HSCIF compatible
> >> > UART.
> >> > +    - "renesas,scif-r8a7745" for R8A7745 (RZ/G1E) SCIF compatible
> >> > UART.
> >> > +    - "renesas,scifa-r8a7745" for R8A7745 (RZ/G1E) SCIFA compatible
> >> > UART.
> >> > +    - "renesas,scifb-r8a7745" for R8A7745 (RZ/G1E) SCIFB compatible
> >> > UART.
> >> > +    - "renesas,hscif-r8a7745" for R8A7745 (RZ/G1E) HSCIF compatible
> >> > UART.
> > 
> > Are we *really* going to add four compat string for each RZ/G* SoC ? We're
> > reaching the limit of sanity...
> 
> Is it really 4 distinct UARTs on a chip? DT can't fix that insanity.

It's really 4 different UART types on a chip, yes. We have actually 5 
different UART types, named SCI, SCIF, SCIFA, SCIFB and HSCIF. Only the last 4 
are used on R-Car SoCs.

There are 34 compatible strings defined, one per UART + SoC combination, plus 
a set of more generic ones. So far, the driver handles the r7s72100 compatible 
string separately as the UART on that chip is quite peculiar, but for all 
other SoCs we only need to match against

- the five generic renesas,(h)sci(f|fa|fb)? types
- the per-family renesas,rcar-gen[123]-scif types for the SCIF only

This means that there's a high level of compatibility between UARTs instances 
in different SoCs (we might need a few more per-family compatible strings to 
tell models apart that could present have family-dependent features currently 
not supported in the driver, but I believe my argument still remains largely 
true). However, due to the combination of the "DT is an ABI" and "IPs that 
appear identical in the datasheet could actually have differences that we 
haven't found yet" dogmas, the proliferation of per-SoC compatible strings is 
getting out of hands.
Chris Brandt Oct. 5, 2016, 1:50 p.m. UTC | #9
> There are 34 compatible strings defined, one per UART + SoC combination,
> plus a set of more generic ones. So far, the driver handles the r7s72100
> compatible string separately as the UART on that chip is quite peculiar,
> but for all other SoCs we only need to match against

Just FYI...
There are 2 different types of UARTS (SCI) on r7s72100: SCIF and SCI

Getting  the "SCI" ones to work takes some 'tweaking' of some registers in the interrupt controller that are outside of the scope of the SCI driver. Basically, the power on reset values for some IRQ signaling is wrong but can be adjusted with a register. At the moment, I've been fixing that in u-boot.

So in reality, a "renesas,sci-r7s72100" is probably needed too if you want to throw that one on the pile....


Chris
Laurent Pinchart Oct. 5, 2016, 2:10 p.m. UTC | #10
Hi Chris,

On Wednesday 05 Oct 2016 13:50:18 Chris Brandt wrote:
> > There are 34 compatible strings defined, one per UART + SoC combination,
> > plus a set of more generic ones. So far, the driver handles the r7s72100
> > compatible string separately as the UART on that chip is quite peculiar,
> > but for all other SoCs we only need to match against
> 
> Just FYI...
> There are 2 different types of UARTS (SCI) on r7s72100: SCIF and SCI
> 
> Getting  the "SCI" ones to work takes some 'tweaking' of some registers in
> the interrupt controller that are outside of the scope of the SCI driver.
> Basically, the power on reset values for some IRQ signaling is wrong but
> can be adjusted with a register. At the moment, I've been fixing that in
> u-boot.
> 
> So in reality, a "renesas,sci-r7s72100" is probably needed too if you want
> to throw that one on the pile....

I'm totally fine adding compatible strings when it makes sense, what bothers 
me is a pile of compat strings to describe IP cores that are identical :-)
Geert Uytterhoeven Oct. 6, 2016, 8:55 p.m. UTC | #11
On Wed, Oct 5, 2016 at 3:37 PM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> On Wednesday 05 Oct 2016 08:28:05 Rob Herring wrote:
>> Is it really 4 distinct UARTs on a chip? DT can't fix that insanity.
>
> It's really 4 different UART types on a chip, yes. We have actually 5
> different UART types, named SCI, SCIF, SCIFA, SCIFB and HSCIF. Only the last 4
> are used on R-Car SoCs.

And even that is a simplification ;-)

AFAIU, evolution seems to have been

    SCI --> SCIF ---> SCIF + BRG ---> HSCIF
              |
              +---> SCIFA ---> SCIFB

Now, that's a simplication, too ;-) There are many intermediate variants
with slightly different features and register bits,esp. on SuperH.
They're all handled by the same sh-sci.c driver.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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
diff mbox

Patch

Index: tty/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
===================================================================
--- tty.orig/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
+++ tty/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
@@ -9,6 +9,14 @@  Required properties:
     - "renesas,scifb-r8a73a4" for R8A73A4 (R-Mobile APE6) SCIFB compatible UART.
     - "renesas,scifa-r8a7740" for R8A7740 (R-Mobile A1) SCIFA compatible UART.
     - "renesas,scifb-r8a7740" for R8A7740 (R-Mobile A1) SCIFB compatible UART.
+    - "renesas,scif-r8a7743" for R8A7743 (RZ/G1M) SCIF compatible UART.
+    - "renesas,scifa-r8a7743" for R8A7743 (RZ/G1M) SCIFA compatible UART.
+    - "renesas,scifb-r8a7743" for R8A7743 (RZ/G1M) SCIFB compatible UART.
+    - "renesas,hscif-r8a7743" for R8A7743 (RZ/G1M) HSCIF compatible UART.
+    - "renesas,scif-r8a7745" for R8A7745 (RZ/G1E) SCIF compatible UART.
+    - "renesas,scifa-r8a7745" for R8A7745 (RZ/G1E) SCIFA compatible UART.
+    - "renesas,scifb-r8a7745" for R8A7745 (RZ/G1E) SCIFB compatible UART.
+    - "renesas,hscif-r8a7745" for R8A7745 (RZ/G1E) HSCIF compatible UART.
     - "renesas,scif-r8a7778" for R8A7778 (R-Car M1) SCIF compatible UART.
     - "renesas,scif-r8a7779" for R8A7779 (R-Car H1) SCIF compatible UART.
     - "renesas,scif-r8a7790" for R8A7790 (R-Car H2) SCIF compatible UART.
@@ -38,11 +46,15 @@  Required properties:
     - "renesas,rcar-gen1-scif" for R-Car Gen1 SCIF compatible UART,
     - "renesas,rcar-gen2-scif" for R-Car Gen2 SCIF compatible UART,
     - "renesas,rcar-gen3-scif" for R-Car Gen3 SCIF compatible UART,
+    - "renesas,rzg-scif" for RZ/G SCIF compatible UART.
     - "renesas,rcar-gen2-scifa" for R-Car Gen2 SCIFA compatible UART,
+    - "renesas,rzg-scifa" for RZ/G SCIFA compatible UART.
     - "renesas,rcar-gen2-scifb" for R-Car Gen2 SCIFB compatible UART,
+    - "renesas,rzg-scifb" for RZ/G SCIFB compatible UART.
     - "renesas,rcar-gen1-hscif" for R-Car Gen1 HSCIF compatible UART,
     - "renesas,rcar-gen2-hscif" for R-Car Gen2 HSCIF compatible UART,
     - "renesas,rcar-gen3-hscif" for R-Car Gen3 HSCIF compatible UART,
+    - "renesas,rzg-hscif" for RZ/G HSCIF compatible UART.
     - "renesas,scif" for generic SCIF compatible UART.
     - "renesas,scifa" for generic SCIFA compatible UART.
     - "renesas,scifb" for generic SCIFB compatible UART.
Index: tty/drivers/tty/serial/sh-sci.c
===================================================================
--- tty.orig/drivers/tty/serial/sh-sci.c
+++ tty/drivers/tty/serial/sh-sci.c
@@ -2950,6 +2950,9 @@  static const struct of_device_id of_sci_
 	}, {
 		.compatible = "renesas,rcar-gen3-scif",
 		.data = SCI_OF_DATA(PORT_SCIF, SCIx_SH4_SCIF_BRG_REGTYPE),
+	}, {
+		.compatible = "renesas,rzg-scif",
+		.data = SCI_OF_DATA(PORT_SCIF, SCIx_SH4_SCIF_BRG_REGTYPE),
 	},
 	/* Generic types */
 	{