This patch adds a target for the IBM PowerXCell Accelerator Board.
[openwrt.git] / target / linux / pxcab / patches-2.6.30 / 0001-powerpc-mpic-Fix-mapping-of-DCR-based-MPIC-variants.patch
1 commit 5a2642f620eb6e40792822fa0eafe23046fbb55e
2 Author: Benjamin Herrenschmidt <benh@kernel.crashing.org>
3 Date:   Mon Jun 22 16:47:59 2009 +0000
4
5     powerpc/mpic: Fix mapping of "DCR" based MPIC variants
6     
7     Commit 31207dab7d2e63795eb15823947bd2f7025b08e2
8     "Fix incorrect allocation of interrupt rev-map"
9     introduced a regression crashing on boot on machines using
10     a "DCR" based MPIC, such as the Cell blades.
11     
12     The reason is that the irq host data structure is initialized
13     much later as a result of that patch, causing our calls to
14     mpic_map() do be done before we have a host setup.
15     
16     Unfortunately, this breaks _mpic_map_dcr() which uses the
17     mpic->irqhost to get to the device node.
18     
19     This fixes it by, instead, passing the device node explicitely
20     to mpic_map().
21     
22     Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
23     Acked-by: Akira Tsukamoto <akirat@rd.scei.sony.co.jp>
24
25 diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
26 index 9c3af50..32a2e95 100644
27 --- a/arch/powerpc/sysdev/mpic.c
28 +++ b/arch/powerpc/sysdev/mpic.c
29 @@ -279,28 +279,29 @@ static void _mpic_map_mmio(struct mpic *mpic, phys_addr_t phys_addr,
30  }
31  
32  #ifdef CONFIG_PPC_DCR
33 -static void _mpic_map_dcr(struct mpic *mpic, struct mpic_reg_bank *rb,
34 +static void _mpic_map_dcr(struct mpic *mpic, struct device_node *node,
35 +                         struct mpic_reg_bank *rb,
36                           unsigned int offset, unsigned int size)
37  {
38         const u32 *dbasep;
39  
40 -       dbasep = of_get_property(mpic->irqhost->of_node, "dcr-reg", NULL);
41 +       dbasep = of_get_property(node, "dcr-reg", NULL);
42  
43 -       rb->dhost = dcr_map(mpic->irqhost->of_node, *dbasep + offset, size);
44 +       rb->dhost = dcr_map(node, *dbasep + offset, size);
45         BUG_ON(!DCR_MAP_OK(rb->dhost));
46  }
47  
48 -static inline void mpic_map(struct mpic *mpic, phys_addr_t phys_addr,
49 -                           struct mpic_reg_bank *rb, unsigned int offset,
50 -                           unsigned int size)
51 +static inline void mpic_map(struct mpic *mpic, struct device_node *node,
52 +                           phys_addr_t phys_addr, struct mpic_reg_bank *rb,
53 +                           unsigned int offset, unsigned int size)
54  {
55         if (mpic->flags & MPIC_USES_DCR)
56 -               _mpic_map_dcr(mpic, rb, offset, size);
57 +               _mpic_map_dcr(mpic, node, rb, offset, size);
58         else
59                 _mpic_map_mmio(mpic, phys_addr, rb, offset, size);
60  }
61  #else /* CONFIG_PPC_DCR */
62 -#define mpic_map(m,p,b,o,s)    _mpic_map_mmio(m,p,b,o,s)
63 +#define mpic_map(m,n,p,b,o,s)  _mpic_map_mmio(m,p,b,o,s)
64  #endif /* !CONFIG_PPC_DCR */
65  
66  
67 @@ -1152,8 +1153,8 @@ struct mpic * __init mpic_alloc(struct device_node *node,
68         }
69  
70         /* Map the global registers */
71 -       mpic_map(mpic, paddr, &mpic->gregs, MPIC_INFO(GREG_BASE), 0x1000);
72 -       mpic_map(mpic, paddr, &mpic->tmregs, MPIC_INFO(TIMER_BASE), 0x1000);
73 +       mpic_map(mpic, node, paddr, &mpic->gregs, MPIC_INFO(GREG_BASE), 0x1000);
74 +       mpic_map(mpic, node, paddr, &mpic->tmregs, MPIC_INFO(TIMER_BASE), 0x1000);
75  
76         /* Reset */
77         if (flags & MPIC_WANTS_RESET) {
78 @@ -1194,7 +1195,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
79  
80         /* Map the per-CPU registers */
81         for (i = 0; i < mpic->num_cpus; i++) {
82 -               mpic_map(mpic, paddr, &mpic->cpuregs[i],
83 +               mpic_map(mpic, node, paddr, &mpic->cpuregs[i],
84                          MPIC_INFO(CPU_BASE) + i * MPIC_INFO(CPU_STRIDE),
85                          0x1000);
86         }
87 @@ -1202,7 +1203,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
88         /* Initialize main ISU if none provided */
89         if (mpic->isu_size == 0) {
90                 mpic->isu_size = mpic->num_sources;
91 -               mpic_map(mpic, paddr, &mpic->isus[0],
92 +               mpic_map(mpic, node, paddr, &mpic->isus[0],
93                          MPIC_INFO(IRQ_BASE), MPIC_INFO(IRQ_STRIDE) * mpic->isu_size);
94         }
95         mpic->isu_shift = 1 + __ilog2(mpic->isu_size - 1);
96 @@ -1256,8 +1257,10 @@ void __init mpic_assign_isu(struct mpic *mpic, unsigned int isu_num,
97  
98         BUG_ON(isu_num >= MPIC_MAX_ISU);
99  
100 -       mpic_map(mpic, paddr, &mpic->isus[isu_num], 0,
101 +       mpic_map(mpic, mpic->irqhost->of_node,
102 +                paddr, &mpic->isus[isu_num], 0,
103                  MPIC_INFO(IRQ_STRIDE) * mpic->isu_size);
104 +
105         if ((isu_first + mpic->isu_size) > mpic->num_sources)
106                 mpic->num_sources = isu_first + mpic->isu_size;
107  }