Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6148413ybi; Wed, 29 May 2019 03:38:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQt1QWyzMH3b7XxpBuIE/yQirwy/VCbmejjamD5fd2aAhQjfh80pQli9T1cvHhTiQdIswk X-Received: by 2002:a17:90a:af8d:: with SMTP id w13mr11245097pjq.143.1559126338972; Wed, 29 May 2019 03:38:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559126338; cv=none; d=google.com; s=arc-20160816; b=j5fcFP8fkiaDE4gEIydZrdEv2apozFqbpPxY9940kWYOnT331XhTB89yPF0Rrv2AmB AnGKFHNZF1oYi1XjZYGZPcODor6H7TdO24NvwQkHpbsvmSTLgebto5re/pO38M+yrk5H G4Jekq3ZduVOE+SWtLXHDwa7hlr72+8kArTwWyLJ7fv5n9PzAQML8A5hV19wykKFb6oE h7fctLmu15uKQHV8nrI1ZB9q9d4A2c9UJMAKg5nmMRA6Qns/vHZK/FS9c0RU6qpIZZPv bpBCTVfJMgHCthRApA3Nfopt+QmLnDcJO9YJvQP8OD/WDXnDIYgLWcXvPWqbXbGKq0ht 5sUg== 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=tjnCyAMKOLgkdZookUva/jit8+LoVCiTGzc0TNGq/oA=; b=gFKt/Ub6w1uS9vUjw2BZ2JnCvws8Lqi0kVNDJ1wgz8q2QcAzpCTGiIp3te88hXPpCM sSh3Vn2DzTXlsixnCvD7sgBG6qUc+da++ZPmV+ypxsHOJjCGOaJsdeRL5XEqyTts1iNM uLxirPqPLVyX//J2oNXnAVdMEbY1hL8q5tU8xYYzMv6C6Zs66nMjXUo2jbrPqlSzxI1P U4eXVgGe0OjHlR0a0yGVJhn5PtIOQ9EVZRPUQWGtRg/strhP02WcRYMnQ55B54I/lmLI /jefmarSqsO802NS1KD6fH6z8svFGng09gdqsiV17eQkeDNukVg1+obHT9SokHzD3lMf MPKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wOZ28q0D; 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 q203si24242188pgq.384.2019.05.29.03.38.41; Wed, 29 May 2019 03:38:58 -0700 (PDT) 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=wOZ28q0D; 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 S1726102AbfE2Kh3 (ORCPT + 99 others); Wed, 29 May 2019 06:37:29 -0400 Received: from mail-vs1-f66.google.com ([209.85.217.66]:41040 "EHLO mail-vs1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725990AbfE2Kh3 (ORCPT ); Wed, 29 May 2019 06:37:29 -0400 Received: by mail-vs1-f66.google.com with SMTP id w19so1390475vsw.8 for ; Wed, 29 May 2019 03:37:28 -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=tjnCyAMKOLgkdZookUva/jit8+LoVCiTGzc0TNGq/oA=; b=wOZ28q0Dbsa83UgZEqBAyC7OuWb0kt0Le7tZXn7K4Cvh6Qd+xStSW7Yy8L8potaaWt vCbmGvPV8IcOQ/DvUiQ+adosG5dqCgOU0cxAlWaHwgdAWEQOwpa7mZd3r2dQfTTa/2Xp xfPvIdlyNqkUFyFUY7m71UUGC1xzQFWh/BD7nQZZSeEY2xfK/LMN48ajDbNJGFbWO1VN bLgEW84wPlSshhv5X9kGiTUuNdGdVICyMUMKraO5xgLstqh0aOGGWLQgBSCCB89yzogY Q9AQwpTs7/7RAYNEQnseubioA2ZJ7re36Nw2eitt4gpv7aqrecWSSXkKxIZOQg4hewD7 y3bQ== 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=tjnCyAMKOLgkdZookUva/jit8+LoVCiTGzc0TNGq/oA=; b=eRko2KiUQjrGXt8a0tacNFWe3Tj3Y1zILiA23HkFHghWeMAaL2TcJ2VEbiyLni9SrT Wd3qVP46IMp7LS43XT6AciZyqNtNjBIcI1UVTgz4EYP0Tiu1kP/3mnPkdZN2edS79mrw bAKU7iC+6fUZwFyYxia0wt+Ja5gbZP7I3+zYzEKHnaNgSGbjqDJTPJFHMq1WN77KYHJY KBiBqHW/F6m+fUAfvq0odYdFpyLCDdYj3uLNg8tZFYpFpPGBFXZzQ22bXMPAIx7DoUEv MP7+MBX1m4/EKXDdOoGM7tgEwjdGfKDjGRQ0izRaYE/embv6oYJ9txRP4arvGt3KXvcg 1bKA== X-Gm-Message-State: APjAAAVqqsx0A+eSvXOacIHIEdOZhjtGVePKaXtdQZf2a9dauq8NeT1v JQgPX0YJ0wdh/sOvP/A+2aYOocm3xurdwISP33tUJQ== X-Received: by 2002:a67:fa51:: with SMTP id j17mr38251200vsq.89.1559126247816; Wed, 29 May 2019 03:37:27 -0700 (PDT) MIME-Version: 1.0 References: <1556264798-18540-1-git-send-email-ludovic.Barre@st.com> <1556264798-18540-4-git-send-email-ludovic.Barre@st.com> In-Reply-To: From: Ulf Hansson Date: Wed, 29 May 2019 12:36:50 +0200 Message-ID: Subject: Re: [PATCH V2 3/5] mmc: mmci: fix clear of busy detect status 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, 29 May 2019 at 11:20, Ludovic BARRE wrote: > > hi Ulf > > On 5/27/19 8:17 PM, Ulf Hansson wrote: > > On Fri, 26 Apr 2019 at 09:46, Ludovic Barre wrote: > >> > >> From: Ludovic Barre > >> > >> The "busy_detect_flag" is used to read/clear busy value of > >> mmci status. The "busy_detect_mask" is used to manage busy irq of > >> mmci mask. > >> For sdmmc variant, the 2 properties have not the same offset. > >> To clear the busyd0 status bit, we must add busy detect flag, > >> the mmci mask is not enough. > >> > >> Signed-off-by: Ludovic Barre > > > > Ludovic, again, apologies for the delay. > > > >> --- > >> drivers/mmc/host/mmci.c | 3 ++- > >> 1 file changed, 2 insertions(+), 1 deletion(-) > >> > >> diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c > >> index a040f54..3cd52e8 100644 > >> --- a/drivers/mmc/host/mmci.c > >> +++ b/drivers/mmc/host/mmci.c > >> @@ -1517,7 +1517,8 @@ static irqreturn_t mmci_irq(int irq, void *dev_id) > >> * to make sure that both start and end interrupts are always > >> * cleared one after the other. > >> */ > >> - status &= readl(host->base + MMCIMASK0); > >> + status &= readl(host->base + MMCIMASK0) | > >> + host->variant->busy_detect_flag; > > > > I think this is not entirely correct, because it would mean we check > > for busy even if we haven't unmasked the busy IRQ via the > > variant->busy_detect_mask. > > if the variant is busy_detect false: > => no problem because the busy_detect_flag or busy_detect_mask is not > defined. Right. > > if variant is busy_detect true: > the busy handle is split in 3 steps (see mmci_cmd_irq): > step 1: detection of busy line => unmasked the busy irq end > step 2: in busy wait => ignore cmd irq while current busy flag is > enabled. > step 3: end of busy => clear and mask busy irq > > To detect the first step (see mmci_cmd_irq: which unmasks the busy irq) > we need to know the current busy state. Actually, the status register is > re-read in mmci_cmd_irq, why not used the status read in mmci_irq and in > parameter ? Right, I see your point. On the other hand, that re-read of the status registers should really not be needed. Maybe it's a leftover from my initial version of the code, but in any case we should remove that. > > Regards, > Ludo > > > > > I suggest to store a new bool in the host (call it > > "busy_detect_unmasked" or whatever makes sense to you), to track > > whether we have unmasked the busy IRQ or not. Then take this flag into > > account, before ORing the value of host->variant->busy_detect_flag, > > according to above. > > > >> if (host->variant->busy_detect) > >> writel(status & ~host->variant->busy_detect_mask, > >> host->base + MMCICLEAR); > >> -- > >> 2.7.4 Kind regards Uffe