From: Amit Daniel Kachhap amit.daniel@samsung.com
This API is similar to DT based irq_of_parse_and_map but does link parent/child IRQ controllers. This is tested for primary GIC PPI and GIC SPI interrupts and not for secondary child irq controllers.
[Hanjun: Add some comments for interrupt mapping from DT to ACPI, and rework it according to the API of irq_create_acpi_mapping()]
Signed-off-by: Amit Daniel Kachhap amit.daniel@samsung.com Signed-off-by: Hanjun Guo hanjun.guo@linaro.org --- drivers/acpi/plat/arm/boot.c | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-)
diff --git a/drivers/acpi/plat/arm/boot.c b/drivers/acpi/plat/arm/boot.c index a912a7a..70262a2 100644 --- a/drivers/acpi/plat/arm/boot.c +++ b/drivers/acpi/plat/arm/boot.c @@ -254,12 +254,37 @@ int (*__acpi_register_gsi)(struct device *dev, u32 gsi, int acpi_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity) { unsigned int irq; - unsigned int plat_gsi = gsi; + unsigned int irq_type;
- plat_gsi = (*__acpi_register_gsi)(dev, gsi, trigger, polarity); - - irq = gsi_to_irq(plat_gsi); + /* + * ACPI have no bindings to indicate SPI or PPI, so we + * use following mapping from DT to ACPI. + * + * For FDT + * PPI interrupt: in the range [0, 15]; + * SPI interrupt: in the range [0, 987]; + * + * For ACPI, using identity mapping for hwirq: + * PPI interrupt: in the range [16, 31]; + * SPI interrupt: in the range [32, 1019]; + */
+ if (trigger == ACPI_EDGE_SENSITIVE && + polarity == ACPI_ACTIVE_LOW) + irq_type = IRQ_TYPE_EDGE_FALLING; + else if (trigger == ACPI_EDGE_SENSITIVE && + polarity == ACPI_ACTIVE_HIGH) + irq_type = IRQ_TYPE_EDGE_RISING; + else if (trigger == ACPI_LEVEL_SENSITIVE && + polarity == ACPI_ACTIVE_LOW) + irq_type = IRQ_TYPE_LEVEL_LOW; + else if (trigger == ACPI_LEVEL_SENSITIVE && + polarity == ACPI_ACTIVE_HIGH) + irq_type = IRQ_TYPE_LEVEL_HIGH; + else + irq_type = IRQ_TYPE_NONE; + + irq = irq_create_acpi_mapping(gsi, irq_type); return irq; } EXPORT_SYMBOL_GPL(acpi_register_gsi);