Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1405446pxb; Thu, 21 Oct 2021 23:40:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylsnLYSRODJhoT3mfcnUorPU78SJG/LNqSNTFJvUMo6g3HV00oCySHTAGhjAH3r6RNR0ew X-Received: by 2002:a63:1717:: with SMTP id x23mr8003292pgl.182.1634884840415; Thu, 21 Oct 2021 23:40:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634884840; cv=none; d=google.com; s=arc-20160816; b=MbimDeS4dP8dDPcLIJFb/9+aQ2ej5edf3WwJK1OCDLOsOM3O40XECgXlpqVSv6q+Of v6FozliQwJMtlmXBdn9syy1oMgA956Eo5p0RyHc6xh05i1sgsN90zObgfgPrJko9ncc0 6Ww2b44nKSl9EUZiuIF5bHPLLV/2zAk/dME+32d/32DqDwddNGV/XrfysJu0xhdBFS4d A3AFmF/6H8z1aqF6DXOjUhRCMkCRE/zn4Ibds9n6o51IOZKg1IOvHjxr7+aiivPAx2P9 kykTIElbjIX6iHKErt3ZeoE67OzwvMOOQgZbe4UXjwZKjaeGL0ta9zSTYxkUqjeVFppN dAjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature:dkim-filter; bh=LkFPqrQa+YT41CfhU97akjcr79eXsXgMnGQruTJ1HIs=; b=bYEepO1g4n7tiTq/hpF9H3mzm1MJPw9H9oRYhzM4gkotje3plmOecQbIjXm6zVCfQ0 WYLAKPXJJibkAmb8RuGBinyi2cYGZvW3CoK2qu7oz3Cw3pfPI5PbIeY9w74iAQsKxoVT 46HkjkvNkOr4060FFC3OP6tWjH9EzzAjH8qI/b7vQWNUyE6jFG2q5Iu6prNXHq+qnV5h 70fqYdb77wsLDE00FZmFKfy/fGD81DxA8hXhLkoo2XX4GuvnE4kHoeoQ24M1xkgzJmVw du+xDIZex8l5no2iaYLHL8dpOz2CvLNNgBiFdnrLmrkSyyHDTXZLWRz5Lw7kMhG+FKma XGdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=CB3V3qnc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 11si9985604pgu.329.2021.10.21.23.40.27; Thu, 21 Oct 2021 23:40:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=CB3V3qnc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230332AbhJVGlv (ORCPT + 99 others); Fri, 22 Oct 2021 02:41:51 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:58771 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230238AbhJVGlu (ORCPT ); Fri, 22 Oct 2021 02:41:50 -0400 Received: from epcas1p2.samsung.com (unknown [182.195.41.46]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20211022063931epoutp014e25cecc195ff791d9024d48aad79db7~wRwm9jp1j0394403944epoutp01_ for ; Fri, 22 Oct 2021 06:39:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20211022063931epoutp014e25cecc195ff791d9024d48aad79db7~wRwm9jp1j0394403944epoutp01_ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1634884771; bh=LkFPqrQa+YT41CfhU97akjcr79eXsXgMnGQruTJ1HIs=; h=From:To:Cc:Subject:Date:References:From; b=CB3V3qnc5NioVLVYYi2ZKzPxjKVpFsy9MRN30XqkUYk/9U9CNN6W4JLImlV3LiRC7 ItyZrEc7ojS+UHi6H83RXtxU2Lc8NGIEDD/rTfB6TTAHVpoKvES7TDThkJ1g+YP3tl hT0TJcHGJZtaA94yW5eBmRf4ebw9Z7wVvct9hsvg= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20211022063931epcas1p39555326907bf3396430fb4754b45ce14~wRwmsYjYo2325323253epcas1p3D; Fri, 22 Oct 2021 06:39:31 +0000 (GMT) Received: from epsmges1p3.samsung.com (unknown [182.195.38.243]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4HbF7j47c1z4x9Q0; Fri, 22 Oct 2021 06:39:29 +0000 (GMT) Received: from epcas1p3.samsung.com ( [182.195.41.47]) by epsmges1p3.samsung.com (Symantec Messaging Gateway) with SMTP id E3.BD.09592.1AC52716; Fri, 22 Oct 2021 15:39:29 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas1p2.samsung.com (KnoxPortal) with ESMTPA id 20211022063928epcas1p28a32be208929f9905c80e655736b7a7d~wRwkNB9-K1434414344epcas1p28; Fri, 22 Oct 2021 06:39:28 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20211022063928epsmtrp1dd8ba207920fe9104e9c65fe3eaef5a2~wRwkIM-Az0281702817epsmtrp1c; Fri, 22 Oct 2021 06:39:28 +0000 (GMT) X-AuditID: b6c32a37-28fff70000002578-47-61725ca173af Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 6E.10.08902.0AC52716; Fri, 22 Oct 2021 15:39:28 +0900 (KST) Received: from localhost.localdomain (unknown [10.88.98.193]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20211022063928epsmtip10c52a65d505e3f4807a537c3bf7d97fb~wRwj6Q9Mp1451514515epsmtip1T; Fri, 22 Oct 2021 06:39:28 +0000 (GMT) From: Huijin Park To: Ulf Hansson Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Huijin Park , Huijin Park Subject: [PATCH 1/2] mmc: core: adjust polling interval for CMD1 Date: Fri, 22 Oct 2021 15:39:19 +0900 Message-Id: <20211022063920.2145-1-huijin.park@samsung.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrDKsWRmVeSWpSXmKPExsWy7bCmvu7CmKJEg39tQhYv9x5itui46GJx edccNosj//sZLY6vDXdg9dg56y67x51re9g8+rasYvT4vEkugCUq2yYjNTEltUghNS85PyUz L91WyTs43jne1MzAUNfQ0sJcSSEvMTfVVsnFJ0DXLTMHaKuSQlliTilQKCCxuFhJ386mKL+0 JFUhI7+4xFYptSAlp8CsQK84Mbe4NC9dLy+1xMrQwMDIFKgwITvj8XfNguuCFYfPvmZqYDzI 18XIySEhYCLxd8UC1i5GLg4hgR2MEqcX3GAHSQgJfGKUuHJRGCLxjVHi+KEdLDAds298hira yygxvU8dogio4eaGZYwgCTYBbYnra7eC2SICGhJ7Hp5nBbGZBbqAim45gNjCAg4Sd07+ZQKx WQRUJe427QWq4eDgFbCWOPIpAWKXvMTMS9/BdvEKCEqcnPmEBWKMvETz1tnMIHslBHaxSyx+ 280O0eAi0fjgFSuELSzx6vgWqLiUxMv+Nii7XGLXhKtQzQ2MEn1rv0M1GEu8e7uWGeQIZgFN ifW79CHCihI7f89lhFjMJ/Huaw/YnRICvBIdbUIQJaoSi69+hJoiLXHowV1GCNtD4n7DWjZI WMVKTFmxiG0Co/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DU6qB adKbA75Vz/7sZOVgDv16P1CbmdFOv792zXn1+dbSvV9ClnVfN528XSpQ/IxmbUbp80/aW6s9 OpzZTZXm2VtUsB3zfdW7VUbu4PXylRatzVZztW7lfbhdvfTTzAVnuhfffTC3UzXwbp3+JafL sxLM9FK+vpTbeYz1+HXdVJtXM90kfpjvzvg3OVbv1Ps5ZapeIYHqs0++eLFRQ9OdN371lk1r pCZVMf5revTq7Kp7Qn4xu/RmHhfZ4M/6qkVy++kotdAl6XPr/q5ZOmkng7PchJyPDqtLJtf9 mZK3rFdsfc5EpUdM7+si8zdP//xs/aI1ujfN/D5NU3/KwbrM4LzKOmHZJ6Ezxa//a9qgzvj+ Xb0SS3FGoqEWc1FxIgCHJkzOrQIAAA== X-CMS-MailID: 20211022063928epcas1p28a32be208929f9905c80e655736b7a7d X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20211022063928epcas1p28a32be208929f9905c80e655736b7a7d References: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In mmc_send_op_cond(), loops are continuously performed at the same interval of 10 ms. However the behaviour is not good for some eMMC which can be out from a busy state earlier than 10 ms if normal. Therefore, this patch adjusts the waiting interval time. The interval time starts at 1 ms, but doubles until the range reaches 10 ms for each loop. The reason for adjusting the interval time is that it is important to reduce the eMMC initialization time, especially in devices that use eMMC as rootfs. Test log(eMMC:KLM8G1GETF-B041): before: 12 ms (0.439407 - 0.427186) [0.419407] mmc0: starting CMD0 arg 00000000 flags 000000c0 [0.422652] mmc0: starting CMD1 arg 00000000 flags 000000e1 [0.424270] mmc0: starting CMD0 arg 00000000 flags 000000c0 [0.427186] mmc0: starting CMD1 arg 40000080 flags 000000e1<-start [0.439407] mmc0: starting CMD1 arg 40000080 flags 000000e1<-finish [0.439721] mmc0: starting CMD2 arg 00000000 flags 00000007 after: 4 ms (0.431725 - 0.427352) [0.419575] mmc0: starting CMD0 arg 00000000 flags 000000c0 [0.422819] mmc0: starting CMD1 arg 00000000 flags 000000e1 [0.424435] mmc0: starting CMD0 arg 00000000 flags 000000c0 [0.427352] mmc0: starting CMD1 arg 40000080 flags 000000e1<-start [0.428913] mmc0: starting CMD1 arg 40000080 flags 000000e1 [0.431725] mmc0: starting CMD1 arg 40000080 flags 000000e1<-finish [0.432038] mmc0: starting CMD2 arg 00000000 flags 00000007 Signed-off-by: Huijin Park diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 0c54858e89c0..61b4ffdc89ce 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -177,6 +177,7 @@ int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) { struct mmc_command cmd = {}; int i, err = 0; + int interval = 1, interval_max = 10; cmd.opcode = MMC_SEND_OP_COND; cmd.arg = mmc_host_is_spi(host) ? 0 : ocr; @@ -198,7 +199,9 @@ int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) err = -ETIMEDOUT; - mmc_delay(10); + mmc_delay(interval); + if (interval < interval_max) + interval = min(interval * 2, interval_max); /* * According to eMMC specification v5.1 section 6.4.3, we -- 2.17.1