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

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>

authored by

Palash Kambar and committed by
Martin K. Petersen
3126b5fd 8791b078

+22 -1
+21
drivers/ufs/host/ufs-qcom.c
··· 38 38 #define DEEMPHASIS_3_5_dB 0x04 39 39 #define NO_DEEMPHASIS 0x0 40 40 41 + #define UFS_ICE_SYNC_RST_SEL BIT(3) 42 + #define UFS_ICE_SYNC_RST_SW BIT(4) 43 + 41 44 enum { 42 45 TSTBUS_UAWM, 43 46 TSTBUS_UARM, ··· 754 751 { 755 752 struct ufs_qcom_host *host = ufshcd_get_variant(hba); 756 753 int err; 754 + u32 reg_val; 757 755 758 756 err = ufs_qcom_enable_lane_clks(host); 759 757 if (err) 760 758 return err; 759 + 760 + if ((!ufs_qcom_is_link_active(hba)) && 761 + host->hw_ver.major == 5 && 762 + host->hw_ver.minor == 0 && 763 + host->hw_ver.step == 0) { 764 + ufshcd_writel(hba, UFS_ICE_SYNC_RST_SEL | UFS_ICE_SYNC_RST_SW, UFS_MEM_ICE_CFG); 765 + reg_val = ufshcd_readl(hba, UFS_MEM_ICE_CFG); 766 + reg_val &= ~(UFS_ICE_SYNC_RST_SEL | UFS_ICE_SYNC_RST_SW); 767 + /* 768 + * HW documentation doesn't recommend any delay between the 769 + * reset set and clear. But we are enforcing an arbitrary delay 770 + * to give flops enough time to settle in. 771 + */ 772 + usleep_range(50, 100); 773 + ufshcd_writel(hba, reg_val, UFS_MEM_ICE_CFG); 774 + ufshcd_readl(hba, UFS_MEM_ICE_CFG); 775 + } 761 776 762 777 return ufs_qcom_ice_resume(host); 763 778 }
+1 -1
drivers/ufs/host/ufs-qcom.h
··· 60 60 UFS_AH8_CFG = 0xFC, 61 61 62 62 UFS_RD_REG_MCQ = 0xD00, 63 - 63 + UFS_MEM_ICE_CFG = 0x2600, 64 64 REG_UFS_MEM_ICE_CONFIG = 0x260C, 65 65 REG_UFS_MEM_ICE_NUM_CORE = 0x2664, 66 66