Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1377756pxu; Sat, 5 Dec 2020 14:01:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJw+VrsMb+du+Vlx53XjIf9jJGk7ZDuJQu0308vtjSNAyvJdavntR4pFoDlAI+vNeZ4dmSiM X-Received: by 2002:a50:b404:: with SMTP id b4mr13661377edh.369.1607205673960; Sat, 05 Dec 2020 14:01:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607205673; cv=none; d=google.com; s=arc-20160816; b=tjNT1ZLeKef85wdk7rrD4ZcrIeB7ZqlYe4qzB7o0GOeIwkBd1nRUtcORcIR/SJlbgU 9A6B6+sBWcYeEXjltsk2Oxcd0ChGVz50cpTdUY+5LO7Zw7NZh21v9HZUsmxYC9ELGXLq MDpWjRwnxDtpjpnJeJctnkm4LoKvzBoqAawX3zPyy2V5KE8IBr9yTVsAae+qfQLLIFo4 z+0maN2OWXxdGFdNxcS3EBGv/hlWOJS9giCvXefSu5J63kaIEHtcxNVxCDOfwwKw8fDH sPgbnga+xltKeu6MZj+Vny/enFJt3um5KnVNzpjwxvsYfaQ8f5vHBu83ouod4M6lYaJC 3s4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=RnPGsL5UhnsbJbtboy0u0w8SIQMnUnd3u3mXFgk0BlA=; b=r3vMc6cHSP60CxwLeN2Q91+adHbBRf3HN4mz1QTmzjYfdjXZ6h+jeBaWmSQ6u8jzMM pXylNFVgj52kbBZNxD+DxJHk+DLz+ZJomyV5KyyjQluZqQ5GkbbQR/tN8qu+iiaWnuu8 YZ/zq5S0B0f9ZL2mTLdX6VpsnXjzznGxri4es0hfudccvuHX+iNJ+2MtQTocwKIEqi9K 8h7lHZfbq8s4AHDKkFV+FEbTDCxv1VgoNRoo1AWpqTLPpMxhQ9O1WAF9x6K1p7oaLVKF bf3c57jEG5qPj+c/oUACbCsezlvkTgCfjdAk4WN8MCMjE7azWiZvwoS5gUhjND+BKGWq wN+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QBDKffSi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id m10si3901047eja.453.2020.12.05.14.00.50; Sat, 05 Dec 2020 14:01:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QBDKffSi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1725933AbgLEV7Q (ORCPT + 99 others); Sat, 5 Dec 2020 16:59:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725601AbgLEV7P (ORCPT ); Sat, 5 Dec 2020 16:59:15 -0500 Received: from mail-lf1-x144.google.com (mail-lf1-x144.google.com [IPv6:2a00:1450:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AA6BC0613CF for ; Sat, 5 Dec 2020 13:58:34 -0800 (PST) Received: by mail-lf1-x144.google.com with SMTP id a9so12665614lfh.2 for ; Sat, 05 Dec 2020 13:58:34 -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=RnPGsL5UhnsbJbtboy0u0w8SIQMnUnd3u3mXFgk0BlA=; b=QBDKffSizXw3Hne63nOrGQEVY1jTsatKuzYz/ZZAe7RQYOSvnIoaJLEzZBzhQ1uI/z 6wVwVDC+RIe487zU3QdIrUBpCk+moQ2SZOImnzjY3LV7XzHads9Mh1f7pykctTONzltR pT8yQiRVAZLzY956t8SsBL3SqhroH2BrbZntifNT+Y0r1Kv+1fG15IM/1h+IWnQzeUdG +Mm3RZajawmJRelq2YD5fxrnRI7fJbj7V6BaVwUyjdBRDtKNHlKy3ad5b52Ff8Z/VY0h 0itvfWPNsAscc/54pl09Yudf/S1Vl2+vsJQJq4QJ2MzqCpjbguoiirONGR85sHpByFkK sabw== 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=RnPGsL5UhnsbJbtboy0u0w8SIQMnUnd3u3mXFgk0BlA=; b=h8x1owk8eTo9Kt6bFbRYGMLx/47kFnYDB+bonodUZU5NTXj4UFsbWeIVDLqknwXvfS oaLfzV7bcZRp2UEyzbpwvxJHOpn7m2mETntObBexdB0/c3o0il4JtxUVkD4CZD6IVG2O y6nn/sFPCJP1Q7KEzUcZmtQJPEJE4aTeOrgRu2T1zIjPndAOMZK9SCH0SgNVZHNMmF0h bDnF0tuePcJvLYZ0wKxj9vzDSmKWvNeBcogj1cBJyKtdK4tFsUHZ33s4ZSU5czGQ+aAj LWpp1Gizqga8K+LArc2dZbJyKKc/AoG+meAqSQP7adJx0spsttoQN8xu0AOpz2Y3G+8a BPUg== X-Gm-Message-State: AOAM530BBKL3LcxukN0gQmQ1Hf2SOq3Q8UhlOK1eOB/XKg3fYTvsTRsj jkFcRIITnaVwCmAzQ8Ei6PXenlChGDhyCBnQRkw2gA== X-Received: by 2002:a05:6512:3e7:: with SMTP id n7mr5356188lfq.585.1607205512973; Sat, 05 Dec 2020 13:58:32 -0800 (PST) MIME-Version: 1.0 References: <1606728979-44259-1-git-send-email-luojiaxing@huawei.com> In-Reply-To: <1606728979-44259-1-git-send-email-luojiaxing@huawei.com> From: Linus Walleij Date: Sat, 5 Dec 2020 22:58:22 +0100 Message-ID: Subject: Re: [PATCH v1] gpio: dwapb: mask/unmask IRQ when disable/enable it To: Luo Jiaxing , Marc Zyngier Cc: Bartosz Golaszewski , Serge Semin , Andy Shevchenko , Andy Shevchenko , "open list:GPIO SUBSYSTEM" , "linux-kernel@vger.kernel.org" , Linuxarm Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sorry for top posting but I need the help of the irqchip maintainer Marc Z to hash this out. The mask/unmask/disable/enable semantics is something that you need to work with every day to understand right. Yours, Linus Walleij On Mon, Nov 30, 2020 at 10:36 AM Luo Jiaxing wrote: > > The mask and unmask registers are not configured in dwapb_irq_enable() and > dwapb_irq_disable(). In the following situations, the IRQ will be masked by > default after the IRQ is enabled: > > mask IRQ -> disable IRQ -> enable IRQ > > In this case, the IRQ status of GPIO controller is inconsistent with it's > irq_data too. For example, in __irq_enable(), IRQD_IRQ_DISABLED and > IRQD_IRQ_MASKED are both clear, but GPIO controller do not perform unmask. > > Signed-off-by: Luo Jiaxing > --- > drivers/gpio/gpio-dwapb.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c > index 2a9046c..ca654eb 100644 > --- a/drivers/gpio/gpio-dwapb.c > +++ b/drivers/gpio/gpio-dwapb.c > @@ -270,6 +270,8 @@ static void dwapb_irq_enable(struct irq_data *d) > u32 val; > > spin_lock_irqsave(&gc->bgpio_lock, flags); > + val = dwapb_read(gpio, GPIO_INTMASK) & ~BIT(irqd_to_hwirq(d)); > + dwapb_write(gpio, GPIO_INTMASK, val); > val = dwapb_read(gpio, GPIO_INTEN); > val |= BIT(irqd_to_hwirq(d)); > dwapb_write(gpio, GPIO_INTEN, val); > @@ -284,6 +286,8 @@ static void dwapb_irq_disable(struct irq_data *d) > u32 val; > > spin_lock_irqsave(&gc->bgpio_lock, flags); > + val = dwapb_read(gpio, GPIO_INTMASK) | BIT(irqd_to_hwirq(d)); > + dwapb_write(gpio, GPIO_INTMASK, val); > val = dwapb_read(gpio, GPIO_INTEN); > val &= ~BIT(irqd_to_hwirq(d)); > dwapb_write(gpio, GPIO_INTEN, val); > -- > 2.7.4 >