From patchwork Thu Nov 22 11:39:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 10693965 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 79F8613AD for ; Thu, 22 Nov 2018 11:40:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 68BBF2C3D0 for ; Thu, 22 Nov 2018 11:40:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5CD6C2C4A5; Thu, 22 Nov 2018 11:40:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA2C82C3D0 for ; Thu, 22 Nov 2018 11:40:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394867AbeKVWTF (ORCPT ); Thu, 22 Nov 2018 17:19:05 -0500 Received: from lelv0143.ext.ti.com ([198.47.23.248]:42052 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391015AbeKVWTE (ORCPT ); Thu, 22 Nov 2018 17:19:04 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id wAMBe16l022672; Thu, 22 Nov 2018 05:40:01 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1542886801; bh=XHNydlm9b1vORxwMNoF+q3/Zh9EOgYa5zG9zouBbcpI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=U4BJB7bnLmTfQSwjS/Hx4f2Epzfb7ZNeBG4w5sZ2b5m2duEwEE5afJNOwe1TeCzbM /1/QCHJgaBLfQ5JYThd1heEaOANzHeDYwpCD9BqoDjcstKawK5RZg5IqgMmUzKSUdv rrJcCNW5yiCNvt1NO4ifhZEFX3AE6zH/hddoYb3A= Received: from DFLE115.ent.ti.com (dfle115.ent.ti.com [10.64.6.36]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id wAMBe1ma107209 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 22 Nov 2018 05:40:01 -0600 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Thu, 22 Nov 2018 05:39:58 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Thu, 22 Nov 2018 05:39:59 -0600 Received: from dlelxv97.itg.ti.com (dlelxv97.itg.ti.com [172.17.2.193]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id wAMBdwS9011429; Thu, 22 Nov 2018 05:39:58 -0600 Received: from localhost.localdomain (vboxa0400828d.dhcp.ti.com [172.22.239.63]) by dlelxv97.itg.ti.com (8.14.3/8.13.8) with ESMTP id wAMBdDf9013203; Thu, 22 Nov 2018 05:39:55 -0600 From: Roger Quadros To: CC: , , , , , , , , , , , , , , , , Subject: [PATCH 10/17] soc: ti: pruss_intc: Add API to trigger a PRU sysevent Date: Thu, 22 Nov 2018 13:39:06 +0200 Message-ID: <1542886753-17625-11-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1542886753-17625-1-git-send-email-rogerq@ti.com> References: <1542886753-17625-1-git-send-email-rogerq@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suman Anna 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 Signed-off-by: Suman Anna --- drivers/soc/ti/pruss_intc.c | 31 +++++++++++++++++++++++++++++++ include/linux/pruss.h | 7 +++++++ 2 files changed, 38 insertions(+) diff --git a/drivers/soc/ti/pruss_intc.c b/drivers/soc/ti/pruss_intc.c index df6b83b..6158b63 100644 --- a/drivers/soc/ti/pruss_intc.c +++ b/drivers/soc/ti/pruss_intc.c @@ -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 index 198ae25..768b698 100644 --- a/include/linux/pruss.h +++ b/include/linux/pruss.h @@ -41,6 +41,8 @@ int pruss_request_mem_region(struct pruss *pruss, enum pruss_mem mem_id, int pruss_release_mem_region(struct pruss *pruss, struct pruss_mem_region *region); +int pruss_intc_trigger(unsigned int irq); + #else static inline int pruss_request_mem_region(struct pruss *pruss, @@ -56,6 +58,11 @@ static inline int pruss_release_mem_region(struct pruss *pruss, return -ENOTSUPP; } +static inline int pruss_intc_trigger(unsigned int irq) +{ + return -ENOTSUPP; +} + #endif /* CONFIG_TI_PRUSS */ #endif /* __LINUX_PRUSS_H */