summaryrefslogtreecommitdiff
path: root/drivers/scsi/ufs
diff options
context:
space:
mode:
authorBean Huo <beanhuo@micron.com>2019-07-15 11:21:10 +0000
committerMartin K. Petersen <martin.petersen@oracle.com>2019-07-22 16:44:07 -0400
commit838c1efc6a0adbf44d16e4714f43443db598cdb5 (patch)
tree4632217a28e364d886926835759c10d9a33a6a4a /drivers/scsi/ufs
parent70a51d8c53176080e82b2aef050f820ccdd4b3f8 (diff)
scsi: ufs: change msleep to usleep_range
This patch is to change msleep() to usleep_range() based on Documentation/timers/timers-howto.txt. It suggests using usleep_range() for small msec(1ms - 20ms) since msleep() will often sleep longer than desired value. After changing, booting time will be 5ms-10ms faster than before. I tested this change on two different platforms, one has 5ms faster, another one is about 10ms. I think this is different on different platform. Actually, from UFS host side, 1ms-5ms delay is already sufficient for its initialization of the local UIC layer. Fixes: 7a3e97b0dc4b ([SCSI] ufshcd: UFS Host controller driver) Signed-off-by: Bean Huo <beanhuo@micron.com> Acked-by: Stanley Chu <stanley.chu@mediatek.com> Reviewed-by: Avri Altman <avri.altman@wdc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/ufs')
-rw-r--r--drivers/scsi/ufs/ufshcd.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 3804a704e565..a383d0f54f5d 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -4226,12 +4226,6 @@ static int ufshcd_hba_execute_hce(struct ufs_hba *hba)
{
int retry;
- /*
- * msleep of 1 and 5 used in this function might result in msleep(20),
- * but it was necessary to send the UFS FPGA to reset mode during
- * development and testing of this driver. msleep can be changed to
- * mdelay and retry count can be reduced based on the controller.
- */
if (!ufshcd_is_hba_active(hba))
/* change controller state to "reset state" */
ufshcd_hba_stop(hba, true);
@@ -4254,7 +4248,7 @@ static int ufshcd_hba_execute_hce(struct ufs_hba *hba)
* instruction might be read back.
* This delay can be changed based on the controller.
*/
- msleep(1);
+ usleep_range(1000, 1100);
/* wait for the host controller to complete initialization */
retry = 10;
@@ -4266,7 +4260,7 @@ static int ufshcd_hba_execute_hce(struct ufs_hba *hba)
"Controller enable failed\n");
return -EIO;
}
- msleep(5);
+ usleep_range(5000, 5100);
}
/* enable UIC related interrupts */