Commit f1dc6c4f authored by Maxime Ripard's avatar Maxime Ripard

irqchip: sunxi: Make use of the IRQCHIP_DECLARE macro

This allows to remove some boilerplate code. At the same time, call the
set_handle_irq function in the initialization function of the irqchip,
so that we can remove it from the machine declaration.
Signed-off-by: default avatarMaxime Ripard <maxime.ripard@free-electrons.com>
parent 119fd635
...@@ -14,13 +14,13 @@ ...@@ -14,13 +14,13 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/irqchip.h>
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/of_irq.h> #include <linux/of_irq.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/clk/sunxi.h> #include <linux/clk/sunxi.h>
#include <linux/irqchip/sunxi.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
...@@ -104,8 +104,7 @@ static const char * const sunxi_board_dt_compat[] = { ...@@ -104,8 +104,7 @@ static const char * const sunxi_board_dt_compat[] = {
DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)") DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)")
.init_machine = sunxi_dt_init, .init_machine = sunxi_dt_init,
.map_io = sunxi_map_io, .map_io = sunxi_map_io,
.init_irq = sunxi_init_irq, .init_irq = irqchip_init,
.handle_irq = sunxi_handle_irq,
.restart = sunxi_restart, .restart = sunxi_restart,
.init_time = sunxi_timer_init, .init_time = sunxi_timer_init,
.dt_compat = sunxi_board_dt_compat, .dt_compat = sunxi_board_dt_compat,
......
...@@ -20,7 +20,10 @@ ...@@ -20,7 +20,10 @@
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/of_irq.h> #include <linux/of_irq.h>
#include <linux/irqchip/sunxi.h> #include <asm/exception.h>
#include <asm/mach/irq.h>
#include "irqchip.h"
#define SUNXI_IRQ_VECTOR_REG 0x00 #define SUNXI_IRQ_VECTOR_REG 0x00
#define SUNXI_IRQ_PROTECTION_REG 0x08 #define SUNXI_IRQ_PROTECTION_REG 0x08
...@@ -33,6 +36,8 @@ ...@@ -33,6 +36,8 @@
static void __iomem *sunxi_irq_base; static void __iomem *sunxi_irq_base;
static struct irq_domain *sunxi_irq_domain; static struct irq_domain *sunxi_irq_domain;
static asmlinkage void __exception_irq_entry sunxi_handle_irq(struct pt_regs *regs);
void sunxi_irq_ack(struct irq_data *irqd) void sunxi_irq_ack(struct irq_data *irqd)
{ {
unsigned int irq = irqd_to_hwirq(irqd); unsigned int irq = irqd_to_hwirq(irqd);
...@@ -125,20 +130,13 @@ static int __init sunxi_of_init(struct device_node *node, ...@@ -125,20 +130,13 @@ static int __init sunxi_of_init(struct device_node *node,
if (!sunxi_irq_domain) if (!sunxi_irq_domain)
panic("%s: unable to create IRQ domain\n", node->full_name); panic("%s: unable to create IRQ domain\n", node->full_name);
return 0; set_handle_irq(sunxi_handle_irq);
}
static struct of_device_id sunxi_irq_dt_ids[] __initconst = {
{ .compatible = "allwinner,sunxi-ic", .data = sunxi_of_init },
{ }
};
void __init sunxi_init_irq(void) return 0;
{
of_irq_init(sunxi_irq_dt_ids);
} }
IRQCHIP_DECLARE(allwinner_sunxi_ic, "allwinner,sunxi-ic", sunxi_of_init);
asmlinkage void __exception_irq_entry sunxi_handle_irq(struct pt_regs *regs) static asmlinkage void __exception_irq_entry sunxi_handle_irq(struct pt_regs *regs)
{ {
u32 irq, hwirq; u32 irq, hwirq;
......
/*
* Copyright 2012 Maxime Ripard
*
* Maxime Ripard <maxime.ripard@free-electrons.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef __LINUX_IRQCHIP_SUNXI_H
#define __LINUX_IRQCHIP_SUNXI_H
#include <asm/exception.h>
extern void sunxi_init_irq(void);
extern asmlinkage void __exception_irq_entry sunxi_handle_irq(
struct pt_regs *regs);
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment