[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f4c009a117a3978e9e98195abcc98c07@kernel.org>
Date: Sat, 21 Mar 2020 14:14:39 +0000
From: Marc Zyngier <maz@...nel.org>
To: Jiaxun Yang <jiaxun.yang@...goat.com>
Cc: linux-mips@...r.kernel.org, Huacai Chen <chenhc@...ote.com>,
Thomas Gleixner <tglx@...utronix.de>,
Jason Cooper <jason@...edaemon.net>,
Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Ralf Baechle <ralf@...ux-mips.org>,
Paul Burton <paulburton@...nel.org>,
Allison Randal <allison@...utok.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org, devicetree@...r.kernel.org
Subject: Re: [PATCH v5 04/11] irqchip: Add driver for Loongson-3
HyperTransport PIC controller
On 2020-03-18 06:20, Jiaxun Yang wrote:
> This controller appeared on Loongson-3 family of chips to receive
> interrupts
> from PCH PIC.
> It is a I8259 with optimized interrupt polling flow. We can poll
> interrupt number
> from HT vector directly but still have to follow standard I8259
> routines to mask,
> unmask and EOI.
>
> Co-developed-by: Huacai Chen <chenhc@...ote.com>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@...goat.com>
>
> ---
> v4-v5:
> Enhancements according to maz's suggestions:
> - Add static for private struct
> - Drop pointless rename
> - Fix DT parse bug
> - Clarifications in comments and commit message
> ---
> arch/mips/include/asm/i8259.h | 1 +
> drivers/irqchip/Kconfig | 10 ++
> drivers/irqchip/Makefile | 1 +
> drivers/irqchip/irq-loongson-htpic.c | 149 +++++++++++++++++++++++++++
> 4 files changed, 161 insertions(+)
> create mode 100644 drivers/irqchip/irq-loongson-htpic.c
[...]
> +int __init htpic_of_init(struct device_node *node, struct device_node
> *parent)
> +{
> + unsigned int parent_irq[4];
> + int i, err;
> + int num_parents = 0;
> +
> + if (htpic) {
> + pr_err("loongson-htpic: Only one HTPIC is allowed in the system\n");
> + return -ENODEV;
> + }
> +
> + htpic = kzalloc(sizeof(*htpic), GFP_KERNEL);
> + if (!htpic) {
> + err = -ENOMEM;
> + goto out_free;
> + }
> +
> + htpic->base = of_iomap(node, 0);
> + if (!htpic->base) {
> + err = -ENODEV;
> + goto out_free;
> + }
> +
> + htpic->domain = __init_i8259_irqs(node);
> + if (!htpic->domain) {
> + pr_err("loongson-htpic: Failed to initialize i8259 IRQs\n");
> + err = -ENOMEM;
> + goto out_iounmap;
> + }
> +
> + /* Interrupt may come from any of the 4 interrupt line */
> + for (i = 0; i < HTPIC_MAX_PARENT_IRQ; i++) {
> + parent_irq[i] = irq_of_parse_and_map(node, i);
> + if (parent_irq[i] < 0)
irq_of_parse_and_map() returns 0 when there is no interrupt to be
mapped. You should probably test for that too.
Thanks,
M.
--
Jazz is not dead. It just smells funny...
Powered by blists - more mailing lists