mmc: renesas_sdhi: support manual calibration
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Wed, 2 Sep 2020 08:18:12 +0000 (10:18 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Wed, 9 Sep 2020 11:09:44 +0000 (13:09 +0200)
commitce6f92c2801e90650106b00666aa37560978e324
tree6efa2c8040f9c5a278bde4292f8ed307d4c4d565
parent354f47b699ae209606dcd0b05200cd7f17059e38
mmc: renesas_sdhi: support manual calibration

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 was completed
- 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@renesas.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/20200902081812.1591-3-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/renesas_sdhi.h
drivers/mmc/host/renesas_sdhi_core.c