Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 93843f3d authored by Subhash Jadavani's avatar Subhash Jadavani
Browse files

scsi: ufs-qcom: disable both host and device LCC



UniPro v1.6 specication requires both host and device TX LCC Enable to be
in same state but current driver still attempts to disable just one
side of LCC. With this change, if Host supports UniPro v1.6 (and all
commercial UFS devices anyway supports the UniPro v1.6), we would keep
both host and device TX LCC disabled after the link startup. Keeping LCC
disabled helps avoid multiple compatibility issues between host and device.

Change-Id: I1697089255b63f70a465c8b42a899ee6ab0acd88
Signed-off-by: default avatarSubhash Jadavani <subhashj@codeaurora.org>
parent 66f4f85a
Loading
Loading
Loading
Loading
+17 −2
Original line number Diff line number Diff line
@@ -224,6 +224,7 @@ static int ufs_qcom_link_startup_post_change(struct ufs_hba *hba)
	 * change sequence which may cause host PHY to go into bad state.
	 * Disabling Rx LineCfg of host PHY should help avoid this.
	 */
	if (ufshcd_get_local_unipro_ver(hba) == UFS_UNIPRO_VER_1_41)
		err = ufs_qcom_phy_ctrl_rx_linecfg(phy, false);

out:
@@ -557,6 +558,19 @@ static int ufs_qcom_link_startup_notify(struct ufs_hba *hba, bool status)
			 */
			err = ufs_qcom_set_dme_vs_core_clk_ctrl_clear_div(hba,
									  150);

		/*
		 * Some UFS devices (and may be host) have issues if LCC is
		 * enabled. So we are setting PA_Local_TX_LCC_Enable to 0
		 * before link startup which will make sure that both host
		 * and device TX LCC are disabled once link startup is
		 * completed.
		 */
		if (ufshcd_get_local_unipro_ver(hba) != UFS_UNIPRO_VER_1_41)
			err = ufshcd_dme_set(hba,
					UIC_ARG_MIB(PA_LOCAL_TX_LCC_ENABLE),
					0);

		break;
	case POST_CHANGE:
		ufs_qcom_link_startup_post_change(hba);
@@ -1025,10 +1039,11 @@ static void ufs_qcom_advertise_quirks(struct ufs_hba *hba)

		if (host->hw_ver.minor == 0x001 && host->hw_ver.step == 0x0001)
			hba->quirks |= UFSHCD_QUIRK_BROKEN_INTR_AGGR;

		hba->quirks |= UFSHCD_QUIRK_BROKEN_LCC;
	}

	if (host->hw_ver.major >= 0x2) {
		hba->quirks |= UFSHCD_QUIRK_BROKEN_LCC;
		hba->quirks |= UFSHCD_QUIRK_BROKEN_UFS_HCI_VERSION;

		if (!ufs_qcom_cap_qunipro(host))
+2 −1
Original line number Diff line number Diff line
@@ -1000,7 +1000,7 @@ static const char *ufschd_ufs_dev_pwr_mode_to_string(
	}
}

static u32 ufshcd_get_local_unipro_ver(struct ufs_hba *hba)
u32 ufshcd_get_local_unipro_ver(struct ufs_hba *hba)
{
	/* HCI version 1.0 and 1.1 supports UniPro 1.41 */
	if ((hba->ufs_version == UFSHCI_VERSION_10) ||
@@ -1009,6 +1009,7 @@ static u32 ufshcd_get_local_unipro_ver(struct ufs_hba *hba)
	else
		return UFS_UNIPRO_VER_1_6;
}
EXPORT_SYMBOL(ufshcd_get_local_unipro_ver);

static bool ufshcd_is_unipro_pa_params_tuning_req(struct ufs_hba *hba)
{
+1 −0
Original line number Diff line number Diff line
@@ -1052,4 +1052,5 @@ int ufshcd_change_power_mode(struct ufs_hba *hba,
			     struct ufs_pa_layer_attr *pwr_mode);
void ufshcd_abort_outstanding_transfer_requests(struct ufs_hba *hba,
		int result);
u32 ufshcd_get_local_unipro_ver(struct ufs_hba *hba);
#endif /* End of Header */
+1 −0
Original line number Diff line number Diff line
@@ -74,6 +74,7 @@
#define PA_MAXRXSPEEDFAST	0x1541
#define PA_MAXRXSPEEDSLOW	0x1542
#define PA_TXLINKSTARTUPHS	0x1544
#define PA_LOCAL_TX_LCC_ENABLE	0x155E
#define PA_TXSPEEDFAST		0x1565
#define PA_TXSPEEDSLOW		0x1566
#define PA_REMOTEVERINFO	0x15A0