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

Commit 5cc6ae3c authored by Yaniv Gardi's avatar Yaniv Gardi Committed by Subhash Jadavani
Browse files

scsi: ufs: disable LCC configuration in the UFS device



LCC configuration that is needed for optical connections, is not needed
when working with UFS devices. As this values is already disabled
in the host, it should also be disabled in the device.

Change-Id: I81a6ac7310ff9dbf2d6c571431e62beab107fdf2
Signed-off-by: default avatarYaniv Gardi <ygardi@codeaurora.org>
parent 2d2b4785
Loading
Loading
Loading
Loading
+28 −2
Original line number Diff line number Diff line
@@ -2872,14 +2872,40 @@ static int ufshcd_link_startup(struct ufs_hba *hba)
		goto out;
	} else if (hba->quirks & UFSHCD_BROKEN_LCC) {
		int hc_tx_lanes;
		int device_tx_lanes;
		int i;
		int err;

		/*
		 * Disabling the TX_LCC_ENABLE in the Host and in the Device.
		 * As disabling operation is done for each lane, the number of
		 * TX Connected Lanes should be read seperately from host and
		 * from Device and then, apply the disable command on every
		 * lane, on both, Host and Device
		 */
		ufshcd_dme_get(hba,
			UIC_ARG_MIB(PA_CONNECTEDTXDATALANES), &hc_tx_lanes);

		for (i = 0; i < hc_tx_lanes; ++i)
			ufshcd_dme_set(hba,
		ufshcd_dme_peer_get(hba,
				    UIC_ARG_MIB(PA_CONNECTEDTXDATALANES),
				    &device_tx_lanes);

		for (i = 0; i < hc_tx_lanes; ++i) {
			err = ufshcd_dme_set(hba,
				UIC_ARG_MIB_SEL(TX_LCC_ENABLE, i), 0);
			if (err)
				dev_err(hba->dev, "%s: Disable TX_LCC_ENABLE (Host) failed, lane = %d, err = %d",
					__func__, i, err);
		}

		for (i = 0; i < device_tx_lanes; ++i) {
			err = ufshcd_dme_peer_set(hba,
				UIC_ARG_MIB_SEL(TX_LCC_ENABLE, i), 0);
			if (err)
				dev_err(hba->dev, "%s: Disable TX_LCC_ENABLE (Device) failed, lane = %d, err = %d",
					__func__, i, err);
		}

	}

	/* Include any host controller configuration via UIC commands */