Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp149096pxb; Mon, 13 Sep 2021 15:32:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKRaB8Q1whPkeJE+hUtlV4c60OMfALgF5bWMj+0FqGHFLv6KhM01oNnwFYKaQJ776LjExF X-Received: by 2002:a05:6e02:eaf:: with SMTP id u15mr2478381ilj.313.1631572350141; Mon, 13 Sep 2021 15:32:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631572350; cv=none; d=google.com; s=arc-20160816; b=UAgoX5MhB3gMTgLZqFARX4ytXQa5cBVLmWtdNZ9BfrqWcgUTqj8pj1YP8V72L6/phJ EBFXxGkZjxtzqC/tx+zwYtNHd5e5XxcPSK9M7qFIZOVTx9SZdDofbssEyDoKRG1jRCXP kL4cVIFH/2Q9xoSn7ZnwDIxX0/+H+7Y3zbymdF036YFjzcDKKEm3QwNWNIO8O3eJ5a9h sE41351EQA/Fp0O1gCWhPLPUQoS8JPHuFf/4sP6PoWoqBvTEUCFhGhj44RrkFzbgLgZ9 MsW/xNmj7cw/zn+xIf+hfKYFzfKbef9y3bzTi/VPhfd7CF64X1V+emf3trSrNyedZ7XD eWRQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KGIQPY7R0yfYpaAESEftBYBGjvjQXwHztThTUCWYJos=; b=w8c6xHtocvkaOqx8oe2znoX/wZpYZS4AMpCM8qFRPY8zDjx/UVAEQobrk4ThoS8WYi Agzm43tU4mMyIV7abKi0hRMQCj/1ZTMvzFkHmqg7Z5Uu8MN+iKG6ZKSw/26nNqm3UnBd 48w1kBTC3iwXZJ7e7Wjo+1Rvvb3VaQaaSVwfJTnUduFGHEJIrrYn5rP7CsAWZdTKYUOn ey6UdZbsfzxt39gsNGEDhXcZL0p4fj1pB/nfYmC0tX25T0PCa0j5uHJ9g+xTZBV/8kWs MVTrFHouP0VZfWwE30kyAcpp3fpCUBgfZd+5wtPv19aUnJVOhq4cY6j+IF8SOcTRKyb/ vF5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NkRBdBAO; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f22si8734223jam.69.2021.09.13.15.32.18; Mon, 13 Sep 2021 15:32:30 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NkRBdBAO; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343653AbhIMOBG (ORCPT + 99 others); Mon, 13 Sep 2021 10:01:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:48144 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245628AbhIMN5s (ORCPT ); Mon, 13 Sep 2021 09:57:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 55A66619F7; Mon, 13 Sep 2021 13:36:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631540199; bh=xG7jdbEVTdgikYe/GCHx0LOQi5SCpyDAYXBYer+y2NU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NkRBdBAO3aLSM1i9VopS5XTaEKSm/80GLAv8u1L/dPt6YerMI/+yoQwi2GOjH1gQD afB++808dPhrPsK8VMgFumM9xa4lw0H0yBeQoX6bf2GewANVB9uJmrpx7SKZSPmFR0 QbyQSn5AGCwWyKYzEENqzMgyLAzOydx1qbSl+EJM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen Zhu , Huacai Chen , Marc Zyngier , Sasha Levin Subject: [PATCH 5.13 061/300] irqchip/loongson-pch-pic: Improve edge triggered interrupt support Date: Mon, 13 Sep 2021 15:12:02 +0200 Message-Id: <20210913131111.423039333@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131109.253835823@linuxfoundation.org> References: <20210913131109.253835823@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Huacai Chen [ Upstream commit e5dec38ac5d05d17a7110c8045aa101015281e4d ] Edge-triggered mode and level-triggered mode need different handlers, and edge-triggered mode need a specific ack operation. So improve it. Fixes: ef8c01eb64ca6719da449dab0 ("irqchip: Add Loongson PCH PIC controller") Signed-off-by: Chen Zhu Signed-off-by: Huacai Chen Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20210805132216.3539007-1-chenhuacai@loongson.cn Signed-off-by: Sasha Levin --- 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.30.2