mmc: renesas_sdhi: Change HW adjustment register according to speed mode
Subsystems (2)
Wolfram Sang
maintainerPATCH 1/1 mmc: renesas_sdhi: Change HW adjustment register according to speed mode
From: Takeshi Saito <[email protected]>
SCC is used for SDR104/HS200/HS400. We need to change SCC_DT2FF according to the mode. If it is inappropriate, CRC error tends to occur.
This adds variable "tap_hs400" for HS400 mode and configures SCC_DT2FF as needed.
---
I don't have a testcase currently, so I don't think this is stable material. If this ever changes, we can have it added to stable later. But I am open for other opinions here. Tested on Salvator-XS with Renesas R-Car M3N, no regressions in both detecting HS400 and transferring large files.
drivers/mmc/host/renesas_sdhi.h | 2 ++ drivers/mmc/host/renesas_sdhi_core.c | 8 ++++++++ drivers/mmc/host/renesas_sdhi_internal_dmac.c | 1 + 3 files changed, 11 insertions(+)
drivers/mmc/host/renesas_sdhi.h +2 -0
@@ -15,6 +15,7 @@struct renesas_sdhi_scc {unsigned long clk_rate;/* clock rate for SDR104 */ u32 tap;/* sampling clock position for SDR104 */ +u32 tap_hs400;/* sampling clock position for HS400 */ };struct renesas_sdhi_of_data {
@@ -49,6 +50,7 @@ struct renesas_sdhi {struct pinctrl_state *pins_default, *pins_uhs;void __iomem *scc_ctl;u32 scc_tappos; +u32 scc_tappos_hs400; };#define host_to_priv (host) \
drivers/mmc/host/renesas_sdhi_core.c +8 -0
@@ -337,6 +337,10 @@ static void renesas_sdhi_hs400_complete(struct tmio_mmc_host *host)/* Set HS400 mode */ sd_ctrl_write16 (host,CTL_SDIF_MODE ,0x0001 |sd_ctrl_read16 (host,CTL_SDIF_MODE )); + +sd_scc_write32 (host, priv,SH_MOBILE_SDHI_SCC_DT2FF , + priv->scc_tappos_hs400); + sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_TMPPORT2, (SH_MOBILE_SDHI_SCC_TMPPORT2_HS400EN | SH_MOBILE_SDHI_SCC_TMPPORT2_HS400OSEL) |
@@ -396,6 +400,9 @@ static void renesas_sdhi_reset_hs400_mode(struct tmio_mmc_host *host,/* Reset HS400 mode */ sd_ctrl_write16 (host,CTL_SDIF_MODE , ~0x0001 &sd_ctrl_read16 (host,CTL_SDIF_MODE )); + +sd_scc_write32 (host, priv,SH_MOBILE_SDHI_SCC_DT2FF , priv->scc_tappos); + sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_TMPPORT2, ~(SH_MOBILE_SDHI_SCC_TMPPORT2_HS400EN | SH_MOBILE_SDHI_SCC_TMPPORT2_HS400OSEL) &
@@ -786,6 +793,7 @@ int renesas_sdhi_probe(struct platform_device *pdev,if (taps[i].clk_rate ==0 || taps[i].clk_rate == host->mmc->f_max) { priv->scc_tappos = taps->tap; + priv->scc_tappos_hs400 = taps->tap_hs400; hit = true;break ; }
drivers/mmc/host/renesas_sdhi_internal_dmac.c +1 -0
@@ -81,6 +81,7 @@ static struct renesas_sdhi_scc rcar_gen3_scc_taps[] = { { .clk_rate = 0, .tap = 0x00000300, + .tap_hs400 = 0x00000704, }, };
Signature · 1 line
2.11.0
Hi Wolfram,
Thanks for your patch.
Quoted 11 lines · Wolfram Sang
From: Takeshi Saito <[email protected]>
SCC is used for SDR104/HS200/HS400. We need to change
SCC_DT2FFaccording to the mode. If it is inappropriate, CRC error tends to occur.This adds variable "
tap_hs400" for HS400 mode and configuresSCC_DT2FFas needed.Signed-off-by Takeshi Saito <[email protected]>[wsa: rebased to upstream and updated commit message]Signed-off-by Wolfram Sang <[email protected]>
I think this looks good.
Quoted 80 lines
---
I don't have a testcase currently, so I don't think this is stable material. If this ever changes, we can have it added to stable later. But I am open for other opinions here. Tested on Salvator-XS with Renesas R-Car M3N, no regressions in both detecting HS400 and transferring large files.
drivers/mmc/host/renesas_sdhi.h | 2 ++ drivers/mmc/host/renesas_sdhi_core.c | 8 ++++++++ drivers/mmc/host/renesas_sdhi_internal_dmac.c | 1 + 3 files changed, 11 insertions(+)drivers/mmc/host/renesas_sdhi.h +2
-0@@ -15,6 +15,7 @@struct renesas_sdhi_scc {unsigned long clk_rate;/* clock rate for SDR104 */ u32 tap;/* sampling clock position for SDR104 */ +u32 tap_hs400;/* sampling clock position for HS400 */ };struct renesas_sdhi_of_data {@@ -49,6 +50,7 @@ struct renesas_sdhi {struct pinctrl_state *pins_default, *pins_uhs;void __iomem *scc_ctl;u32 scc_tappos; +u32 scc_tappos_hs400; };#define host_to_priv (host) \drivers/mmc/host/renesas_sdhi_core.c +8
-0@@ -337,6 +337,10 @@ static void renesas_sdhi_hs400_complete(struct tmio_mmc_host *host)/* Set HS400 mode */ sd_ctrl_write16 (host,CTL_SDIF_MODE ,0x0001 |sd_ctrl_read16 (host,CTL_SDIF_MODE )); + +sd_scc_write32 (host, priv,SH_MOBILE_SDHI_SCC_DT2FF , + priv->scc_tappos_hs400); + sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_TMPPORT2, (SH_MOBILE_SDHI_SCC_TMPPORT2_HS400EN | SH_MOBILE_SDHI_SCC_TMPPORT2_HS400OSEL) |@@ -396,6 +400,9 @@ static void renesas_sdhi_reset_hs400_mode(struct tmio_mmc_host *host,/* Reset HS400 mode */ sd_ctrl_write16 (host,CTL_SDIF_MODE , ~0x0001 &sd_ctrl_read16 (host,CTL_SDIF_MODE )); + +sd_scc_write32 (host, priv,SH_MOBILE_SDHI_SCC_DT2FF , priv->scc_tappos); + sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_TMPPORT2, ~(SH_MOBILE_SDHI_SCC_TMPPORT2_HS400EN | SH_MOBILE_SDHI_SCC_TMPPORT2_HS400OSEL) &@@ -786,6 +793,7 @@ int renesas_sdhi_probe(struct platform_device *pdev,if (taps[i].clk_rate ==0 || taps[i].clk_rate == host->mmc->f_max) { priv->scc_tappos = taps->tap; + priv->scc_tappos_hs400 = taps->tap_hs400; hit = true;break ; }drivers/mmc/host/renesas_sdhi_internal_dmac.c +1
-0@@ -81,6 +81,7 @@ static struct renesas_sdhi_scc rcar_gen3_scc_taps[] = { { .clk_rate = 0, .tap = 0x00000300, + .tap_hs400 = 0x00000704, }, };Signature · 1 line
2.11.0
Signature · 2 lines
Regards, Niklas Söderlund
Quoted 1 line · Niklas Söderlund
Hi Wolfram,
Hi,
Quoted 11 lines
Thanks for your patch.
Quoted 8 lines · Wolfram Sang
From: Takeshi Saito <[email protected]>
SCC is used for SDR104/HS200/HS400. We need to change
SCC_DT2FFaccording to the mode. If it is inappropriate, CRC error tends to occur.This adds variable "
tap_hs400" for HS400 mode and configuresSCC_DT2FFas needed.
Quoted 7 lines
Quoted 3 lines
Signed-off-by Takeshi Saito <[email protected]>[wsa: rebased to upstream and updated commit message]Signed-off-by Wolfram Sang <[email protected]>I think this looks good.
Reviewed-by Niklas Söderlund <[email protected]>
Can you test this on E3 Ebisu (do you have a board) ?
Signature · 2 lines
Best regards, Marek Vasut
Hi Marek,
Quoted 16 lines · Marek Vasut
Quoted 1 line · Niklas Söderlund
Hi Wolfram,
Hi,
Quoted 11 lines
Thanks for your patch.
Quoted 8 lines · Wolfram Sang
From: Takeshi Saito <[email protected]>
SCC is used for SDR104/HS200/HS400. We need to change
SCC_DT2FFaccording to the mode. If it is inappropriate, CRC error tends to occur.This adds variable "
tap_hs400" for HS400 mode and configuresSCC_DT2FFas needed.
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
Signed-off-by Takeshi Saito <[email protected]>[wsa: rebased to upstream and updated commit message]Signed-off-by Wolfram Sang <[email protected]>I think this looks good.
Reviewed-by Niklas Söderlund <[email protected]>Can you test this on E3 Ebisu (do you have a board) ?
I do not have a E3 so I'm afraid I can not provide a tested by tag for that board.
Signature · 2 lines
Regards, Niklas Söderlund
Quoted 23 lines · Niklas Söderlund
Hi Marek,
Quoted 20 lines · Marek Vasut
Quoted 1 line · Niklas Söderlund
Hi Wolfram,
Hi,
Quoted 15 lines
Thanks for your patch.
Quoted 11 lines · Wolfram Sang
From: Takeshi Saito <[email protected]>
SCC is used for SDR104/HS200/HS400. We need to change
SCC_DT2FFaccording to the mode. If it is inappropriate, CRC error tends to occur.This adds variable "
tap_hs400" for HS400 mode and configuresSCC_DT2FFas needed.Signed-off-by Takeshi Saito <[email protected]>[wsa: rebased to upstream and updated commit message]Signed-off-by Wolfram Sang <[email protected]>
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
I think this looks good.
Reviewed-by Niklas Söderlund <[email protected]>Can you test this on E3 Ebisu (do you have a board) ?
I do not have a E3 so I'm afraid I can not provide a tested by tag for that board.
I am happy to test. Is anything specific required?
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Can you test this on E3 Ebisu (do you have a board) ?
I do not have a E3 so I'm afraid I can not provide a tested by tag for that board.
I am happy to test. Is anything specific required?
Nope, we don't have a testcase. Just check if everything still works.
Marek Vasut
Tested-byQuoted 26 lines · Simon Horman
Quoted 25 lines · Niklas Söderlund
Hi Marek,
Quoted 22 lines · Marek Vasut
Quoted 1 line · Niklas Söderlund
Hi Wolfram,
Hi,
Quoted 17 lines
Thanks for your patch.
Quoted 11 lines · Wolfram Sang
From: Takeshi Saito <[email protected]>
SCC is used for SDR104/HS200/HS400. We need to change
SCC_DT2FFaccording to the mode. If it is inappropriate, CRC error tends to occur.This adds variable "
tap_hs400" for HS400 mode and configuresSCC_DT2FFas needed.Signed-off-by Takeshi Saito <[email protected]>[wsa: rebased to upstream and updated commit message]Signed-off-by Wolfram Sang <[email protected]>I think this looks good.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Quoted 1 line
Reviewed-by Niklas Söderlund <[email protected]>Can you test this on E3 Ebisu (do you have a board) ?
I do not have a E3 so I'm afraid I can not provide a tested by tag for that board.
I am happy to test. Is anything specific required?
Not anymore.
On E3 Ebisu 4D
Signature · 2 lines
Best regards, Marek Vasut
Quoted 6 lines · Wolfram Sang
From: Takeshi Saito <[email protected]>
SCC is used for SDR104/HS200/HS400. We need to change
SCC_DT2FFaccording to the mode. If it is inappropriate, CRC error tends to occur.
Quoted 6 lines
This adds variable "
tap_hs400" for HS400 mode and configuresSCC_DT2FFas needed.Signed-off-by Takeshi Saito <[email protected]>[wsa: rebased to upstream and updated commit message]Signed-off-by Wolfram Sang <[email protected]>
Applied for next, thanks!
Kind regards
Uffe
Quoted 80 lines
---
I don't have a testcase currently, so I don't think this is stable material. If this ever changes, we can have it added to stable later. But I am open for other opinions here. Tested on Salvator-XS with Renesas R-Car M3N, no regressions in both detecting HS400 and transferring large files.
drivers/mmc/host/renesas_sdhi.h | 2 ++ drivers/mmc/host/renesas_sdhi_core.c | 8 ++++++++ drivers/mmc/host/renesas_sdhi_internal_dmac.c | 1 + 3 files changed, 11 insertions(+)drivers/mmc/host/renesas_sdhi.h +2
-0@@ -15,6 +15,7 @@struct renesas_sdhi_scc {unsigned long clk_rate;/* clock rate for SDR104 */ u32 tap;/* sampling clock position for SDR104 */ +u32 tap_hs400;/* sampling clock position for HS400 */ };struct renesas_sdhi_of_data {@@ -49,6 +50,7 @@ struct renesas_sdhi {struct pinctrl_state *pins_default, *pins_uhs;void __iomem *scc_ctl;u32 scc_tappos; +u32 scc_tappos_hs400; };#define host_to_priv (host) \drivers/mmc/host/renesas_sdhi_core.c +8
-0@@ -337,6 +337,10 @@ static void renesas_sdhi_hs400_complete(struct tmio_mmc_host *host)/* Set HS400 mode */ sd_ctrl_write16 (host,CTL_SDIF_MODE ,0x0001 |sd_ctrl_read16 (host,CTL_SDIF_MODE )); + +sd_scc_write32 (host, priv,SH_MOBILE_SDHI_SCC_DT2FF , + priv->scc_tappos_hs400); + sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_TMPPORT2, (SH_MOBILE_SDHI_SCC_TMPPORT2_HS400EN | SH_MOBILE_SDHI_SCC_TMPPORT2_HS400OSEL) |@@ -396,6 +400,9 @@ static void renesas_sdhi_reset_hs400_mode(struct tmio_mmc_host *host,/* Reset HS400 mode */ sd_ctrl_write16 (host,CTL_SDIF_MODE , ~0x0001 &sd_ctrl_read16 (host,CTL_SDIF_MODE )); + +sd_scc_write32 (host, priv,SH_MOBILE_SDHI_SCC_DT2FF , priv->scc_tappos); + sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_TMPPORT2, ~(SH_MOBILE_SDHI_SCC_TMPPORT2_HS400EN | SH_MOBILE_SDHI_SCC_TMPPORT2_HS400OSEL) &@@ -786,6 +793,7 @@ int renesas_sdhi_probe(struct platform_device *pdev,if (taps[i].clk_rate ==0 || taps[i].clk_rate == host->mmc->f_max) { priv->scc_tappos = taps->tap; + priv->scc_tappos_hs400 = taps->tap_hs400; hit = true;break ; }drivers/mmc/host/renesas_sdhi_internal_dmac.c +1
-1@@ -81,6 +81,7 @@ static struct renesas_sdhi_scc rcar_gen3_scc_taps[] = { { .clk_rate = 0, .tap = 0x00000300, + .tap_hs400 = 0x00000704, }, }; --2.11.0