phy: qcom: Utilize UFS reset controller
Move the PHY reset from ufs-qcom into the respective PHYs. This will allow us to merge the two phases of UFS PHY initialization. Signed-off-by: Evan Green <evgreen@chromium.org> Reviewed-by: Stephen Boyd <swboyd@chromium.org> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
This commit is contained in:

committed by
Kishon Vijay Abraham I

parent
12fd5f250d
commit
c9b589791f
@@ -897,6 +897,7 @@ struct qmp_phy {
|
||||
* @init_count: phy common block initialization count
|
||||
* @phy_initialized: indicate if PHY has been initialized
|
||||
* @mode: current PHY mode
|
||||
* @ufs_reset: optional UFS PHY reset handle
|
||||
*/
|
||||
struct qcom_qmp {
|
||||
struct device *dev;
|
||||
@@ -914,6 +915,8 @@ struct qcom_qmp {
|
||||
int init_count;
|
||||
bool phy_initialized;
|
||||
enum phy_mode mode;
|
||||
|
||||
struct reset_control *ufs_reset;
|
||||
};
|
||||
|
||||
static inline void qphy_setbits(void __iomem *base, u32 offset, u32 val)
|
||||
@@ -1314,6 +1317,7 @@ static int qcom_qmp_phy_com_exit(struct qcom_qmp *qmp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
reset_control_assert(qmp->ufs_reset);
|
||||
if (cfg->has_phy_com_ctrl) {
|
||||
qphy_setbits(serdes, cfg->regs[QPHY_COM_START_CONTROL],
|
||||
SERDES_START | PCS_START);
|
||||
@@ -1351,6 +1355,33 @@ static int qcom_qmp_phy_init(struct phy *phy)
|
||||
|
||||
dev_vdbg(qmp->dev, "Initializing QMP phy\n");
|
||||
|
||||
if (cfg->no_pcs_sw_reset) {
|
||||
/*
|
||||
* Get UFS reset, which is delayed until now to avoid a
|
||||
* circular dependency where UFS needs its PHY, but the PHY
|
||||
* needs this UFS reset.
|
||||
*/
|
||||
if (!qmp->ufs_reset) {
|
||||
qmp->ufs_reset =
|
||||
devm_reset_control_get_exclusive(qmp->dev,
|
||||
"ufsphy");
|
||||
|
||||
if (IS_ERR(qmp->ufs_reset)) {
|
||||
ret = PTR_ERR(qmp->ufs_reset);
|
||||
dev_err(qmp->dev,
|
||||
"failed to get UFS reset: %d\n",
|
||||
ret);
|
||||
|
||||
qmp->ufs_reset = NULL;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
ret = reset_control_assert(qmp->ufs_reset);
|
||||
if (ret)
|
||||
goto err_lane_rst;
|
||||
}
|
||||
|
||||
ret = qcom_qmp_phy_com_init(qphy);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -1383,6 +1414,9 @@ static int qcom_qmp_phy_init(struct phy *phy)
|
||||
cfg->rx_tbl, cfg->rx_tbl_num);
|
||||
|
||||
qcom_qmp_phy_configure(pcs, cfg->regs, cfg->pcs_tbl, cfg->pcs_tbl_num);
|
||||
ret = reset_control_deassert(qmp->ufs_reset);
|
||||
if (ret)
|
||||
goto err_lane_rst;
|
||||
|
||||
/*
|
||||
* UFS PHY requires the deassert of software reset before serdes start.
|
||||
|
Reference in New Issue
Block a user