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

Commit dab587b4 authored by Subhash Jadavani's avatar Subhash Jadavani Committed by Sujit Reddy Thumma
Browse files

scsi: ufs: don't turn off ref_clk when link is active



If UniPro link is active then ref_clk to UFS device shouldn't be
disabled during the suspend otherwise UniPro link on device will
go out of sync from host side link. This patch adds the check for
the same.

Change-Id: I826c54f0d5f261add4aa8f31336577c63747a2f6
Signed-off-by: default avatarSubhash Jadavani <subhashj@codeaurora.org>
parent 7c7954f2
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -3905,7 +3905,8 @@ out:
	return ret;
}

static int ufshcd_setup_clocks(struct ufs_hba *hba, bool on)
static int __ufshcd_setup_clocks(struct ufs_hba *hba, bool on,
				 bool skip_ref_clk)
{
	int ret = 0;
	struct ufs_clk_info *clki;
@@ -3916,6 +3917,9 @@ static int ufshcd_setup_clocks(struct ufs_hba *hba, bool on)

	list_for_each_entry(clki, head, list) {
		if (!IS_ERR_OR_NULL(clki->clk)) {
			if (skip_ref_clk && !strcmp(clki->name, "ref_clk"))
				continue;

			if (on && !clki->enabled) {
				ret = clk_prepare_enable(clki->clk);
				if (ret) {
@@ -3941,6 +3945,11 @@ out:
	return ret;
}

static int ufshcd_setup_clocks(struct ufs_hba *hba, bool on)
{
	return  __ufshcd_setup_clocks(hba, on, false);
}

static int ufshcd_init_clocks(struct ufs_hba *hba)
{
	int ret = 0;
@@ -4259,8 +4268,11 @@ disable_clks:
			goto set_link_active;
	}

	/* freeze the hardware by turning off the clocks */
	if (!ufshcd_is_link_active(hba))
		ufshcd_setup_clocks(hba, false);
	else
		/* If link is active, device ref_clk can't be switched off */
		__ufshcd_setup_clocks(hba, false, true);

	/*
	 * Disable the host irq as host controller as there won't be any