]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - rpmsg/rpmsg.git/commitdiff
irqchip/irq-pruss-intc: Add API to trigger a PRU sysevent
authorSuman Anna <s-anna@ti.com>
Thu, 14 Feb 2019 22:54:04 +0000 (16:54 -0600)
committerSuman Anna <s-anna@ti.com>
Sat, 23 Feb 2019 17:39:59 +0000 (11:39 -0600)
The PRUSS INTC can generate an interrupt to various processor
subsystems on the SoC through a set of 64 possible PRU system
events. These system events can be used by PRU client drivers
or applications for event notifications/signalling between PRUs
and MPU or other processors. A new API, pruss_intc_trigger() is
provided to MPU-side PRU client drivers/applications to be able
to trigger an event/interrupt using IRQ numbers provided by the
PRUSS-INTC irqdomain chip.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
drivers/irqchip/irq-pruss-intc.c
include/linux/pruss.h [new file with mode: 0644]

index f9c50b3c278417ced6c79575cdaf061bb6b85aa5..c2fd4f14a732efc4dabf3bc54e3f67786a1a0b64 100644 (file)
@@ -395,6 +395,37 @@ static void pruss_intc_irq_relres(struct irq_data *data)
        module_put(THIS_MODULE);
 }
 
+/**
+ * pruss_intc_trigger() - trigger a PRU system event
+ * @irq: linux IRQ number associated with a PRU system event
+ *
+ * Trigger an interrupt by signalling a specific PRU system event.
+ * This can be used by PRUSS client users to raise/send an event to
+ * a PRU or any other core that is listening on the host interrupt
+ * mapped to that specific PRU system event. The @irq variable is the
+ * Linux IRQ number associated with a specific PRU system event that
+ * a client user/application uses. The interrupt mappings for this is
+ * provided by the PRUSS INTC irqchip instance.
+ *
+ * Returns 0 on success, or an error value upon failure.
+ */
+int pruss_intc_trigger(unsigned int irq)
+{
+       struct irq_desc *desc;
+
+       if (irq <= 0)
+               return -EINVAL;
+
+       desc = irq_to_desc(irq);
+       if (!desc)
+               return -EINVAL;
+
+       pruss_intc_irq_retrigger(&desc->irq_data);
+
+       return 0;
+}
+EXPORT_SYMBOL_GPL(pruss_intc_trigger);
+
 static int pruss_intc_irq_domain_map(struct irq_domain *d, unsigned int virq,
                                     irq_hw_number_t hw)
 {
diff --git a/include/linux/pruss.h b/include/linux/pruss.h
new file mode 100644 (file)
index 0000000..07b81a2
--- /dev/null
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/**
+ * PRU-ICSS Subsystem user interfaces
+ *
+ * Copyright (C) 2015-2019 Texas Instruments Incorporated - http://www.ti.com
+ *     Suman Anna <s-anna@ti.com>
+ */
+
+#ifndef __LINUX_PRUSS_H
+#define __LINUX_PRUSS_H
+
+#if IS_ENABLED(CONFIG_TI_PRUSS)
+
+int pruss_intc_trigger(unsigned int irq);
+
+#else
+
+static inline int pruss_intc_trigger(unsigned int irq)
+{
+       return -ENOTSUPP;
+}
+
+#endif /* CONFIG_TI_PRUSS */
+
+#endif /* __LINUX_PRUSS_H */