From 5160e718d269a5b74283ce565455c863de42ebcd Mon Sep 17 00:00:00 2001 From: Amit Pundir Date: Thu, 6 Apr 2023 23:23:51 +0530 Subject: [PATCH] Revert "FROMGIT: scsi: ufs: ufs-qcom: Add support for reinitializing the UFS device" This reverts commit e2379e8f901e85495b6320d64d4650c05bf53909. UFS G4 patchseries broke RB5 (sm8250). Reverting a minimal set of patches to get the device booting again. Bug: 146449535 Change-Id: If5ff418a051e9b22ab945723bc49705d7d682980 Signed-off-by: Amit Pundir --- drivers/ufs/host/ufs-qcom.c | 26 ++++---------------------- drivers/ufs/host/ufs-qcom.h | 2 -- include/ufs/ufshcd.h | 6 ------ 3 files changed, 4 insertions(+), 30 deletions(-) diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index dae35e52b1e1..5fe1e02b1ffe 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -303,6 +303,7 @@ static int ufs_qcom_power_up_sequence(struct ufs_hba *hba) struct ufs_qcom_host *host = ufshcd_get_variant(hba); struct phy *phy = host->generic_phy; int ret; + bool is_rate_B = UFS_QCOM_LIMIT_HS_RATE == PA_HS_MODE_B; /* Reset UFS Host Controller and PHY */ ret = ufs_qcom_host_reset(hba); @@ -310,6 +311,9 @@ static int ufs_qcom_power_up_sequence(struct ufs_hba *hba) dev_warn(hba->dev, "%s: host reset returned %d\n", __func__, ret); + if (is_rate_B) + phy_set_mode(phy, PHY_MODE_UFS_HS_B); + /* phy initialization - calibrate the phy */ ret = phy_init(phy); if (ret) { @@ -318,8 +322,6 @@ static int ufs_qcom_power_up_sequence(struct ufs_hba *hba) return ret; } - phy_set_mode_ext(phy, PHY_MODE_UFS_HS_B, host->hs_gear); - /* power on phy - start serdes and phy's power and clocks */ ret = phy_power_on(phy); if (ret) { @@ -722,9 +724,6 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba, return ret; } - /* Use the agreed gear */ - host->hs_gear = dev_req_params->gear_tx; - /* enable the device ref clock before changing to HS mode */ if (!ufshcd_is_hs_mode(&hba->pwr_info) && ufshcd_is_hs_mode(dev_req_params)) @@ -838,9 +837,6 @@ static void ufs_qcom_advertise_quirks(struct ufs_hba *hba) | UFSHCD_QUIRK_DME_PEER_ACCESS_AUTO_MODE | UFSHCD_QUIRK_BROKEN_PA_RXHSUNTERMCAP); } - - if (host->hw_ver.major > 0x3) - hba->quirks |= UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH; } static void ufs_qcom_set_caps(struct ufs_hba *hba) @@ -1048,12 +1044,6 @@ static int ufs_qcom_init(struct ufs_hba *hba) dev_warn(dev, "%s: failed to configure the testbus %d\n", __func__, err); - /* - * Power up the PHY using the minimum supported gear (UFS_HS_G2). - * Switching to max gear will be performed during reinit if supported. - */ - host->hs_gear = UFS_HS_G2; - return 0; out_variant_clear: @@ -1397,13 +1387,6 @@ static void ufs_qcom_config_scaling_param(struct ufs_hba *hba, } #endif -static void ufs_qcom_reinit_notify(struct ufs_hba *hba) -{ - struct ufs_qcom_host *host = ufshcd_get_variant(hba); - - phy_power_off(host->generic_phy); -} - /* Resources */ static const struct ufshcd_res_info ufs_res_info[RES_MAX] = { {.name = "ufs_mem",}, @@ -1650,7 +1633,6 @@ static const struct ufs_hba_variant_ops ufs_hba_qcom_vops = { .device_reset = ufs_qcom_device_reset, .config_scaling_param = ufs_qcom_config_scaling_param, .program_key = ufs_qcom_ice_program_key, - .reinit_notify = ufs_qcom_reinit_notify, .mcq_config_resource = ufs_qcom_mcq_config_resource, .get_hba_mac = ufs_qcom_get_hba_mac, .op_runtime_config = ufs_qcom_op_runtime_config, diff --git a/drivers/ufs/host/ufs-qcom.h b/drivers/ufs/host/ufs-qcom.h index 13219bf74779..078b7074169e 100644 --- a/drivers/ufs/host/ufs-qcom.h +++ b/drivers/ufs/host/ufs-qcom.h @@ -218,8 +218,6 @@ struct ufs_qcom_host { struct gpio_desc *device_reset; - u32 hs_gear; - int esi_base; bool esi_enabled; }; diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h index 643d5a4d051a..f6d12bab2fc2 100644 --- a/include/ufs/ufshcd.h +++ b/include/ufs/ufshcd.h @@ -610,12 +610,6 @@ enum ufshcd_quirks { * auto-hibernate capability but it's FASTAUTO only. */ UFSHCD_QUIRK_HIBERN_FASTAUTO = 1 << 18, - - /* - * This quirk needs to be enabled if the host controller needs - * to reinit the device after switching to maximum gear. - */ - UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH = 1 << 19, }; enum ufshcd_android_quirks {