lkml.org 
[lkml]   [2020]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@lemote.com>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.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...

\
 
 \ /
  Last update: 2020-03-21 15:15    [W:0.164 / U:0.732 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site