Patch "scsi: ufs: qcom: Perform read back after writing reset bit" has been added to the 6.8-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    scsi: ufs: qcom: Perform read back after writing reset bit

to the 6.8-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     scsi-ufs-qcom-perform-read-back-after-writing-reset-.patch
and it can be found in the queue-6.8 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 0f77b450b3f9609356a802dae437c0db33c2d519
Author: Andrew Halaney <ahalaney@xxxxxxxxxx>
Date:   Fri Mar 29 15:46:43 2024 -0500

    scsi: ufs: qcom: Perform read back after writing reset bit
    
    [ Upstream commit c4d28e06b0c94636f6e35d003fa9ebac0a94e1ae ]
    
    Currently, the reset bit for the UFS provided reset controller (used by its
    phy) is written to, and then a mb() happens to try and ensure that hit the
    device. Immediately afterwards a usleep_range() occurs.
    
    mb() ensures that the write completes, but completion doesn't mean that it
    isn't stored in a buffer somewhere. The recommendation for ensuring this
    bit has taken effect on the device is to perform a read back to force it to
    make it all the way to the device. This is documented in device-io.rst and
    a talk by Will Deacon on this can be seen over here:
    
        https://youtu.be/i6DayghhA8Q?si=MiyxB5cKJXSaoc01&t=1678
    
    Let's do that to ensure the bit hits the device. By doing so and
    guaranteeing the ordering against the immediately following usleep_range(),
    the mb() can safely be removed.
    
    Fixes: 81c0fc51b7a7 ("ufs-qcom: add support for Qualcomm Technologies Inc platforms")
    Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxx>
    Reviewed-by: Can Guo <quic_cang@xxxxxxxxxxx>
    Signed-off-by: Andrew Halaney <ahalaney@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240329-ufs-reset-ensure-effect-before-delay-v5-1-181252004586@xxxxxxxxxx
    Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/ufs/host/ufs-qcom.h b/drivers/ufs/host/ufs-qcom.h
index 9dd9a391ebb76..b9de170983c9e 100644
--- a/drivers/ufs/host/ufs-qcom.h
+++ b/drivers/ufs/host/ufs-qcom.h
@@ -151,10 +151,10 @@ static inline void ufs_qcom_assert_reset(struct ufs_hba *hba)
 	ufshcd_rmwl(hba, UFS_PHY_SOFT_RESET, UFS_PHY_SOFT_RESET, REG_UFS_CFG1);
 
 	/*
-	 * Make sure assertion of ufs phy reset is written to
-	 * register before returning
+	 * Dummy read to ensure the write takes effect before doing any sort
+	 * of delay
 	 */
-	mb();
+	ufshcd_readl(hba, REG_UFS_CFG1);
 }
 
 static inline void ufs_qcom_deassert_reset(struct ufs_hba *hba)
@@ -162,10 +162,10 @@ static inline void ufs_qcom_deassert_reset(struct ufs_hba *hba)
 	ufshcd_rmwl(hba, UFS_PHY_SOFT_RESET, 0, REG_UFS_CFG1);
 
 	/*
-	 * Make sure de-assertion of ufs phy reset is written to
-	 * register before returning
+	 * Dummy read to ensure the write takes effect before doing any sort
+	 * of delay
 	 */
-	mb();
+	ufshcd_readl(hba, REG_UFS_CFG1);
 }
 
 /* Host controller hardware version: major.minor.step */




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux