Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

phy: qcom-qmp-ufs: Refactor phy_power_on and phy_calibrate callbacks

Commit 052553af6a31 ("ufs/phy: qcom: Refactor to use phy_init call")
puts enabling regulators & clks, calibrating UFS PHY, starting serdes
and polling PCS ready status into phy_power_on.

In Current code regulators enable, clks enable, calibrating UFS PHY,
start_serdes and polling PCS_ready_status are part of phy_power_on.

UFS PHY registers are retained after power collapse, meaning calibrating
UFS PHY, start_serdes and polling PCS_ready_status can be done only when
hba is powered_on, and not needed every time when phy_power_on is called
during resume. Hence keep the code which enables PHY's regulators & clks
in phy_power_on and move the rest steps into phy_calibrate function.

Refactor the code to retain PHY regulators & clks in phy_power_on and
move out rest of the code to new phy_calibrate function.

Also move reset_control_assert to qmp_ufs_phy_calibrate to align
with Hardware programming guide.

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Co-developed-by: Can Guo <quic_cang@quicinc.com>
Signed-off-by: Can Guo <quic_cang@quicinc.com>
Signed-off-by: Nitin Rawat <quic_nitirawa@quicinc.com>
Link: https://lore.kernel.org/r/20250526153821.7918-5-quic_nitirawa@quicinc.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Nitin Rawat and committed by
Vinod Koul
cbfd6c12 dbd20821

+6 -20
+6 -20
drivers/phy/qualcomm/phy-qcom-qmp-ufs.c
··· 1797 1797 return 0; 1798 1798 } 1799 1799 1800 - static int qmp_ufs_init(struct phy *phy) 1800 + static int qmp_ufs_power_on(struct phy *phy) 1801 1801 { 1802 1802 struct qmp_ufs *qmp = phy_get_drvdata(phy); 1803 1803 const struct qmp_phy_cfg *cfg = qmp->cfg; ··· 1825 1825 return ret; 1826 1826 } 1827 1827 } 1828 - 1829 - ret = reset_control_assert(qmp->ufs_reset); 1830 - if (ret) 1831 - return ret; 1832 1828 } 1833 1829 1834 1830 ret = qmp_ufs_com_init(qmp); ··· 1842 1846 void __iomem *status; 1843 1847 unsigned int val; 1844 1848 int ret; 1849 + 1850 + ret = reset_control_assert(qmp->ufs_reset); 1851 + if (ret) 1852 + return ret; 1845 1853 1846 1854 qmp_ufs_init_registers(qmp, cfg); 1847 1855 ··· 1899 1899 return 0; 1900 1900 } 1901 1901 1902 - static int qmp_ufs_power_on(struct phy *phy) 1903 - { 1904 - int ret; 1905 - 1906 - ret = qmp_ufs_init(phy); 1907 - if (ret) 1908 - return ret; 1909 - 1910 - ret = qmp_ufs_phy_calibrate(phy); 1911 - if (ret) 1912 - qmp_ufs_exit(phy); 1913 - 1914 - return ret; 1915 - } 1916 - 1917 1902 static int qmp_ufs_disable(struct phy *phy) 1918 1903 { 1919 1904 int ret; ··· 1928 1943 static const struct phy_ops qcom_qmp_ufs_phy_ops = { 1929 1944 .power_on = qmp_ufs_power_on, 1930 1945 .power_off = qmp_ufs_disable, 1946 + .calibrate = qmp_ufs_phy_calibrate, 1931 1947 .set_mode = qmp_ufs_set_mode, 1932 1948 .owner = THIS_MODULE, 1933 1949 };