Skip to contentSkip to conversation

regression caused by: "amlogic: mmc: meson-gx: add signal resampling"

PATCH In review Andreas Fenkart 4 participants 14 messages Jan 16, 2019 – Jan 22, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

failed to initialize builtin emmc device:
"mmc1: error -110 whilst initialising MMC card"

amlogic/meson-gxl-s905x-p212.dtb
linux-5.0-rc2 / 1c7fc5cbc

I bisected the problem and after reverting the following patch, mmc is found again:

commit 71645e65729f0c5aef8dccf961c97fa766835bd4 (tag: mmc_bad_resable)

Author: Jerome Brunet <[email protected]>
Date:   Thu Dec 6 16:18:28 2018 +0100

mmc: meson-gx: add signal resampling

With some eMMC devices, there is still issues with the new phase settings. Enabling signal resampling seems to solve the problem for these.

/Andi

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

#1 lore raw

+ Jerome, Kevin

Quoted 16 lines · Andreas Fenkart

failed to initialize builtin emmc device:
"mmc1: error -110 whilst initialising MMC card"

amlogic/meson-gxl-s905x-p212.dtb
linux-5.0-rc2 / 1c7fc5cbc

I bisected the problem and after reverting the following patch, mmc is found again:

commit 71645e65729f0c5aef8dccf961c97fa766835bd4 (tag: mmc_bad_resable)

Author: Jerome Brunet <[email protected]>
Date:   Thu Dec 6 16:18:28 2018 +0100

mmc: meson-gx: add signal resampling

Quoted 8 lines

With some eMMC devices, there is still issues with the new phase settings. Enabling signal resampling seems to solve the problem for these.

/Andi

Andi, thanks for reporting and bisecting!

I have looped in Jerome and Kevin to see if they can have a look. Let's give them a few days before we consider the revert.

Kind regards
Uffe

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

reviewer
#2 lore raw
Quoted 25 lines · Ulf Hansson

+ Jerome, Kevin

Quoted 22 lines · Andreas Fenkart

failed to initialize builtin emmc device:
"mmc1: error -110 whilst initialising MMC card"

amlogic/meson-gxl-s905x-p212.dtb
linux-5.0-rc2 / 1c7fc5cbc

I bisected the problem and after reverting the following patch, mmc is found again:

commit 71645e65729f0c5aef8dccf961c97fa766835bd4 (tag: mmc_bad_resable)

Author: Jerome Brunet <[email protected]>
Date:   Thu Dec 6 16:18:28 2018 +0100

mmc: meson-gx: add signal resampling

With some eMMC devices, there is still issues with the new phase settings. Enabling signal resampling seems to solve the problem for these.

Quoted 6 lines
Quoted 1 line

/Andi

Andi, thanks for reporting and bisecting!

I have looped in Jerome and Kevin to see if they can have a look. Let's give them a few days before we consider the revert.

Hi Andi,

There an actual s905x p212 in kernelci which is not showing any issue, AFAIK.

https://kernelci.org/boot/meson-gxl-s905x-p212/

Have a look a this recent boot of mainline/arm64:
https://storage.kernelci.org/mainline/master/v5.0-rc2-36-gfe76fc6aaf53/arm64/defconfig/lab-baylibre-seattle/boot-meson-gxl-s905x-p212.txt

Has the p212 is ref design of the s905x, we often see the related DT used on other device.

Is your board actually a p212 ?
If yes, could you tell us about any of the marking on PCB, such as the board revision ?
If not, could you tell us more about your device ?

We proposing this series, I flagged that this patch and the other one (on phase settings) needed broader testing. It could possibly cause regression for tunning and high speed modes ... this typically show with error -5 (tunning failed)

Here your eMMC timedout during init, so even before an attempt is made to tune which is odd. Could you try to enable signal resampling only when going forhigh speed modes ?

Quoted 3 lines

Kind regards
Uffe

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

#3 lore raw

Hi Jerome

Quoted 6 lines

There an actual s905x p212 in kernelci which is not showing any issue, AFAIK.

https://kernelci.org/boot/meson-gxl-s905x-p212/

Have a look a this recent boot of mainline/arm64:
https://storage.kernelci.org/mainline/master/v5.0-rc2-36-gfe76fc6aaf53/arm64/defconfig/lab-baylibre-seattle/boot-meson-gxl-s905x-p212.txt

thanks, great way to compare with my local output messages

already wondered about this:

[    1.195173] meson_vid_pll_div_recalc_rate: Invalid config value for

vid_pll_div

Quoted 7 lines

Has the p212 is ref design of the s905x, we often see the related DT used on other device.

Is your board actually a p212 ?
If yes, could you tell us about any of the marking on PCB, such as the board revision ?
If not, could you tell us more about your device ?

it's a "BeeLink Mini M8 SII"

pasted the output here
https://pastebin.com/UCnR25mK

should I try with another dtb?

Quoted 7 lines

We proposing this series, I flagged that this patch and the other one (on phase settings) needed broader testing. It could possibly cause regression for tunning and high speed modes ... this typically show with error -5 (tunning failed)

Here your eMMC timedout during init, so even before an attempt is made to tune which is odd. Could you try to enable signal resampling only when going forhigh speed modes ?

huh, need to look into how to do that.

/Andi

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

#4 lore raw

Hi Andreas,

Quoted 5 lines · Andreas Fenkart

Hi Jerome

Quoted 4 lines

There an actual s905x p212 in kernelci which is not showing any issue, AFAIK.

https://kernelci.org/boot/meson-gxl-s905x-p212/

Quoted 8 lines
Quoted 2 lines

Have a look a this recent boot of mainline/arm64:
https://storage.kernelci.org/mainline/master/v5.0-rc2-36-gfe76fc6aaf53/arm64/defconfig/lab-baylibre-seattle/boot-meson-gxl-s905x-p212.txt

thanks, great way to compare with my local output messages

already wondered about this:

[    1.195173] meson_vid_pll_div_recalc_rate: Invalid config value for

vid_pll_div

This is a warning I should put in dbg, the vid_pll config at reset is unknown and we can't calc a rate...

Quoted 9 lines
Quoted 8 lines

Has the p212 is ref design of the s905x, we often see the related DT used on other device.

Is your board actually a p212 ?
If yes, could you tell us about any of the marking on PCB, such as the board revision ?
If not, could you tell us more about your device ?

Quoted 6 lines

it's a "BeeLink Mini M8 SII"

pasted the output here
https://pastebin.com/UCnR25mK

should I try with another dtb?

Devices derivative from P212 are not 100% same as the reference design, by using different components and with maybe less good pcb routing, so high speed clocks & modes could not work at all.

You should add a dts for you device based on p212 with some changes in the mmc capabilities.

since we can't have access to the source changes for these devices, it's only based on guess..

Neil

Quoted 9 lines
Quoted 8 lines

We proposing this series, I flagged that this patch and the other one (on phase settings) needed broader testing. It could possibly cause regression for tunning and high speed modes ... this typically show with error -5 (tunning failed)

Here your eMMC timedout during init, so even before an attempt is made to tune which is odd. Could you try to enable signal resampling only when going forhigh speed modes ?

Quoted 9 lines

huh, need to look into how to do that.

/Andi

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

#5 lore raw
In reply to Andreas Fenkart

Am Do., 17. Jan. 2019 um 13:35 Uhr schrieb Andreas Fenkart <[email protected]>:

Quoted 6 lines

Hi Jerome

Quoted 2 lines

Here your eMMC timedout during init, so even before an attempt is made to tune which is odd. Could you try to enable signal resampling only when going forhigh speed modes ?

card is found with this patch:

drivers/mmc/host/meson-gx-mmc.c +0 -0
@@ -432,12 +432,17 @@ static int meson_mmc_clk_set(struct meson_host

*host, struct mmc_ios *ios)

        struct mmc_host *mmc = host->mmc;
        unsigned long rate = ios->clock;
        int ret;

- u32 cfg;
+ u32 cfg = 0, adj = 0;

        /* DDR modes require higher module clock */
        if (meson_mmc_timing_is_ddr(ios))
                rate <<= 1;

        /* Same request - bail-out */
        if (host->req_rate == rate)
                return 0;
@@ -475,6 +480,13 @@ static int meson_mmc_clk_set(struct meson_host
*host, struct mmc_ios *ios)
        if (ios->clock != mmc->actual_clock)
                dev_dbg(host->dev, "requested rate was %u\n", ios->clock);

+ if (rate >= 200000000) {

+               printk("enable signal resampling");
+               /* enable signal resampling w/o delay */
+               adj = ADJUST_ADJ_EN;
+               writel(adj, host->regs + host->data->adjust);
+       }
+
        /* (re)start clock */
        meson_mmc_clk_ungate(host);

/Andi

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

reviewer
#6 lore raw
Quoted 29 lines · Andreas Fenkart

Am Do., 17. Jan. 2019 um 13:35 Uhr schrieb Andreas Fenkart < [email protected]>:

Quoted 5 lines

Hi Jerome

Quoted 4 lines

Here your eMMC timedout during init, so even before an attempt is made to tune
which is odd. Could you try to enable signal resampling only when going forhigh speed modes ?

card is found with this patch:

drivers/mmc/host/meson-gx-mmc.c +1 -1
@@ -432,12 +432,17 @@ static int meson_mmc_clk_set(struct meson_host
 *host, struct mmc_ios *ios)
        struct mmc_host *mmc = host->mmc;
        unsigned long rate = ios->clock;
        int ret;
-       u32 cfg;
+       u32 cfg = 0, adj = 0;
 
        /* DDR modes require higher module clock */
        if (meson_mmc_timing_is_ddr(ios))
                rate <<= 1;
 
        /* Same request - bail-out */
        if (host->req_rate == rate)
                return 0;
@@ -475,6 +480,13 @@ static int meson_mmc_clk_set(struct meson_host
 *host, struct mmc_ios *ios)

drivers/mmc/host/meson-gx-mmc.c static int meson_mmc_clk_set(struct meson_host · line 490

Quoted 10 lines
drivers/mmc/host/meson-gx-mmc.c +7 -0
        if (ios->clock != mmc->actual_clock)
                dev_dbg(host->dev, "requested rate was %u\n", ios->clock);
 
+       if (rate >= 200000000) {
+               printk("enable signal resampling");
+               /* enable signal resampling w/o delay */
+               adj = ADJUST_ADJ_EN;
+               writel(adj, host->regs + host->data->adjust);
+       }
+

200Mhz is a bit arbitrary.
I would prefer if you enabled resampling when starting a tuning And disable it on power up, in the set_ios() callaback.

Quoted 4 lines
drivers/mmc/host/meson-gx-mmc.c +0 -0
        /* (re)start clock */
        meson_mmc_clk_ungate(host);

/Andi

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

#7 lore raw

From: Andreas Fenkart <[email protected]>
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
mmc1: error -110 whilst initialising MMC card

---
 drivers/mmc/host/meson-gx-mmc.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/mmc/host/meson-gx-mmc.c +2 -1
index c2690c1a50ff..b65ec4bea980 100644
@@ -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);
+
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 */
+ 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)

Signature · 3 lines
2.20.1

Am Do., 17. Jan. 2019 um 15:11 Uhr schrieb Jerome Brunet <[email protected]>:
Quoted 34 lines · Andreas Fenkart
Quoted 32 lines

Am Do., 17. Jan. 2019 um 13:35 Uhr schrieb Andreas Fenkart < [email protected]>:

Quoted 5 lines

Hi Jerome

Quoted 4 lines

Here your eMMC timedout during init, so even before an attempt is made to tune
which is odd. Could you try to enable signal resampling only when going forhigh speed modes ?

card is found with this patch:

drivers/mmc/host/meson-gx-mmc.c +1 -1
@@ -432,12 +432,17 @@ static int meson_mmc_clk_set(struct meson_host
 *host, struct mmc_ios *ios)
        struct mmc_host *mmc = host->mmc;
        unsigned long rate = ios->clock;
        int ret;
-       u32 cfg;
+       u32 cfg = 0, adj = 0;
 
        /* DDR modes require higher module clock */
        if (meson_mmc_timing_is_ddr(ios))
                rate <<= 1;
 
        /* Same request - bail-out */
        if (host->req_rate == rate)
                return 0;
@@ -475,6 +480,13 @@ static int meson_mmc_clk_set(struct meson_host
 *host, struct mmc_ios *ios)
        if (ios->clock != mmc->actual_clock)
                dev_dbg(host->dev, "requested rate was %u\n", ios->clock);
 
Quoted 18 lines

drivers/mmc/host/meson-gx-mmc.c static int meson_mmc_clk_set(struct meson_host · line 490

Quoted 7 lines
drivers/mmc/host/meson-gx-mmc.c +7 -0
+       if (rate >= 200000000) {
+               printk("enable signal resampling");
+               /* enable signal resampling w/o delay */
+               adj = ADJUST_ADJ_EN;
+               writel(adj, host->regs + host->data->adjust);
+       }
+

200Mhz is a bit arbitrary.
I would prefer if you enabled resampling when starting a tuning And disable it on power up, in the set_ios() callaback.

Quoted 4 lines
drivers/mmc/host/meson-gx-mmc.c +0 -0
        /* (re)start clock */
        meson_mmc_clk_ungate(host);

/Andi

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

reviewer
#8 lore raw
Quoted 6 lines · Andreas Fenkart

From: Andreas Fenkart <[email protected]>
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.

Quoted 2 lines

mmc1: error -110 whilst initialising MMC card

missing the 'Fixes' tag here

Quoted 22 lines
---
 drivers/mmc/host/meson-gx-mmc.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/mmc/host/meson-gx- renamed from drivers/mmc/host/meson-gx-mmc.c +0 -0

mmc.c
index c2690c1a50ff..b65ec4bea980 100644

drivers/mmc/host/meson-gx-mmc.c +2 -1
@@ -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",

drivers/mmc/host/meson-gx-mmc.c static int meson_mmc_clk_phase_tuning(struct · line 737

Quoted 8 lines
drivers/mmc/host/meson-gx-mmc.c +4 -0
@@ -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

drivers/mmc/host/meson-gx-mmc.c static void meson_mmc_set_ios(struct mmc_host · line 777

Quoted 9 lines
drivers/mmc/host/meson-gx-mmc.c +0 -0
  clk_set_phase(clk, point * CLK_PHASE_STEP);
  dev_dbg(mmc_dev(mmc), "success with phase: %d\n",
  clk_get_phase(clk));
drivers/mmc/host/meson-gx-mmc.c +1 -0
@@ -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.

Quoted 25 lines
drivers/mmc/host/meson-gx-mmc.c +3 -5
+ 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);
 }
 
Quoted 1 line

static int meson_mmc_card_busy(struct mmc_host *mmc)

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

#9 lore raw

From 7ea0b63ddfc841251cbcc33c8ed0151e52e372f2 Mon Sep 17 00:00:00 2001
From: Andreas Fenkart <[email protected]>
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 "BeeLink Mini M8 SII" if enabled too early
mmc1: error -110 whilst initialising MMC card

Fixes 71645e65729f ("mmc: meson-gx: add signal resampling")
---
 drivers/mmc/host/meson-gx-mmc.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/mmc/host/meson-gx-mmc.c +0 -0
index c2690c1a50ff..dba499009d0c 100644
@@ -738,6 +738,11 @@ 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 adj = 0;
+
+ /* enable signal resampling w/o delay */
+ adj = ADJUST_ADJ_EN;
+ writel(adj, host->regs + host->data->adjust);

return meson_mmc_clk_phase_tuning(mmc, opcode, host->rx_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 */
+ 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)

Signature · 3 lines
2.20.1

Am Do., 17. Jan. 2019 um 16:08 Uhr schrieb Jerome Brunet <[email protected]>:
Quoted 90 lines · Andreas Fenkart
Quoted 6 lines

From: Andreas Fenkart <[email protected]>
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.

Quoted 2 lines

mmc1: error -110 whilst initialising MMC card

missing the 'Fixes' tag here

Quoted 22 lines
---
 drivers/mmc/host/meson-gx-mmc.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/mmc/host/meson-gx- renamed from drivers/mmc/host/meson-gx-mmc.c +0 -0

mmc.c
index c2690c1a50ff..b65ec4bea980 100644

drivers/mmc/host/meson-gx-mmc.c +2 -1
@@ -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",

drivers/mmc/host/meson-gx-mmc.c static int meson_mmc_clk_phase_tuning(struct · line 737

Quoted 8 lines
drivers/mmc/host/meson-gx-mmc.c +4 -0
@@ -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

drivers/mmc/host/meson-gx-mmc.c static void meson_mmc_set_ios(struct mmc_host · line 777

Quoted 9 lines
drivers/mmc/host/meson-gx-mmc.c +0 -0
  clk_set_phase(clk, point * CLK_PHASE_STEP);
  dev_dbg(mmc_dev(mmc), "success with phase: %d\n",
  clk_get_phase(clk));
drivers/mmc/host/meson-gx-mmc.c +1 -0
@@ -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.

Quoted 18 lines
drivers/mmc/host/meson-gx-mmc.c +3 -1
+ 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;
 
Quoted 10 lines
Quoted 8 lines
drivers/mmc/host/meson-gx-mmc.c +0 -4
  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
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

reviewer
#10 lore raw
Quoted 6 lines · Andreas Fenkart

From 7ea0b63ddfc841251cbcc33c8ed0151e52e372f2 Mon Sep 17 00:00:00 2001
From: Andreas Fenkart <[email protected]>
Date: Thu, 17 Jan 2019 15:39:52 +0100
Subject: [PATCH] mmc: meson-gx: enable signal re-sampling together with tuning

Quoted 6 lines

card detection fails on "BeeLink Mini M8 SII" if enabled too early
mmc1: error -110 whilst initialising MMC card

Fixes 71645e65729f ("mmc: meson-gx: add signal resampling")

---

Andreas,

Your patch gets corrupted by your mailer which makes it quite annoying to apply.
I would suggest using git send-email

Plus, when sending patch it is better if the actual subject of the mail allows patchwork to pick it up.
Since it is 2nd version, of your fix, the subject should start with [PATCH v2].
This helps maintainers (and patchwork) track things

Jerome

Quoted 149 lines
 drivers/mmc/host/meson-gx-mmc.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/mmc/host/meson-gx- renamed from drivers/mmc/host/meson-gx-mmc.c +0 -0

mmc.c
index c2690c1a50ff..dba499009d0c 100644

drivers/mmc/host/meson-gx-mmc.c +5 -0
@@ -738,6 +738,11 @@ 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 adj = 0;
+
+ /* enable signal resampling w/o delay */
+ adj = ADJUST_ADJ_EN;
+ writel(adj, host->regs + host->data->adjust);
 
  return meson_mmc_clk_phase_tuning(mmc, opcode, host->rx_clk);

}

drivers/mmc/host/meson-gx-mmc.c +4 -5
@@ -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 */
+ 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)
--
2.20.1

Am Do., 17. Jan. 2019 um 16:08 Uhr schrieb Jerome Brunet < [email protected]>:

Quoted 91 lines · Andreas Fenkart
Quoted 6 lines

From: Andreas Fenkart <[email protected]>
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.

Quoted 2 lines

mmc1: error -110 whilst initialising MMC card

missing the 'Fixes' tag here

Quoted 24 lines
---
  drivers/mmc/host/meson-gx-mmc.c | 16 ++++++++++------
  1 file changed, 10 insertions(+), 6 deletions(-)
drivers/mmc/host/meson- renamed from drivers/mmc/host/meson-gx-mmc.c +0 -0

gx-
mmc.c
index c2690c1a50ff..b65ec4bea980 100644

drivers/mmc/host/meson-gx-mmc.c +2 -1
@@ -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",

drivers/mmc/host/meson-gx-mmc.c static int meson_mmc_clk_phase_tuning(struct · line 737

Quoted 8 lines
drivers/mmc/host/meson-gx-mmc.c +4 -0
@@ -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

drivers/mmc/host/meson-gx-mmc.c static void meson_mmc_set_ios(struct mmc_host · line 777

Quoted 9 lines
drivers/mmc/host/meson-gx-mmc.c +0 -0
   clk_set_phase(clk, point * CLK_PHASE_STEP);
   dev_dbg(mmc_dev(mmc), "success with phase: %d\n",
   clk_get_phase(clk));
drivers/mmc/host/meson-gx-mmc.c +1 -0
@@ -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.

Quoted 18 lines
drivers/mmc/host/meson-gx-mmc.c +3 -1
+ 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;
 
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/mmc/host/meson-gx-mmc.c +0 -4
   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
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

#11 lore raw

PATCH v2 1/1 mmc: meson-gx: enable signal re-sampling together with tuning

card detection fails on "BeeLink Mini M8 SII" if enabled too early
mmc1: error -110 whilst initialising MMC card

Fixes 71645e65729f ("mmc: meson-gx: add signal resampling")
---
 drivers/mmc/host/meson-gx-mmc.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/mmc/host/meson-gx-mmc.c +9 -5
index c2690c1a50ff..dba499009d0c 100644
@@ -738,6 +738,11 @@ 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 adj = 0;
+
+	/* enable signal resampling w/o delay */
+	adj = ADJUST_ADJ_EN;
+	writel(adj, host->regs + host->data->adjust);
 
 	return meson_mmc_clk_phase_tuning(mmc, opcode, host->rx_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 */
+		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)
Signature · 7 lines
2.20.1


_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
reviewer Reviewed-by Tested-by on v2 1/1
#12 lore raw

Re: [PATCH v2] mmc: meson-gx: enable signal re-sampling together with tuning

Quoted 8 lines · Andreas Fenkart

card detection fails on "BeeLink Mini M8 SII" if enabled too early
mmc1: error -110 whilst initialising MMC card

Fixes 71645e65729f ("mmc: meson-gx: add signal resampling")
---
 drivers/mmc/host/meson-gx-mmc.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

on the axg-s400 (eMMC and SDIO)
on lhe libretech-cc (eMMC and SD)

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

#13 lore raw

Re: [PATCH v2] mmc: meson-gx: enable signal re-sampling together with tuning

In reply to Andreas Fenkart
Quoted 6 lines · Andreas Fenkart

card detection fails on "BeeLink Mini M8 SII" if enabled too early
mmc1: error -110 whilst initialising MMC card

Fixes 71645e65729f ("mmc: meson-gx: add signal resampling")

Applied for fixes, thanks!

Kind regards
Uffe

Quoted 51 lines
---
 drivers/mmc/host/meson-gx-mmc.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/mmc/host/meson-gx-mmc.c +9 -6
index c2690c1a50ff..dba499009d0c 100644
@@ -738,6 +738,11 @@ 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 adj = 0;
+
+       /* enable signal resampling w/o delay */
+       adj = ADJUST_ADJ_EN;
+       writel(adj, host->regs + host->data->adjust);
 
        return meson_mmc_clk_phase_tuning(mmc, opcode, host->rx_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 */
+               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)
--
Quoted 2 lines

2.20.1

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic