Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5272621ybl; Tue, 27 Aug 2019 02:01:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqxtL7sSRDUGrh+/O5t/zyIJAV/Z4sJXQfsH06kUcBAWpd4y8tRVpcgPZ0x6Ug2YkIQCyD5E X-Received: by 2002:aa7:8559:: with SMTP id y25mr24532282pfn.260.1566896478505; Tue, 27 Aug 2019 02:01:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566896478; cv=none; d=google.com; s=arc-20160816; b=eFZ3xv8XQX2MKNC5dP3ZF0KtGrMTOl7zCEtVAP+/LHfH8Dq7qbg4nJM2KHgJRC3Xj2 OrOo/kKaKdrME34+AsPI+sMCgnwT7qiRIvAwMqwx8H9zXw8X1PaP8CjvX/EHXwiB840v 3Ui4wKYkPicF0cqe2WXsnCkpkW7xL88kwB8CzfOhTnec6VzkLM8YdJbQG1NZ2tamsJ6y lAcfsXqUJPjUImcr6XI6OhhhkgclpgOQ9esq04Hljw0cDGiKgS+bHStnt76gCSY4Lnop d1mX7CDc5oPuWw75kwC3kPy19j1+1WrgvWIDjprTfyhtoIIXhvOLo+QCjuVt2b2KePhq cxhQ== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GDPLbh2Za9If16kngBr0Vy91wenOeOyR+BDWVi+j/l8=; b=BZ9eF834SMaOCo08MzAISeRV4Wt8FICSifJBmpvYBslXSmPB3HnHMpJK8AZov5/8sZ zGKMN42wuIA3QEFGd57DBvwm7RLRzXXOVPoMsoFYWK9+Q7zWIC45z0km5pTQ91kd54LZ 459yWF17Ww0lQ/t+a2mmW8XSibPp+lQpMT1pIOwW0yHS3t8ioCXupndmA8qIHDaUvYcm xZktkORh09xcoezTsXt+GMI8SdQw58CoQL+IW3YUnIdpRTZPvrCZJXTHDTSSVYK+Gudb S+QJ0px/80SEfJfDRtSTnk0dCW+uxUF28jIX3VbDbr3NYvVZ8U26JZ2lQyO8Nf4gB2sP PxPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@flygoat.com header.s=mail header.b=p7a94URR; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f23si748400plj.241.2019.08.27.02.01.03; Tue, 27 Aug 2019 02:01:18 -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=@flygoat.com header.s=mail header.b=p7a94URR; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729517AbfH0JAI (ORCPT + 99 others); Tue, 27 Aug 2019 05:00:08 -0400 Received: from forward104p.mail.yandex.net ([77.88.28.107]:36079 "EHLO forward104p.mail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726091AbfH0JAI (ORCPT ); Tue, 27 Aug 2019 05:00:08 -0400 X-Greylist: delayed 384 seconds by postgrey-1.27 at vger.kernel.org; Tue, 27 Aug 2019 05:00:05 EDT Received: from mxback6j.mail.yandex.net (mxback6j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10f]) by forward104p.mail.yandex.net (Yandex) with ESMTP id 8CF404B01AEB; Tue, 27 Aug 2019 11:54:41 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback6j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 6wxlYKcOkb-sfpSOoHv; Tue, 27 Aug 2019 11:54:41 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; s=mail; t=1566896081; bh=GDPLbh2Za9If16kngBr0Vy91wenOeOyR+BDWVi+j/l8=; h=In-Reply-To:Subject:To:From:Cc:References:Date:Message-Id; b=p7a94URRoHEenFOSNITq6Ze3C0HzxvW8GZnRtZwTvFIsNDFJkfSLJ+l9/18bk0Y6e 7OYtsru6kk19cutO4I1/s3Cp1Ixud/xrX/T0IvTbA3VNvQyGa0yDiA7zJdOeyMFwW6 F67kC95DNSvlYlK5A5AjIzxx4KlB9kZ61R36WT34= Authentication-Results: mxback6j.mail.yandex.net; dkim=pass header.i=@flygoat.com Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id JOqUfE8LDO-satCj8nx; Tue, 27 Aug 2019 11:54:40 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) From: Jiaxun Yang To: linux-mips@vger.kernel.org Cc: chenhc@lemote.com, paul.burton@mips.com, tglx@linutronix.de, jason@lakedaemon.net, maz@kernel.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, mark.rutland@arm.co, devicetree@vger.kernel.org, Jiaxun Yang Subject: [PATCH 08/13] irqchip: i8259: Add plat-poll support Date: Tue, 27 Aug 2019 16:52:57 +0800 Message-Id: <20190827085302.5197-9-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190827085302.5197-1-jiaxun.yang@flygoat.com> References: <20190827085302.5197-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For some platforms (e.g. Loongson-3), platfrom interrupt controller supports polling interrupt vector from i8259 automaticly and generating sepreated interrupt. Thus we add plat-poll OF property for these platforms and setup sepreated chained interrupt handler. Signed-off-by: Jiaxun Yang --- drivers/irqchip/irq-i8259.c | 47 ++++++++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/drivers/irqchip/irq-i8259.c b/drivers/irqchip/irq-i8259.c index d000870d9b6b..e7a9895f3b2d 100644 --- a/drivers/irqchip/irq-i8259.c +++ b/drivers/irqchip/irq-i8259.c @@ -40,6 +40,12 @@ static void mask_and_ack_8259A(struct irq_data *d); static void init_8259A(int auto_eoi); static int (*i8259_poll)(void) = i8259_irq; +struct plat_poll_priv { + struct irq_domain *domain; + int hwirq; +}; +static struct plat_poll_priv plat_poll_priv[16]; + static struct irq_chip i8259A_chip = { .name = "XT-PIC", .irq_mask = disable_8259A_irq, @@ -346,22 +352,51 @@ static void i8259_irq_dispatch(struct irq_desc *desc) generic_handle_irq(irq); } +static void plat_poll_irq_dispatch(struct irq_desc *desc) +{ + struct plat_poll_priv *priv = irq_desc_get_handler_data(desc); + unsigned int irq; + + irq = irq_linear_revmap(priv->domain, priv->hwirq); + generic_handle_irq(irq); +} + int __init i8259_of_init(struct device_node *node, struct device_node *parent) { struct irq_domain *domain; - unsigned int parent_irq; domain = __init_i8259_irqs(node); - parent_irq = irq_of_parse_and_map(node, 0); - if (!parent_irq) { - pr_err("Failed to map i8259 parent IRQ\n"); - irq_domain_remove(domain); - return -ENODEV; + if (of_find_property(node, "plat-poll", NULL)) { + int i; + + for (i = 0; i < 16; i++) { + int parent_irq = irq_of_parse_and_map(node, i); + + if (!parent_irq) { + pr_err("Failed to map %d plat-poll i8259 parent IRQ\n", i); + irq_domain_remove(domain); + return -ENODEV; + } + plat_poll_priv[i].domain = domain; + plat_poll_priv[i].hwirq = i; + irq_set_chained_handler_and_data(parent_irq, + plat_poll_irq_dispatch, + &plat_poll_priv[i]); + } + } else { + unsigned int parent_irq; + + parent_irq = irq_of_parse_and_map(node, 0); + if (!parent_irq) { + pr_err("Failed to map i8259 parent IRQ\n"); + irq_domain_remove(domain); + return -ENODEV; } irq_set_chained_handler_and_data(parent_irq, i8259_irq_dispatch, domain); + } return 0; } IRQCHIP_DECLARE(i8259, "intel,i8259", i8259_of_init); -- 2.22.0