]> xenbits.xensource.com Git - people/iwj/xen.git/commitdiff
xen/arm: New callback in uart_driver to get device tree interrupt structure
authorJulien Grall <julien.grall@linaro.org>
Fri, 26 Apr 2013 19:36:35 +0000 (20:36 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Mon, 13 May 2013 10:59:59 +0000 (11:59 +0100)
The existing function serial_irq doesn't allow to retrieve if the interrupt
is edge or level trigger.

Use this function to routes IRQs for all serial ports which Xen is using
to Xen.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
xen/arch/arm/gic.c
xen/drivers/char/serial.c
xen/include/xen/serial.h

index 821f6836bf754575c1bd3104ef2d2e5b28dac088..761f570aa8bafd95125eb24ca7275b43aab2d791 100644 (file)
@@ -24,6 +24,7 @@
 #include <xen/irq.h>
 #include <xen/sched.h>
 #include <xen/errno.h>
+#include <xen/serial.h>
 #include <xen/softirq.h>
 #include <xen/list.h>
 #include <xen/device_tree.h>
@@ -501,9 +502,20 @@ void gic_route_ppis(void)
 
 void gic_route_spis(void)
 {
+    int seridx;
+    const struct dt_irq *irq;
+
     /* XXX should get these from DT */
     /* UART */
     gic_route_irq(37, 0, 1u << smp_processor_id(), 0xa0);
+
+    for ( seridx = 0; seridx <= SERHND_IDX; seridx++ )
+    {
+        if ( (irq = serial_dt_irq(seridx)) == NULL )
+            continue;
+
+        gic_route_dt_irq(irq, 1u << smp_processor_id(), 0xa0);
+    }
 }
 
 void __init release_irq(unsigned int irq)
index a3d2b26cd9648662b95bce9c59a630907f126891..0ae7e4daeba0a3ac0b5185bad4cc8ff4fd24d908 100644 (file)
@@ -482,6 +482,16 @@ int __init serial_irq(int idx)
     return -1;
 }
 
+const struct dt_irq __init *serial_dt_irq(int idx)
+{
+    if ( (idx >= 0) && (idx < ARRAY_SIZE(com)) &&
+         com[idx].driver && com[idx].driver->dt_irq_get )
+        return com[idx].driver->dt_irq_get(&com[idx]);
+
+    return NULL;
+}
+
+
 void serial_suspend(void)
 {
     int i;
index b932ed4eb46c76e429b6976a289bafd441fcb7a4..5de517136bf837f23ff951caa304c61c036e55bf 100644 (file)
@@ -71,6 +71,8 @@ struct uart_driver {
     int  (*getc)(struct serial_port *, char *);
     /* Get IRQ number for this port's serial line: returns -1 if none. */
     int  (*irq)(struct serial_port *);
+    /* Get IRQ device node for this port's serial line: returns NULL if none. */
+    const struct dt_irq *(*dt_irq_get)(struct serial_port *);
 };
 
 /* 'Serial handles' are composed from the following fields. */
@@ -120,6 +122,9 @@ void serial_end_log_everything(int handle);
 /* Return irq number for specified serial port (identified by index). */
 int serial_irq(int idx);
 
+/* Return irq device node for specified serial port (identified by index). */
+const struct dt_irq *serial_dt_irq(int idx);
+
 /* Serial suspend/resume. */
 void serial_suspend(void);
 void serial_resume(void);