diff options
| author | Venkat Gopalakrishnan <venkatg@codeaurora.org> | 2017-01-23 17:34:52 -0800 |
|---|---|---|
| committer | Venkat Gopalakrishnan <venkatg@codeaurora.org> | 2017-01-23 17:34:52 -0800 |
| commit | 98d825a34c0892de0f1311b582f4109a4b78e18a (patch) | |
| tree | 713840b7a03ab11c6c650234c0b6d61d93941f94 | |
| parent | c128400dc563bc5514ed3773730fc282197e08eb (diff) | |
scsi: ufs: check for err state when polling for doorbell
As part of polling for doorbell during clk scaling, we need to
make sure the host is in good state before polling.
In case error handler is running at the same time, that could
reset the clocks as part of recovery causing unclocked register
access when polling for doorbell.
Change-Id: I715932e9bffd51956d3a24aa2aec66c2c9a4652b
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
| -rw-r--r-- | drivers/scsi/ufs/ufshcd.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index d4acc3c911f5..73d298da7885 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4141,17 +4141,17 @@ int ufshcd_wait_for_doorbell_clr(struct ufs_hba *hba, u64 wait_timeout_us) ufshcd_hold_all(hba); spin_lock_irqsave(hba->host->host_lock, flags); - if (hba->ufshcd_state != UFSHCD_STATE_OPERATIONAL) { - ret = -EBUSY; - goto out; - } - /* * Wait for all the outstanding tasks/transfer requests. * Verify by checking the doorbell registers are clear. */ start = ktime_get(); do { + if (hba->ufshcd_state != UFSHCD_STATE_OPERATIONAL) { + ret = -EBUSY; + goto out; + } + tm_doorbell = ufshcd_readl(hba, REG_UTP_TASK_REQ_DOOR_BELL); tr_doorbell = ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL); if (!tm_doorbell && !tr_doorbell) { |
