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>
This commit is contained in:
Subhash Jadavani 2015-02-26 12:17:13 -08:00 committed by David Keitel
parent 25245a746c
commit 43b632cb97

View file

@ -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) {