Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a35057d1 authored by Nishanth Menon's avatar Nishanth Menon Committed by Jason Cooper
Browse files

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: default avatarNishanth Menon <nm@ti.com>
Signed-off-by: default avatarSricharan R <r.sricharan@ti.com>
Acked-by: default avatarSantosh Shilimkar <santosh.shilimkar@ti.com>
Link: https://lkml.kernel.org/r/1403766634-18543-5-git-send-email-r.sricharan@ti.com


Signed-off-by: default avatarJason Cooper <jason@lakedaemon.net>
parent 64e0f8ba
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -22,6 +22,9 @@ Optional properties:
  SOC-specific hard-wiring of those irqs which unexpectedly bypasses the
  SOC-specific hard-wiring of those irqs which unexpectedly bypasses the
  crossbar. These irqs have a crossbar register, but still cannot be used.
  crossbar. These irqs have a crossbar register, but still cannot be used.


- ti,irqs-safe-map: integer which maps to a safe configuration to use
  when the interrupt controller irq is unused (when not provided, default is 0)

Examples:
Examples:
		crossbar_mpu: @4a020000 {
		crossbar_mpu: @4a020000 {
			compatible = "ti,irq-crossbar";
			compatible = "ti,irq-crossbar";
+17 −2
Original line number Original line Diff line number Diff line
@@ -23,12 +23,14 @@


/*
/*
 * @int_max: maximum number of supported interrupts
 * @int_max: maximum number of supported interrupts
 * @safe_map: safe default value to initialize the crossbar
 * @irq_map: array of interrupts to crossbar number mapping
 * @irq_map: array of interrupts to crossbar number mapping
 * @crossbar_base: crossbar base address
 * @crossbar_base: crossbar base address
 * @register_offsets: offsets for each irq number
 * @register_offsets: offsets for each irq number
 */
 */
struct crossbar_device {
struct crossbar_device {
	uint int_max;
	uint int_max;
	uint safe_map;
	uint *irq_map;
	uint *irq_map;
	void __iomem *crossbar_base;
	void __iomem *crossbar_base;
	int *register_offsets;
	int *register_offsets;
@@ -88,8 +90,10 @@ static void crossbar_domain_unmap(struct irq_domain *d, unsigned int irq)
{
{
	irq_hw_number_t hw = irq_get_irq_data(irq)->hwirq;
	irq_hw_number_t hw = irq_get_irq_data(irq)->hwirq;


	if (hw > GIC_IRQ_START)
	if (hw > GIC_IRQ_START) {
		cb->irq_map[hw - GIC_IRQ_START] = IRQ_FREE;
		cb->irq_map[hw - GIC_IRQ_START] = IRQ_FREE;
		cb->write(hw - GIC_IRQ_START, cb->safe_map);
	}
}
}


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


	of_property_read_u32(node, "ti,irqs-safe-map", &cb->safe_map);

	/* Initialize the crossbar with safe map to start with */
	for (i = 0; i < max; i++) {
		if (cb->irq_map[i] == IRQ_RESERVED ||
		    cb->irq_map[i] == IRQ_SKIP)
			continue;

		cb->write(i, cb->safe_map);
	}

	register_routable_domain_ops(&routable_irq_domain_ops);
	register_routable_domain_ops(&routable_irq_domain_ops);
	return 0;
	return 0;