Hi Wolfram-san, Thank you for the patch! (And, I'm sorry for the delayed response.) > From: Wolfram Sang, Sent: Friday, June 5, 2020 7:12 PM > > Some R-Car Gen3 SoCs need some manual correction of timing parameters > after the automatic tuning has finished but before next CMD13 is > completed. This patch implements that by this state machine: > > - introducing a per-SoC correction table if needed > - iff such a table exists, the 'fixup_request' callback is populated > during probe > - iff such a table exists, a runtime flag ('needs_adjust_hs400') > is set when HS400 tuning gets prepared We should set the needs_adjust_hs400 when HS400EN=1 is set. In other words, we should set it in renesas_sdhi_hs400_complete(), not renesas_sdhi_prepare_hs400_tuning(). > - if tuning HS400 fails, the runtime flag is cleared again > - the callback will check the runtime flag and enable the corrected > manual mode if the flag is set and CMD13 is encountered > - at the end of the enablement the runtime flag is cleared > - iff the configuration flag is set, the manual mode will be disabled > when HS400 gets downgraded > > There also some helper functions added to access the TMPPORT registers. > The actual correction table is SoC and instance(!) specific and is > added to the quirks struct. > > Signed-off-by: Takeshi Saito <takeshi.saito.xv@xxxxxxxxxxx> > Signed-off-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx> <snip> > +static void renesas_sdhi_adjust_hs400_mode_enable(struct tmio_mmc_host *host) > +{ > + struct renesas_sdhi *priv = host_to_priv(host); > + u32 calib_code; > + > + /* disable write protect */ > + sd_scc_tmpport_write32(host, priv, 0x00, > + SH_MOBILE_SDHI_SCC_TMPPORT_DISABLE_WP_CODE); > + /* read calibration code and adjust */ > + calib_code = sd_scc_tmpport_read32(host, priv, 0x26); When we read the calib_code at room temperature, the value will be around 0x10. However, we will get 0x00 here. So, we need to fix it. Best regards, Yoshihiro Shimoda