aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorWei Li <liwei213@huawei.com>2018-11-08 12:08:29 -0500
committerMartin K. Petersen <martin.petersen@oracle.com>2018-11-08 21:22:52 -0500
commit8e4829c6f7470722c1f5a1dc5769ebe09ef036d6 (patch)
tree47d388c02b777ba93c860fecf3a5be23df8a3e5a /drivers
parentf2ffd4e5bc7b629b312be48fbe3c3a2afbd67e4a (diff)
scsi: ufs: Fix hynix ufs bug with quirk on hi36xx SoC
Hynix ufs has deviations on hi36xx platform which will result in ufs bursts transfer failures. To fix the problem, the Hynix device must set the register VS_DebugSaveConfigTime to 0x10, which will set time reference for SaveConfigTime is 250 ns. The time reference for SaveConfigTime is 40 ns by default. This patch is necessary to boot on HiKey960 boards that use Hynix UFS chips (H28U62301AMR model: hB8aL1). Cc: Vinayak Holikatti <vinholikatti@gmail.com> Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com> Cc: "Martin K. Petersen" <martin.petersen@oracle.com> Cc: linux-scsi@vger.kernel.org Signed-off-by: Wei Li <liwei213@huawei.com> Signed-off-by: Dmitry Shmidt <dimitrysh@google.com> [jstultz: Forward ported from older code, slight tweak to commit message] Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/ufs/ufs-hisi.c9
-rw-r--r--drivers/scsi/ufs/ufs_quirks.h6
-rw-r--r--drivers/scsi/ufs/ufshcd.c2
3 files changed, 17 insertions, 0 deletions
diff --git a/drivers/scsi/ufs/ufs-hisi.c b/drivers/scsi/ufs/ufs-hisi.c
index 46df707e6f2c..452e19f8fb47 100644
--- a/drivers/scsi/ufs/ufs-hisi.c
+++ b/drivers/scsi/ufs/ufs-hisi.c
@@ -20,6 +20,7 @@
20#include "unipro.h" 20#include "unipro.h"
21#include "ufs-hisi.h" 21#include "ufs-hisi.h"
22#include "ufshci.h" 22#include "ufshci.h"
23#include "ufs_quirks.h"
23 24
24static int ufs_hisi_check_hibern8(struct ufs_hba *hba) 25static int ufs_hisi_check_hibern8(struct ufs_hba *hba)
25{ 26{
@@ -390,6 +391,14 @@ static void ufs_hisi_set_dev_cap(struct ufs_hisi_dev_params *hisi_param)
390 391
391static void ufs_hisi_pwr_change_pre_change(struct ufs_hba *hba) 392static void ufs_hisi_pwr_change_pre_change(struct ufs_hba *hba)
392{ 393{
394 if (hba->dev_quirks & UFS_DEVICE_QUIRK_HOST_VS_DEBUGSAVECONFIGTIME) {
395 pr_info("ufs flash device must set VS_DebugSaveConfigTime 0x10\n");
396 /* VS_DebugSaveConfigTime */
397 ufshcd_dme_set(hba, UIC_ARG_MIB(0xD0A0), 0x10);
398 /* sync length */
399 ufshcd_dme_set(hba, UIC_ARG_MIB(0x1556), 0x48);
400 }
401
393 /* update */ 402 /* update */
394 ufshcd_dme_set(hba, UIC_ARG_MIB(0x15A8), 0x1); 403 ufshcd_dme_set(hba, UIC_ARG_MIB(0x15A8), 0x1);
395 /* PA_TxSkip */ 404 /* PA_TxSkip */
diff --git a/drivers/scsi/ufs/ufs_quirks.h b/drivers/scsi/ufs/ufs_quirks.h
index 71f73d1d1ad1..5d2dfdb41a6f 100644
--- a/drivers/scsi/ufs/ufs_quirks.h
+++ b/drivers/scsi/ufs/ufs_quirks.h
@@ -131,4 +131,10 @@ struct ufs_dev_fix {
131 */ 131 */
132#define UFS_DEVICE_QUIRK_HOST_PA_SAVECONFIGTIME (1 << 8) 132#define UFS_DEVICE_QUIRK_HOST_PA_SAVECONFIGTIME (1 << 8)
133 133
134/*
135 * Some UFS devices require VS_DebugSaveConfigTime is 0x10,
136 * enabling this quirk ensure this.
137 */
138#define UFS_DEVICE_QUIRK_HOST_VS_DEBUGSAVECONFIGTIME (1 << 9)
139
134#endif /* UFS_QUIRKS_H_ */ 140#endif /* UFS_QUIRKS_H_ */
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 27db55b0ca7f..f1c57cd33b5b 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -231,6 +231,8 @@ static struct ufs_dev_fix ufs_fixups[] = {
231 UFS_FIX(UFS_VENDOR_SKHYNIX, UFS_ANY_MODEL, UFS_DEVICE_NO_VCCQ), 231 UFS_FIX(UFS_VENDOR_SKHYNIX, UFS_ANY_MODEL, UFS_DEVICE_NO_VCCQ),
232 UFS_FIX(UFS_VENDOR_SKHYNIX, UFS_ANY_MODEL, 232 UFS_FIX(UFS_VENDOR_SKHYNIX, UFS_ANY_MODEL,
233 UFS_DEVICE_QUIRK_HOST_PA_SAVECONFIGTIME), 233 UFS_DEVICE_QUIRK_HOST_PA_SAVECONFIGTIME),
234 UFS_FIX(UFS_VENDOR_SKHYNIX, "hB8aL1" /*H28U62301AMR*/,
235 UFS_DEVICE_QUIRK_HOST_VS_DEBUGSAVECONFIGTIME),
234 236
235 END_FIX 237 END_FIX
236}; 238};