diff mbox series

[1/4] dt-bindings: mmc: renesas_sdhi: Add r8a77470 support

Message ID 1537530911-443-2-git-send-email-fabrizio.castro@bp.renesas.com
State New
Headers show
Series Add SDHI2 support to iwg23s | expand

Commit Message

Fabrizio Castro Sept. 21, 2018, 11:55 a.m. UTC
Document SDHI support for the RZ/G1C (a.k.a. R8A77470) SoC.

Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
Reviewed-by: Biju Das <biju.das@bp.renesas.com>
---
 Documentation/devicetree/bindings/mmc/tmio_mmc.txt | 1 +
 1 file changed, 1 insertion(+)

Comments

Wolfram Sang Sept. 22, 2018, 6:43 p.m. UTC | #1
On Fri, Sep 21, 2018 at 12:55:08PM +0100, Fabrizio Castro wrote:
> Document SDHI support for the RZ/G1C (a.k.a. R8A77470) SoC.
> 
> Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
> Reviewed-by: Biju Das <biju.das@bp.renesas.com>

Acked-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Simon Horman Sept. 24, 2018, 9:11 a.m. UTC | #2
On Fri, Sep 21, 2018 at 12:55:08PM +0100, Fabrizio Castro wrote:
> Document SDHI support for the RZ/G1C (a.k.a. R8A77470) SoC.
> 
> Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
> Reviewed-by: Biju Das <biju.das@bp.renesas.com>

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Geert Uytterhoeven Sept. 24, 2018, 9:37 a.m. UTC | #3
Hi Fabrizio,

On Fri, Sep 21, 2018 at 1:55 PM Fabrizio Castro
<fabrizio.castro@bp.renesas.com> wrote:
> Document SDHI support for the RZ/G1C (a.k.a. R8A77470) SoC.
>
> Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
> Reviewed-by: Biju Das <biju.das@bp.renesas.com>
> ---
>  Documentation/devicetree/bindings/mmc/tmio_mmc.txt | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/Documentation/devicetree/bindings/mmc/tmio_mmc.txt b/Documentation/devicetree/bindings/mmc/tmio_mmc.txt
> index c434200..8f3a113 100644
> --- a/Documentation/devicetree/bindings/mmc/tmio_mmc.txt
> +++ b/Documentation/devicetree/bindings/mmc/tmio_mmc.txt
> @@ -17,6 +17,7 @@ Required properties:
>                 "renesas,sdhi-r8a7740" - SDHI IP on R8A7740 SoC
>                 "renesas,sdhi-r8a7743" - SDHI IP on R8A7743 SoC
>                 "renesas,sdhi-r8a7745" - SDHI IP on R8A7745 SoC
> +               "renesas,sdhi-r8a77470" - SDHI IP on R8A77470 SoC
>                 "renesas,sdhi-r8a7778" - SDHI IP on R8A7778 SoC
>                 "renesas,sdhi-r8a7779" - SDHI IP on R8A7779 SoC
>                 "renesas,sdhi-r8a7790" - SDHI IP on R8A7790 SoC

It seems RZ/G1C has two slighty different types of SD card interfaces:
  1. SDHI0 and SDHI2 use SYS-DMAC,
  2. SDHI1 can also be used as an MMC interface, and has an internal DMAC.

Do we need to distinguish between them using the compatible value, or
are there other ways?

Gr{oetje,eeting}s,

                        Geert
Wolfram Sang Sept. 24, 2018, 12:26 p.m. UTC | #4
> It seems RZ/G1C has two slighty different types of SD card interfaces:
>   1. SDHI0 and SDHI2 use SYS-DMAC,
>   2. SDHI1 can also be used as an MMC interface, and has an internal DMAC.
> 
> Do we need to distinguish between them using the compatible value, or
> are there other ways?

Yes, that seems to need an update to our current implementation which is
per-SoC only. One idea from my side would be to whitelist SYS-DMAC for
this compatible and then check if dma-properties are present, otherwise
fall back to internal DMAC?

Fabrizio, did you have any plans how to handle that?
Geert Uytterhoeven Sept. 24, 2018, 12:44 p.m. UTC | #5
Hi Wolfram,

On Mon, Sep 24, 2018 at 2:26 PM Wolfram Sang <wsa@the-dreams.de> wrote:
> > It seems RZ/G1C has two slighty different types of SD card interfaces:
> >   1. SDHI0 and SDHI2 use SYS-DMAC,
> >   2. SDHI1 can also be used as an MMC interface, and has an internal DMAC.
> >
> > Do we need to distinguish between them using the compatible value, or
> > are there other ways?
>
> Yes, that seems to need an update to our current implementation which is
> per-SoC only. One idea from my side would be to whitelist SYS-DMAC for
> this compatible and then check if dma-properties are present, otherwise
> fall back to internal DMAC?

I'm afraid that won't work, as the "dmas" properties are optional. So you
cannot distinguish between optional properties missing and internal DMA
present.

A dirty hack would be checking the device name for xxxxxxxx.sdhi, like how
whitelisting is implemented in the IPMMU driver.

Gr{oetje,eeting}s,

                        Geert
Fabrizio Castro Sept. 24, 2018, 6:33 p.m. UTC | #6
Hello Geert,

> Subject: Re: [PATCH 1/4] dt-bindings: mmc: renesas_sdhi: Add r8a77470 support
>
> Hi Fabrizio,
>
> On Fri, Sep 21, 2018 at 1:55 PM Fabrizio Castro
> <fabrizio.castro@bp.renesas.com> wrote:
> > Document SDHI support for the RZ/G1C (a.k.a. R8A77470) SoC.
> >
> > Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
> > Reviewed-by: Biju Das <biju.das@bp.renesas.com>
> > ---
> >  Documentation/devicetree/bindings/mmc/tmio_mmc.txt | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/Documentation/devicetree/bindings/mmc/tmio_mmc.txt b/Documentation/devicetree/bindings/mmc/tmio_mmc.txt
> > index c434200..8f3a113 100644
> > --- a/Documentation/devicetree/bindings/mmc/tmio_mmc.txt
> > +++ b/Documentation/devicetree/bindings/mmc/tmio_mmc.txt
> > @@ -17,6 +17,7 @@ Required properties:
> >                 "renesas,sdhi-r8a7740" - SDHI IP on R8A7740 SoC
> >                 "renesas,sdhi-r8a7743" - SDHI IP on R8A7743 SoC
> >                 "renesas,sdhi-r8a7745" - SDHI IP on R8A7745 SoC
> > +               "renesas,sdhi-r8a77470" - SDHI IP on R8A77470 SoC
> >                 "renesas,sdhi-r8a7778" - SDHI IP on R8A7778 SoC
> >                 "renesas,sdhi-r8a7779" - SDHI IP on R8A7779 SoC
> >                 "renesas,sdhi-r8a7790" - SDHI IP on R8A7790 SoC
>
> It seems RZ/G1C has two slighty different types of SD card interfaces:
>   1. SDHI0 and SDHI2 use SYS-DMAC,
>   2. SDHI1 can also be used as an MMC interface, and has an internal DMAC.
>
> Do we need to distinguish between them using the compatible value, or
> are there other ways?

The most sensible thing to do here is probably to distinguish between them using
the compatible value, we were thinking about using the following for SDHI1:
compatible = "renesas,sdhi-mmc-r8a77470", "renesas,rcar-gen3-sdhi";

What do you guys think?

I have a prototype for this and it seems to be working fine, but I have only run some
basic checks at run time on the MMC, that's why I haven't sent anything just yet.

Thanks,
Fab

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



Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.
Geert Uytterhoeven Sept. 25, 2018, 6:47 a.m. UTC | #7
Hi Fabrizio,

On Mon, Sep 24, 2018 at 8:34 PM Fabrizio Castro
<fabrizio.castro@bp.renesas.com> wrote:
> > Subject: Re: [PATCH 1/4] dt-bindings: mmc: renesas_sdhi: Add r8a77470 support
> > On Fri, Sep 21, 2018 at 1:55 PM Fabrizio Castro
> > <fabrizio.castro@bp.renesas.com> wrote:
> > > Document SDHI support for the RZ/G1C (a.k.a. R8A77470) SoC.
> > >
> > > Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
> > > Reviewed-by: Biju Das <biju.das@bp.renesas.com>

> > > --- a/Documentation/devicetree/bindings/mmc/tmio_mmc.txt
> > > +++ b/Documentation/devicetree/bindings/mmc/tmio_mmc.txt
> > > @@ -17,6 +17,7 @@ Required properties:
> > >                 "renesas,sdhi-r8a7740" - SDHI IP on R8A7740 SoC
> > >                 "renesas,sdhi-r8a7743" - SDHI IP on R8A7743 SoC
> > >                 "renesas,sdhi-r8a7745" - SDHI IP on R8A7745 SoC
> > > +               "renesas,sdhi-r8a77470" - SDHI IP on R8A77470 SoC
> > >                 "renesas,sdhi-r8a7778" - SDHI IP on R8A7778 SoC
> > >                 "renesas,sdhi-r8a7779" - SDHI IP on R8A7779 SoC
> > >                 "renesas,sdhi-r8a7790" - SDHI IP on R8A7790 SoC
> >
> > It seems RZ/G1C has two slighty different types of SD card interfaces:
> >   1. SDHI0 and SDHI2 use SYS-DMAC,
> >   2. SDHI1 can also be used as an MMC interface, and has an internal DMAC.
> >
> > Do we need to distinguish between them using the compatible value, or
> > are there other ways?
>
> The most sensible thing to do here is probably to distinguish between them using
> the compatible value, we were thinking about using the following for SDHI1:
> compatible = "renesas,sdhi-mmc-r8a77470", "renesas,rcar-gen3-sdhi";
>
> What do you guys think?

Oh, so it's identical (or "sufficiently compatible") with the SD card
interface on R-Car Gen3?
"renesas,sdhi-mmc-r8a77470" may be a good way to distinguish.
I'm a bit reluctant to add "renesas,rcar-gen3-sdhi", though.

Gr{oetje,eeting}s,

                        Geert
Simon Horman Sept. 25, 2018, 7:47 a.m. UTC | #8
On Tue, Sep 25, 2018 at 08:47:38AM +0200, Geert Uytterhoeven wrote:
> Hi Fabrizio,
> 
> On Mon, Sep 24, 2018 at 8:34 PM Fabrizio Castro
> <fabrizio.castro@bp.renesas.com> wrote:
> > > Subject: Re: [PATCH 1/4] dt-bindings: mmc: renesas_sdhi: Add r8a77470 support
> > > On Fri, Sep 21, 2018 at 1:55 PM Fabrizio Castro
> > > <fabrizio.castro@bp.renesas.com> wrote:
> > > > Document SDHI support for the RZ/G1C (a.k.a. R8A77470) SoC.
> > > >
> > > > Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
> > > > Reviewed-by: Biju Das <biju.das@bp.renesas.com>
> 
> > > > --- a/Documentation/devicetree/bindings/mmc/tmio_mmc.txt
> > > > +++ b/Documentation/devicetree/bindings/mmc/tmio_mmc.txt
> > > > @@ -17,6 +17,7 @@ Required properties:
> > > >                 "renesas,sdhi-r8a7740" - SDHI IP on R8A7740 SoC
> > > >                 "renesas,sdhi-r8a7743" - SDHI IP on R8A7743 SoC
> > > >                 "renesas,sdhi-r8a7745" - SDHI IP on R8A7745 SoC
> > > > +               "renesas,sdhi-r8a77470" - SDHI IP on R8A77470 SoC
> > > >                 "renesas,sdhi-r8a7778" - SDHI IP on R8A7778 SoC
> > > >                 "renesas,sdhi-r8a7779" - SDHI IP on R8A7779 SoC
> > > >                 "renesas,sdhi-r8a7790" - SDHI IP on R8A7790 SoC
> > >
> > > It seems RZ/G1C has two slighty different types of SD card interfaces:
> > >   1. SDHI0 and SDHI2 use SYS-DMAC,
> > >   2. SDHI1 can also be used as an MMC interface, and has an internal DMAC.
> > >
> > > Do we need to distinguish between them using the compatible value, or
> > > are there other ways?
> >
> > The most sensible thing to do here is probably to distinguish between them using
> > the compatible value, we were thinking about using the following for SDHI1:
> > compatible = "renesas,sdhi-mmc-r8a77470", "renesas,rcar-gen3-sdhi";
> >
> > What do you guys think?
> 
> Oh, so it's identical (or "sufficiently compatible") with the SD card
> interface on R-Car Gen3?
> "renesas,sdhi-mmc-r8a77470" may be a good way to distinguish.
> I'm a bit reluctant to add "renesas,rcar-gen3-sdhi", though.

I am also reluctant to add "renesas,rcar-gen3-sdhi", because as we are
seeing things are not so simple wrt to compatible.

Can I clarify the proposal regarding "renesas,sdhi-mmc-r8a77470",
would it be as well as or instead of "renesas,sdhi-r8a77470" ?

And what is signified by "mmc" that is not implied by (some of the)
existing compat strings?


Perhaps stating the obvious: this feels a lot like the problem we thought
we had with different Gen-3 SoCs/ES versions. And in that case we decided
against using compat strings to differentiate. The main difference here
seems to be that we need to differentiate between different ports on the
same SoC.
Geert Uytterhoeven Sept. 25, 2018, 7:55 a.m. UTC | #9
Hi Simon,

On Tue, Sep 25, 2018 at 9:47 AM Simon Horman <horms@verge.net.au> wrote:
> On Tue, Sep 25, 2018 at 08:47:38AM +0200, Geert Uytterhoeven wrote:
> > On Mon, Sep 24, 2018 at 8:34 PM Fabrizio Castro
> > <fabrizio.castro@bp.renesas.com> wrote:
> > > > Subject: Re: [PATCH 1/4] dt-bindings: mmc: renesas_sdhi: Add r8a77470 support
> > > > On Fri, Sep 21, 2018 at 1:55 PM Fabrizio Castro
> > > > <fabrizio.castro@bp.renesas.com> wrote:
> > > > > Document SDHI support for the RZ/G1C (a.k.a. R8A77470) SoC.
> > > > >
> > > > > Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
> > > > > Reviewed-by: Biju Das <biju.das@bp.renesas.com>
> >
> > > > > --- a/Documentation/devicetree/bindings/mmc/tmio_mmc.txt
> > > > > +++ b/Documentation/devicetree/bindings/mmc/tmio_mmc.txt
> > > > > @@ -17,6 +17,7 @@ Required properties:
> > > > >                 "renesas,sdhi-r8a7740" - SDHI IP on R8A7740 SoC
> > > > >                 "renesas,sdhi-r8a7743" - SDHI IP on R8A7743 SoC
> > > > >                 "renesas,sdhi-r8a7745" - SDHI IP on R8A7745 SoC
> > > > > +               "renesas,sdhi-r8a77470" - SDHI IP on R8A77470 SoC
> > > > >                 "renesas,sdhi-r8a7778" - SDHI IP on R8A7778 SoC
> > > > >                 "renesas,sdhi-r8a7779" - SDHI IP on R8A7779 SoC
> > > > >                 "renesas,sdhi-r8a7790" - SDHI IP on R8A7790 SoC
> > > >
> > > > It seems RZ/G1C has two slighty different types of SD card interfaces:
> > > >   1. SDHI0 and SDHI2 use SYS-DMAC,
> > > >   2. SDHI1 can also be used as an MMC interface, and has an internal DMAC.
> > > >
> > > > Do we need to distinguish between them using the compatible value, or
> > > > are there other ways?
> > >
> > > The most sensible thing to do here is probably to distinguish between them using
> > > the compatible value, we were thinking about using the following for SDHI1:
> > > compatible = "renesas,sdhi-mmc-r8a77470", "renesas,rcar-gen3-sdhi";
> > >
> > > What do you guys think?
> >
> > Oh, so it's identical (or "sufficiently compatible") with the SD card
> > interface on R-Car Gen3?
> > "renesas,sdhi-mmc-r8a77470" may be a good way to distinguish.
> > I'm a bit reluctant to add "renesas,rcar-gen3-sdhi", though.
>
> I am also reluctant to add "renesas,rcar-gen3-sdhi", because as we are
> seeing things are not so simple wrt to compatible.
>
> Can I clarify the proposal regarding "renesas,sdhi-mmc-r8a77470",
> would it be as well as or instead of "renesas,sdhi-r8a77470" ?

AFAIU, "renesas,sdhi-r8a77470" would be still used for SDHI0 and SDHI2.

> And what is signified by "mmc" that is not implied by (some of the)
> existing compat strings?

"SDHI1 can also be used as an MMC interface".

Note that this (can also be used as an MMC interface) seems to be true
for the SD card interfaces in R-Car Gen3, too.

> Perhaps stating the obvious: this feels a lot like the problem we thought
> we had with different Gen-3 SoCs/ES versions. And in that case we decided
> against using compat strings to differentiate. The main difference here
> seems to be that we need to differentiate between different ports on the
> same SoC.

So either
  a) SDHI0/2 vs. SDHI1 are different, deserving different compatible values, or
  b) SDHI0/1/2 are identical, but SDHI1 is wired different, deserving the same
     compatible value, but one or more additional properties describing the
     different wiring.

Wolfram's proposal for b) was looking at the (lack of) dmas properties, but
that's not sufficient, as they are optional anyway.

Gr{oetje,eeting}s,

                        Geert
Wolfram Sang Sept. 25, 2018, 8:22 a.m. UTC | #10
> > Perhaps stating the obvious: this feels a lot like the problem we thought
> > we had with different Gen-3 SoCs/ES versions. And in that case we decided
> > against using compat strings to differentiate. The main difference here
> > seems to be that we need to differentiate between different ports on the
> > same SoC.

Yes, I agree. Our so far agreed solution didn't take into account that
there are different SDHI versions on the same SoC. Adding a compatible
might be the easiest solution, but then we have a mix of compatibles,
soc_device_match, and even version register (deeper in the driver). My
gut feeling is we should take the time to rethink all this?

> So either
>   a) SDHI0/2 vs. SDHI1 are different, deserving different compatible values, or
>   b) SDHI0/1/2 are identical, but SDHI1 is wired different, deserving the same
>      compatible value, but one or more additional properties describing the
>      different wiring.

Actually, SDHI2 seems different, too. It doesn't support SDR104. I don't
have the SDHI specific docs, but from the main docs, all SDHI instances
are different.
Geert Uytterhoeven Sept. 25, 2018, 8:28 a.m. UTC | #11
Hi Wolfram,

On Tue, Sep 25, 2018 at 10:22 AM Wolfram Sang <wsa@the-dreams.de> wrote:
> > > Perhaps stating the obvious: this feels a lot like the problem we thought
> > > we had with different Gen-3 SoCs/ES versions. And in that case we decided
> > > against using compat strings to differentiate. The main difference here
> > > seems to be that we need to differentiate between different ports on the
> > > same SoC.
>
> Yes, I agree. Our so far agreed solution didn't take into account that
> there are different SDHI versions on the same SoC. Adding a compatible
> might be the easiest solution, but then we have a mix of compatibles,
> soc_device_match, and even version register (deeper in the driver). My
> gut feeling is we should take the time to rethink all this?
>
> > So either
> >   a) SDHI0/2 vs. SDHI1 are different, deserving different compatible values, or
> >   b) SDHI0/1/2 are identical, but SDHI1 is wired different, deserving the same
> >      compatible value, but one or more additional properties describing the
> >      different wiring.
>
> Actually, SDHI2 seems different, too. It doesn't support SDR104. I don't
> have the SDHI specific docs, but from the main docs, all SDHI instances
> are different.

I forgot about the version register.

Fabrizio: can you please check what the 3 instances report in their version
registers? Thanks!

Gr{oetje,eeting}s,

                        Geert
Fabrizio Castro Sept. 25, 2018, 12:45 p.m. UTC | #12
Hi Geert,

> Subject: Re: [PATCH 1/4] dt-bindings: mmc: renesas_sdhi: Add r8a77470 support
>
> Hi Wolfram,
>
> On Tue, Sep 25, 2018 at 10:22 AM Wolfram Sang <wsa@the-dreams.de> wrote:
> > > > Perhaps stating the obvious: this feels a lot like the problem we thought
> > > > we had with different Gen-3 SoCs/ES versions. And in that case we decided
> > > > against using compat strings to differentiate. The main difference here
> > > > seems to be that we need to differentiate between different ports on the
> > > > same SoC.
> >
> > Yes, I agree. Our so far agreed solution didn't take into account that
> > there are different SDHI versions on the same SoC. Adding a compatible
> > might be the easiest solution, but then we have a mix of compatibles,
> > soc_device_match, and even version register (deeper in the driver). My
> > gut feeling is we should take the time to rethink all this?
> >
> > > So either
> > >   a) SDHI0/2 vs. SDHI1 are different, deserving different compatible values, or
> > >   b) SDHI0/1/2 are identical, but SDHI1 is wired different, deserving the same
> > >      compatible value, but one or more additional properties describing the
> > >      different wiring.
> >
> > Actually, SDHI2 seems different, too. It doesn't support SDR104. I don't
> > have the SDHI specific docs, but from the main docs, all SDHI instances
> > are different.
>
> I forgot about the version register.
>
> Fabrizio: can you please check what the 3 instances report in their version
> registers? Thanks!

SDHI0: 0xcc0d
SDHI1: 0xcc10
SDHI2: 0xcc0d

Cheers,
Fab

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



Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.
Geert Uytterhoeven Sept. 25, 2018, 1:03 p.m. UTC | #13
Hi Fabrizio,

On Tue, Sep 25, 2018 at 2:45 PM Fabrizio Castro
<fabrizio.castro@bp.renesas.com> wrote:
> > Subject: Re: [PATCH 1/4] dt-bindings: mmc: renesas_sdhi: Add r8a77470 support
> > On Tue, Sep 25, 2018 at 10:22 AM Wolfram Sang <wsa@the-dreams.de> wrote:
> > > > > Perhaps stating the obvious: this feels a lot like the problem we thought
> > > > > we had with different Gen-3 SoCs/ES versions. And in that case we decided
> > > > > against using compat strings to differentiate. The main difference here
> > > > > seems to be that we need to differentiate between different ports on the
> > > > > same SoC.
> > >
> > > Yes, I agree. Our so far agreed solution didn't take into account that
> > > there are different SDHI versions on the same SoC. Adding a compatible
> > > might be the easiest solution, but then we have a mix of compatibles,
> > > soc_device_match, and even version register (deeper in the driver). My
> > > gut feeling is we should take the time to rethink all this?
> > >
> > > > So either
> > > >   a) SDHI0/2 vs. SDHI1 are different, deserving different compatible values, or
> > > >   b) SDHI0/1/2 are identical, but SDHI1 is wired different, deserving the same
> > > >      compatible value, but one or more additional properties describing the
> > > >      different wiring.
> > >
> > > Actually, SDHI2 seems different, too. It doesn't support SDR104. I don't
> > > have the SDHI specific docs, but from the main docs, all SDHI instances
> > > are different.
> >
> > I forgot about the version register.
> >
> > Fabrizio: can you please check what the 3 instances report in their version
> > registers? Thanks!
>
> SDHI0: 0xcc0d
> SDHI1: 0xcc10
> SDHI2: 0xcc0d

Thank you. So SDHI1 differs from SDH0/2.
SDHI2 probably doesn't support SDR104 because its parent clock is a div6
clock, while the others have SDCKCR parents.

Plus we don't describe the relation to the SDH clock yet.

Gr{oetje,eeting}s,

                        Geert
Fabrizio Castro Sept. 25, 2018, 1:12 p.m. UTC | #14
Hello Geert,

> Subject: Re: [PATCH 1/4] dt-bindings: mmc: renesas_sdhi: Add r8a77470 support
>
> Hi Fabrizio,
>
> On Tue, Sep 25, 2018 at 2:45 PM Fabrizio Castro
> <fabrizio.castro@bp.renesas.com> wrote:
> > > Subject: Re: [PATCH 1/4] dt-bindings: mmc: renesas_sdhi: Add r8a77470 support
> > > On Tue, Sep 25, 2018 at 10:22 AM Wolfram Sang <wsa@the-dreams.de> wrote:
> > > > > > Perhaps stating the obvious: this feels a lot like the problem we thought
> > > > > > we had with different Gen-3 SoCs/ES versions. And in that case we decided
> > > > > > against using compat strings to differentiate. The main difference here
> > > > > > seems to be that we need to differentiate between different ports on the
> > > > > > same SoC.
> > > >
> > > > Yes, I agree. Our so far agreed solution didn't take into account that
> > > > there are different SDHI versions on the same SoC. Adding a compatible
> > > > might be the easiest solution, but then we have a mix of compatibles,
> > > > soc_device_match, and even version register (deeper in the driver). My
> > > > gut feeling is we should take the time to rethink all this?
> > > >
> > > > > So either
> > > > >   a) SDHI0/2 vs. SDHI1 are different, deserving different compatible values, or
> > > > >   b) SDHI0/1/2 are identical, but SDHI1 is wired different, deserving the same
> > > > >      compatible value, but one or more additional properties describing the
> > > > >      different wiring.
> > > >
> > > > Actually, SDHI2 seems different, too. It doesn't support SDR104. I don't
> > > > have the SDHI specific docs, but from the main docs, all SDHI instances
> > > > are different.
> > >
> > > I forgot about the version register.
> > >
> > > Fabrizio: can you please check what the 3 instances report in their version
> > > registers? Thanks!
> >
> > SDHI0: 0xcc0d
> > SDHI1: 0xcc10
> > SDHI2: 0xcc0d
>
> Thank you. So SDHI1 differs from SDH0/2.
> SDHI2 probably doesn't support SDR104 because its parent clock is a div6
> clock, while the others have SDCKCR parents.
>
> Plus we don't describe the relation to the SDH clock yet.

I am looking into the remaining SDHI interfaces now, how do you want me to handle SDHI1?

Thanks,
Fab

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



Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.
Fabrizio Castro Sept. 26, 2018, 6:08 p.m. UTC | #15
Hello Geert,

> Subject: Re: [PATCH 1/4] dt-bindings: mmc: renesas_sdhi: Add r8a77470 support
>
> Hi Fabrizio,
>
> On Mon, Sep 24, 2018 at 8:34 PM Fabrizio Castro
> <fabrizio.castro@bp.renesas.com> wrote:
> > > Subject: Re: [PATCH 1/4] dt-bindings: mmc: renesas_sdhi: Add r8a77470 support
> > > On Fri, Sep 21, 2018 at 1:55 PM Fabrizio Castro
> > > <fabrizio.castro@bp.renesas.com> wrote:
> > > > Document SDHI support for the RZ/G1C (a.k.a. R8A77470) SoC.
> > > >
> > > > Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
> > > > Reviewed-by: Biju Das <biju.das@bp.renesas.com>
>
> > > > --- a/Documentation/devicetree/bindings/mmc/tmio_mmc.txt
> > > > +++ b/Documentation/devicetree/bindings/mmc/tmio_mmc.txt
> > > > @@ -17,6 +17,7 @@ Required properties:
> > > >                 "renesas,sdhi-r8a7740" - SDHI IP on R8A7740 SoC
> > > >                 "renesas,sdhi-r8a7743" - SDHI IP on R8A7743 SoC
> > > >                 "renesas,sdhi-r8a7745" - SDHI IP on R8A7745 SoC
> > > > +               "renesas,sdhi-r8a77470" - SDHI IP on R8A77470 SoC
> > > >                 "renesas,sdhi-r8a7778" - SDHI IP on R8A7778 SoC
> > > >                 "renesas,sdhi-r8a7779" - SDHI IP on R8A7779 SoC
> > > >                 "renesas,sdhi-r8a7790" - SDHI IP on R8A7790 SoC
> > >
> > > It seems RZ/G1C has two slighty different types of SD card interfaces:
> > >   1. SDHI0 and SDHI2 use SYS-DMAC,
> > >   2. SDHI1 can also be used as an MMC interface, and has an internal DMAC.
> > >
> > > Do we need to distinguish between them using the compatible value, or
> > > are there other ways?
> >
> > The most sensible thing to do here is probably to distinguish between them using
> > the compatible value, we were thinking about using the following for SDHI1:
> > compatible = "renesas,sdhi-mmc-r8a77470", "renesas,rcar-gen3-sdhi";
> >
> > What do you guys think?
>
> Oh, so it's identical (or "sufficiently compatible") with the SD card
> interface on R-Car Gen3?

It seems identical to R-Car Gen3. I have done proper testing now and everything
seems to be working as expected.

> "renesas,sdhi-mmc-r8a77470" may be a good way to distinguish.
> I'm a bit reluctant to add "renesas,rcar-gen3-sdhi", though.

We could just use "renesas,sdhi-mmc-r8a77470" for SDHI1 and "renesas,sdhi- r8a77470"
for SDHI0 and SDHI2 then, without generic compatible strings, or maybe we could
use "renesas,rcar-gen2-sdhi" for both even though that would be incorrect as per the
current implementation of the drivers.

Today I have given some thought on how to distinguish the two types of IP from the
two different drivers without having driver specific compatible strings, and unfortunately
we would still need to take into account some information coming from the device tree
(like the memory address of the interface) in order to decide if we need to fail the probing.
I can't use the VERSION register to make any decision as to read the registers in a meaningful
way we still need to know bus_shift, and then the DMA properties are optional, therefore
using different compatible strings for the two types of IP still feels like the best option to me.

I am dropping all of the patches from this series and I am going to send another version
to address the comments on the implementation of r8a77470_pin_to_pocctrl, but also
to address both SD card and eMMC, so that we can reason about what's the best thing to do
by looking at the implementation of a working example.

Cheers,
Fab

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



Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/mmc/tmio_mmc.txt b/Documentation/devicetree/bindings/mmc/tmio_mmc.txt
index c434200..8f3a113 100644
--- a/Documentation/devicetree/bindings/mmc/tmio_mmc.txt
+++ b/Documentation/devicetree/bindings/mmc/tmio_mmc.txt
@@ -17,6 +17,7 @@  Required properties:
 		"renesas,sdhi-r8a7740" - SDHI IP on R8A7740 SoC
 		"renesas,sdhi-r8a7743" - SDHI IP on R8A7743 SoC
 		"renesas,sdhi-r8a7745" - SDHI IP on R8A7745 SoC
+		"renesas,sdhi-r8a77470" - SDHI IP on R8A77470 SoC
 		"renesas,sdhi-r8a7778" - SDHI IP on R8A7778 SoC
 		"renesas,sdhi-r8a7779" - SDHI IP on R8A7779 SoC
 		"renesas,sdhi-r8a7790" - SDHI IP on R8A7790 SoC