From: Simon Horman <horms@verge.net.au>
To: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>,
Magnus Damm <magnus.damm@gmail.com>,
"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
"linux-renesas-soc@vger.kernel.org"
<linux-renesas-soc@vger.kernel.org>,
Ben Hutchings <ben.hutchings@codethink.co.uk>,
Ian Molton <ian@mnementh.co.uk>,
Ulf Hansson <ulf.hansson@linaro.org>
Subject: Re: [PATCH/RFC 1/3] mmc: tmio: Add tuning support
Date: Fri, 13 May 2016 11:36:02 +0900 [thread overview]
Message-ID: <20160513023601.GF24529@verge.net.au> (raw)
In-Reply-To: <SG2PR06MB091980ABDB9B697B47A1AE98D8730@SG2PR06MB0919.apcprd06.prod.outlook.com>
On Thu, May 12, 2016 at 06:12:44AM +0000, Yoshihiro Shimoda wrote:
> Hi Simon-san,
>
> > From: Behalf Of Simon Horman
> > Sent: Tuesday, May 10, 2016 2:52 PM
> >
> > From: Ai Kyuse <ai.kyuse.uw@renesas.com>
> >
> > Add tuning support for use with SDR104 mode
> >
> > Signed-off-by: Ai Kyuse <ai.kyuse.uw@renesas.com>
> > Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
>
> I have some minor comments :)
>
> < snip >
> > @@ -753,6 +785,157 @@ static int tmio_mmc_start_data(struct tmio_mmc_host *host,
> > return 0;
> > }
> >
> > +#define TMIO_MMC_MAX_TUNING_LOOP 40
> > +
> > +static int tmio_mmc_execute_tuning(struct mmc_host *mmc, u32 opcode)
> > +{
> > + struct tmio_mmc_host *host = mmc_priv(mmc);
> > + struct mmc_ios *ios = &mmc->ios;
> > +
> > + unsigned long timeout, val;
> > + unsigned long *tap;
> > + int tuning_loop_counter = TMIO_MMC_MAX_TUNING_LOOP;
> < snip >
> > + /*
> > + * Issue CMD19 repeatedly till Execute Tuning is set to 0 or the number
> > + * of loops reaches 40 times or a timeout of 150ms occurs.
> > + */
> > + timeout = 150;
>
> The tuning_loop_counter is 40 and timeout is 150.
> However,
>
> > + do {
> > + if (host->prepare_tuning)
> > + host->prepare_tuning(host, val % num);
> > +
> > + if (!tuning_loop_counter && !timeout)
> > + break;
>
> < snip >
>
> > + tuning_loop_counter--;
> > + timeout--;
> > + mdelay(1);
> > + } while ((val < (num * 2)) && (tuning_loop_counter || timeout));
>
> They will be decreased by 1. So, I think we don't need either variable.
Thanks for bringing this to my attention.
As Wolfram pointed out in another sub-thread it looks like this code
is based on sdhci.c. And I believe that the version in that file has
the issue you raise addressed by:
7ce45e950624 ("mmc: sdhci: SD tuning is broken for some controllers").
I'll update this patch accordingly.
>
> > + * The Host Driver has exhausted the maximum number of loops allowed,
> > + * so use fixed sampling frequency.
> > + */
> > + if (tuning_loop_counter || timeout) {
> > + if (host->select_tuning) {
> > + ret = host->select_tuning(host, tap);
> > + if (ret < 0)
> > + goto out;
> > + }
> > + host->done_tuning = true;
> > + } else {
> > + dev_warn(&host->pdev->dev, ": Tuning procedure failed\n");
>
> The first 2 charactors ": " is strange to me.
Yes, thanks for noticing that. I plan to drop ": ".
> > + ret = -EIO;
> > + goto out;
> > + }
> > +
> > +out:
> > + kfree(data_buf);
> > +err_data:
> > + kfree(tap);
> > +err_tap:
> > + if (ret < 0 && host->hw_reset)
> > + host->hw_reset(host);
>
> We can use tmio_mmc_hw_reset() of this patch.
> Then, we can remove the condition of "host->hw_reset".
Thanks, will do.
[...]
next prev parent reply other threads:[~2016-05-13 2:36 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-10 5:52 [PATCH/RFC 0/3] UHS-I SDR-104 support for sh_mobile_sdhi Simon Horman
2016-05-10 5:52 ` [PATCH/RFC 1/3] mmc: tmio: Add tuning support Simon Horman
2016-05-12 6:12 ` Yoshihiro Shimoda
2016-05-13 2:36 ` Simon Horman [this message]
2016-05-12 16:50 ` Wolfram Sang
2016-05-13 2:28 ` Simon Horman
2016-05-13 3:31 ` Simon Horman
2016-05-10 5:52 ` [PATCH/RFC 2/3] mmc: sh_mobile_sdhi: " Simon Horman
2016-05-10 6:25 ` Kuninori Morimoto
2016-05-11 23:13 ` Simon Horman
2016-05-12 16:50 ` Wolfram Sang
2016-05-10 5:52 ` [PATCH/RFC 3/3] ARM: dts: r8a7790: lager: Enable UHS-I SDR-104 Simon Horman
2016-05-10 9:13 ` Magnus Damm
2016-05-11 12:44 ` Wolfram Sang
2016-05-11 23:11 ` Simon Horman
2016-05-12 6:30 ` [PATCH/RFC 0/3] UHS-I SDR-104 support for sh_mobile_sdhi Yoshihiro Shimoda
2016-05-12 6:45 ` Geert Uytterhoeven
2016-05-12 7:45 ` Yoshihiro Shimoda
2016-05-12 7:47 ` Geert Uytterhoeven
2016-05-12 8:09 ` Yoshihiro Shimoda
2016-05-12 8:32 ` Geert Uytterhoeven
[not found] ` <SG2PR06MB0919824AFCAE20C395E50738D8730@SG2PR06MB0919.apcprd06.prod.outlook.com>
2016-05-12 12:32 ` Geert Uytterhoeven
2016-05-12 12:41 ` Wolfram Sang
2016-05-12 12:53 ` Geert Uytterhoeven
2016-05-13 2:32 ` Simon Horman
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=20160513023601.GF24529@verge.net.au \
--to=horms@verge.net.au \
--cc=ben.hutchings@codethink.co.uk \
--cc=ian@mnementh.co.uk \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=ulf.hansson@linaro.org \
--cc=wsa+renesas@sang-engineering.com \
--cc=yoshihiro.shimoda.uh@renesas.com \
/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;
as well as URLs for NNTP newsgroup(s).