From: Chin Liang See <clsee@altera.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4] mmc: socfpga_dw_mmc: Enable calibration for drvsel and smplsel
Date: Wed, 27 Jan 2016 21:13:40 +0800 [thread overview]
Message-ID: <1453900420.2348.17.camel@altera.com> (raw)
In-Reply-To: <1453852938.29677.27.camel@rtred1test09.kymeta.local>
On Wed, 2016-01-27 at 00:01 +0000, Trent Piepho wrote:
> On Fri, 2015-11-27 at 15:22 +0800, Chin Liang See wrote:
> > Enable SDMMC calibration to determine the best setting for
> > drvsel and smplsel. Calibration will be triggered if the
> > drvsel and smplsel node are not available in DTS.
>
> We have a Cyclone V based board and on the latest revision the SD
> card
> interface has become unreliable at 50 MHz. The SD card moved a few
> inches further away from the SoC in this revision. I though maybe
> smplsel could be an issue and found this patch.
>
> I ported this to our board, but found that this algorithm doesn't
> appear
> to work that well for us.
>
> In my testing I found the fastest way to produce SD errors on Linux
> was
> to repeatedly issue two sector read multiple commands. This produces
> about one error per 10,000 commands. Usually a CRC error on the
> response but also data CRC errors and data stop bit errors.
>
> This calibration code tests by using a single set block length
> command
> to check if the combination of drvsel and smplsel is good. Obviously
> if
> 0.01% of commands fail then checking via the result of one command is
> nearly useless. And indeed this is the case, every cal test passes
> and
> one gets a table of all trues.
Do note that these cal value are not passed to Linux. Wonder your Linux
is using the cal value as obtained from U-Boot calibration?
>
> It is however worse than that. Some cal settings are clearly bad.
> For
> instance, drvsel 3 smplsel 7 does not work at all on our board.
> Every
> read command tried with those settings will fail. But the set block
> length command succeeds. Perhaps because it neither sends nor
> receives
> any data?
Per SD specifications, set block length (CMD16) will expect response R1
which is normal response from the card.
> So the calibration seems unlikely to improve anything, since
> it will always choose 3, 3 for the settings. The basic premise, that
> it
> can tell if a pair of settings work or not, appears to not be true.
Wonder any difference if you change the value in DTS (without the
calibration code)? I am referring U-Boot accessing the SD card.
>
> > +static int socfpga_dwmci_find_row_col_fit_rectangle(unsigned
> > rect_width,
> > + unsigned rect_height,
> > + unsigned char
> > cal_results[SOCFPGA_SD_DRVSEL][SOCFPGA_SD_SMPLSEL],
> > + unsigned int *cal_row, unsigned int *cal_col)
>
> There is no documentation of what exactly parameters are here. But
> one
> can determine that cal_row will contain the zero based index of the
> "best" row.
>
Oh there is a link at the function's comment to explain the algo.
>
> > + for (row = 0; row < SOCFPGA_SD_DRVSEL; row++) {
> > + for (col = 0; col < SOCFPGA_SD_SMPLSEL; col++) {
> > + priv->drvsel = row + 1;
> > + priv->smplsel = col;
>
> Here drvsel is set to row + 1.
This is also part of comment. In quick, we are seeing meta stability
issue when drvsel = 0 and that why we skip it
>
> > +
> > + err = socfpga_dwmci_find_calibration_point(cal_results,
> > sum,
> > + &priv->drvsel,
> > + &priv
> > ->smplsel);
>
> But this function returns the zero based row number (I think it would
> be
> easier to notice if it were documented) in priv->drvsel. Not row +
> 1.
> It seems that you will always program drvsel to be 1 smaller than it
> should be.
Same as previous comment
Thanks
Chin Liang
next prev parent reply other threads:[~2016-01-27 13:13 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-27 7:22 [U-Boot] [PATCH v4] mmc: socfpga_dw_mmc: Enable calibration for drvsel and smplsel Chin Liang See
2015-11-27 18:36 ` Simon Glass
2015-11-27 19:41 ` Marek Vasut
2015-11-29 1:59 ` Simon Glass
2015-11-29 2:05 ` Marek Vasut
2015-11-29 20:19 ` Simon Glass
2015-11-29 20:41 ` Marek Vasut
2015-11-29 13:39 ` Marek Vasut
2015-12-01 15:32 ` Chin Liang See
2015-12-01 15:38 ` Marek Vasut
2015-12-02 5:52 ` Chin Liang See
2015-12-02 14:39 ` Marek Vasut
2015-12-02 15:10 ` Chin Liang See
2015-12-02 15:43 ` Marek Vasut
2015-12-03 18:17 ` Pavel Machek
2016-01-27 0:01 ` Trent Piepho
2016-01-27 13:13 ` Chin Liang See [this message]
2016-01-27 18:58 ` Trent Piepho
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1453900420.2348.17.camel@altera.com \
--to=clsee@altera.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox