From patchwork Mon Mar 16 03:42:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanley Chu X-Patchwork-Id: 11439629 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1523B14DD for ; Mon, 16 Mar 2020 03:42:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E87122071B for ; Mon, 16 Mar 2020 03:42:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="nlpuXPN7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729686AbgCPDm2 (ORCPT ); Sun, 15 Mar 2020 23:42:28 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:32774 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729423AbgCPDm2 (ORCPT ); Sun, 15 Mar 2020 23:42:28 -0400 X-UUID: e234ed76ab774b75b5c27f8f9640545d-20200316 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=7YpwD2GG32xhcNkZears5WlJqU2pNhGBUQ+n78Lc3nw=; b=nlpuXPN7dly/LYxojhCWJlS1DimwRsV5FAG/PhtwdOavf87hSYy7cN3W4VMszo3vwhRTwfc7RkYEK3+ICnrCJ2odF07m5Kx1KZPtBR8TqDszDd+r3Um7fR0HB40T6EslvmuenenMbng2g38jDdzKNh8jt2UWAYHY6HGfTP4CQ1s=; X-UUID: e234ed76ab774b75b5c27f8f9640545d-20200316 Received: from mtkcas09.mediatek.inc [(172.21.101.178)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 347351772; Mon, 16 Mar 2020 11:42:21 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs02n1.mediatek.inc (172.21.101.77) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 16 Mar 2020 11:40:05 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Mon, 16 Mar 2020 11:39:23 +0800 From: Stanley Chu To: , , , , CC: , , , , , , , , , , , , Stanley Chu Subject: [PATCH v5 7/8] scsi: ufs: make HCE polling more compact to improve initialization latency Date: Mon, 16 Mar 2020 11:42:17 +0800 Message-ID: <20200316034218.11914-8-stanley.chu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200316034218.11914-1-stanley.chu@mediatek.com> References: <20200316034218.11914-1-stanley.chu@mediatek.com> MIME-Version: 1.0 X-MTK: N Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Reduce the waiting period between each HCE (Host Controller Enable) polling from 5 ms to 1 ms. In the same time, increase the maximum polling times to make "total polling time" unchanged approximately. This change could make HCE initializatoin faster to improve latency of ufshcd initialization, error recovery, and resume behaviors. Signed-off-by: Stanley Chu Reviewed-by: Avri Altman Reviewed-by: Can Guo --- drivers/scsi/ufs/ufshcd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index dcbf45d547d8..cd33d07c56cf 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4301,7 +4301,7 @@ int ufshcd_hba_enable(struct ufs_hba *hba) ufshcd_wait_us(hba->hba_enable_delay_us, 100, true); /* wait for the host controller to complete initialization */ - retry = 10; + retry = 50; while (ufshcd_is_hba_active(hba)) { if (retry) { retry--; @@ -4310,7 +4310,7 @@ int ufshcd_hba_enable(struct ufs_hba *hba) "Controller enable failed\n"); return -EIO; } - ufshcd_wait_us(5000, 100, true); + ufshcd_wait_us(1000, 100, true); } /* enable UIC related interrupts */