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 UFS PHY reset

Refactor the UFS PHY reset handling to parse the reset logic only once
during initialization, instead of every resume.

As part of this change, move the UFS PHY reset parsing logic from
qmp_phy_power_on to the new qmp_ufs_phy_init function introduced
as part of phy_ops::init callback.

Co-developed-by: Ram Kumar Dwivedi <quic_rdwivedi@quicinc.com>
Signed-off-by: Ram Kumar Dwivedi <quic_rdwivedi@quicinc.com>
Signed-off-by: Nitin Rawat <quic_nitirawa@quicinc.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20250526153821.7918-6-quic_nitirawa@quicinc.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Nitin Rawat and committed by
Vinod Koul
d58b9ff4 cbfd6c12

+31 -28
+31 -28
drivers/phy/qualcomm/phy-qcom-qmp-ufs.c
··· 1800 1800 static int qmp_ufs_power_on(struct phy *phy) 1801 1801 { 1802 1802 struct qmp_ufs *qmp = phy_get_drvdata(phy); 1803 - const struct qmp_phy_cfg *cfg = qmp->cfg; 1804 1803 int ret; 1805 1804 dev_vdbg(qmp->dev, "Initializing QMP phy\n"); 1806 1805 1807 - if (cfg->no_pcs_sw_reset) { 1808 - /* 1809 - * Get UFS reset, which is delayed until now to avoid a 1810 - * circular dependency where UFS needs its PHY, but the PHY 1811 - * needs this UFS reset. 1812 - */ 1813 - if (!qmp->ufs_reset) { 1814 - qmp->ufs_reset = 1815 - devm_reset_control_get_exclusive(qmp->dev, 1816 - "ufsphy"); 1817 - 1818 - if (IS_ERR(qmp->ufs_reset)) { 1819 - ret = PTR_ERR(qmp->ufs_reset); 1820 - dev_err(qmp->dev, 1821 - "failed to get UFS reset: %d\n", 1822 - ret); 1823 - 1824 - qmp->ufs_reset = NULL; 1825 - return ret; 1826 - } 1827 - } 1828 - } 1829 - 1830 1806 ret = qmp_ufs_com_init(qmp); 1831 - if (ret) 1832 - return ret; 1833 - 1834 - return 0; 1807 + return ret; 1835 1808 } 1836 1809 1837 1810 static int qmp_ufs_phy_calibrate(struct phy *phy) ··· 1898 1925 return 0; 1899 1926 } 1900 1927 1928 + static int qmp_ufs_phy_init(struct phy *phy) 1929 + { 1930 + struct qmp_ufs *qmp = phy_get_drvdata(phy); 1931 + const struct qmp_phy_cfg *cfg = qmp->cfg; 1932 + int ret; 1933 + 1934 + if (!cfg->no_pcs_sw_reset) 1935 + return 0; 1936 + 1937 + /* 1938 + * Get UFS reset, which is delayed until now to avoid a 1939 + * circular dependency where UFS needs its PHY, but the PHY 1940 + * needs this UFS reset. 1941 + */ 1942 + if (!qmp->ufs_reset) { 1943 + qmp->ufs_reset = 1944 + devm_reset_control_get_exclusive(qmp->dev, "ufsphy"); 1945 + 1946 + if (IS_ERR(qmp->ufs_reset)) { 1947 + ret = PTR_ERR(qmp->ufs_reset); 1948 + dev_err(qmp->dev, "failed to get PHY reset: %d\n", ret); 1949 + qmp->ufs_reset = NULL; 1950 + return ret; 1951 + } 1952 + } 1953 + 1954 + return 0; 1955 + } 1956 + 1901 1957 static const struct phy_ops qcom_qmp_ufs_phy_ops = { 1958 + .init = qmp_ufs_phy_init, 1902 1959 .power_on = qmp_ufs_power_on, 1903 1960 .power_off = qmp_ufs_disable, 1904 1961 .calibrate = qmp_ufs_phy_calibrate,