Skip to content

Commit bcff661

Browse files
author
Michal Simek
committed
microblaze: intc: Clean driver init function
- Use of_iomap - Use of_property_read_u32 - Fix printk Signed-off-by: Michal Simek <michal.simek@xilinx.com>
1 parent 8a9e90a commit bcff661

1 file changed

Lines changed: 19 additions & 10 deletions

File tree

‎arch/microblaze/kernel/intc.c‎

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
#include <linux/init.h>
1313
#include <linux/irqdomain.h>
1414
#include <linux/irq.h>
15-
#include <asm/page.h>
15+
#include <linux/of_address.h>
1616
#include <linux/io.h>
1717
#include <linux/bug.h>
1818

1919
#include <asm/prom.h>
2020
#include <asm/irq.h>
2121
#include "../../drivers/irqchip/irqchip.h"
2222

23-
static unsigned int intc_baseaddr;
23+
static void __iomem *intc_baseaddr;
2424

2525
/* No one else should require these constants, so define them locally here. */
2626
#define ISR 0x00 /* Interrupt Status Register */
@@ -120,19 +120,28 @@ static int __init xilinx_intc_of_init(struct device_node *intc,
120120
struct device_node *parent)
121121
{
122122
u32 nr_irq, intr_mask;
123+
int ret;
123124

124-
intc_baseaddr = be32_to_cpup(of_get_property(intc, "reg", NULL));
125-
intc_baseaddr = (unsigned long) ioremap(intc_baseaddr, PAGE_SIZE);
126-
nr_irq = be32_to_cpup(of_get_property(intc,
127-
"xlnx,num-intr-inputs", NULL));
125+
intc_baseaddr = of_iomap(intc, 0);
126+
BUG_ON(!intc_baseaddr);
127+
128+
ret = of_property_read_u32(intc, "xlnx,num-intr-inputs", &nr_irq);
129+
if (ret < 0) {
130+
pr_err("%s: unable to read xlnx,num-intr-inputs\n", __func__);
131+
return -EINVAL;
132+
}
133+
134+
ret = of_property_read_u32(intc, "xlnx,kind-of-intr", &intr_mask);
135+
if (ret < 0) {
136+
pr_err("%s: unable to read xlnx,kind-of-intr\n", __func__);
137+
return -EINVAL;
138+
}
128139

129-
intr_mask =
130-
be32_to_cpup(of_get_property(intc, "xlnx,kind-of-intr", NULL));
131140
if (intr_mask > (u32)((1ULL << nr_irq) - 1))
132141
pr_info(" ERROR: Mismatch in kind-of-intr param\n");
133142

134-
pr_info("%s #0 at 0x%08x, num_irq=%d, edge=0x%x\n",
135-
intc->name, intc_baseaddr, nr_irq, intr_mask);
143+
pr_info("%s: num_irq=%d, edge=0x%x\n",
144+
intc->full_name, nr_irq, intr_mask);
136145

137146
/*
138147
* Disable all external interrupts until they are

0 commit comments

Comments
 (0)