Apps: generic: ZynqMP R5: use libmetal ISR
authorWendy Liang <jliang@xilinx.com>
Sat, 6 Aug 2016 05:34:11 +0000 (22:34 -0700)
committerWendy Liang <jliang@xilinx.com>
Thu, 13 Oct 2016 05:01:47 +0000 (22:01 -0700)
Use libmetal ISR in ZynqMP R5 generic for interrupt handling.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
apps/system/generic/machine/zynqmp_r5/helper.c
lib/remoteproc/drivers/zynqmp_remoteproc_a53.c

index d0d72dc3035c9132503d3f17c545f0190bd502aa..7e775f61472a8f395c94dabd2dc4f2d67e60eca5 100644 (file)
 #include "metal/sys.h"
 
 #define INTC_DEVICE_ID         XPAR_SCUGIC_0_DEVICE_ID
+/** IPI IRQ ID */
+#define IPI_IRQ_VECT_ID         65
 
 XScuGic InterruptController;
 
-extern void bm_env_isr(int vector);
+extern void metal_irq_isr(unsigned int irq);
 extern int platform_register_metal_device(void);
 
-void zynqmp_r5_irq_isr()
-{
-
-       unsigned int raw_irq;
-       int irq_vector;
-       raw_irq =
-           (unsigned int)XScuGic_CPUReadReg(&InterruptController,
-                                            XSCUGIC_INT_ACK_OFFSET);
-       irq_vector = (int)(raw_irq & XSCUGIC_ACK_INTID_MASK);
-
-       bm_env_isr(irq_vector);
-
-       XScuGic_CPUWriteReg(&InterruptController, XSCUGIC_EOI_OFFSET, raw_irq);
-}
-
 int zynqmp_r5_gic_initialize()
 {
        u32 Status;
@@ -85,10 +72,14 @@ int zynqmp_r5_gic_initialize()
         * logic in the ARM processor.
         */
        Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_IRQ_INT,
-                                    (Xil_ExceptionHandler) zynqmp_r5_irq_isr,
-                                    &InterruptController);
+                       (Xil_ExceptionHandler)XScuGic_InterruptHandler,
+                       &InterruptController);
 
        Xil_ExceptionEnable();
+       /* Connect Interrupt ID with ISR */
+       XScuGic_Connect(&InterruptController, IPI_IRQ_VECT_ID,
+                          (Xil_ExceptionHandler)metal_irq_isr,
+                          (void *)IPI_IRQ_VECT_ID);
 
        return 0;
 }
index 5f67bf5bfb1f09a3459016f8a340706c215e8d21..386eb23fc14ed304cd1e7ec94fc7ac8df8125b75 100644 (file)
@@ -122,11 +122,7 @@ static int _enable_interrupt(struct proc_vring *vring_hw)
        metal_irq_register(vring_hw->intr_info.vect_id, _ipi_handler,
                                vring_hw->intr_info.dev, vring_hw);
        /* Enable IPI interrupt */
-#if 0
-       env_enable_interrupt(vring_hw->intr_info.vect_id,
-                            vring_hw->intr_info.priority,
-                            vring_hw->intr_info.trigger_type);
-#endif
+       metal_irq_enable(vring_hw->intr_info.vect_id);
        metal_io_write32(io, IPI_IER_OFFSET, ipi->ipi_chn_mask);
        return 0;
 }