* [PATCH 0/3] mmc: meson-gx: fixes for v4.14
@ 2017-10-02 12:27 Jerome Brunet
2017-10-02 12:27 ` [PATCH 1/3] mmc: meson-gx: make sure the clock is rounded down Jerome Brunet
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Jerome Brunet @ 2017-10-02 12:27 UTC (permalink / raw)
To: Ulf Hansson, Carlo Caione, Kevin Hilman
Cc: Jerome Brunet, Heiner Kallweit, linux-mmc, linux-amlogic,
linux-arm-kernel, linux-kernel
This patchset fixes the issues reported by Heiner [0] with the odroid-c2.
In a nutshell, this series does the following:
* Make sure the mmc clock rate is not set higher than what is requested
* Reset the tuning values on mmc power cycle instead of POWER_ON
* Add tuning of the tx phase to the tuning function.
This fixes the problem seen on the odroid-c2, both for hs200 and hs400.
To check for regression, this series has also been tested on the gxl
libretech-cc
Ulf, could you please pick this as fixes for v4.14 ?
[0]: https://lkml.kernel.org/r/e2171288-84ef-82db-2efc-300935e6c062@gmail.com
Jerome Brunet (3):
mmc: meson-gx: make sure the clock is rounded down
mmc: meson-gx: fix rx phase reset
mmc: meson-gx: include tx phase in the tuning process
drivers/mmc/host/meson-gx-mmc.c | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
--
2.13.5
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] mmc: meson-gx: make sure the clock is rounded down
2017-10-02 12:27 [PATCH 0/3] mmc: meson-gx: fixes for v4.14 Jerome Brunet
@ 2017-10-02 12:27 ` Jerome Brunet
2017-10-02 12:27 ` [PATCH 2/3] mmc: meson-gx: fix rx phase reset Jerome Brunet
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Jerome Brunet @ 2017-10-02 12:27 UTC (permalink / raw)
To: Ulf Hansson, Carlo Caione, Kevin Hilman
Cc: Jerome Brunet, Heiner Kallweit, linux-mmc, linux-amlogic,
linux-arm-kernel, linux-kernel
Using CLK_DIVIDER_ROUND_CLOSEST is unsafe as the mmc clock could be
rounded to a rate higher the specified rate. Removing this flag ensure
that, if the rate needs to be rounded, it will be rounded down.
Fixes: 51c5d8447bd7 ("MMC: meson: initial support for GX platforms")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
drivers/mmc/host/meson-gx-mmc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index c885c2d4b904..421c8719c202 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -531,8 +531,7 @@ static int meson_mmc_clk_init(struct meson_host *host)
div->shift = __ffs(CLK_DIV_MASK);
div->width = __builtin_popcountl(CLK_DIV_MASK);
div->hw.init = &init;
- div->flags = (CLK_DIVIDER_ONE_BASED |
- CLK_DIVIDER_ROUND_CLOSEST);
+ div->flags = CLK_DIVIDER_ONE_BASED;
clk = devm_clk_register(host->dev, &div->hw);
if (WARN_ON(IS_ERR(clk)))
--
2.13.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] mmc: meson-gx: fix rx phase reset
2017-10-02 12:27 [PATCH 0/3] mmc: meson-gx: fixes for v4.14 Jerome Brunet
2017-10-02 12:27 ` [PATCH 1/3] mmc: meson-gx: make sure the clock is rounded down Jerome Brunet
@ 2017-10-02 12:27 ` Jerome Brunet
2017-10-02 12:27 ` [PATCH 3/3] mmc: meson-gx: include tx phase in the tuning process Jerome Brunet
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Jerome Brunet @ 2017-10-02 12:27 UTC (permalink / raw)
To: Ulf Hansson, Carlo Caione, Kevin Hilman
Cc: Jerome Brunet, Heiner Kallweit, linux-mmc, linux-amlogic,
linux-arm-kernel, linux-kernel
Resetting the phase when POWER_ON is set the set_ios() call means that the
phase is reset almost every time the set_ios() is called, while the
expected behavior was to reset the phase on a power cycle.
This had gone unnoticed until now because in all mode (except hs400) the
tuning is done after the last to set_ios(). In such case, the tuning
result is used anyway. In HS400, there are a few calls to set_ios() after
the tuning is done, overwriting the tuning result.
Resetting the phase on POWER_UP instead of POWER_ON solve the problem.
Fixes: d341ca88eead ("mmc: meson-gx: rework tuning function")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
drivers/mmc/host/meson-gx-mmc.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index 421c8719c202..08a55c2e96e1 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -745,6 +745,10 @@ static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
case MMC_POWER_UP:
if (!IS_ERR(mmc->supply.vmmc))
mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd);
+
+ /* Reset rx phase */
+ clk_set_phase(host->rx_clk, 0);
+
break;
case MMC_POWER_ON:
@@ -758,8 +762,6 @@ static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
host->vqmmc_enabled = true;
}
- /* Reset rx phase */
- clk_set_phase(host->rx_clk, 0);
break;
}
--
2.13.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] mmc: meson-gx: include tx phase in the tuning process
2017-10-02 12:27 [PATCH 0/3] mmc: meson-gx: fixes for v4.14 Jerome Brunet
2017-10-02 12:27 ` [PATCH 1/3] mmc: meson-gx: make sure the clock is rounded down Jerome Brunet
2017-10-02 12:27 ` [PATCH 2/3] mmc: meson-gx: fix rx phase reset Jerome Brunet
@ 2017-10-02 12:27 ` Jerome Brunet
2017-10-02 18:33 ` [PATCH 0/3] mmc: meson-gx: fixes for v4.14 Kevin Hilman
2017-10-04 8:59 ` Ulf Hansson
4 siblings, 0 replies; 6+ messages in thread
From: Jerome Brunet @ 2017-10-02 12:27 UTC (permalink / raw)
To: Ulf Hansson, Carlo Caione, Kevin Hilman
Cc: Jerome Brunet, Heiner Kallweit, linux-mmc, linux-amlogic,
linux-arm-kernel, linux-kernel
It has been reported that some platforms (odroid-c2) may require
a different tx phase setting to operate at high speed (hs200 and hs400)
To improve the situation, this patch includes tx phase in the tuning
process.
Fixes: d341ca88eead ("mmc: meson-gx: rework tuning function")
Reported-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
drivers/mmc/host/meson-gx-mmc.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index 08a55c2e96e1..85745ef179e2 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -716,6 +716,22 @@ static int meson_mmc_clk_phase_tuning(struct mmc_host *mmc, u32 opcode,
static int meson_mmc_execute_tuning(struct mmc_host *mmc, u32 opcode)
{
struct meson_host *host = mmc_priv(mmc);
+ int ret;
+
+ /*
+ * If this is the initial tuning, try to get a sane Rx starting
+ * phase before doing the actual tuning.
+ */
+ if (!mmc->doing_retune) {
+ ret = meson_mmc_clk_phase_tuning(mmc, opcode, host->rx_clk);
+
+ if (ret)
+ return ret;
+ }
+
+ ret = meson_mmc_clk_phase_tuning(mmc, opcode, host->tx_clk);
+ if (ret)
+ return ret;
return meson_mmc_clk_phase_tuning(mmc, opcode, host->rx_clk);
}
@@ -746,8 +762,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);
- /* Reset rx phase */
+ /* Reset phases */
clk_set_phase(host->rx_clk, 0);
+ clk_set_phase(host->tx_clk, 270);
break;
--
2.13.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] mmc: meson-gx: fixes for v4.14
2017-10-02 12:27 [PATCH 0/3] mmc: meson-gx: fixes for v4.14 Jerome Brunet
` (2 preceding siblings ...)
2017-10-02 12:27 ` [PATCH 3/3] mmc: meson-gx: include tx phase in the tuning process Jerome Brunet
@ 2017-10-02 18:33 ` Kevin Hilman
2017-10-04 8:59 ` Ulf Hansson
4 siblings, 0 replies; 6+ messages in thread
From: Kevin Hilman @ 2017-10-02 18:33 UTC (permalink / raw)
To: Jerome Brunet
Cc: Ulf Hansson, Carlo Caione, Heiner Kallweit, linux-mmc,
linux-amlogic, linux-arm-kernel, linux-kernel
Jerome Brunet <jbrunet@baylibre.com> writes:
> This patchset fixes the issues reported by Heiner [0] with the odroid-c2.
> In a nutshell, this series does the following:
>
> * Make sure the mmc clock rate is not set higher than what is requested
> * Reset the tuning values on mmc power cycle instead of POWER_ON
> * Add tuning of the tx phase to the tuning function.
>
> This fixes the problem seen on the odroid-c2, both for hs200 and hs400.
> To check for regression, this series has also been tested on the gxl
> libretech-cc
>
> Ulf, could you please pick this as fixes for v4.14 ?
>
> [0]: https://lkml.kernel.org/r/e2171288-84ef-82db-2efc-300935e6c062@gmail.com
>
> Jerome Brunet (3):
> mmc: meson-gx: make sure the clock is rounded down
> mmc: meson-gx: fix rx phase reset
> mmc: meson-gx: include tx phase in the tuning process
>
> drivers/mmc/host/meson-gx-mmc.c | 26 ++++++++++++++++++++++----
> 1 file changed, 22 insertions(+), 4 deletions(-)
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] mmc: meson-gx: fixes for v4.14
2017-10-02 12:27 [PATCH 0/3] mmc: meson-gx: fixes for v4.14 Jerome Brunet
` (3 preceding siblings ...)
2017-10-02 18:33 ` [PATCH 0/3] mmc: meson-gx: fixes for v4.14 Kevin Hilman
@ 2017-10-04 8:59 ` Ulf Hansson
4 siblings, 0 replies; 6+ messages in thread
From: Ulf Hansson @ 2017-10-04 8:59 UTC (permalink / raw)
To: Jerome Brunet
Cc: Carlo Caione, Kevin Hilman, Heiner Kallweit, linux-mmc,
open list:ARM/Amlogic Meson...,
linux-arm-kernel, linux-kernel
On 2 October 2017 at 14:27, Jerome Brunet <jbrunet@baylibre.com> wrote:
> This patchset fixes the issues reported by Heiner [0] with the odroid-c2.
> In a nutshell, this series does the following:
>
> * Make sure the mmc clock rate is not set higher than what is requested
> * Reset the tuning values on mmc power cycle instead of POWER_ON
> * Add tuning of the tx phase to the tuning function.
>
> This fixes the problem seen on the odroid-c2, both for hs200 and hs400.
> To check for regression, this series has also been tested on the gxl
> libretech-cc
>
> Ulf, could you please pick this as fixes for v4.14 ?
Thanks, applied for fixes!
Kind regards
Uffe
>
> [0]: https://lkml.kernel.org/r/e2171288-84ef-82db-2efc-300935e6c062@gmail.com
>
> Jerome Brunet (3):
> mmc: meson-gx: make sure the clock is rounded down
> mmc: meson-gx: fix rx phase reset
> mmc: meson-gx: include tx phase in the tuning process
>
> drivers/mmc/host/meson-gx-mmc.c | 26 ++++++++++++++++++++++----
> 1 file changed, 22 insertions(+), 4 deletions(-)
>
> --
> 2.13.5
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-10-04 8:59 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-02 12:27 [PATCH 0/3] mmc: meson-gx: fixes for v4.14 Jerome Brunet
2017-10-02 12:27 ` [PATCH 1/3] mmc: meson-gx: make sure the clock is rounded down Jerome Brunet
2017-10-02 12:27 ` [PATCH 2/3] mmc: meson-gx: fix rx phase reset Jerome Brunet
2017-10-02 12:27 ` [PATCH 3/3] mmc: meson-gx: include tx phase in the tuning process Jerome Brunet
2017-10-02 18:33 ` [PATCH 0/3] mmc: meson-gx: fixes for v4.14 Kevin Hilman
2017-10-04 8:59 ` Ulf Hansson
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).