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 AEEC6C43381 for ; Wed, 6 Mar 2019 09:50:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7D0B420661 for ; Wed, 6 Mar 2019 09:50:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="hEY6t285" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729860AbfCFJuP (ORCPT ); Wed, 6 Mar 2019 04:50:15 -0500 Received: from mail-vs1-f66.google.com ([209.85.217.66]:34320 "EHLO mail-vs1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728866AbfCFJuP (ORCPT ); Wed, 6 Mar 2019 04:50:15 -0500 Received: by mail-vs1-f66.google.com with SMTP id h7so1827374vsl.1 for ; Wed, 06 Mar 2019 01:50:13 -0800 (PST) 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=nYGx/05f3pFj8L/hPCABZq2kRoRRjtRTmW249CzO1a8=; b=hEY6t285cP6ZBHUnL86m4ynB3V84L9yvKoc7WMeCHBIP3mXp++gC0Ab2wbm2Iik1Fq g+2VBV2FICDs/uzBB/EMJyYHi5c4ZJobD6xmpy2L8igyAGc36Qzj6gbvJL6rBWRwxhtC QKdeqhtckBe0gE6NimDqZf77mCbadJvsQ7uafJCFe47q9B1XV5JqFqwnmt9k5zBCaH+l 7Iblf9ohGTP8FDzIAPuYP47G06pEQBkNCduP2UHFSV/Id7dxOllwR4dcLHYOB9ddoQsb rws5/VXpnVlWUu3o0SLlGuAn7ObdUtHOz9Mb8V5aPrD0TxT9kdOuVUt3seINkDlwnygu NRBQ== 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=nYGx/05f3pFj8L/hPCABZq2kRoRRjtRTmW249CzO1a8=; b=D2Veko7f1WoFnIoDMlG6lNgULUww/ukjZ8VMUPvPmh/WFNM+bfjkVld4iW/fh4o2Oj dqX3GF1hET/sh5vzQrycXjFtgM1enYTcdkQNBK+ycoNkP3h4or2bYgD8zO04PAX8iRZN 2Hq5488wnZgH1UByl69RHKuzuIlEFG9TcmQXJT6KwOeyoLBJILEDIlNp34VMtI9VEXnO h3WRDPDxvrAVzGvgXIh2xzs9L1dLu1z7zDK0WiiEynWK74OPDGhkMID8hVT7V7t08/wp sgPRhnoUQbwuq4hY3GHBWy8ZZ5wsEQ1/GecDWqD75fX4SmpazBDBFGU4BaHkD/NCyEwf Rk3Q== X-Gm-Message-State: APjAAAVKnq4ko4CtCc65dR/bs0UAkNQEuB3IRqx8FtMTy4jz53nIWf/Y Qxb/xbie6OMep+a/eIMPEQKjeKnf0U+ME2dehoJkNF3c X-Google-Smtp-Source: APXvYqymp7qOtk2IkJLycAhfxwi8OB9/yojc0tLyue9/RGEtDKSMKStNYcU8Sua5FGQgrMSaNoJzIeVh5CeukxAzymQ= X-Received: by 2002:a67:768f:: with SMTP id r137mr3384762vsc.35.1551865813425; Wed, 06 Mar 2019 01:50:13 -0800 (PST) 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> <5b531f55-b8a0-5a83-4a7c-727013a66820@st.com> In-Reply-To: <5b531f55-b8a0-5a83-4a7c-727013a66820@st.com> From: Ulf Hansson Date: Wed, 6 Mar 2019 10:49:37 +0100 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 Wed, 6 Mar 2019 at 10:04, Ludovic BARRE wrote: > > Hi Ulf > > On 3/6/19 10:00 AM, 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. > >> > >> Signed-off-by: Ludovic Barre > > > > Before I review this, can you tell what HW you have tested this on? > > I tested on stm32mp157c (stm32_sdmmc variant) Okay, I see. So we need to get this tested for the ux500v2 variant as well. I try to get some time to do that, soon. However it seems like you could benefit from having one of those boards yourself. It would speed up the process, as you wouldn't have to rely on me doing the test. :-) Is there a chance of you could dig up some of these old boards from somewhere? Kind regards Uffe > > > > > Kind regards > > Uffe > > > >> --- > >> 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)) { > >> > >> @@ -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; > >> + > >> + if (host->variant->busy_detect && > >> + (!busy_resp || host->busy_status)) > >> status &= ~host->variant->busy_detect_flag; > >> > >> ret = 1; > >> -- > >> 2.7.4 > >> 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 15332C43381 for ; Wed, 6 Mar 2019 09:50:22 +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 D9BD820661 for ; Wed, 6 Mar 2019 09:50:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="exTBeyVm"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="hEY6t285" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D9BD820661 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=GAANwX6zcjVyG40FdJAjRNouhk5vy4hpG/YobT30GWE=; b=exTBeyVmxfg3dD YGCVsPhgYkr/rdMFMqOBmLXq+ON9cBc6sya+UOXDU1aMy5lhtjhvGa+ifWv+fNTRZjmZsl/Ts/Wgs grdMucHxXz0TpHYTpsnl5DOD3mrzB2TFyS9pCuZpbtWpA7OURgoFuOBtHfr5UcUfbggzk1jwgF6Qc MokiVwKaSNkvuRXAsjKtpQCmnzRAxZs8/YHpvuDIKoi8QVmEX/rMit8KbHU4PtkpZyX/IshST7WVg 7606hvK53iT54VFen7wHU16NDFuMSg6U7O93Vr7LwSqVARilQFGUyjFLCf4G6yML79pb5/tV6hxw4 5gdXFD/C1JgA/TGnzc3Q==; 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 1h1TBq-0003Vc-5f; Wed, 06 Mar 2019 09:50:18 +0000 Received: from mail-vs1-xe44.google.com ([2607:f8b0:4864:20::e44]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h1TBm-0003US-JG for linux-arm-kernel@lists.infradead.org; Wed, 06 Mar 2019 09:50:16 +0000 Received: by mail-vs1-xe44.google.com with SMTP id i15so1831911vsd.10 for ; Wed, 06 Mar 2019 01:50:14 -0800 (PST) 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=nYGx/05f3pFj8L/hPCABZq2kRoRRjtRTmW249CzO1a8=; b=hEY6t285cP6ZBHUnL86m4ynB3V84L9yvKoc7WMeCHBIP3mXp++gC0Ab2wbm2Iik1Fq g+2VBV2FICDs/uzBB/EMJyYHi5c4ZJobD6xmpy2L8igyAGc36Qzj6gbvJL6rBWRwxhtC QKdeqhtckBe0gE6NimDqZf77mCbadJvsQ7uafJCFe47q9B1XV5JqFqwnmt9k5zBCaH+l 7Iblf9ohGTP8FDzIAPuYP47G06pEQBkNCduP2UHFSV/Id7dxOllwR4dcLHYOB9ddoQsb rws5/VXpnVlWUu3o0SLlGuAn7ObdUtHOz9Mb8V5aPrD0TxT9kdOuVUt3seINkDlwnygu NRBQ== 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=nYGx/05f3pFj8L/hPCABZq2kRoRRjtRTmW249CzO1a8=; b=e6OIhNqX2GXyWOgVgYqMPNr2MHlTgtne+re3vZBcZmzNKl16OHew17ocGFkely4Br3 hzvVP/N7fDCCIRHKewM93yrOSshWA22MAvgbDlTRJvhai8LSgr2FdV6lgyLsm27ZZVrf P7glXpjzgpKZz23pbkdoArNQz6wp9cLj/n8ejNd99XeQCeD7H6Vg7HNrQX4wE0LBIR8A yslr75e0c85pctvQENkSRJicvsgV6Zq8IBaO1GPa9QmpTQQGbDQo/mAyq47ZZaDGODQM 4hE/uylMTziEyHRBmFc3rPvQNwSzZZz7v3jFEkdAZ3cW2tkS28VtjE+dIhxdOGaDwCWh sSHA== X-Gm-Message-State: APjAAAUZzPnUCDKg0Gq7xKr+m8rBK6Bx+j8Qk7FFGGqh5//LIqQZoNcT 1MkKYfcheIBL51K7I6xa7h4vLHsmE6iNrIapdMlPUg== X-Google-Smtp-Source: APXvYqymp7qOtk2IkJLycAhfxwi8OB9/yojc0tLyue9/RGEtDKSMKStNYcU8Sua5FGQgrMSaNoJzIeVh5CeukxAzymQ= X-Received: by 2002:a67:768f:: with SMTP id r137mr3384762vsc.35.1551865813425; Wed, 06 Mar 2019 01:50:13 -0800 (PST) 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> <5b531f55-b8a0-5a83-4a7c-727013a66820@st.com> In-Reply-To: <5b531f55-b8a0-5a83-4a7c-727013a66820@st.com> From: Ulf Hansson Date: Wed, 6 Mar 2019 10:49:37 +0100 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-20190306_015014_792905_BCC7B25F X-CRM114-Status: GOOD ( 24.15 ) 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 Wed, 6 Mar 2019 at 10:04, Ludovic BARRE wrote: > > Hi Ulf > > On 3/6/19 10:00 AM, 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. > >> > >> Signed-off-by: Ludovic Barre > > > > Before I review this, can you tell what HW you have tested this on? > > I tested on stm32mp157c (stm32_sdmmc variant) Okay, I see. So we need to get this tested for the ux500v2 variant as well. I try to get some time to do that, soon. However it seems like you could benefit from having one of those boards yourself. It would speed up the process, as you wouldn't have to rely on me doing the test. :-) Is there a chance of you could dig up some of these old boards from somewhere? Kind regards Uffe > > > > > Kind regards > > Uffe > > > >> --- > >> 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)) { > >> > >> @@ -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; > >> + > >> + if (host->variant->busy_detect && > >> + (!busy_resp || host->busy_status)) > >> status &= ~host->variant->busy_detect_flag; > >> > >> ret = 1; > >> -- > >> 2.7.4 > >> _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel