Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Marc Zyngier <marc.zyngier@arm.com>
To: Alban Bedel <albeu@free.fr>
Cc: <linux-mips@linux-mips.org>, Ralf Baechle <ralf@linux-mips.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Jason Cooper <jason@lakedaemon.net>,
	Alexander Couzens <lynxis@fe80.eu>,
	Joel Porquet <joel@porquet.org>,
	"Andrew Bresticker" <abrestic@chromium.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 6/6] MIPS: ath79: irq: Move the CPU IRQ driver to drivers/irqchip
Date: Wed, 20 Jan 2016 12:49:48 +0000	[thread overview]
Message-ID: <20160120124948.6917859f@sofa.wild-wind.fr.eu.org> (raw)
In-Reply-To: <1447788896-15553-7-git-send-email-albeu@free.fr>

On Tue, 17 Nov 2015 20:34:56 +0100
Alban Bedel <albeu@free.fr> wrote:

> Signed-off-by: Alban Bedel <albeu@free.fr>
> ---
>  arch/mips/ath79/irq.c                    | 81 ++------------------------
>  arch/mips/include/asm/mach-ath79/ath79.h |  1 +
>  drivers/irqchip/Makefile                 |  1 +
>  drivers/irqchip/irq-ath79-cpu.c          | 97 ++++++++++++++++++++++++++++++++
>  4 files changed, 105 insertions(+), 75 deletions(-)
>  create mode 100644 drivers/irqchip/irq-ath79-cpu.c
>

[...]
 
> diff --git a/drivers/irqchip/irq-ath79-cpu.c b/drivers/irqchip/irq-ath79-cpu.c
> new file mode 100644
> index 0000000..befe93c
> --- /dev/null
> +++ b/drivers/irqchip/irq-ath79-cpu.c
> @@ -0,0 +1,97 @@
> +/*
> + *  Atheros AR71xx/AR724x/AR913x specific interrupt handling
> + *
> + *  Copyright (C) 2015 Alban Bedel <albeu@free.fr>
> + *  Copyright (C) 2010-2011 Jaiganesh Narayanan <jnarayanan@atheros.com>
> + *  Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
> + *  Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
> + *
> + *  Parts of this file are based on Atheros' 2.6.15/2.6.31 BSP
> + *
> + *  This program is free software; you can redistribute it and/or modify it
> + *  under the terms of the GNU General Public License version 2 as published
> + *  by the Free Software Foundation.
> + */
> +
> +#include <linux/interrupt.h>
> +#include <linux/irqchip.h>
> +#include <linux/of.h>
> +
> +#include <asm/irq_cpu.h>
> +#include <asm/mach-ath79/ath79.h>
> +
> +/*
> + * The IP2/IP3 lines are tied to a PCI/WMAC/USB device. Drivers for
> + * these devices typically allocate coherent DMA memory, however the
> + * DMA controller may still have some unsynchronized data in the FIFO.
> + * Issue a flush in the handlers to ensure that the driver sees
> + * the update.
> + *
> + * This array map the interrupt lines to the DDR write buffer channels.
> + */
> +
> +static unsigned irq_wb_chan[8] = {
> +	-1, -1, -1, -1, -1, -1, -1, -1,
> +};
> +
> +asmlinkage void plat_irq_dispatch(void)
> +{
> +	unsigned long pending;
> +	int irq;
> +
> +	pending = read_c0_status() & read_c0_cause() & ST0_IM;
> +
> +	if (!pending) {
> +		spurious_interrupt();
> +		return;
> +	}
> +
> +	pending >>= CAUSEB_IP;
> +	while (pending) {
> +		irq = fls(pending) - 1;
> +		if (irq < ARRAY_SIZE(irq_wb_chan) && irq_wb_chan[irq] != -1)
> +			ath79_ddr_wb_flush(irq_wb_chan[irq]);
> +		do_IRQ(MIPS_CPU_IRQ_BASE + irq);

I'm rather unfamiliar with the MIPS IRQ handling, but I'm vaguely
surprised by the lack of domain. How do you unsure that the IRQ space
used here doesn't clash with the one created in your "misc" irqchip?

> +		pending &= ~BIT(irq);
> +	}
> +}
> +
> +static int __init ar79_cpu_intc_of_init(
> +	struct device_node *node, struct device_node *parent)
> +{
> +	int err, i, count;
> +
> +	/* Fill the irq_wb_chan table */
> +	count = of_count_phandle_with_args(
> +		node, "qca,ddr-wb-channels", "#qca,ddr-wb-channel-cells");
> +
> +	for (i = 0; i < count; i++) {
> +		struct of_phandle_args args;
> +		u32 irq = i;
> +
> +		of_property_read_u32_index(
> +			node, "qca,ddr-wb-channel-interrupts", i, &irq);
> +		if (irq >= ARRAY_SIZE(irq_wb_chan))
> +			continue;
> +
> +		err = of_parse_phandle_with_args(
> +			node, "qca,ddr-wb-channels",
> +			"#qca,ddr-wb-channel-cells",
> +			i, &args);
> +		if (err)
> +			return err;
> +
> +		irq_wb_chan[irq] = args.args[0];
> +	}
> +
> +	return mips_cpu_irq_of_init(node, parent);
> +}
> +IRQCHIP_DECLARE(ar79_cpu_intc, "qca,ar7100-cpu-intc",
> +		ar79_cpu_intc_of_init);
> +
> +void __init ath79_cpu_irq_init(unsigned irq_wb_chan2, unsigned irq_wb_chan3)
> +{
> +	irq_wb_chan[2] = irq_wb_chan2;
> +	irq_wb_chan[3] = irq_wb_chan3;
> +	mips_cpu_irq_init();
> +}

Thanks,

	M.
-- 
AAAFNRAA

WARNING: multiple messages have this Message-ID (diff)
From: Marc Zyngier <marc.zyngier@arm.com>
To: Alban Bedel <albeu@free.fr>
Cc: linux-mips@linux-mips.org, Ralf Baechle <ralf@linux-mips.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Jason Cooper <jason@lakedaemon.net>,
	Alexander Couzens <lynxis@fe80.eu>,
	Joel Porquet <joel@porquet.org>,
	Andrew Bresticker <abrestic@chromium.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 6/6] MIPS: ath79: irq: Move the CPU IRQ driver to drivers/irqchip
Date: Wed, 20 Jan 2016 12:49:48 +0000	[thread overview]
Message-ID: <20160120124948.6917859f@sofa.wild-wind.fr.eu.org> (raw)
Message-ID: <20160120124948.c1uARQyz2z2s-dxTUm_3mSlN34Qs3qHVYdyqtvgOLVQ@z> (raw)
In-Reply-To: <1447788896-15553-7-git-send-email-albeu@free.fr>

On Tue, 17 Nov 2015 20:34:56 +0100
Alban Bedel <albeu@free.fr> wrote:

> Signed-off-by: Alban Bedel <albeu@free.fr>
> ---
>  arch/mips/ath79/irq.c                    | 81 ++------------------------
>  arch/mips/include/asm/mach-ath79/ath79.h |  1 +
>  drivers/irqchip/Makefile                 |  1 +
>  drivers/irqchip/irq-ath79-cpu.c          | 97 ++++++++++++++++++++++++++++++++
>  4 files changed, 105 insertions(+), 75 deletions(-)
>  create mode 100644 drivers/irqchip/irq-ath79-cpu.c
>

[...]
 
> diff --git a/drivers/irqchip/irq-ath79-cpu.c b/drivers/irqchip/irq-ath79-cpu.c
> new file mode 100644
> index 0000000..befe93c
> --- /dev/null
> +++ b/drivers/irqchip/irq-ath79-cpu.c
> @@ -0,0 +1,97 @@
> +/*
> + *  Atheros AR71xx/AR724x/AR913x specific interrupt handling
> + *
> + *  Copyright (C) 2015 Alban Bedel <albeu@free.fr>
> + *  Copyright (C) 2010-2011 Jaiganesh Narayanan <jnarayanan@atheros.com>
> + *  Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
> + *  Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
> + *
> + *  Parts of this file are based on Atheros' 2.6.15/2.6.31 BSP
> + *
> + *  This program is free software; you can redistribute it and/or modify it
> + *  under the terms of the GNU General Public License version 2 as published
> + *  by the Free Software Foundation.
> + */
> +
> +#include <linux/interrupt.h>
> +#include <linux/irqchip.h>
> +#include <linux/of.h>
> +
> +#include <asm/irq_cpu.h>
> +#include <asm/mach-ath79/ath79.h>
> +
> +/*
> + * The IP2/IP3 lines are tied to a PCI/WMAC/USB device. Drivers for
> + * these devices typically allocate coherent DMA memory, however the
> + * DMA controller may still have some unsynchronized data in the FIFO.
> + * Issue a flush in the handlers to ensure that the driver sees
> + * the update.
> + *
> + * This array map the interrupt lines to the DDR write buffer channels.
> + */
> +
> +static unsigned irq_wb_chan[8] = {
> +	-1, -1, -1, -1, -1, -1, -1, -1,
> +};
> +
> +asmlinkage void plat_irq_dispatch(void)
> +{
> +	unsigned long pending;
> +	int irq;
> +
> +	pending = read_c0_status() & read_c0_cause() & ST0_IM;
> +
> +	if (!pending) {
> +		spurious_interrupt();
> +		return;
> +	}
> +
> +	pending >>= CAUSEB_IP;
> +	while (pending) {
> +		irq = fls(pending) - 1;
> +		if (irq < ARRAY_SIZE(irq_wb_chan) && irq_wb_chan[irq] != -1)
> +			ath79_ddr_wb_flush(irq_wb_chan[irq]);
> +		do_IRQ(MIPS_CPU_IRQ_BASE + irq);

I'm rather unfamiliar with the MIPS IRQ handling, but I'm vaguely
surprised by the lack of domain. How do you unsure that the IRQ space
used here doesn't clash with the one created in your "misc" irqchip?

> +		pending &= ~BIT(irq);
> +	}
> +}
> +
> +static int __init ar79_cpu_intc_of_init(
> +	struct device_node *node, struct device_node *parent)
> +{
> +	int err, i, count;
> +
> +	/* Fill the irq_wb_chan table */
> +	count = of_count_phandle_with_args(
> +		node, "qca,ddr-wb-channels", "#qca,ddr-wb-channel-cells");
> +
> +	for (i = 0; i < count; i++) {
> +		struct of_phandle_args args;
> +		u32 irq = i;
> +
> +		of_property_read_u32_index(
> +			node, "qca,ddr-wb-channel-interrupts", i, &irq);
> +		if (irq >= ARRAY_SIZE(irq_wb_chan))
> +			continue;
> +
> +		err = of_parse_phandle_with_args(
> +			node, "qca,ddr-wb-channels",
> +			"#qca,ddr-wb-channel-cells",
> +			i, &args);
> +		if (err)
> +			return err;
> +
> +		irq_wb_chan[irq] = args.args[0];
> +	}
> +
> +	return mips_cpu_irq_of_init(node, parent);
> +}
> +IRQCHIP_DECLARE(ar79_cpu_intc, "qca,ar7100-cpu-intc",
> +		ar79_cpu_intc_of_init);
> +
> +void __init ath79_cpu_irq_init(unsigned irq_wb_chan2, unsigned irq_wb_chan3)
> +{
> +	irq_wb_chan[2] = irq_wb_chan2;
> +	irq_wb_chan[3] = irq_wb_chan3;
> +	mips_cpu_irq_init();
> +}

Thanks,

	M.
-- 
AAAFNRAA

  reply	other threads:[~2016-01-20 12:50 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-17 19:34 [PATCH 0/6] MIPS: ath79: Move the IRQ drivers to drivers/irqchip Alban Bedel
2015-11-17 19:34 ` [PATCH 1/6] MIPS: ath79: Fix the size of the MISC INTC registers in ar9132.dtsi Alban Bedel
2015-11-17 19:34 ` [PATCH 2/6] MIPS: ath79: irq: Remove useless #ifdef CONFIG_IRQCHIP Alban Bedel
2015-11-17 19:34 ` [PATCH 3/6] MIPS: ath79: irq: Prepare moving the MISC driver to drivers/irqchip Alban Bedel
2015-11-17 19:34 ` [PATCH 4/6] MIPS: ath79: irq: Move " Alban Bedel
2015-11-17 20:03   ` Jason Cooper
2015-11-17 20:06     ` Thomas Gleixner
2015-11-17 20:09       ` Jason Cooper
2015-12-30 13:53   ` Alban
2015-12-30 13:53     ` Alban
2016-01-20  8:15     ` Alban
2016-01-20  8:15       ` Alban
2016-01-20 12:38   ` Marc Zyngier
2016-01-20 12:38     ` Marc Zyngier
2016-01-20 19:51     ` Alban
2016-01-20 19:51       ` Alban
2015-11-17 19:34 ` [PATCH 5/6] MIPS: ath79: Allow using ath79_ddr_wb_flush() from drivers Alban Bedel
2015-11-17 19:34 ` [PATCH 6/6] MIPS: ath79: irq: Move the CPU IRQ driver to drivers/irqchip Alban Bedel
2016-01-20 12:49   ` Marc Zyngier [this message]
2016-01-20 12:49     ` Marc Zyngier
2016-01-20 19:46     ` Alban
2016-01-20 19:46       ` Alban
2016-01-21  8:52       ` Marc Zyngier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160120124948.6917859f@sofa.wild-wind.fr.eu.org \
    --to=marc.zyngier@arm.com \
    --cc=abrestic@chromium.org \
    --cc=albeu@free.fr \
    --cc=jason@lakedaemon.net \
    --cc=joel@porquet.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=lynxis@fe80.eu \
    --cc=ralf@linux-mips.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox