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: 151760 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp628529ljp; Thu, 22 Nov 2018 03:40:07 -0800 (PST) X-Google-Smtp-Source: AFSGD/VxUgzvWBf+Y7QGhdLrVRHi7MFo6PekEE4T3RkhWbuUjHqTqiQ1+pLEdczeKlm+cewAO48p X-Received: by 2002:a17:902:70c6:: with SMTP id l6mr5306779plt.30.1542886807130; Thu, 22 Nov 2018 03:40:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542886807; cv=none; d=google.com; s=arc-20160816; b=iJ2Hu8AcnCJ+Iv5/R5br/oNHRWCK8muDE/8M+9kw5RNQSoemcWInpP7y1cnkM4IWz2 7rL+7Sp9Thw+GbvEXspsNTi0DhOdPx3Mz20A8/3xIocu1j0e55Rmdt+FT4IQ565Halgi SHW7gZJicEs4cOC8LdE9SV8fPHdz3it1q7Hbj8ahXIdtLisW6yIi8zOm3guUIdZYPjRx k7dtKRsi7a6/4O9FrjPn++rYHehKSG7GHSuTt5pxoe1/J7FFJRZpHfcWfqqe+m8mBVyG B9bVqqkE66nRXO7MEc8XMJVc2wgLDEmTXOMxj8c1kskyDSFyvMBBneUHSXHEoRHOhXeC prAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=XHNydlm9b1vORxwMNoF+q3/Zh9EOgYa5zG9zouBbcpI=; b=OZ3Vvy3rCm47+CNTT4mnFeMWVqFySBGG70vPRN/F2V0yWYS3US8LYmFay4b43e2M4t sxqLcTccSg0+P0uGzrJhLrsfNR+D1InPjEYL4J1EKTnkVNRarDl2ts7jrawL7aMCNIW6 Uq+CbIJ9FZ1BNMdFm5jqTl/Ahq9CxHYSXNhpwCIA/RDGJj6XIUVbXCZW0YK+0i+erDnd Oqi1Q9WcoMKC8EBJA8rGoJ+wiKY89zbyvS8MhBbWVeNDoRtSF+QLZOKNc2nDETDITZ+T JO/jfmZQOkfXbayC0eBukQOAVtVzLVS44eoK3r2G/4XYVmT4mpKXVGf6DOKIjWY5xj6i mrEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=U4BJB7bn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i39si22778481plb.256.2018.11.22.03.40.06; Thu, 22 Nov 2018 03:40:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=U4BJB7bn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394879AbeKVWTF (ORCPT + 32 others); 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(+) -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki 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 */