From ac11399e771cdd93a53db7bfbadd46eb2c6fc610 Mon Sep 17 00:00:00 2001 From: "Bao D. Nguyen" Date: Thu, 18 Jun 2020 13:20:30 -0700 Subject: [PATCH] scsi: ufshcd: Properly set the device Icc Level UFS version 3.0 and later devices use Vcc and Vccq regulators while UFS version 2.0 and 2.1 devices use Vcc and Vccq2 . Properly set the device's supported Icc level for the regulators used by the device. Change-Id: I3e657d6167976706d69a582b3983df794102e3af Signed-off-by: Bao D. Nguyen --- drivers/scsi/ufs/ufshcd-qti.c | 4 +++- drivers/scsi/ufs/ufshcd.c | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd-qti.c b/drivers/scsi/ufs/ufshcd-qti.c index 64143b5b0207..a9b904b1e178 100644 --- a/drivers/scsi/ufs/ufshcd-qti.c +++ b/drivers/scsi/ufs/ufshcd-qti.c @@ -7613,7 +7613,9 @@ static u32 ufshcd_find_max_sup_active_icc_level(struct ufs_hba *hba, * vendors don't use this rail for embedded UFS devices as well. So * it is normal that VCCQ rail may not be provided for given platform. */ - if (!hba->vreg_info.vcc || !hba->vreg_info.vccq2) { + if (!hba->vreg_info.vcc || + (!hba->vreg_info.vccq && hba->dev_info.wspecversion >= 0x300) || + (!hba->vreg_info.vccq2 && hba->dev_info.wspecversion < 0x300)) { dev_err(hba->dev, "%s: Regulator capability was not set, bActiveICCLevel=%d\n", __func__, icc_level); goto out; diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index d32b4a4dfc6d..4b7400a7e108 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -6636,8 +6636,9 @@ static u32 ufshcd_find_max_sup_active_icc_level(struct ufs_hba *hba, { u32 icc_level = 0; - if (!hba->vreg_info.vcc || !hba->vreg_info.vccq || - !hba->vreg_info.vccq2) { + if (!hba->vreg_info.vcc || + (!hba->vreg_info.vccq && hba->dev_info.wspecversion >= 0x300) || + (!hba->vreg_info.vccq2 && hba->dev_info.wspecversion < 0x300)) { dev_err(hba->dev, "%s: Regulator capability was not set, actvIccLevel=%d", __func__, icc_level);