Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6072869ybi; Wed, 29 May 2019 02:23:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqzpI0QZmCct8Sfa7HCuqpAvSWhkXCvYfuQ8Alo+4QWpRka1LYykEu7aFGThU9AUo7G61nmO X-Received: by 2002:a62:5244:: with SMTP id g65mr25731163pfb.237.1559121825267; Wed, 29 May 2019 02:23:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559121825; cv=none; d=google.com; s=arc-20160816; b=AoItX3bTncPs70dRmRXi3BfKLCuDGPnJ7H6I/tv8I9C10N6bhDfv2C9NivTSbTfUmj jlFDOP4niKPZLJWenPyL8WKSKgG4/bTj4itS2ZTSytkpw2d+rAvYZBt0F/RO2R8GxQ1x 3gWGSUm8xwVqbAeCMi8MQE5ncNXQWFjgLMrJvHBpisUzucFPt0nk2G8kejb3Uzjyw+Ks eRApTbBmps14zn1WrPXN4LBEznnynNYfCuDakaSCmwz7c+QjBHL20GPZENF6TKhnBjt9 z9fagxODk7qhsdeNug+GYMa1J1pfeuqzUnrKhiXDQzUUhcjRQiAXsiS3TMyXMHBfEw9k sh+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=OqzTfdhqia5TW2akazmwmN49UNTjwbfJGUFpC1QJyQ8=; b=XVzXh+h8E6vM2opTSe3Vji0bsHiIFBnpR4M9nBYvAie/gmCKLA4OFMv0RnyNXaT7O0 YUli7GaGp5mvGGueM/E2cHBteVTmgmPsxSq29yYHy2ZNsTbIosXdKoQO88HqKpcbjNKW OOS+QVsWsMF7wttZqwo46yAss8zgN/ArS64JLxJzq/8Rj4/8m0BpY2TVTMKksGhUuyEl vma8yCXbgC09LkKGDn9iVYD3nohKYDlGlEEGjRYVdiu1PeR7fi5O6IUU5keO9PG2f2QW xr1VoWiYfnqbnBso8j3SZ69swBZeVxSOmMfLGJIstyAdPKI/29SwLG8LfehOo0bf73/H Uuhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b="tD/8cwXr"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n1si24760644pgh.584.2019.05.29.02.23.28; Wed, 29 May 2019 02:23:45 -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=@st.com header.s=STMicroelectronics header.b="tD/8cwXr"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726841AbfE2JVA (ORCPT + 99 others); Wed, 29 May 2019 05:21:00 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:50344 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725874AbfE2JVA (ORCPT ); Wed, 29 May 2019 05:21:00 -0400 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x4T9HJmV011994; Wed, 29 May 2019 11:20:48 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=STMicroelectronics; bh=OqzTfdhqia5TW2akazmwmN49UNTjwbfJGUFpC1QJyQ8=; b=tD/8cwXryQRpID8VESzInftZqx7l0uVgJd4LEML5K4zgD/y6L5XdDdIjvve50czGN4rF KZnV8l4i1lGf4gjH4Uz1cAxqal0oW4PGraXIy++Ux0wjL5NuD6/ox37iWSR/a7IdtAIr lXW+GYKSs3vSeCUurICVquKOMb+Dl7uvsMLMvwOjYtFY5lRkINATZZ8aaFovaryuBNSN Nb0jWQBmuccXkGI0FF+utl82sPZUs/n64/dqohbx7I81f/e/IPNb3Nj5ObNW0uKEzmUN 81d/rU6Wbb/03MBMOQJ+12abw3m0FmS+HI8zYEhEWv/5icVLDyKFQcIe6pgf0icUka2K 5A== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2spvkh6hn7-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 29 May 2019 11:20:48 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id A1C7C34; Wed, 29 May 2019 09:20:43 +0000 (GMT) Received: from Webmail-eu.st.com (sfhdag6node1.st.com [10.75.127.16]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 7AE9D2653; Wed, 29 May 2019 09:20:43 +0000 (GMT) Received: from [10.48.0.237] (10.75.127.46) by SFHDAG6NODE1.st.com (10.75.127.16) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Wed, 29 May 2019 11:20:42 +0200 Subject: Re: [PATCH V2 3/5] mmc: mmci: fix clear of busy detect status To: Ulf Hansson CC: Rob Herring , Srinivas Kandagatla , Maxime Coquelin , Alexandre Torgue , Linux ARM , Linux Kernel Mailing List , DTML , "linux-mmc@vger.kernel.org" , References: <1556264798-18540-1-git-send-email-ludovic.Barre@st.com> <1556264798-18540-4-git-send-email-ludovic.Barre@st.com> From: Ludovic BARRE Message-ID: Date: Wed, 29 May 2019 11:20:42 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.75.127.46] X-ClientProxiedBy: SFHDAG4NODE2.st.com (10.75.127.11) To SFHDAG6NODE1.st.com (10.75.127.16) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-05-29_05:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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 ? 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 >