Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4303704pxv; Mon, 5 Jul 2021 20:10:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPB1l1FMIJmWWtEJeoGGU2Daa3mEx4U4Qj9e9ivGnaIUFT7mmpQilU48Duv/71YYrQ2ctU X-Received: by 2002:a17:907:7249:: with SMTP id ds9mr1319119ejc.179.1625541048585; Mon, 05 Jul 2021 20:10:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625541048; cv=none; d=google.com; s=arc-20160816; b=dUoqdelXjFqT03EQMESLciLTfdbqi1PMYb/eVKjOdnk/uY5fa4yrvkNnW0krqU9IZb 4qR10LyuGf6wkyEgXOkqIjwm+Nv1QUqR9uyuQagmL++sjrVtF+AtcB0tPa4ZMI7TqsE7 Xo7gafGchRO6gtGXvst3rAo0zV+4qn7ZPhA8knQ2DYjdNWRIKWf5Vng48xpYDkx6KxQK LlHBvTjMMANj0mo0yFGZ+mB9CotgMTQMpmr1QZAxQUk84gazijjKhhcjDXMRI3nLSUNh ZSagijCBZel5FxWJUWgdX+QkhiNZj+lHidDQAybOErP4uO8mQsf81RQ1jvNmWRphMA6H piQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=bi7jFWE7EDg3Fp9pN+NzD2u8cU1ARO5WKjknfNt8Kh8=; b=iE8ld4U7oso+Wt2BJBYDXKmsZlhq/CuiqLjm5OEF6LypDqfDqxO0rZ1glgqAj4LQgD 43WWzsJ3ZXPXcyjn2msZJ23I2xwa0AiQEKvS87j2vLQp2xaQyW6He/olEHLkJyq+nBEW /TN0ay4AozSqXb2CFlSpxUZKvq9rtRGG6p9Q4/cfD3SpLBxo5aT/kQNnsmcO5wasx83i SMwS77AOG6UbaT7RY4AeruenSsk2eYYuZGmMvOCAXho2o1k9TTBevlMfDF3jH6vvfkeV GeF+joUHpjpp2teZ2wD/o05BdBDnhlEdF94KKnBeF1Vknmfp7OtOLZJCmZPcATxjIcVU fQRg== 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 b10si4455555edx.143.2021.07.05.20.10.26; Mon, 05 Jul 2021 20:10:48 -0700 (PDT) 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 S229942AbhGFDLy (ORCPT + 99 others); Mon, 5 Jul 2021 23:11:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:39672 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229827AbhGFDLw (ORCPT ); Mon, 5 Jul 2021 23:11:52 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A7CC26197E; Tue, 6 Jul 2021 03:09:11 +0000 (UTC) From: Huacai Chen To: Thomas Gleixner , Marc Zyngier Cc: linux-kernel@vger.kernel.org, Xuefeng Li , Huacai Chen , Jiaxun Yang , Huacai Chen , Chen Zhu Subject: [PATCH 2/9] irqchip/loongson-pch-pic: Improve edge triggered interrupt support Date: Tue, 6 Jul 2021 11:08:57 +0800 Message-Id: <20210706030904.1411775-3-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210706030904.1411775-1-chenhuacai@loongson.cn> References: <20210706030904.1411775-1-chenhuacai@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Edge-triggered mode and level-triggered mode need different handlers, and edge-triggered mode need a specific ack operation. So improve it. Signed-off-by: Chen Zhu Signed-off-by: Huacai Chen --- drivers/irqchip/irq-loongson-pch-pic.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-loongson-pch-pic.c b/drivers/irqchip/irq-loongson-pch-pic.c index f790ca6d78aa..a4eb8a2181c7 100644 --- a/drivers/irqchip/irq-loongson-pch-pic.c +++ b/drivers/irqchip/irq-loongson-pch-pic.c @@ -92,18 +92,22 @@ static int pch_pic_set_type(struct irq_data *d, unsigned int type) case IRQ_TYPE_EDGE_RISING: pch_pic_bitset(priv, PCH_PIC_EDGE, d->hwirq); pch_pic_bitclr(priv, PCH_PIC_POL, d->hwirq); + irq_set_handler_locked(d, handle_edge_irq); break; case IRQ_TYPE_EDGE_FALLING: pch_pic_bitset(priv, PCH_PIC_EDGE, d->hwirq); pch_pic_bitset(priv, PCH_PIC_POL, d->hwirq); + irq_set_handler_locked(d, handle_edge_irq); break; case IRQ_TYPE_LEVEL_HIGH: pch_pic_bitclr(priv, PCH_PIC_EDGE, d->hwirq); pch_pic_bitclr(priv, PCH_PIC_POL, d->hwirq); + irq_set_handler_locked(d, handle_level_irq); break; case IRQ_TYPE_LEVEL_LOW: pch_pic_bitclr(priv, PCH_PIC_EDGE, d->hwirq); pch_pic_bitset(priv, PCH_PIC_POL, d->hwirq); + irq_set_handler_locked(d, handle_level_irq); break; default: ret = -EINVAL; @@ -113,11 +117,24 @@ static int pch_pic_set_type(struct irq_data *d, unsigned int type) return ret; } +static void pch_pic_ack_irq(struct irq_data *d) +{ + unsigned int reg; + struct pch_pic *priv = irq_data_get_irq_chip_data(d); + + reg = readl(priv->base + PCH_PIC_EDGE + PIC_REG_IDX(d->hwirq) * 4); + if (reg & BIT(PIC_REG_BIT(d->hwirq))) { + writel(BIT(PIC_REG_BIT(d->hwirq)), + priv->base + PCH_PIC_CLR + PIC_REG_IDX(d->hwirq) * 4); + } + irq_chip_ack_parent(d); +} + static struct irq_chip pch_pic_irq_chip = { .name = "PCH PIC", .irq_mask = pch_pic_mask_irq, .irq_unmask = pch_pic_unmask_irq, - .irq_ack = irq_chip_ack_parent, + .irq_ack = pch_pic_ack_irq, .irq_set_affinity = irq_chip_set_affinity_parent, .irq_set_type = pch_pic_set_type, }; -- 2.27.0