]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
scsi: ufs: exynos: Ensure consistent phy reference counts
authorPeter Griffin <peter.griffin@linaro.org>
Wed, 19 Mar 2025 15:30:21 +0000 (15:30 +0000)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 3 Apr 2025 13:53:51 +0000 (09:53 -0400)
ufshcd_link_startup() can call ufshcd_vops_link_startup_notify()
multiple times when retrying. This causes the phy reference count to
keep increasing and the phy to not properly re-initialize.

If the phy has already been previously powered on, first issue a
phy_power_off() and phy_exit(), before re-initializing and powering on
again.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Link: https://lore.kernel.org/r/20250319-exynos-ufs-stability-fixes-v2-4-96722cc2ba1b@linaro.org
Fixes: 3d73b200f989 ("scsi: ufs: ufs-exynos: Change ufs phy control sequence")
Cc: stable@vger.kernel.org
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/ufs/host/ufs-exynos.c

index 533904a4c1a728856749f9a5cb02b90d7f76a473..e77b3c63e69811527ea618e8399a699a4f9ee93a 100644 (file)
@@ -962,6 +962,12 @@ static int exynos_ufs_phy_init(struct exynos_ufs *ufs)
        }
 
        phy_set_bus_width(generic_phy, ufs->avail_ln_rx);
+
+       if (generic_phy->power_count) {
+               phy_power_off(generic_phy);
+               phy_exit(generic_phy);
+       }
+
        ret = phy_init(generic_phy);
        if (ret) {
                dev_err(hba->dev, "%s: phy init failed, ret = %d\n",