@@ -87,6 +87,12 @@ static int samsung_ufs_phy_calibrate(struct phy *phy)
return -EINVAL;
}
+ if (ufs_phy->mode == PHY_MODE_UFS_HIBERN8_ENTER)
+ ufs_phy->ufs_phy_state = CFG_POST_HIBERN8_ENTER;
+
+ if (ufs_phy->mode == PHY_MODE_UFS_HIBERN8_EXIT)
+ ufs_phy->ufs_phy_state = CFG_PRE_HIBERN8_EXIT;
+
cfg = cfgs[ufs_phy->ufs_phy_state];
if (!cfg)
goto out;
@@ -105,8 +111,9 @@ static int samsung_ufs_phy_calibrate(struct phy *phy)
goto out;
}
- if (ufs_phy->ufs_phy_state == CFG_POST_PWR_HS &&
- ufs_phy->drvdata->wait_for_cdr) {
+ if ((ufs_phy->ufs_phy_state == CFG_POST_PWR_HS ||
+ ufs_phy->ufs_phy_state == CFG_PRE_HIBERN8_EXIT) &&
+ ufs_phy->drvdata->wait_for_cdr) {
err = ufs_phy->drvdata->wait_for_cdr(phy, i);
if (err)
goto out;
@@ -137,6 +144,13 @@ static int samsung_ufs_phy_calibrate(struct phy *phy)
/* Change back to INIT state */
ufs_phy->ufs_phy_state = CFG_PRE_INIT;
break;
+ case CFG_POST_HIBERN8_ENTER:
+ ufs_phy->ufs_phy_state = CFG_PRE_HIBERN8_EXIT;
+ break;
+ case CFG_PRE_HIBERN8_EXIT:
+ /* Change back to INIT state */
+ ufs_phy->ufs_phy_state = CFG_PRE_INIT;
+ break;
default:
dev_err(ufs_phy->dev, "wrong state for phy calibration\n");
}
@@ -89,6 +89,8 @@ enum {
CFG_POST_INIT,
CFG_PRE_PWR_HS,
CFG_POST_PWR_HS,
+ CFG_POST_HIBERN8_ENTER,
+ CFG_PRE_HIBERN8_EXIT,
CFG_TAG_MAX,
};
Add two new states CFG_POST_HIBERN8_ENTER and CFG_PRE_HIBERN8_EXIT to the phy driver which map to the new PHY_MODE_UFS_HIBERN8_ENTER and PHY_MODE_UFS_HIBERN8_EXIT modes. These are used to program phy specific calibration values when entering and exiting hibern8. When exiting from hibern8 state we also update the logic to wait for cdr lock. Signed-off-by: Peter Griffin <peter.griffin@linaro.org> --- drivers/phy/samsung/phy-samsung-ufs.c | 18 ++++++++++++++++-- drivers/phy/samsung/phy-samsung-ufs.h | 2 ++ 2 files changed, 18 insertions(+), 2 deletions(-)