Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp3966933imb; Wed, 6 Mar 2019 01:51:58 -0800 (PST) X-Google-Smtp-Source: APXvYqz+cwtb5sKrrTVLdothWzhYoo9Edwh9ugYoGJR7riQel/ZfaAydqiZqooZV8MccaaYOgwei X-Received: by 2002:a17:902:f096:: with SMTP id go22mr5857591plb.172.1551865918065; Wed, 06 Mar 2019 01:51:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551865918; cv=none; d=google.com; s=arc-20160816; b=XMfz2uiqQDebssX225LCZUsk1cHyHqhZKoK2F+LbfGlKN0JGsuYbMSvzbTD+o1wpZ+ sIubdsNenvcAVMwB2PcdNcZJcfz1VoyUmzln0QNSObF3nqHWEoJQEAlW7NJuPCMFUbhO g9kuOujn/iU/fB5+sJgcEFyhfSh82WKobd2r39RFcP0qwWMelEMLTTs6q1G+kjP9XgwI VcWccQB71WM3/OuV4B9FGPiVmcf6WM/PtZMlgFkwohOHJzPG+XI5DBgIqctdfHIj5qI+ okNINsxf+7RzzSvSPi6v+THFGoItvh7ZMKsbenkHboJWIkNbt1OAv36tgiZW9Bjy7X58 dG9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=nYGx/05f3pFj8L/hPCABZq2kRoRRjtRTmW249CzO1a8=; b=a19vJGZbvpBPLVUSxgCASpXJqv9Ri1nzX6Iv8gkIMe3u5ExKWYpcPnLs6xysGNdOGX QH6jDnYQqiViFzeM+Cytw5u4MgWOQ2sGY+Tf6HenmG2m/3W1+0esS3zOutp/0l4mLkMO r1YXjj5Svc7619zpSIvA6StZpaK5p9+3Fy/ozmK8c4G4xnreW9LwQRZQO2vtz5ArPkfQ Xbug63J3UUwS/viGDUDlninXOS0mI2E+MiRO+pnd5LtyGkLphGW47SBFKlaQhSfCHxJr 0aoli5UH4Fj3FOUEMyh4XSxDCTyKUXr70eZkW1ClTiFm9pxxjse875Qt8rMYn3/eHkaH sCPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hEY6t285; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r203si1037086pgr.517.2019.03.06.01.51.42; Wed, 06 Mar 2019 01:51:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hEY6t285; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729856AbfCFJuP (ORCPT + 99 others); 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-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 > >>