diff mbox

[v8,6/6] mmc: sh_mobile_sdhi: Add tuning support

Message ID 20170110223043.GA2710@katana (mailing list archive)
State Not Applicable
Headers show

Commit Message

Wolfram Sang Jan. 10, 2017, 10:30 p.m. UTC
> Oddly enough the error are only printed when I insert the SD card in the 
> mmc0 slot. I can insert/eject the card multiple times in mmc1 and no 
> error but the first insertion in mmc0 and boom. Only difference I can 
> see are the clock speed between mmc0 and mmc1.

Can you try this patch?

From: Wolfram Sang <wsa+renesas@sang-engineering.com>
Date: Sun, 13 Nov 2016 11:10:09 +0100
Subject: [PATCH] pinctrl: pfc: r8a7795: WIP: hardcode TDSEL value

Otherwise, AC-180M won't get probed with SDR50 and EMMY-W1 has more
tuning errors with SDR104.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/pinctrl/sh-pfc/pfc-r8a7795.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Niklas Söderlund Jan. 11, 2017, 8:35 a.m. UTC | #1
Hi Wolfram,

Thanks for your feedback.

On 2017-01-10 23:30:43 +0100, Wolfram Sang wrote:
> 
> > Oddly enough the error are only printed when I insert the SD card in the 
> > mmc0 slot. I can insert/eject the card multiple times in mmc1 and no 
> > error but the first insertion in mmc0 and boom. Only difference I can 
> > see are the clock speed between mmc0 and mmc1.
> 
> Can you try this patch?
> 
> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Date: Sun, 13 Nov 2016 11:10:09 +0100
> Subject: [PATCH] pinctrl: pfc: r8a7795: WIP: hardcode TDSEL value
> 
> Otherwise, AC-180M won't get probed with SDR50 and EMMY-W1 has more
> tuning errors with SDR104.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>  drivers/pinctrl/sh-pfc/pfc-r8a7795.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7795.c b/drivers/pinctrl/sh-pfc/pfc-r8a7795.c

I'm doing my tests on Koelsch so I'm afraid setting the TDSEL in 
pfc-r8a7795.c won't do much ;-) Nevertheless I tried to mimic the patch 
for Koelsch but found the documentation lacking and where unable to do 
so. That is I found a TDSEL register but no documentation of its 
content.

I could try to run the test on r8a7795 but my understanding is that the 
IPMMU is not 100% OK on ES1.0. That is at least why I stopped testing on 
it a while back. Have this been addressed in a recent firmware I could 
upgrade to?

> index 3f58bfd676ce94..3e3f7585efe8b3 100644
> --- a/drivers/pinctrl/sh-pfc/pfc-r8a7795.c
> +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7795.c
> @@ -5416,6 +5416,9 @@ static int r8a7795_pinmux_init(struct sh_pfc *pfc)
>  		pr_info("%s: R-Car H3 >= ES2.0\n", __func__);
>  		// FIXME Fixup r8a7795_pinmux_info for ES2.0
>  	}
> +
> +#define TDSEL 0xe60603c0
> +	sh_pfc_write_reg(pfc, TDSEL, 32, 0xc3);
>  	return 0;
>  }
>  
> -- 
> 2.10.2
> 
>
Geert Uytterhoeven Jan. 11, 2017, 8:42 a.m. UTC | #2
Hi Niklas,

On Wed, Jan 11, 2017 at 9:35 AM, Niklas Söderlund
<niklas.soderlund@ragnatech.se> wrote:
> On 2017-01-10 23:30:43 +0100, Wolfram Sang wrote:
>> > Oddly enough the error are only printed when I insert the SD card in the
>> > mmc0 slot. I can insert/eject the card multiple times in mmc1 and no
>> > error but the first insertion in mmc0 and boom. Only difference I can
>> > see are the clock speed between mmc0 and mmc1.
>>
>> Can you try this patch?
>>
>> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
>> Date: Sun, 13 Nov 2016 11:10:09 +0100
>> Subject: [PATCH] pinctrl: pfc: r8a7795: WIP: hardcode TDSEL value
>>
>> Otherwise, AC-180M won't get probed with SDR50 and EMMY-W1 has more
>> tuning errors with SDR104.
>>
>> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
>> ---
>>  drivers/pinctrl/sh-pfc/pfc-r8a7795.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7795.c b/drivers/pinctrl/sh-pfc/pfc-r8a7795.c
>
> I'm doing my tests on Koelsch so I'm afraid setting the TDSEL in
> pfc-r8a7795.c won't do much ;-) Nevertheless I tried to mimic the patch
> for Koelsch but found the documentation lacking and where unable to do
> so. That is I found a TDSEL register but no documentation of its
> content.

The datasheet does mention which bits are for SD[023]_CLK.
Actual bit patterns should be the same as on r8a7795.

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
Niklas Söderlund Jan. 11, 2017, 9:17 a.m. UTC | #3
Hi Geert,

Thanks for your feedback.

On 2017-01-11 09:42:09 +0100, Geert Uytterhoeven wrote:
> Hi Niklas,
> 
> On Wed, Jan 11, 2017 at 9:35 AM, Niklas Söderlund
> <niklas.soderlund@ragnatech.se> wrote:
> > On 2017-01-10 23:30:43 +0100, Wolfram Sang wrote:
> >> > Oddly enough the error are only printed when I insert the SD card in the
> >> > mmc0 slot. I can insert/eject the card multiple times in mmc1 and no
> >> > error but the first insertion in mmc0 and boom. Only difference I can
> >> > see are the clock speed between mmc0 and mmc1.
> >>
> >> Can you try this patch?
> >>
> >> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
> >> Date: Sun, 13 Nov 2016 11:10:09 +0100
> >> Subject: [PATCH] pinctrl: pfc: r8a7795: WIP: hardcode TDSEL value
> >>
> >> Otherwise, AC-180M won't get probed with SDR50 and EMMY-W1 has more
> >> tuning errors with SDR104.
> >>
> >> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> >> ---
> >>  drivers/pinctrl/sh-pfc/pfc-r8a7795.c | 3 +++
> >>  1 file changed, 3 insertions(+)
> >>
> >> diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7795.c b/drivers/pinctrl/sh-pfc/pfc-r8a7795.c
> >
> > I'm doing my tests on Koelsch so I'm afraid setting the TDSEL in
> > pfc-r8a7795.c won't do much ;-) Nevertheless I tried to mimic the patch
> > for Koelsch but found the documentation lacking and where unable to do
> > so. That is I found a TDSEL register but no documentation of its
> > content.
> 
> The datasheet does mention which bits are for SD[023]_CLK.
> Actual bit patterns should be the same as on r8a7795.

Thanks for the information about the bit patterns. I tried using the 
same bit pattern on SD[023]_CLK but the error persisted :-( 

> 
> 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
Wolfram Sang Jan. 11, 2017, 3:05 p.m. UTC | #4
Hi Niklas,

> I'm doing my tests on Koelsch so I'm afraid setting the TDSEL in 
> pfc-r8a7795.c won't do much ;-) Nevertheless I tried to mimic the patch 
> for Koelsch but found the documentation lacking and where unable to do 
> so. That is I found a TDSEL register but no documentation of its 
> content.

Sorry, that slipped through. Actually, I sent a patch for H2:

https://patchwork.kernel.org/patch/9434323/

I wanted to do some TDSEL testing on other Gen2 boards in Brussels,
provided that people could bring some. So, if you could bring that
Koelsch board, that would be really helpful.

I assume that you created a similar patch to the above for Koelsch and
the issue still remained? :(

Regards,

   Wolfram
Niklas Söderlund Jan. 11, 2017, 3:57 p.m. UTC | #5
Hi Wolfram,

On 2017-01-11 16:05:21 +0100, Wolfram Sang wrote:
> Hi Niklas,
> 
> > I'm doing my tests on Koelsch so I'm afraid setting the TDSEL in 
> > pfc-r8a7795.c won't do much ;-) Nevertheless I tried to mimic the patch 
> > for Koelsch but found the documentation lacking and where unable to do 
> > so. That is I found a TDSEL register but no documentation of its 
> > content.
> 
> Sorry, that slipped through. Actually, I sent a patch for H2:
> 
> https://patchwork.kernel.org/patch/9434323/
> 
> I wanted to do some TDSEL testing on other Gen2 boards in Brussels,
> provided that people could bring some. So, if you could bring that
> Koelsch board, that would be really helpful.

Sure, can you or someone else bring a power source? I plan to not check 
luggage so everything to conserve space helps :-)

> 
> I assume that you created a similar patch to the above for Koelsch and
> the issue still remained? :(

Yes I did with the help from Geert, I have now also tried your patch.  
Unfortunately the result is the same and the warning is printed. I hope 
to be able to spend more time later this week with the tuning patch to 
try and figure this out.

> 
> Regards,
> 
>    Wolfram
>
Geert Uytterhoeven Jan. 11, 2017, 3:59 p.m. UTC | #6
On Wed, Jan 11, 2017 at 4:57 PM, Niklas Söderlund
<niklas.soderlund@ragnatech.se> wrote:
> On 2017-01-11 16:05:21 +0100, Wolfram Sang wrote:
>> I wanted to do some TDSEL testing on other Gen2 boards in Brussels,
>> provided that people could bring some. So, if you could bring that
>> Koelsch board, that would be really helpful.
>
> Sure, can you or someone else bring a power source? I plan to not check
> luggage so everything to conserve space helps :-)

I also have a koelsch, so no need to take one on a plane ;-)

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
Wolfram Sang Jan. 11, 2017, 5:34 p.m. UTC | #7
> I also have a koelsch, so no need to take one on a plane ;-)

I thought yours was so heavily hooked up that it was a bit cumbersome to
bring it somewhere. Happy to be wrong here :)
Niklas Söderlund Jan. 12, 2017, 11:17 a.m. UTC | #8
On 2017-01-11 18:34:32 +0100, Wolfram Sang wrote:
> 
> > I also have a koelsch, so no need to take one on a plane ;-)
> 
> I thought yours was so heavily hooked up that it was a bit cumbersome to
> bring it somewhere. Happy to be wrong here :)
> 

To be super clear, Geert you can bring your Koelsch and Wolfram you only 
want to do testing on one Koelsch board and not as many as you can get 
your hands on?

If so I be happy to leave my board at home and not have to take it on 
the plane, please confirm so there are no misunderstandings :-)
Geert Uytterhoeven Jan. 12, 2017, 11:23 a.m. UTC | #9
On Thu, Jan 12, 2017 at 12:17 PM, Niklas Söderlund
<niklas.soderlund@ragnatech.se> wrote:
> On 2017-01-11 18:34:32 +0100, Wolfram Sang wrote:
>> > I also have a koelsch, so no need to take one on a plane ;-)
>>
>> I thought yours was so heavily hooked up that it was a bit cumbersome to
>> bring it somewhere. Happy to be wrong here :)
>
> To be super clear, Geert you can bring your Koelsch and Wolfram you only
> want to do testing on one Koelsch board and not as many as you can get
> your hands on?
>
> If so I be happy to leave my board at home and not have to take it on
> the plane, please confirm so there are no misunderstandings :-)

I'll bring my Koelsch.

AFAIK, Wolfram is interested in "as many SD cards", not "as many Koelsch
boards".

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
Wolfram Sang Jan. 12, 2017, 1:03 p.m. UTC | #10
> I'll bring my Koelsch.

Great. I *think* one Koelsch will do, but if it is not too much of a
problem, double-checking with a second board won't hurt. So, since Geert
will probably bring all necessary cables and supplies, maybe you can
pack the board nonetheless? But having one Koelsch already is really
good!

> AFAIK, Wolfram is interested in "as many SD cards", not "as many Koelsch
> boards".

1st: as many Gen2 boards as possible (one per Gen2 SoC version would be
awesome!) Gose, Alt anyone?

For those, I'll bring my SanDisk card which causes issues when ejecting
on all my boards. This is my main target.

2nd: as many SD cards as possible

This is a secondary target, but trying to find other issues/other type
of cards with same issues will be helpful, too.

Thanks,

   Wolfram
Niklas Söderlund Jan. 17, 2017, 11:29 a.m. UTC | #11
On 2017-01-12 14:03:24 +0100, Wolfram Sang wrote:
> 
> > I'll bring my Koelsch.
> 
> Great. I *think* one Koelsch will do, but if it is not too much of a
> problem, double-checking with a second board won't hurt. So, since Geert
> will probably bring all necessary cables and supplies, maybe you can
> pack the board nonetheless? But having one Koelsch already is really
> good!

If it fits in my luggage I will bring it then (I think it will), but I 
won't throw out my laptop to make room for it then since Geert will 
bring his :-)

> 
> > AFAIK, Wolfram is interested in "as many SD cards", not "as many Koelsch
> > boards".
> 
> 1st: as many Gen2 boards as possible (one per Gen2 SoC version would be
> awesome!) Gose, Alt anyone?
> 
> For those, I'll bring my SanDisk card which causes issues when ejecting
> on all my boards. This is my main target.
> 
> 2nd: as many SD cards as possible
> 
> This is a secondary target, but trying to find other issues/other type
> of cards with same issues will be helpful, too.
> 
> Thanks,
> 
>    Wolfram
>
diff mbox

Patch

diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7795.c b/drivers/pinctrl/sh-pfc/pfc-r8a7795.c
index 3f58bfd676ce94..3e3f7585efe8b3 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a7795.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7795.c
@@ -5416,6 +5416,9 @@  static int r8a7795_pinmux_init(struct sh_pfc *pfc)
 		pr_info("%s: R-Car H3 >= ES2.0\n", __func__);
 		// FIXME Fixup r8a7795_pinmux_info for ES2.0
 	}
+
+#define TDSEL 0xe60603c0
+	sh_pfc_write_reg(pfc, TDSEL, 32, 0xc3);
 	return 0;
 }