Commit a4781c2a authored by Shawn Lin's avatar Shawn Lin Committed by Kishon Vijay Abraham I

phy: rockchip-emmc: retry calpad busy trimming

It turns out that 5us isn't enough for all cases, so let's
retry some more times to wait for caldone.
Signed-off-by: default avatarShawn Lin <shawn.lin@rock-chips.com>
Tested-by: default avatarZiyuan Xu <xzy.xu@rock-chips.com>
Signed-off-by: default avatarCaesar Wang <wxt@rock-chips.com>
Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
parent fee7e1d5
...@@ -76,6 +76,10 @@ ...@@ -76,6 +76,10 @@
#define PHYCTRL_OTAPDLYSEL_MASK 0xf #define PHYCTRL_OTAPDLYSEL_MASK 0xf
#define PHYCTRL_OTAPDLYSEL_SHIFT 0x7 #define PHYCTRL_OTAPDLYSEL_SHIFT 0x7
#define PHYCTRL_IS_CALDONE(x) \
((((x) >> PHYCTRL_CALDONE_SHIFT) & \
PHYCTRL_CALDONE_MASK) == PHYCTRL_CALDONE_DONE)
struct rockchip_emmc_phy { struct rockchip_emmc_phy {
unsigned int reg_offset; unsigned int reg_offset;
struct regmap *reg_base; struct regmap *reg_base;
...@@ -90,6 +94,7 @@ static int rockchip_emmc_phy_power(struct phy *phy, bool on_off) ...@@ -90,6 +94,7 @@ static int rockchip_emmc_phy_power(struct phy *phy, bool on_off)
unsigned int freqsel = PHYCTRL_FREQSEL_200M; unsigned int freqsel = PHYCTRL_FREQSEL_200M;
unsigned long rate; unsigned long rate;
unsigned long timeout; unsigned long timeout;
int ret;
/* /*
* Keep phyctrl_pdb and phyctrl_endll low to allow * Keep phyctrl_pdb and phyctrl_endll low to allow
...@@ -160,17 +165,19 @@ static int rockchip_emmc_phy_power(struct phy *phy, bool on_off) ...@@ -160,17 +165,19 @@ static int rockchip_emmc_phy_power(struct phy *phy, bool on_off)
PHYCTRL_PDB_SHIFT)); PHYCTRL_PDB_SHIFT));
/* /*
* According to the user manual, it asks driver to * According to the user manual, it asks driver to wait 5us for
* wait 5us for calpad busy trimming * calpad busy trimming. However it is documented that this value is
* PVT(A.K.A process,voltage and temperature) relevant, so some
* failure cases are found which indicates we should be more tolerant
* to calpad busy trimming.
*/ */
udelay(5); ret = regmap_read_poll_timeout(rk_phy->reg_base,
regmap_read(rk_phy->reg_base, rk_phy->reg_offset + GRF_EMMCPHY_STATUS,
rk_phy->reg_offset + GRF_EMMCPHY_STATUS, caldone, PHYCTRL_IS_CALDONE(caldone),
&caldone); 0, 50);
caldone = (caldone >> PHYCTRL_CALDONE_SHIFT) & PHYCTRL_CALDONE_MASK; if (ret) {
if (caldone != PHYCTRL_CALDONE_DONE) { pr_err("%s: caldone failed, ret=%d\n", __func__, ret);
pr_err("rockchip_emmc_phy_power: caldone timeout.\n"); return ret;
return -ETIMEDOUT;
} }
/* Set the frequency of the DLL operation */ /* Set the frequency of the DLL operation */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment