base-files: define yes/no as valid boolean options
[openwrt.git] / target / linux / mvebu / patches-3.10 / 0074-irqchip-armada-370-xp-properly-request-resources.patch
1 From c8efa45217cbd780dafe12d87b61554c2e19a010 Mon Sep 17 00:00:00 2001
2 From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3 Date: Thu, 6 Jun 2013 18:22:51 +0200
4 Subject: [PATCH 074/203] irqchip: armada-370-xp: properly request resources
5
6 Instead of using of_iomap(), we now use of_address_to_resource(),
7 request_mem_region() and ioremap(). This allows the corresponding I/O
8 regions to be properly requested and visible in /proc/iomem.
9
10 The main motivation for this change is that the introduction of the
11 MSI support requires us to get the physical address of the main
12 interrupt controller registers, so we will need the corresponding
13 'struct resource' anyway.
14
15 We also take this opportunity to change a panic() to BUG_ON(), in
16 order to be consistent with the rest of the driver.
17
18 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
19 Tested-by: Daniel Price <daniel.price@gmail.com>
20 Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
21 ---
22  drivers/irqchip/irq-armada-370-xp.c | 20 ++++++++++++++++----
23  1 file changed, 16 insertions(+), 4 deletions(-)
24
25 --- a/drivers/irqchip/irq-armada-370-xp.c
26 +++ b/drivers/irqchip/irq-armada-370-xp.c
27 @@ -248,12 +248,25 @@ armada_370_xp_handle_irq(struct pt_regs
28  static int __init armada_370_xp_mpic_of_init(struct device_node *node,
29                                              struct device_node *parent)
30  {
31 +       struct resource main_int_res, per_cpu_int_res;
32         u32 control;
33  
34 -       main_int_base = of_iomap(node, 0);
35 -       per_cpu_int_base = of_iomap(node, 1);
36 +       BUG_ON(of_address_to_resource(node, 0, &main_int_res));
37 +       BUG_ON(of_address_to_resource(node, 1, &per_cpu_int_res));
38  
39 +       BUG_ON(!request_mem_region(main_int_res.start,
40 +                                  resource_size(&main_int_res),
41 +                                  node->full_name));
42 +       BUG_ON(!request_mem_region(per_cpu_int_res.start,
43 +                                  resource_size(&per_cpu_int_res),
44 +                                  node->full_name));
45 +
46 +       main_int_base = ioremap(main_int_res.start,
47 +                               resource_size(&main_int_res));
48         BUG_ON(!main_int_base);
49 +
50 +       per_cpu_int_base = ioremap(per_cpu_int_res.start,
51 +                                  resource_size(&per_cpu_int_res));
52         BUG_ON(!per_cpu_int_base);
53  
54         control = readl(main_int_base + ARMADA_370_XP_INT_CONTROL);
55 @@ -262,8 +275,7 @@ static int __init armada_370_xp_mpic_of_
56                 irq_domain_add_linear(node, (control >> 2) & 0x3ff,
57                                 &armada_370_xp_mpic_irq_ops, NULL);
58  
59 -       if (!armada_370_xp_mpic_domain)
60 -               panic("Unable to add Armada_370_Xp MPIC irq domain (DT)\n");
61 +       BUG_ON(!armada_370_xp_mpic_domain);
62  
63         irq_set_default_host(armada_370_xp_mpic_domain);
64