Re: [PATCH 5/7] mmc: meson-gx: avoid clock glitch when switching to DDR modes

From: Jerome Brunet
Date: Thu Apr 18 2019 - 16:46:12 EST


On Thu, 2019-04-18 at 22:16 +0200, Martin Blumenstingl wrote:
> Hi Jerome,
>
> On Wed, Apr 17, 2019 at 10:44 PM Jerome Brunet <jbrunet@xxxxxxxxxxxx> wrote:
> > Activating DDR in the Amlogic mmc controller, among other things, will
> > divide the output clock by 2. So by activating it with clock on, we are
> > creating a glitch on the output.
> >
> > Instead, let's deal with DDR when the clock output is off, when setting
> > the clock.
> >
> > Signed-off-by: Jerome Brunet <jbrunet@xxxxxxxxxxxx>
> it seems that this patch breaks SD card on my Khadas VIM and Khadas VIM2.

The error I see in your logs is with eMMC and hs200, not SD card.

Either way, There is something I don't really get. eMMC should not go through
any DDR mode to reach HS200 (which is an SDR mode), neither should SD to reach
HS.

All this does is flipping the DDR bit (when necessary) when clock if off for
the mmc device, avoiding a glitch on clk line.

This patch should not make any difference for SDR only setup, Maybe I missed
something, but I don't see how it could make anything different for SDR only.

I (repeatedly) tested both vim1 and vim2, without seeing this issue, so I can't
debug this. I'll need more detail to progress, something does not make sense here.

> I used git bisect within this series to find that issue.
> applying your .dts patches on top doesn't fix it
>
> two boot logs attached:
> * kvim-broken.txt has patches 1-5 (= including this patch) applied
> * kvim-working.txt has only patches 1-4 (= excluding this patch) applied
>
>
> Regards
> Martin