Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 292463
b: refs/heads/master
c: c1b8d45
h: refs/heads/master
i:
  292461: 573e885
  292459: b2d12da
  292455: 51b7ae1
  292447: 83f61b5
v: v3
  • Loading branch information
Kyle Moffett authored and Benjamin Herrenschmidt committed Feb 22, 2012
1 parent 5a93d70 commit f22838b
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5019609fce965dbdc66a7d947385fe92ca522231
refs/heads/master: c1b8d45db4dbc64cc6015f97922f767fdf782f64
7 changes: 7 additions & 0 deletions trunk/Documentation/devicetree/bindings/powerpc/fsl/mpic.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ PROPERTIES
If present the MPIC will be assumed to only be able to route
non-IPI interrupts to a single CPU at a time (EG: Freescale MPIC).

- last-interrupt-source
Usage: optional
Value type: <u32>
Some MPICs do not correctly report the number of hardware sources
in the global feature registers. If specified, this field will
override the value read from MPIC_GREG_FEATURE_LAST_SRC.

INTERRUPT SPECIFIER DEFINITION

Interrupt specifiers consists of 4 cells encoded as
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ mpic: pic@40000 {
device_type = "open-pic";
big-endian;
single-cpu-affinity;
last-interrupt-source = <255>;
};

timer@41100 {
Expand Down
46 changes: 26 additions & 20 deletions trunk/arch/powerpc/sysdev/mpic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1149,6 +1149,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
u32 greg_feature;
const char *vers;
const u32 *psrc;
u32 last_irq;

/* Default MPIC search parameters */
static const struct of_device_id __initconst mpic_device_id[] = {
Expand Down Expand Up @@ -1220,7 +1221,6 @@ struct mpic * __init mpic_alloc(struct device_node *node,
mpic->hc_tm = mpic_tm_chip;
mpic->hc_tm.name = name;

mpic->isu_size = isu_size;
mpic->num_sources = 0; /* so far */

if (mpic->flags & MPIC_LARGE_VECTORS)
Expand Down Expand Up @@ -1307,20 +1307,6 @@ struct mpic * __init mpic_alloc(struct device_node *node,
mpic_read(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0))
| MPIC_GREG_GCONF_MCK);

/*
* Read feature register. For non-ISU MPICs, num sources as well. On
* ISU MPICs, sources are counted as ISUs are added
*/
greg_feature = mpic_read(mpic->gregs, MPIC_INFO(GREG_FEATURE_0));
if (isu_size == 0) {
if (irq_count)
mpic->num_sources = irq_count;
else
mpic->num_sources =
((greg_feature & MPIC_GREG_FEATURE_LAST_SRC_MASK)
>> MPIC_GREG_FEATURE_LAST_SRC_SHIFT) + 1;
}

/*
* The MPIC driver will crash if there are more cores than we
* can initialize, so we may as well catch that problem here.
Expand All @@ -1336,18 +1322,38 @@ struct mpic * __init mpic_alloc(struct device_node *node,
0x1000);
}

/*
* Read feature register. For non-ISU MPICs, num sources as well. On
* ISU MPICs, sources are counted as ISUs are added
*/
greg_feature = mpic_read(mpic->gregs, MPIC_INFO(GREG_FEATURE_0));

/*
* By default, the last source number comes from the MPIC, but the
* device-tree and board support code can override it on buggy hw.
*/
last_irq = (greg_feature & MPIC_GREG_FEATURE_LAST_SRC_MASK)
>> MPIC_GREG_FEATURE_LAST_SRC_SHIFT;
of_property_read_u32(mpic->node, "last-interrupt-source", &last_irq);
if (irq_count)
last_irq = irq_count - 1;

/* Initialize main ISU if none provided */
if (mpic->isu_size == 0) {
mpic->isu_size = mpic->num_sources;
if (!isu_size) {
isu_size = last_irq + 1;
mpic->num_sources = isu_size;
mpic_map(mpic, mpic->paddr, &mpic->isus[0],
MPIC_INFO(IRQ_BASE), MPIC_INFO(IRQ_STRIDE) * mpic->isu_size);
MPIC_INFO(IRQ_BASE),
MPIC_INFO(IRQ_STRIDE) * isu_size);
}

mpic->isu_size = isu_size;
mpic->isu_shift = 1 + __ilog2(mpic->isu_size - 1);
mpic->isu_mask = (1 << mpic->isu_shift) - 1;

mpic->irqhost = irq_alloc_host(mpic->node, IRQ_HOST_MAP_LINEAR,
isu_size ? isu_size : mpic->num_sources,
&mpic_host_ops, intvec_top + 1);
mpic->isu_size, &mpic_host_ops,
intvec_top + 1);

/*
* FIXME: The code leaks the MPIC object and mappings here; this
Expand Down

0 comments on commit f22838b

Please sign in to comment.