Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6AC19C432BE for ; Sat, 28 Aug 2021 05:13:46 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 60BE660200 for ; Sat, 28 Aug 2021 05:13:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 60BE660200 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3D4F782F32; Sat, 28 Aug 2021 07:13:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="S63hFvr1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EF8A6832CA; Sat, 28 Aug 2021 07:13:41 +0200 (CEST) Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 72CAA82F00 for ; Sat, 28 Aug 2021 07:13:24 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jh80.chung@samsung.com Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20210828051314epoutp041f22c3048eed5139929547a91c516f4c~fYGj4ovl72816228162epoutp04M for ; Sat, 28 Aug 2021 05:13:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20210828051314epoutp041f22c3048eed5139929547a91c516f4c~fYGj4ovl72816228162epoutp04M DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1630127594; bh=hDEhVczUZxp5IyS4+4Oz8Yph4kJhBr8u1kXKoMOaIfo=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=S63hFvr1sEuo9Ns3XEHRJZevaEmM76E+6nQDCr+afJT4DabVgxA2eYYmyiqaXdiY0 K7zU+OG4EBZhjly9ouKHtknf10Q9mCOl5pvnlYhL8hXhNjKXdGps46uidJf8V04pLT YItpmvFEmSQHY5fPVWC5nqW45+LR5a1JNbsXRVGg= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20210828051312epcas1p20c1774751999ec0604a394afd57929dc~fYGizNDtQ1301113011epcas1p2C; Sat, 28 Aug 2021 05:13:12 +0000 (GMT) Received: from epsmges1p3.samsung.com (unknown [182.195.38.233]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4GxPqS4vR8z4x9Pw; Sat, 28 Aug 2021 05:13:08 +0000 (GMT) Received: from epcas1p2.samsung.com ( [182.195.41.46]) by epsmges1p3.samsung.com (Symantec Messaging Gateway) with SMTP id 0D.62.09765.4E5C9216; Sat, 28 Aug 2021 14:13:08 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas1p4.samsung.com (KnoxPortal) with ESMTPA id 20210828051307epcas1p4d8fd5b09d6b973184b8010d5234ad2c7~fYGeMuNIb0406204062epcas1p40; Sat, 28 Aug 2021 05:13:07 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210828051307epsmtrp2b999bf7e4b642407323dbcb704ac8bc6~fYGeMGyxA2832528325epsmtrp2a; Sat, 28 Aug 2021 05:13:07 +0000 (GMT) X-AuditID: b6c32a37-915ff70000002625-f4-6129c5e4f8c3 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id DA.85.09091.3E5C9216; Sat, 28 Aug 2021 14:13:07 +0900 (KST) Received: from [10.113.113.235] (unknown [10.113.113.235]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20210828051307epsmtip1f7b7c4a33cae1123d3c4185f5c82a27e~fYGd9q4F_1984019840epsmtip1l; Sat, 28 Aug 2021 05:13:07 +0000 (GMT) Subject: Re: [PATCH 2/2] drivers: mmc: Add wait_dat0 support for sdhci driver To: stcarlso@linux.microsoft.com, u-boot@lists.denx.de Cc: Peng Fan From: Jaehoon Chung Message-ID: Date: Sat, 28 Aug 2021 14:13:56 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210817194641.2269-3-stcarlso@linux.microsoft.com> Content-Language: en-US Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrJKsWRmVeSWpSXmKPExsWy7bCmnu6To5qJBtdfKVj8WPWF1WLZ6/ms Fm/3drI7MHv82n6UyePsnR2MHhvf7WAKYI7KtslITUxJLVJIzUvOT8nMS7dV8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/ba3pwbB+JZbijERDLeai4kQA 4kyrbQwEAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOLMWRmVeSWpSXmKPExsWy7bCSnO7jo5qJBuunK1n8WPWF1WLZ6/ms Fm/3drI7MHv82n6UyePsnR2MHhvf7WAKYI7isklJzcksSy3St0vgyjh2ey5zwTyhivPPD7A1 MF7l62Lk5JAQMJGY23WHsYuRi0NIYDejxPE3c1kgElISn59OZeti5ACyhSUOHy6GqHnLKPH7 yyx2kLiwgK/E5P3xIKaIgJnE6dVVIJ3MAvIS01+tY4UoP80ocWdHAxtIgk1AR2L7t+NMIDav gJ3ExMVLwGwWAVWJ219fgtmiApESnxe8YoWoEZQ4OfMJC8h8TgFHickX/SDmq0v8mXeJGcIW l7j1ZD4TzN7tb+cwT2AUmoWkexaSlllIWmYhaVnAyLKKUTK1oDg3PbfYsMAwL7Vcrzgxt7g0 L10vOT93EyM47LU0dzBuX/VB7xAjEwfjIUYJDmYlEd4F39UShXhTEiurUovy44tKc1KLDzFK c7AoifNe6DoZLySQnliSmp2aWpBaBJNl4uCUamBiLjylvma/r+WProT1VkXvnJ+pVJhPftOu c+9PbdjOUL8248y+B2eu3NugdDK2RTDjx4MZ8Wyfrvtxl86TnbPUftJBv9otz5wYTz5d0ZVv 2J14fr/PC3fPri0Hdul/47+WXH5yb9Pv80U/82dYTvr73zHBfvvO/4Epa34nBlg0OS4J+Gqb 2xXRybW61GD+9ctRZZFnFhtu/KRhHCncevjd4rUu7Xvel8WubJ95uOiq5MHDqj5RqWc5dTWm 3VF7qZl3KX+JW732mtXmOz3r+Hq1+yuVTE+5vW/8LO71zetngfyayEOln5xamHVaXApuyUV9 ebOWyXfO/3S1GY0cE40TW8Qu7poQn6Htevj328tKLMUZiYZazEXFiQAtzPyh6gIAAA== X-CMS-MailID: 20210828051307epcas1p4d8fd5b09d6b973184b8010d5234ad2c7 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: 20210817194813epcas1p2276412cd7adaef629148d2c575b948e0 References: <20210817194641.2269-1-stcarlso@linux.microsoft.com> <20210817194641.2269-3-stcarlso@linux.microsoft.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On 8/18/21 4:46 AM, stcarlso@linux.microsoft.com wrote: > From: Stephen Carlson > > Adds an implementation of the wait_dat0 MMC operation for the DM SDHCI > driver, allowing the driver to continue when the card is ready rather > than waiting for the worst case time on each MMC switch operation. > > Signed-off-by: Stephen Carlson > --- > drivers/mmc/sdhci.c | 20 ++++++++++++++++++++ > include/sdhci.h | 2 ++ > 2 files changed, 22 insertions(+) > > diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c > index eea4701d8a..bb55e00ef5 100644 > --- a/drivers/mmc/sdhci.c > +++ b/drivers/mmc/sdhci.c > @@ -775,6 +775,25 @@ static int sdhci_get_cd(struct udevice *dev) > return value; > } > > +static int sdhci_wait_dat0(struct udevice *dev, int state, > + int timeout_us) > +{ > + int tmp; > + struct mmc *mmc = mmc_get_mmc_dev(dev); > + struct sdhci_host *host = mmc->priv; > + unsigned long timeout = timer_get_us() + timeout_us; > + > + // readx_poll_timeout is unsuitable because sdhci_readl accepts > + // two arguments Removed the comment or use "/* */" instead of "//" And i didn't understand what's unsuitable? Best Regards, Jaehoon Chung > + do { > + tmp = sdhci_readl(host, SDHCI_PRESENT_STATE); > + if (!!(tmp & SDHCI_DATA_0_LVL_MASK) == !!state) > + return 0; > + } while (!timeout_us || !time_after(timer_get_us(), timeout)); > + > + return -ETIMEDOUT; > +} > + > const struct dm_mmc_ops sdhci_ops = { > .send_cmd = sdhci_send_command, > .set_ios = sdhci_set_ios, > @@ -783,6 +802,7 @@ const struct dm_mmc_ops sdhci_ops = { > #ifdef MMC_SUPPORTS_TUNING > .execute_tuning = sdhci_execute_tuning, > #endif > + .wait_dat0 = sdhci_wait_dat0, > }; > #else > static const struct mmc_ops sdhci_ops = { > diff --git a/include/sdhci.h b/include/sdhci.h > index 0ae9471ad7..dd4eb41442 100644 > --- a/include/sdhci.h > +++ b/include/sdhci.h > @@ -65,6 +65,8 @@ > #define SDHCI_CARD_STATE_STABLE BIT(17) > #define SDHCI_CARD_DETECT_PIN_LEVEL BIT(18) > #define SDHCI_WRITE_PROTECT BIT(19) > +#define SDHCI_DATA_LVL_MASK 0x00F00000 > +#define SDHCI_DATA_0_LVL_MASK BIT(20) > > #define SDHCI_HOST_CONTROL 0x28 > #define SDHCI_CTRL_LED BIT(0) >