From: Stanley Chu Date: Wed, 18 Mar 2020 10:40:15 +0000 (+0800) Subject: scsi: ufs: make HCE polling more compact to improve initialization latency X-Git-Tag: v5.7-rc1~112^2~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9fc305ef8eb583b3139643f90abbe38d1c2412ce;p=thirdparty%2Fkernel%2Flinux.git scsi: ufs: make HCE polling more compact to improve initialization latency Reduce the waiting period between each HCE (Host Controller Enable) polling from 5 ms to 1 ms. Also increase the maximum polling times to make "total polling time" roughly the same. This change could make HCE initialization faster to improve latency of ufshcd initialization, error recovery, and resume behaviors. Link: https://lore.kernel.org/r/20200318104016.28049-7-stanley.chu@mediatek.com Reviewed-by: Avri Altman Reviewed-by: Can Guo Signed-off-by: Stanley Chu Signed-off-by: Martin K. Petersen --- diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 01839eef08cb7..153743eef082a 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4238,7 +4238,7 @@ int ufshcd_hba_enable(struct ufs_hba *hba) ufshcd_delay_us(hba->hba_enable_delay_us, 100); /* wait for the host controller to complete initialization */ - retry = 10; + retry = 50; while (ufshcd_is_hba_active(hba)) { if (retry) { retry--; @@ -4247,7 +4247,7 @@ int ufshcd_hba_enable(struct ufs_hba *hba) "Controller enable failed\n"); return -EIO; } - usleep_range(5000, 5100); + usleep_range(1000, 1100); } /* enable UIC related interrupts */