diff options
author | Subhash Jadavani <subhashj@codeaurora.org> | 2015-02-26 12:17:13 -0800 |
---|---|---|
committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-22 10:58:59 -0700 |
commit | 43b632cb9759498dfc7ed6ed38cefdd326c22d06 (patch) | |
tree | b1be7d4fcb88e8476e6ad737f30631315a8086df | |
parent | 25245a746c7bfecd580d3b499a776374c2ac54bc (diff) |
scsi: ufshcd: fix possible unclocked register access
vendor specific setup_clocks ops may depend on clocks managed by ufshcd
driver so if the vendor specific setup_clocks callback is called when
the required clocks are turned off, it results into unclocked register
access.
This change make sure that required clocks are enabled before vendor
specific setup_clocks callback is called.
Change-Id: I670c6b69aa361eb5023ef7d945ff45c3fa986fd7
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
[venkatg@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
-rw-r--r-- | drivers/scsi/ufs/ufshcd.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 1668f54bf29f..d47272a8c438 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -7136,6 +7136,17 @@ static int __ufshcd_setup_clocks(struct ufs_hba *hba, bool on, if (!head || list_empty(head)) goto out; + /* + * vendor specific setup_clocks ops may depend on clocks managed by + * this standard driver hence call the vendor specific setup_clocks + * before disabling the clocks managed here. + */ + if (hba->vops && hba->vops->setup_clocks && !on) { + ret = hba->vops->setup_clocks(hba, on); + if (ret) + return ret; + } + list_for_each_entry(clki, head, list) { if (!IS_ERR_OR_NULL(clki->clk)) { if (skip_ref_clk && !strcmp(clki->name, "ref_clk")) @@ -7158,7 +7169,13 @@ static int __ufshcd_setup_clocks(struct ufs_hba *hba, bool on, } } + /* + * vendor specific setup_clocks ops may depend on clocks managed by + * this standard driver hence call the vendor specific setup_clocks + * after enabling the clocks managed here. + */ ret = ufshcd_vops_setup_clocks(hba, on); + out: if (ret) { list_for_each_entry(clki, head, list) { |