From mboxrd@z Thu Jan 1 00:00:00 1970 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=-7.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS 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 28F15C43219 for ; Thu, 25 Apr 2019 21:33:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 293E520675 for ; Thu, 25 Apr 2019 21:33:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="J69ncogA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730012AbfDYVdI (ORCPT ); Thu, 25 Apr 2019 17:33:08 -0400 Received: from mail-vs1-f65.google.com ([209.85.217.65]:38126 "EHLO mail-vs1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726604AbfDYVdI (ORCPT ); Thu, 25 Apr 2019 17:33:08 -0400 Received: by mail-vs1-f65.google.com with SMTP id s2so758439vsi.5 for ; Thu, 25 Apr 2019 14:33:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=U01nqPAZCX/oH66gDds3hxiIdIZOHSWpwWqAJ0DDR3s=; b=J69ncogArYKLv2j9VwUUeWGPPKUAF//c7+OBM7Q9oXXStXpPwLOtFkEqQZPhRPBf+1 oXN3lK59/CnkIl7SFq3n/AAY8s3mXAAHwSEWFG1VcK+X/MOU44hL4gZlt551sTNQS00M 8RSBW3W7nxSIZOReIKVRL/u3hLnNc5lJEVLx6nsQGf6CFckHFtPLk6PWZPXKrsOlnYSN 0audhEDCt7ktY1s95BJCkcxNPDg9+pEy2LQ2gGplffvff5U1+nrpVqVKtsnLdUdISqKW 9ZjKENBTTWj2lZAinZykm7EW53+py4pM9CFnLeHlGWalJi0rS7oo/CdazPhS1Fi4NarH Nz0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=U01nqPAZCX/oH66gDds3hxiIdIZOHSWpwWqAJ0DDR3s=; b=hj9yXfr+MyiwOt9FUEoQWH6pSrBdK55T21zCL5p9m4/21ful1soFrcwYdEFRzQlHe5 S7Rd7YGrlbrvWtUEfqIgDRYbvGRRMNQcylO9OWIjIUD6dLTOytLxCqIyv2oY7L9Bzsot fmrp6YJ4hTvTqrV0tn6nLv8U6miY4nm3tkG2OlCif3icPcrHLCApi1aDubEtJI+pJxwk rSNiI5N4bRAyZnHctJACSj7+x1pO3BFjCzuWQ5o8jafOd9GLPXf3crxJLObM1XUWYm2U wB/cyWCv6/WnVuSa6F7mE784Rmm2O4pDnMxGMDHZTx0j8+qCUUipCWyOW0Pr+VMB5csp 3epQ== X-Gm-Message-State: APjAAAWP+XitMgCRuX2u6JOG861/zZzq0xe68p+wD6/uL0WgE4PsllUs 2N6TTcd6E6MJecpdU8h4sr8NNYFsVGx4vchaw83hTw== X-Google-Smtp-Source: APXvYqxjix90NtybU2vbW19hzHyh2eWwXVX+6rZWCUn4kkSrm9jpMo9bIidi0r6av8J55qKGuvHJ+1KF9l/YNWZKBto= X-Received: by 2002:a67:cb12:: with SMTP id b18mr6007921vsl.191.1556227986922; Thu, 25 Apr 2019 14:33:06 -0700 (PDT) MIME-Version: 1.0 References: <1551802205-32188-1-git-send-email-ludovic.Barre@st.com> <1551802205-32188-2-git-send-email-ludovic.Barre@st.com> <30eae958-fd66-96a2-52a2-661c0646a302@st.com> In-Reply-To: <30eae958-fd66-96a2-52a2-661c0646a302@st.com> From: Ulf Hansson Date: Thu, 25 Apr 2019 23:32:30 +0200 Message-ID: Subject: Re: [PATCH 1/4] mmc: mmci: avoid fake busy polling To: Ludovic BARRE Cc: Rob Herring , Srinivas Kandagatla , Maxime Coquelin , Alexandre Torgue , Linux ARM , Linux Kernel Mailing List , DTML , "linux-mmc@vger.kernel.org" , linux-stm32@st-md-mailman.stormreply.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 25 Apr 2019 at 16:09, Ludovic BARRE wrote: > > > On 4/25/19 12:08 PM, Ulf Hansson wrote: > > On Thu, 25 Apr 2019 at 11:22, Ludovic BARRE wrote: > >> > >> hi Ulf > >> > >> On 4/23/19 3:39 PM, Ulf Hansson wrote: > >>> On Tue, 5 Mar 2019 at 17:10, Ludovic Barre wrote: > >>>> > >>>> From: Ludovic Barre > >>>> > >>>> The busy status bit could occurred even if no busy response is > >>>> expected (example cmd11). On sdmmc variant, the busy_detect_flag > >>>> reflects inverted value of d0 state, it's sampled at the end of a > >>>> CMD response and a second time 2 clk cycles after the CMD response. > >>>> To avoid a fake busy, the busy status could be checked and polled > >>>> only if the command has RSP_BUSY flag. > >>> > >>> I would appreciate a better explanation of what this patch really changes. > >>> > >>> The above is giving some background to the behavior of sdmmc variant, > >>> but at this point that variant doesn't even have the > >>> ->variant->busy_detect flag set. > >>> > >> > >> Yes, I will try to explain more and focus on common behavior. > >> > >>>> > >>>> Signed-off-by: Ludovic Barre > >>>> --- > >>>> drivers/mmc/host/mmci.c | 19 +++++++++++++------ > >>>> 1 file changed, 13 insertions(+), 6 deletions(-) > >>>> > >>>> diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c > >>>> index 387ff14..4901b73 100644 > >>>> --- a/drivers/mmc/host/mmci.c > >>>> +++ b/drivers/mmc/host/mmci.c > >>>> @@ -1220,12 +1220,13 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd, > >>>> unsigned int status) > >>>> { > >>>> void __iomem *base = host->base; > >>>> - bool sbc; > >>>> + bool sbc, busy_resp; > >>>> > >>>> if (!cmd) > >>>> return; > >>>> > >>>> sbc = (cmd == host->mrq->sbc); > >>>> + busy_resp = !!(cmd->flags & MMC_RSP_BUSY); > >>>> > >>>> /* > >>>> * We need to be one of these interrupts to be considered worth > >>>> @@ -1239,8 +1240,7 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd, > >>>> /* > >>>> * ST Micro variant: handle busy detection. > >>>> */ > >>>> - if (host->variant->busy_detect) { > >>>> - bool busy_resp = !!(cmd->flags & MMC_RSP_BUSY); > >>>> + if (busy_resp && host->variant->busy_detect) { > >>>> > >>>> /* We are busy with a command, return */ > >>>> if (host->busy_status && > >>>> @@ -1253,7 +1253,7 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd, > >>>> * that the special busy status bit is still set before > >>>> * proceeding. > >>>> */ > >>>> - if (!host->busy_status && busy_resp && > >>>> + if (!host->busy_status && > >>>> !(status & (MCI_CMDCRCFAIL|MCI_CMDTIMEOUT)) && > >>>> (readl(base + MMCISTATUS) & host->variant->busy_detect_flag)) { > >>> > >>> All the changes above makes perfect sense to me, but looks more like a > >>> cleanup of the code, rather than actually changing the behavior. > >> > >> yes, few changing (this just avoid to enter in > >> "if (host->variant->busy_detect)") at each time. > >> I could move this part in cleanup patch (before this patch) > > > > Sounds good to me! > > > >> > >>> > >>>> > >>>> @@ -1508,6 +1508,7 @@ static irqreturn_t mmci_irq(int irq, void *dev_id) > >>>> { > >>>> struct mmci_host *host = dev_id; > >>>> u32 status; > >>>> + bool busy_resp; > >>>> int ret = 0; > >>>> > >>>> spin_lock(&host->lock); > >>>> @@ -1550,9 +1551,15 @@ static irqreturn_t mmci_irq(int irq, void *dev_id) > >>>> } > >>>> > >>>> /* > >>>> - * Don't poll for busy completion in irq context. > >>>> + * Don't poll for: > >>>> + * -busy completion in irq context. > >>>> + * -no busy response expected. > >>>> */ > >>>> - if (host->variant->busy_detect && host->busy_status) > >>>> + busy_resp = host->cmd ? > >>>> + !!(host->cmd->flags & MMC_RSP_BUSY) : false; > >>> > >>> This doesn't make sense to me, but I may be missing something. > >>> > >>> host->busy_status is being updated by mmci_cmd_irq() and only when > >>> MMC_RSP_BUSY is set for the command in flight. In other words, > >>> checking for MMC_RSP_BUSY here as well is redundant. No? > >> > >> In mmci_irq the "do while" loops until the status is totally cleared. > >> > >> Today (for variant with busy_detect option), the status busy_detect_flag > >> is excluded only while busy_status period (command with MMC_RSP_BUSY and > >> while busy line is low => "busy_status=1") > >> > >> On SDMMC variant I noticed that busy_detect_flag status could be enabled > >> even if the command is not MMC_RSP_BUSY, for example sdmmc variant stay > >> in loop while cmd11 voltage switch. > > > > Right, I see. > > > >> > >> So I wish extend host->variant->busy_detect_flag exclusion for all > >> commands which is not a MMC_RSP_BUSY. I suppose that other variants > >> could have the same behavior, and else there is no impact, normally. > > > > I am guessing this is because the variant->busy_dpsm_flag has been set > > in the datactrl register, which is needed for mmci_card_busy(). > > > > That said, I am kind of wondering if we ever should need repeat the > > while loop if 'status' contains the bit for > > host->variant->busy_detect_flag. I mean we have already called > > mmci_cmd_irq() to handle it. > > > > So, couldn't we just always do: > > > > if (host->variant->busy_detect_flag) > > status &= ~host->variant->busy_detect_flag; > > > > No? > > yes that make sense, I launched tests on sdmmc and it's ok. > I think, that we could take on this solution. Great! > > If it's ok for you, I resend a series with all modifications. Yes, please do. I haven't reviewed the rest of the series yet, but it may be better to do that when the next version is ready. In either case, I should have some time to run some tests of the next version, if you manage to send it within a couple of days or so. [...] Kind regards Uffe From mboxrd@z Thu Jan 1 00:00:00 1970 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=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS autolearn=unavailable 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 CDF4BC43218 for ; Thu, 25 Apr 2019 21:33:16 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DAE4920675 for ; Thu, 25 Apr 2019 21:33:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NPhJGC/J"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="J69ncogA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DAE4920675 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RW1C/S5bp1GljX3osnslktPkmyYCfCUAXy4l6FrAnDw=; b=NPhJGC/JwwsXWC mabsseZBWjKe/WoyFTalvM2KCGLQYYzmNgEY3qBFEJh7U2uqwOBuzIqUI6Qdu+81slsCElQHOakwr RZWJEBzJaCgmGJtD00PQDcXZrO6CyM7x3B4PikJHoI+LGGCuML1rfjyBJ7U4gS99VncFoMRKzpkrF qYJwVUJH3zbASpjAkB6g2oM/U6jS0hZOCVhN+lsqKfWpBVFedJZR+YHeuR2NuXGdiQ2UN02kztlx0 vR5R++a1MP7CjA6k8FPmcpkTniqN+RsTB9fNoUM8Ltwd6TRg6uNBjpn08oyNe5b+sEMYQY3vHh37K qnpyG9flqMIo935NM8Mg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hJlzT-00082M-Ac; Thu, 25 Apr 2019 21:33:11 +0000 Received: from mail-vs1-xe43.google.com ([2607:f8b0:4864:20::e43]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hJlzQ-000821-4T for linux-arm-kernel@lists.infradead.org; Thu, 25 Apr 2019 21:33:09 +0000 Received: by mail-vs1-xe43.google.com with SMTP id n4so769310vsm.3 for ; Thu, 25 Apr 2019 14:33:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=U01nqPAZCX/oH66gDds3hxiIdIZOHSWpwWqAJ0DDR3s=; b=J69ncogArYKLv2j9VwUUeWGPPKUAF//c7+OBM7Q9oXXStXpPwLOtFkEqQZPhRPBf+1 oXN3lK59/CnkIl7SFq3n/AAY8s3mXAAHwSEWFG1VcK+X/MOU44hL4gZlt551sTNQS00M 8RSBW3W7nxSIZOReIKVRL/u3hLnNc5lJEVLx6nsQGf6CFckHFtPLk6PWZPXKrsOlnYSN 0audhEDCt7ktY1s95BJCkcxNPDg9+pEy2LQ2gGplffvff5U1+nrpVqVKtsnLdUdISqKW 9ZjKENBTTWj2lZAinZykm7EW53+py4pM9CFnLeHlGWalJi0rS7oo/CdazPhS1Fi4NarH Nz0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=U01nqPAZCX/oH66gDds3hxiIdIZOHSWpwWqAJ0DDR3s=; b=dGuOw5LDY94LLuW8fkyS5CYy2d+74CfBQpCA6Lchj07QnKNkt33Zs53qycNhy0/X7C I9pwkYiYD706K8MdGQbNYSpvxX9LS2GSg0fSOuA5EqTwUMcMH8miOOTWU3zKAW10+g0E mNf+2RbS3HeyNMJRckhLJlXtBP2bWRqlVFuKrte+J8jz/xpsDb8wjn0m+RbboSeX0VMV 4OsryD8I7Ug8X4ME4LBQmWVk1DWf/uPpFiwAnrSkAvMMtYLKnDJyU4EV72Rfh47D0u5W zM+v2eO1w21ePTspxsVRcVD1jYfWvRT+ECVW/Lt+Hig4uWJe0I1wfSEHQXzDhoUqYcpP r8Gg== X-Gm-Message-State: APjAAAVgNTXIyvqc+Jlne2ROoH0lyQU2zJfBase7OuQ2EaSxGRyvN+1S MSzJzMNE1D0LjQtNdfkpQTX2xI5Q/eVL1lrUFptEDA== X-Google-Smtp-Source: APXvYqxjix90NtybU2vbW19hzHyh2eWwXVX+6rZWCUn4kkSrm9jpMo9bIidi0r6av8J55qKGuvHJ+1KF9l/YNWZKBto= X-Received: by 2002:a67:cb12:: with SMTP id b18mr6007921vsl.191.1556227986922; Thu, 25 Apr 2019 14:33:06 -0700 (PDT) MIME-Version: 1.0 References: <1551802205-32188-1-git-send-email-ludovic.Barre@st.com> <1551802205-32188-2-git-send-email-ludovic.Barre@st.com> <30eae958-fd66-96a2-52a2-661c0646a302@st.com> In-Reply-To: <30eae958-fd66-96a2-52a2-661c0646a302@st.com> From: Ulf Hansson Date: Thu, 25 Apr 2019 23:32:30 +0200 Message-ID: Subject: Re: [PATCH 1/4] mmc: mmci: avoid fake busy polling To: Ludovic BARRE X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190425_143308_205986_3D31A9B0 X-CRM114-Status: GOOD ( 33.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: DTML , Alexandre Torgue , "linux-mmc@vger.kernel.org" , Linux Kernel Mailing List , Rob Herring , Srinivas Kandagatla , Maxime Coquelin , linux-stm32@st-md-mailman.stormreply.com, Linux ARM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, 25 Apr 2019 at 16:09, Ludovic BARRE wrote: > > > On 4/25/19 12:08 PM, Ulf Hansson wrote: > > On Thu, 25 Apr 2019 at 11:22, Ludovic BARRE wrote: > >> > >> hi Ulf > >> > >> On 4/23/19 3:39 PM, Ulf Hansson wrote: > >>> On Tue, 5 Mar 2019 at 17:10, Ludovic Barre wrote: > >>>> > >>>> From: Ludovic Barre > >>>> > >>>> The busy status bit could occurred even if no busy response is > >>>> expected (example cmd11). On sdmmc variant, the busy_detect_flag > >>>> reflects inverted value of d0 state, it's sampled at the end of a > >>>> CMD response and a second time 2 clk cycles after the CMD response. > >>>> To avoid a fake busy, the busy status could be checked and polled > >>>> only if the command has RSP_BUSY flag. > >>> > >>> I would appreciate a better explanation of what this patch really changes. > >>> > >>> The above is giving some background to the behavior of sdmmc variant, > >>> but at this point that variant doesn't even have the > >>> ->variant->busy_detect flag set. > >>> > >> > >> Yes, I will try to explain more and focus on common behavior. > >> > >>>> > >>>> Signed-off-by: Ludovic Barre > >>>> --- > >>>> drivers/mmc/host/mmci.c | 19 +++++++++++++------ > >>>> 1 file changed, 13 insertions(+), 6 deletions(-) > >>>> > >>>> diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c > >>>> index 387ff14..4901b73 100644 > >>>> --- a/drivers/mmc/host/mmci.c > >>>> +++ b/drivers/mmc/host/mmci.c > >>>> @@ -1220,12 +1220,13 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd, > >>>> unsigned int status) > >>>> { > >>>> void __iomem *base = host->base; > >>>> - bool sbc; > >>>> + bool sbc, busy_resp; > >>>> > >>>> if (!cmd) > >>>> return; > >>>> > >>>> sbc = (cmd == host->mrq->sbc); > >>>> + busy_resp = !!(cmd->flags & MMC_RSP_BUSY); > >>>> > >>>> /* > >>>> * We need to be one of these interrupts to be considered worth > >>>> @@ -1239,8 +1240,7 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd, > >>>> /* > >>>> * ST Micro variant: handle busy detection. > >>>> */ > >>>> - if (host->variant->busy_detect) { > >>>> - bool busy_resp = !!(cmd->flags & MMC_RSP_BUSY); > >>>> + if (busy_resp && host->variant->busy_detect) { > >>>> > >>>> /* We are busy with a command, return */ > >>>> if (host->busy_status && > >>>> @@ -1253,7 +1253,7 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd, > >>>> * that the special busy status bit is still set before > >>>> * proceeding. > >>>> */ > >>>> - if (!host->busy_status && busy_resp && > >>>> + if (!host->busy_status && > >>>> !(status & (MCI_CMDCRCFAIL|MCI_CMDTIMEOUT)) && > >>>> (readl(base + MMCISTATUS) & host->variant->busy_detect_flag)) { > >>> > >>> All the changes above makes perfect sense to me, but looks more like a > >>> cleanup of the code, rather than actually changing the behavior. > >> > >> yes, few changing (this just avoid to enter in > >> "if (host->variant->busy_detect)") at each time. > >> I could move this part in cleanup patch (before this patch) > > > > Sounds good to me! > > > >> > >>> > >>>> > >>>> @@ -1508,6 +1508,7 @@ static irqreturn_t mmci_irq(int irq, void *dev_id) > >>>> { > >>>> struct mmci_host *host = dev_id; > >>>> u32 status; > >>>> + bool busy_resp; > >>>> int ret = 0; > >>>> > >>>> spin_lock(&host->lock); > >>>> @@ -1550,9 +1551,15 @@ static irqreturn_t mmci_irq(int irq, void *dev_id) > >>>> } > >>>> > >>>> /* > >>>> - * Don't poll for busy completion in irq context. > >>>> + * Don't poll for: > >>>> + * -busy completion in irq context. > >>>> + * -no busy response expected. > >>>> */ > >>>> - if (host->variant->busy_detect && host->busy_status) > >>>> + busy_resp = host->cmd ? > >>>> + !!(host->cmd->flags & MMC_RSP_BUSY) : false; > >>> > >>> This doesn't make sense to me, but I may be missing something. > >>> > >>> host->busy_status is being updated by mmci_cmd_irq() and only when > >>> MMC_RSP_BUSY is set for the command in flight. In other words, > >>> checking for MMC_RSP_BUSY here as well is redundant. No? > >> > >> In mmci_irq the "do while" loops until the status is totally cleared. > >> > >> Today (for variant with busy_detect option), the status busy_detect_flag > >> is excluded only while busy_status period (command with MMC_RSP_BUSY and > >> while busy line is low => "busy_status=1") > >> > >> On SDMMC variant I noticed that busy_detect_flag status could be enabled > >> even if the command is not MMC_RSP_BUSY, for example sdmmc variant stay > >> in loop while cmd11 voltage switch. > > > > Right, I see. > > > >> > >> So I wish extend host->variant->busy_detect_flag exclusion for all > >> commands which is not a MMC_RSP_BUSY. I suppose that other variants > >> could have the same behavior, and else there is no impact, normally. > > > > I am guessing this is because the variant->busy_dpsm_flag has been set > > in the datactrl register, which is needed for mmci_card_busy(). > > > > That said, I am kind of wondering if we ever should need repeat the > > while loop if 'status' contains the bit for > > host->variant->busy_detect_flag. I mean we have already called > > mmci_cmd_irq() to handle it. > > > > So, couldn't we just always do: > > > > if (host->variant->busy_detect_flag) > > status &= ~host->variant->busy_detect_flag; > > > > No? > > yes that make sense, I launched tests on sdmmc and it's ok. > I think, that we could take on this solution. Great! > > If it's ok for you, I resend a series with all modifications. Yes, please do. I haven't reviewed the rest of the series yet, but it may be better to do that when the next version is ready. In either case, I should have some time to run some tests of the next version, if you manage to send it within a couple of days or so. [...] Kind regards Uffe _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel