HACK: ufs: add a quirk to skip changing power mode
The rb5 UFS controller dies if we change power mode during init, work
around this for now until it can be properly debugged.
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
diff --git a/drivers/ufs/qcom-ufshcd.c b/drivers/ufs/qcom-ufshcd.c
index ca55c3e..51bcb0c 100644
--- a/drivers/ufs/qcom-ufshcd.c
+++ b/drivers/ufs/qcom-ufshcd.c
@@ -279,6 +279,9 @@
if (priv->hw_ver.major > 0x3)
hba->quirks |= UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH;
+
+ if (ofnode_device_is_compatible(dev_ofnode(hba->dev), "qcom,sm8250-ufshc"))
+ hba->quirks |= UFSHCD_QUIRK_SKIP_CHANGE_POWER_MODE;
}
static void ufs_qcom_dev_ref_clk_ctrl(struct ufs_hba *hba, bool enable)
diff --git a/drivers/ufs/ufs.c b/drivers/ufs/ufs.c
index 6130924..05befc0 100644
--- a/drivers/ufs/ufs.c
+++ b/drivers/ufs/ufs.c
@@ -1976,12 +1976,14 @@
"%s: Failed getting max supported power mode\n",
__func__);
} else {
- ret = ufshcd_change_power_mode(hba, &hba->max_pwr_info.info);
- if (ret) {
- dev_err(hba->dev, "%s: Failed setting power mode, err = %d\n",
- __func__, ret);
+ if (!(hba->quirks & UFSHCD_QUIRK_SKIP_CHANGE_POWER_MODE)) {
+ ret = ufshcd_change_power_mode(hba, &hba->max_pwr_info.info);
+ if (ret) {
+ dev_err(hba->dev, "%s: Failed setting power mode, err = %d\n",
+ __func__, ret);
- return ret;
+ return ret;
+ }
}
debug("UFS Device %s is up!\n", hba->dev->name);
diff --git a/drivers/ufs/ufs.h b/drivers/ufs/ufs.h
index 0f292ae..a3b2c75 100644
--- a/drivers/ufs/ufs.h
+++ b/drivers/ufs/ufs.h
@@ -834,6 +834,11 @@
*/
#define UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH (1 << 19)
+ /*
+ * Skips configuring the power mode and assumes lowest gear.
+ */
+#define UFSHCD_QUIRK_SKIP_CHANGE_POWER_MODE (1 << 20)
+
/* Virtual memory reference */
struct utp_transfer_cmd_desc *ucdl;
struct utp_transfer_req_desc *utrdl;
@@ -978,8 +983,7 @@
#define UFSHCD_UIC_MASK (UIC_COMMAND_COMPL | UIC_POWER_MODE)
-#define UFSHCD_ERROR_MASK (UIC_ERROR |\
- DEVICE_FATAL_ERROR |\
+#define UFSHCD_ERROR_MASK (DEVICE_FATAL_ERROR |\
CONTROLLER_FATAL_ERROR |\
SYSTEM_BUS_FATAL_ERROR)