diff --git a/drivers/phy/qualcomm/phy-qcom-ufs.c b/drivers/phy/qualcomm/phy-qcom-ufs.c index b8ce268eda52..431e777a6bfd 100644 --- a/drivers/phy/qualcomm/phy-qcom-ufs.c +++ b/drivers/phy/qualcomm/phy-qcom-ufs.c @@ -708,14 +708,18 @@ void ufs_qcom_phy_set_tx_lane_enable(struct phy *generic_phy, u32 tx_lanes) } EXPORT_SYMBOL(ufs_qcom_phy_set_tx_lane_enable); -void ufs_qcom_phy_save_controller_version(struct phy *generic_phy, +int ufs_qcom_phy_save_controller_version(struct phy *generic_phy, u8 major, u16 minor, u16 step) { struct ufs_qcom_phy *ufs_qcom_phy = get_ufs_qcom_phy(generic_phy); + if (!ufs_qcom_phy) + return -EPROBE_DEFER; + ufs_qcom_phy->host_ctrl_rev_major = major; ufs_qcom_phy->host_ctrl_rev_minor = minor; ufs_qcom_phy->host_ctrl_rev_step = step; + return 0; } EXPORT_SYMBOL(ufs_qcom_phy_save_controller_version); diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index c10a4e2f6058..d602926029a0 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -3793,9 +3793,13 @@ static int ufs_qcom_init(struct ufs_hba *hba) &host->vdd_hba_reg_nb); /* update phy revision information before calling phy_init() */ - ufs_qcom_phy_save_controller_version(host->generic_phy, host->hw_ver.major, host->hw_ver.minor, host->hw_ver.step); + if (err == -EPROBE_DEFER) { + pr_err("%s: phy device probe is not completed yet\n", + __func__); + goto out_variant_clear; + } err = ufs_qcom_parse_reg_info(host, "qcom,vddp-ref-clk", &host->vddp_ref_clk); diff --git a/include/linux/phy/phy-qcom-ufs.h b/include/linux/phy/phy-qcom-ufs.h index f54bc722051f..311407583c43 100644 --- a/include/linux/phy/phy-qcom-ufs.h +++ b/include/linux/phy/phy-qcom-ufs.h @@ -16,7 +16,7 @@ void ufs_qcom_phy_dbg_register_dump(struct phy *generic_phy); void ufs_qcom_phy_dbg_register_save(struct phy *generic_phy); void ufs_qcom_phy_set_src_clk_h8_enter(struct phy *generic_phy); void ufs_qcom_phy_set_src_clk_h8_exit(struct phy *generic_phy); -void ufs_qcom_phy_save_controller_version(struct phy *generic_phy, +int ufs_qcom_phy_save_controller_version(struct phy *generic_phy, u8 major, u16 minor, u16 step); #endif /* PHY_QCOM_UFS_H_ */