mmc: meson-gx: include tx phase in the tuning process

It has been reported that some platforms (odroid-c2) may require
a different tx phase setting to operate at high speed (hs200 and hs400)

To improve the situation, this patch includes tx phase in the tuning
process.

Fixes: d341ca88eead ("mmc: meson-gx: rework tuning function")
Reported-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by Jerome Brunet and committed by Ulf Hansson 0a446976 3e2b0af4

Changed files
+18 -1
drivers
mmc
+18 -1
drivers/mmc/host/meson-gx-mmc.c
··· 716 716 static int meson_mmc_execute_tuning(struct mmc_host *mmc, u32 opcode) 717 717 { 718 718 struct meson_host *host = mmc_priv(mmc); 719 + int ret; 720 + 721 + /* 722 + * If this is the initial tuning, try to get a sane Rx starting 723 + * phase before doing the actual tuning. 724 + */ 725 + if (!mmc->doing_retune) { 726 + ret = meson_mmc_clk_phase_tuning(mmc, opcode, host->rx_clk); 727 + 728 + if (ret) 729 + return ret; 730 + } 731 + 732 + ret = meson_mmc_clk_phase_tuning(mmc, opcode, host->tx_clk); 733 + if (ret) 734 + return ret; 719 735 720 736 return meson_mmc_clk_phase_tuning(mmc, opcode, host->rx_clk); 721 737 } ··· 762 746 if (!IS_ERR(mmc->supply.vmmc)) 763 747 mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd); 764 748 765 - /* Reset rx phase */ 749 + /* Reset phases */ 766 750 clk_set_phase(host->rx_clk, 0); 751 + clk_set_phase(host->tx_clk, 270); 767 752 768 753 break; 769 754