Skip to content

Commit a35057d

Browse files
nmenonJason Cooper
authored and
Jason Cooper
committed
irqchip: crossbar: Initialise the crossbar with a safe value
Since crossbar is s/w configurable, the initial settings of the crossbar cannot be assumed to be sane. This implies that: a) On initialization all un-reserved crossbars must be initialized to a known 'safe' value. b) When unmapping the interrupt, the safe value must be written to ensure that the crossbar mapping matches with interrupt controller usage. So provide a safe value in the dt data to map if '0' is not safe for the platform and use it during init and unmap While at this, fix the below checkpatch warning. Fixes checkpatch warning: WARNING: Unnecessary space before function pointer arguments #37: FILE: drivers/irqchip/irq-crossbar.c:37: + void (*write) (int, int); Signed-off-by: Nishanth Menon <[email protected]> Signed-off-by: Sricharan R <[email protected]> Acked-by: Santosh Shilimkar <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Jason Cooper <[email protected]>
1 parent 64e0f8b commit a35057d

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

Documentation/devicetree/bindings/arm/omap/crossbar.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ Optional properties:
2222
SOC-specific hard-wiring of those irqs which unexpectedly bypasses the
2323
crossbar. These irqs have a crossbar register, but still cannot be used.
2424

25+
- ti,irqs-safe-map: integer which maps to a safe configuration to use
26+
when the interrupt controller irq is unused (when not provided, default is 0)
27+
2528
Examples:
2629
crossbar_mpu: @4a020000 {
2730
compatible = "ti,irq-crossbar";

drivers/irqchip/irq-crossbar.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,18 @@
2323

2424
/*
2525
* @int_max: maximum number of supported interrupts
26+
* @safe_map: safe default value to initialize the crossbar
2627
* @irq_map: array of interrupts to crossbar number mapping
2728
* @crossbar_base: crossbar base address
2829
* @register_offsets: offsets for each irq number
2930
*/
3031
struct crossbar_device {
3132
uint int_max;
33+
uint safe_map;
3234
uint *irq_map;
3335
void __iomem *crossbar_base;
3436
int *register_offsets;
35-
void (*write) (int, int);
37+
void (*write)(int, int);
3638
};
3739

3840
static struct crossbar_device *cb;
@@ -88,8 +90,10 @@ static void crossbar_domain_unmap(struct irq_domain *d, unsigned int irq)
8890
{
8991
irq_hw_number_t hw = irq_get_irq_data(irq)->hwirq;
9092

91-
if (hw > GIC_IRQ_START)
93+
if (hw > GIC_IRQ_START) {
9294
cb->irq_map[hw - GIC_IRQ_START] = IRQ_FREE;
95+
cb->write(hw - GIC_IRQ_START, cb->safe_map);
96+
}
9397
}
9498

9599
static int crossbar_domain_xlate(struct irq_domain *d,
@@ -214,6 +218,17 @@ static int __init crossbar_of_init(struct device_node *node)
214218
reserved += size;
215219
}
216220

221+
of_property_read_u32(node, "ti,irqs-safe-map", &cb->safe_map);
222+
223+
/* Initialize the crossbar with safe map to start with */
224+
for (i = 0; i < max; i++) {
225+
if (cb->irq_map[i] == IRQ_RESERVED ||
226+
cb->irq_map[i] == IRQ_SKIP)
227+
continue;
228+
229+
cb->write(i, cb->safe_map);
230+
}
231+
217232
register_routable_domain_ops(&routable_irq_domain_ops);
218233
return 0;
219234

0 commit comments

Comments
 (0)