Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3383175pxu; Mon, 30 Nov 2020 01:38:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJzzM6qKNI13KuPrRKapyMeSs8t9VEIVzQpp2UAfEbLoeeQ4+isu0sy92cSCg6DDU9u0o0pT X-Received: by 2002:a05:6402:491:: with SMTP id k17mr20713881edv.370.1606729128158; Mon, 30 Nov 2020 01:38:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606729128; cv=none; d=google.com; s=arc-20160816; b=wiqejd1O3Otlffe10u8QgWsNoGRIbe4MuNWfmxsW8xsIIIFs7iF8LGujgXbsJ54NIa x8+3ifQ/sbYBAVFwIHEd4JQPIAmERgLFqChdDhzUIlS72BBTLKbLqh4J5nhuhu+oYyA5 rtBhuIbJQwZcE5PuXQbRAlKNZVQLIf009xukJsHwXYg+US/poCUj3MeAv9VHCURx83NQ VvKcFoo5v7hmvXwkFv7WnBnWUbICV8VUn9OjM1RGgkDuyGNuB5+PGbELEdrdU7A5IvBg ErkDm7+DLn1mmUjKFv/1Agffx9kHSovS3gUjJ0zn3PA82nymyupHSI+93un5FVyoe/z5 9fdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=jSAq7d/jtAHqqkZgBg6Yvj4MjbfxkJWvI2lABgxwU8Y=; b=TIOlQij+tOwJHvr/dTvoys3HGlnhbG2msfAcJRg2FnLDtkCjK6EkoDc77V2A1DYdH7 4cUdKg/L50nHO0+KBONecj6sKtl69DYf+KZkzT27quEP+zamiEDV/Rh4JYSyLNsrXc6X 9uYpvspLXoTSF2N6ZrXxx2iK9fIW7sM0xPR4qwaURg6yxGYwE3Lqut3h9Aka753rxvG9 nZaFua/Tuhz6zFsKxSwtjaf1d/1A2t3ccsyEBnmbErPzFDQtQ+LCzd3AbcUybvItGWoL Wrn/45hG/PpUqu6LwO744o6kQgnHq6avaA/u4rUSRPBWxM6WJ4nrUCKnWGmcu9BRTQIO 0rqQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y5si10828252edm.386.2020.11.30.01.38.25; Mon, 30 Nov 2020 01:38:48 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727026AbgK3Jgv (ORCPT + 99 others); Mon, 30 Nov 2020 04:36:51 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:8216 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726298AbgK3Jgv (ORCPT ); Mon, 30 Nov 2020 04:36:51 -0500 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Cl0TM3w6TzkcmW; Mon, 30 Nov 2020 17:35:35 +0800 (CST) Received: from huawei.com (10.69.192.56) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.487.0; Mon, 30 Nov 2020 17:36:00 +0800 From: Luo Jiaxing To: , , , , CC: , , Subject: [PATCH v1] gpio: dwapb: mask/unmask IRQ when disable/enable it Date: Mon, 30 Nov 2020 17:36:19 +0800 Message-ID: <1606728979-44259-1-git-send-email-luojiaxing@huawei.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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