linux-amlogic.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Jerome Brunet <jbrunet@baylibre.com>
To: Andreas Fenkart <afenkart@gmail.com>
Cc: "open list:ARM/Amlogic Meson..."
	<linux-amlogic@lists.infradead.org>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	linux-mmc <linux-mmc@vger.kernel.org>,
	krzysztof.michonski@digitalstrom.com,
	Kevin Hilman <khilman@baylibre.com>
Subject: Re: regression caused by: "amlogic: mmc: meson-gx: add signal resampling"
Date: Thu, 17 Jan 2019 16:08:28 +0100	[thread overview]
Message-ID: <c0ab226f363d22f31e13db5ae0af85ea7f7b451e.camel@baylibre.com> (raw)
In-Reply-To: <CALtMJEAp0DJmNYsDWe9WJGH0zeZ2sVyFKe909ehzv87ita4ehw@mail.gmail.com>

On Thu, 2019-01-17 at 15:47 +0100, Andreas Fenkart wrote:
> From: Andreas Fenkart <afenkart@gmail.com>
> Date: Thu, 17 Jan 2019 15:39:52 +0100
> Subject: [PATCH] mmc: meson-gx: enable signal re-sampling together with
> tuning
> 
> card detection fails on some p212 derived boards if enabled too early

Please clearly mention what board you are using, this is too vague.

> mmc1: error -110 whilst initialising MMC card
> 

missing the 'Fixes' tag here

> Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
> ---
>  drivers/mmc/host/meson-gx-mmc.c | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-
> mmc.c
> index c2690c1a50ff..b65ec4bea980 100644
> --- a/drivers/mmc/host/meson-gx-mmc.c
> +++ b/drivers/mmc/host/meson-gx-mmc.c
> @@ -709,7 +709,8 @@ static int meson_mmc_find_tuning_point(unsigned long
> *test)
>  static int meson_mmc_clk_phase_tuning(struct mmc_host *mmc, u32 opcode,
>         struct clk *clk)
>  {
> - int point, ret;
> + struct meson_host *host = mmc_priv(mmc);
> + int point, ret, adj = 0;
>   DECLARE_BITMAP(test, CLK_PHASE_POINT_NUM);
> 
>   dev_dbg(mmc_dev(mmc), "%s phase/delay tunning...\n",
> @@ -729,6 +730,10 @@ static int meson_mmc_clk_phase_tuning(struct
> mmc_host *mmc, u32 opcode,
>   if (point < 0)
>   return point; /* tuning failed */
> 
> + /* enable signal resampling w/o delay */
> + adj = ADJUST_ADJ_EN;
> + writel(adj, host->regs + host->data->adjust);
> +

That's really what I meant.

Here, you are enabling the signal resampling after the tuning.
Several boards won't tune without signal resampling.

This should be done at the very beginning of the function at least.
I would prefer if it was done in meson_mmc_execute_tuning() before calling
meson_mmc_clk_phase_tuning()

Signal resampling should not be dealt with in the unrelated phase tuning
function

>   clk_set_phase(clk, point * CLK_PHASE_STEP);
>   dev_dbg(mmc_dev(mmc), "success with phase: %d\n",
>   clk_get_phase(clk));
> @@ -768,6 +773,9 @@ static void meson_mmc_set_ios(struct mmc_host
> *mmc, struct mmc_ios *ios)
>   if (!IS_ERR(mmc->supply.vmmc))
>   mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd);
> 
> + /* disable signal resampling w/o delay */

nitpick : 'disable signal resampling' is enough.
when disabled, the delay does not matter. 

> + writel(0, host->regs + host->data->adjust);
> +
>   /* Reset rx phase */
>   clk_set_phase(host->rx_clk, 0);
> 
> @@ -1166,7 +1174,7 @@ static int meson_mmc_get_cd(struct mmc_host *mmc)
> 
>  static void meson_mmc_cfg_init(struct meson_host *host)
>  {
> - u32 cfg = 0, adj = 0;
> + u32 cfg = 0;
> 
>   cfg |= FIELD_PREP(CFG_RESP_TIMEOUT_MASK,
>     ilog2(SD_EMMC_CFG_RESP_TIMEOUT));
> @@ -1177,10 +1185,6 @@ static void meson_mmc_cfg_init(struct meson_host
> *host)
>   cfg |= CFG_ERR_ABORT;
> 
>   writel(cfg, host->regs + SD_EMMC_CFG);
> -
> - /* enable signal resampling w/o delay */
> - adj = ADJUST_ADJ_EN;
> - writel(adj, host->regs + host->data->adjust);
>  }
> 
>  static int meson_mmc_card_busy(struct mmc_host *mmc)



_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  reply	other threads:[~2019-01-17 15:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-16 10:13 regression caused by: "amlogic: mmc: meson-gx: add signal resampling" Andreas Fenkart
2019-01-16 11:14 ` Ulf Hansson
2019-01-16 13:12   ` Jerome Brunet
2019-01-17 12:35     ` Andreas Fenkart
2019-01-17 12:42       ` Neil Armstrong
2019-01-17 13:56       ` Andreas Fenkart
2019-01-17 14:11         ` Jerome Brunet
2019-01-17 14:47           ` Andreas Fenkart
2019-01-17 15:08             ` Jerome Brunet [this message]
2019-01-18 10:05               ` Andreas Fenkart
2019-01-18 10:26                 ` Jerome Brunet
2019-01-18 13:32                   ` [PATCH v2] mmc: meson-gx: enable signal re-sampling together with tuning Andreas Fenkart
2019-01-18 14:37                     ` Jerome Brunet
2019-01-22  7:48                     ` Ulf Hansson

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=c0ab226f363d22f31e13db5ae0af85ea7f7b451e.camel@baylibre.com \
    --to=jbrunet@baylibre.com \
    --cc=afenkart@gmail.com \
    --cc=khilman@baylibre.com \
    --cc=krzysztof.michonski@digitalstrom.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    /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).