Skip to content

Commit 3126b5f

Browse files
Palash Kambarmartinkpetersen
authored andcommitted
scsi: ufs: ufs-qcom: Align programming sequence of Shared ICE for UFS controller v5
Disabling the AES core in Shared ICE is not supported during power collapse for UFS Host Controller v5.0, which may lead to data errors after Hibern8 exit. To comply with hardware programming guidelines and avoid this issue, issue a sync reset to ICE upon power collapse exit. Hence follow below steps to reset the ICE upon exiting power collapse and align with Hw programming guide. a. Assert the ICE sync reset by setting both SYNC_RST_SEL and SYNC_RST_SW bits in UFS_MEM_ICE_CFG b. Deassert the reset by clearing SYNC_RST_SW in UFS_MEM_ICE_CFG Signed-off-by: Palash Kambar <quic_pkambar@quicinc.com> Reviewed-by: Manivannan Sadhasivam <mani@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 8791b07 commit 3126b5f

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

drivers/ufs/host/ufs-qcom.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
#define DEEMPHASIS_3_5_dB 0x04
3939
#define NO_DEEMPHASIS 0x0
4040

41+
#define UFS_ICE_SYNC_RST_SEL BIT(3)
42+
#define UFS_ICE_SYNC_RST_SW BIT(4)
43+
4144
enum {
4245
TSTBUS_UAWM,
4346
TSTBUS_UARM,
@@ -751,11 +754,29 @@ static int ufs_qcom_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
751754
{
752755
struct ufs_qcom_host *host = ufshcd_get_variant(hba);
753756
int err;
757+
u32 reg_val;
754758

755759
err = ufs_qcom_enable_lane_clks(host);
756760
if (err)
757761
return err;
758762

763+
if ((!ufs_qcom_is_link_active(hba)) &&
764+
host->hw_ver.major == 5 &&
765+
host->hw_ver.minor == 0 &&
766+
host->hw_ver.step == 0) {
767+
ufshcd_writel(hba, UFS_ICE_SYNC_RST_SEL | UFS_ICE_SYNC_RST_SW, UFS_MEM_ICE_CFG);
768+
reg_val = ufshcd_readl(hba, UFS_MEM_ICE_CFG);
769+
reg_val &= ~(UFS_ICE_SYNC_RST_SEL | UFS_ICE_SYNC_RST_SW);
770+
/*
771+
* HW documentation doesn't recommend any delay between the
772+
* reset set and clear. But we are enforcing an arbitrary delay
773+
* to give flops enough time to settle in.
774+
*/
775+
usleep_range(50, 100);
776+
ufshcd_writel(hba, reg_val, UFS_MEM_ICE_CFG);
777+
ufshcd_readl(hba, UFS_MEM_ICE_CFG);
778+
}
779+
759780
return ufs_qcom_ice_resume(host);
760781
}
761782

drivers/ufs/host/ufs-qcom.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ enum {
6060
UFS_AH8_CFG = 0xFC,
6161

6262
UFS_RD_REG_MCQ = 0xD00,
63-
63+
UFS_MEM_ICE_CFG = 0x2600,
6464
REG_UFS_MEM_ICE_CONFIG = 0x260C,
6565
REG_UFS_MEM_ICE_NUM_CORE = 0x2664,
6666

0 commit comments

Comments
 (0)