From: Ralf Baechle <ralf@linux-mips.org>
To: Binbin Zhou <zhoubb@lemote.com>, Thomas Gleixner <tglx@linutronix.de>
Cc: John Crispin <john@phrozen.org>,
"Steven J . Hill" <Steven.Hill@imgtec.com>,
linux-mips@linux-mips.org, Fuxin Zhang <zhangfx@lemote.com>,
Zhangjin Wu <wuzhangjin@gmail.com>,
Kelvin Cheung <keguang.zhang@gmail.com>,
Chunbo Cui <cuicb@lemote.com>, Huacai Chen <chenhc@lemote.com>
Subject: Re: [PATCH v3 6/8] MIPS: Loongson-1A: Add IRQ type setting support
Date: Mon, 4 Apr 2016 09:15:36 +0200 [thread overview]
Message-ID: <20160404071536.GC13706@linux-mips.org> (raw)
In-Reply-To: <1456793296-17120-7-git-send-email-zhoubb@lemote.com>
Please consider moving this to drivers/irqchip/.
Ralf
On Tue, Mar 01, 2016 at 08:48:14AM +0800, Binbin Zhou wrote:
> Date: Tue, 1 Mar 2016 08:48:14 +0800
> From: Binbin Zhou <zhoubb@lemote.com>
> To: Ralf Baechle <ralf@linux-mips.org>
> Cc: John Crispin <john@phrozen.org>, "Steven J . Hill"
> <Steven.Hill@imgtec.com>, linux-mips@linux-mips.org, Fuxin Zhang
> <zhangfx@lemote.com>, Zhangjin Wu <wuzhangjin@gmail.com>, Kelvin Cheung
> <keguang.zhang@gmail.com>, Binbin Zhou <zhoubb@lemote.com>, Chunbo Cui
> <cuicb@lemote.com>, Huacai Chen <chenhc@lemote.com>
> Subject: [PATCH v3 6/8] MIPS: Loongson-1A: Add IRQ type setting support
>
> Loongson 1A's INT controller support two different interrupt trigger mode:
> level trigger and edge trigger.
>
> Whether the INT controller stores the external interrupts is
> the difference between them.
> The edge trigger should do this, and operate INT_CLR register
> to clear the CPU interrupt state.
>
> Signed-off-by: Chunbo Cui <cuicb@lemote.com>
> Signed-off-by: Binbin Zhou <zhoubb@lemote.com>
> Signed-off-by: Huacai Chen <chenhc@lemote.com>
> ---
> arch/mips/loongson32/common/irq.c | 46 +++++++++++++++++++++++++++++++++++++++
> 1 file changed, 46 insertions(+)
>
> diff --git a/arch/mips/loongson32/common/irq.c b/arch/mips/loongson32/common/irq.c
> index 455a770..01e8cb9 100644
> --- a/arch/mips/loongson32/common/irq.c
> +++ b/arch/mips/loongson32/common/irq.c
> @@ -62,12 +62,57 @@ static void ls1x_irq_unmask(struct irq_data *d)
> | (1 << bit), LS1X_INTC_INTIEN(n));
> }
>
> +static int ls1x_irq_set_type(struct irq_data *data, unsigned int flow_type)
> +{
> + unsigned int bit = (data->irq - LS1X_IRQ_BASE) & 0x1f;
> + unsigned int n = (data->irq - LS1X_IRQ_BASE) >> 5;
> +
> + if (flow_type & IRQ_TYPE_EDGE_BOTH) {
> + if ((flow_type & IRQ_TYPE_EDGE_BOTH) == IRQ_TYPE_EDGE_BOTH) {
> + pr_info("ls1x irq don't support both rising and falling\n");
> + return -1;
> + }
> + ls1x_writel(ls1x_readl(LS1X_INTC_INTCLR(n))
> + | (1 << bit), LS1X_INTC_INTCLR(n));
> + if (flow_type & IRQ_TYPE_EDGE_RISING)
> + ls1x_writel(ls1x_readl(LS1X_INTC_INTPOL(n))
> + | (1 << bit), LS1X_INTC_INTPOL(n));
> + else
> + ls1x_writel(ls1x_readl(LS1X_INTC_INTPOL(n))
> + & ~(1 << bit), LS1X_INTC_INTPOL(n));
> +
> + ls1x_writel(ls1x_readl(LS1X_INTC_INTEDGE(n))
> + | (1 << bit), LS1X_INTC_INTEDGE(n));
> + ls1x_writel(ls1x_readl(LS1X_INTC_INTIEN(n))
> + | (1 << bit), LS1X_INTC_INTIEN(n));
> + irq_set_handler_locked(data, handle_edge_irq);
> + } else if (flow_type && IRQ_TYPE_LEVEL_MASK) {
> + ls1x_writel(ls1x_readl(LS1X_INTC_INTCLR(n))
> + | (1 << bit), LS1X_INTC_INTCLR(n));
> + if (flow_type & IRQ_TYPE_LEVEL_HIGH)
> + ls1x_writel(ls1x_readl(LS1X_INTC_INTPOL(n))
> + | (1 << bit), LS1X_INTC_INTPOL(n));
> + else if (flow_type & IRQ_TYPE_LEVEL_LOW)
> + ls1x_writel(ls1x_readl(LS1X_INTC_INTPOL(n))
> + & ~(1 << bit), LS1X_INTC_INTPOL(n));
> +
> + ls1x_writel(ls1x_readl(LS1X_INTC_INTEDGE(n))
> + & ~(1 << bit), LS1X_INTC_INTEDGE(n));
> + ls1x_writel(ls1x_readl(LS1X_INTC_INTIEN(n))
> + | (1 << bit), LS1X_INTC_INTIEN(n));
> + irq_set_handler_locked(data, handle_level_irq);
> + }
> +
> + return IRQ_SET_MASK_OK;
> +}
> +
> static struct irq_chip ls1x_irq_chip = {
> .name = "LS1X-INTC",
> .irq_ack = ls1x_irq_ack,
> .irq_mask = ls1x_irq_mask,
> .irq_mask_ack = ls1x_irq_mask_ack,
> .irq_unmask = ls1x_irq_unmask,
> + .irq_set_type = ls1x_irq_set_type,
> };
>
> static void ls1x_irq_dispatch(int n)
> @@ -138,6 +183,7 @@ static void __init ls1x_irq_init(int base)
> setup_irq(INT1_IRQ, &cascade_irqaction);
> setup_irq(INT2_IRQ, &cascade_irqaction);
> setup_irq(INT3_IRQ, &cascade_irqaction);
> + setup_irq(INT4_IRQ, &cascade_irqaction);
> }
>
> void __init arch_init_irq(void)
> --
> 1.9.1
>
Ralf
next prev parent reply other threads:[~2016-04-04 7:15 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-01 0:48 [PATCH v3 0/8] MIPS: Loongson: Add the Loongson-1A processor support Binbin Zhou
2016-03-01 0:48 ` [PATCH v3 1/8] MIPS: Loongson: Add basic Loongson-1A CPU support Binbin Zhou
2016-03-01 0:48 ` [PATCH v3 2/8] MIPS: Loongson: Add Loongson-1A Kconfig options Binbin Zhou
2016-04-04 6:43 ` Ralf Baechle
2016-03-01 0:48 ` [PATCH v3 3/8] MIPS: Loongson: Add platform devices for Loongson-1A/1B Binbin Zhou
2016-04-04 6:51 ` Ralf Baechle
2016-03-01 0:48 ` [PATCH v3 4/8] MIPS: Loongson: Add loongson-1A board support Binbin Zhou
2016-03-01 0:48 ` [PATCH v3 5/8] MIPS: Loongson-1A: Workaround for pll register can't be read Binbin Zhou
2016-04-04 7:29 ` Ralf Baechle
2016-04-22 23:14 ` Stephen Boyd
2016-03-01 0:48 ` [PATCH v3 6/8] MIPS: Loongson-1A: Add IRQ type setting support Binbin Zhou
2016-04-04 7:15 ` Ralf Baechle [this message]
2016-03-01 0:48 ` [PATCH v3 7/8] MIPS: Loongson-1A: Enable SPARSEMEN and HIGHMEM Binbin Zhou
2016-03-01 0:48 ` [PATCH v3 8/8] MIPS: Loongson: Add a Loongson-1A default config file Binbin Zhou
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=20160404071536.GC13706@linux-mips.org \
--to=ralf@linux-mips.org \
--cc=Steven.Hill@imgtec.com \
--cc=chenhc@lemote.com \
--cc=cuicb@lemote.com \
--cc=john@phrozen.org \
--cc=keguang.zhang@gmail.com \
--cc=linux-mips@linux-mips.org \
--cc=tglx@linutronix.de \
--cc=wuzhangjin@gmail.com \
--cc=zhangfx@lemote.com \
--cc=zhoubb@lemote.com \
/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