mmc: dw_mmc-rockchip: fix v2 tuning defect

The v2 tuning has a defect, When tuning again, it is possible to
choose the phase that was previously selected which cannot work
stable.

Signed-off-by: Yifeng Zhao <yifeng.zhao@rock-chips.com>
Change-Id: I0dcc83bb35567278e8a10f1964f4636573b165ec
This commit is contained in:
Yifeng Zhao
2023-06-09 10:01:47 +08:00
committed by Tao Huang
parent 701fcef947
commit 5580a7e6f3

View File

@@ -166,7 +166,7 @@ static int dw_mci_v2_execute_tuning(struct dw_mci_slot *slot, u32 opcode)
* It's impossible all 4 fixed phase won't be able to work.
*/
for (i = 0; i < ARRAY_SIZE(degrees); i++) {
degree = degrees[i] + priv->last_degree;
degree = degrees[i] + priv->last_degree + 90;
degree = degree % 360;
clk_set_phase(priv->sample_clk, degree);
if (!mmc_send_tuning(mmc, opcode, NULL))
@@ -179,7 +179,7 @@ static int dw_mci_v2_execute_tuning(struct dw_mci_slot *slot, u32 opcode)
}
done:
dev_info(host->dev, "Successfully tuned phase to %d\n", degrees[i]);
dev_info(host->dev, "Successfully tuned phase to %d\n", degree);
priv->last_degree = degree;
return 0;
}