mmc: {tmio,renesas_sdhi}: fix tuning behavior
Subsystems (2)
v4 cover mmc: {tmio,renesas_sdhi}: fix tuning behavior
Hi,
Tuning failed on my R-Car H3 ES2.0 board using latest mmc/next while the Renesas BSP kernel worked. After some digging I found patches in the BSP which remedied this and whit these applied tuning now works for me.
I have done small fixes, updated commit messages and rebased on latest mmc/next but Hayakawa-san did all the real work. This change helped me to successfully tune a stubborn card I have had trouble in the past to get to work.
Since v3 of this patchset I have dropped 2 patches as they requier more work as HS400 have been merged since the initial posting. These two patches stand alone still fixes tuning issues so while work continues on the dropped two these two are ready for upstream consumption.
Masaharu Hayakawa (1):
mmc: tmio: Fix tuning flow
Niklas Söderlund (1):
mmc: renesas_sdhi: Fix sampling clock position selecting
drivers/mmc/host/renesas_sdhi_core.c | 12 ++++++++++++ drivers/mmc/host/tmio_mmc_core.c | 2 -- 2 files changed, 12 insertions(+), 2 deletions(-)
Signature · 1 line
2.18.0
PATCH v4 1/2 mmc: tmio: Fix tuning flow
From: Masaharu Hayakawa <[email protected]>
If the return value of mmc_send_tuning() is error other than -EILSEQ, the tuning fails and process goes out of for_loop. The correct processing is to judge their TAP as not good (NG) and continue.
---
* Changes since v2
- Use a intermediate variable instead of checking the return value of mmc_send_tuning() in a if statement, suggested by Geert thanks!
- Added tags from Wolfram.
* Changes since v1
- Change '!mmc_send_tuning()' to 'mmc_send_tuning() == 0'.
--- drivers/mmc/host/tmio_mmc_core.c | 2 -- 1 file changed, 2 deletions(-)
drivers/mmc/host/tmio_mmc_core.c +0 -2
@@ -818,8 +818,6 @@ static int tmio_mmc_execute_tuning(struct mmc_host *mmc, u32 opcode) host->prepare_tuning (host, i % host->tap_num); ret =mmc_send_tuning (mmc, opcode,NULL ); -if (ret && ret != -EILSEQ ) - goto out;if (ret ==0 )set_bit (i, host->taps);
Signature · 1 line
2.18.0
PATCH v4 2/2 mmc: renesas_sdhi: Fix sampling clock position selecting
In reply to Niklas SöderlundWhen tuning each tap is issued CMD19 twice and the result of both runs recorded in host->taps. If the result is different between the two runs the wrong sampling clock position was selected. Fix this by merging the two runs and only keep the result for each tap if it was good in both sets.
---
* Changes since v2
- Rewrote the change to use a less clumsy loop. The patch is now completely changed from Hayakawa-sans version and therefor I have also claimed authorship.
- Fixed spelling in comment as suggested by Geert.
* Changes since v1
- Updated commit message after discussion with Wolfram.
- Expanded comment in code to better explain why the results are merged.
--- drivers/mmc/host/renesas_sdhi_core.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/mmc/host/renesas_sdhi_core.c +12 -0
@@ -384,6 +384,18 @@ static int renesas_sdhi_select_tuning(struct tmio_mmc_host *host)/* Clear SCC_RVSREQ */ sd_scc_write32 (host, priv,SH_MOBILE_SDHI_SCC_RVSREQ ,0 ); +/* +* When tuning CMD19 is issued twice for each tap, merge the +* result requiring the tap to be good in both runs before +* considering it for tuning selection. +*/ +for (i =0 ; i < host->tap_num *2 ; i++) { +int offset = host->tap_num * (i < host->tap_num ?1 :-1 ); + +if (!test_bit (i, host->taps)) +clear_bit (i + offset, host->taps); + } +/* * Find the longest consecutive run of successful probes. If that * is more than SH_MOBILE_SDHI_MAX_TAP probes long then use the
Signature · 1 line
2.18.0
Ulf Hansson
AppliedQuoted 22 lines · Niklas Söderlund
Hi,
Tuning failed on my R-Car H3 ES2.0 board using latest mmc/next while the Renesas BSP kernel worked. After some digging I found patches in the BSP which remedied this and whit these applied tuning now works for me.
I have done small fixes, updated commit messages and rebased on latest mmc/next but Hayakawa-san did all the real work. This change helped me to successfully tune a stubborn card I have had trouble in the past to get to work.
Since v3 of this patchset I have dropped 2 patches as they requier more work as HS400 have been merged since the initial posting. These two patches stand alone still fixes tuning issues so while work continues on the dropped two these two are ready for upstream consumption.
Masaharu Hayakawa (1):
mmc: tmio: Fix tuning flowNiklas Söderlund (1):
mmc:renesas_sdhi: Fix sampling clock position selecting
Quoted 7 lines
drivers/mmc/host/renesas_sdhi_core.c | 12 ++++++++++++ drivers/mmc/host/tmio_mmc_core.c | 2 -- 2 files changed, 12 insertions(+), 2 deletions(-)--
2.18.0
Thanks, applied for next!
Kind regards
Uffe