From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 255B9C433E0 for ; Thu, 2 Jul 2020 17:55:45 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E769620737 for ; Thu, 2 Jul 2020 17:55:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="SA9EWjJz"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="Qbp6Hwkc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E769620737 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:Subject:To:From: Date:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=uOH5pjqt2uzAHXsmSTn4agKZa/jQDryXh+GGSyMZJcg=; b=SA9EWjJzFmWTI5iqU88h8oVfs iuKOGSGluMzMb23aBxVoisHthtvS6BYAX9sEL/epAXM75XvNe2RvBpZLKY5dOBajOiqmTw8cxSaRp wSzSeAjKdUVlBmbbf5z8dmAD0NX3eC/cvOJDvN3c1QRtyBUS8DT+o3F08uJsIhoQ7oYt6cUDOMgGH btZJGEl1U9M3k2qQJ/Z8e3VVDbxH/LOajf74gcdNYKWJGMzCbXAo+2H5vVi4twrBq9wDF40e6UgNc 2zyxUPYZ7CB13ilouSL/xC+JEdn+2RUww24CZ1Y0gLNNaQMzKqbQZBUW5HmsNcLSZfxYX/dcb3qce 7dqXimv2A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jr3Ps-0005Pr-Jo; Thu, 02 Jul 2020 17:54:32 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jr3Po-0005Of-VE for linux-arm-kernel@lists.infradead.org; Thu, 02 Jul 2020 17:54:30 +0000 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2B76720737; Thu, 2 Jul 2020 17:54:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593712468; bh=CweWMMu7PLdPE/4i4jZuP/tEfhtGXtOLafsmlGCzXGg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Qbp6HwkcvfR1IULQwGE0aykzqd8vd3GG1GIp0bvJwDxiIepIbjRXXHCL6jxh4xzbD ix2myEkw1+3AVtdXp0TMGhKs1Cyf4mDfZw7iWiqWlI4vghVLUEl5ggySHqa9TLr3Zj E52sdBu8L/DeEg2MycTiE/hmvIzeRpVnWJs3iO8s= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jr3Pm-008VCD-KD; Thu, 02 Jul 2020 18:54:26 +0100 MIME-Version: 1.0 Date: Thu, 02 Jul 2020 18:54:26 +0100 From: Marc Zyngier To: Grzegorz Jaszczyk Subject: Re: [PATCHv3 4/6] irqchip/irq-pruss-intc: Implement irq_{get,set}_irqchip_state ops In-Reply-To: <1593699479-1445-5-git-send-email-grzegorz.jaszczyk@linaro.org> References: <1593699479-1445-1-git-send-email-grzegorz.jaszczyk@linaro.org> <1593699479-1445-5-git-send-email-grzegorz.jaszczyk@linaro.org> User-Agent: Roundcube Webmail/1.4.5 Message-ID: <658e3a8d3374eca91387932a9a246add@kernel.org> X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: grzegorz.jaszczyk@linaro.org, tglx@linutronix.de, jason@lakedaemon.net, s-anna@ti.com, robh+dt@kernel.org, lee.jones@linaro.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, david@lechnology.com, wmills@ti.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200702_135429_151021_BA9AF6C4 X-CRM114-Status: GOOD ( 22.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-omap@vger.kernel.org, jason@lakedaemon.net, linux-kernel@vger.kernel.org, robh+dt@kernel.org, tglx@linutronix.de, lee.jones@linaro.org, wmills@ti.com, linux-arm-kernel@lists.infradead.org, david@lechnology.com Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2020-07-02 15:17, Grzegorz Jaszczyk wrote: > From: David Lechner > > This implements the irq_get_irqchip_state and irq_set_irqchip_state > callbacks for the TI PRUSS INTC driver. The set callback can be used > by drivers to "kick" a PRU by enabling a PRU system event. "enabling"? That'd be unmasking an interrupt, which isn't what this does. "injecting", maybe? > > Example: > irq_set_irqchip_state(irq, IRQCHIP_STATE_PENDING, true); Nice example. What this example does explain is how you are actually going to kick a PRU via this interface. For that to happen, you'd have to have on the Linux side an interrupt that is actually routed to a PRU. And from what I have understood of the previous patches, this can't be the case. What didi I miss? > > Signed-off-by: David Lechner > Signed-off-by: Suman Anna > Signed-off-by: Grzegorz Jaszczyk > Reviewed-by: Lee Jones > --- > v2->v3: > - Get rid of unnecessary pruss_intc_check_write() and use > pruss_intc_write_reg directly. > v1->v2: > - https://patchwork.kernel.org/patch/11069769/ > --- > drivers/irqchip/irq-pruss-intc.c | 43 > ++++++++++++++++++++++++++++++++++++++-- > 1 file changed, 41 insertions(+), 2 deletions(-) > > diff --git a/drivers/irqchip/irq-pruss-intc.c > b/drivers/irqchip/irq-pruss-intc.c > index 49c936f..19b3d38 100644 > --- a/drivers/irqchip/irq-pruss-intc.c > +++ b/drivers/irqchip/irq-pruss-intc.c > @@ -7,6 +7,7 @@ > * Suman Anna > */ > > +#include > #include > #include > #include > @@ -39,8 +40,7 @@ > #define PRU_INTC_HIEISR 0x0034 > #define PRU_INTC_HIDISR 0x0038 > #define PRU_INTC_GPIR 0x0080 > -#define PRU_INTC_SRSR0 0x0200 > -#define PRU_INTC_SRSR1 0x0204 > +#define PRU_INTC_SRSR(x) (0x0200 + (x) * 4) > #define PRU_INTC_SECR0 0x0280 > #define PRU_INTC_SECR1 0x0284 > #define PRU_INTC_ESR0 0x0300 > @@ -145,6 +145,43 @@ static void pruss_intc_irq_relres(struct irq_data > *data) > module_put(THIS_MODULE); > } > > +static int pruss_intc_irq_get_irqchip_state(struct irq_data *data, > + enum irqchip_irq_state which, > + bool *state) > +{ > + struct pruss_intc *intc = irq_data_get_irq_chip_data(data); > + u32 reg, mask, srsr; > + > + if (which != IRQCHIP_STATE_PENDING) > + return -EINVAL; > + > + reg = PRU_INTC_SRSR(data->hwirq / 32); I assume the register file scales as more interrupts are added in the subsequent patch? > + mask = BIT(data->hwirq % 32); > + > + srsr = pruss_intc_read_reg(intc, reg); > + > + *state = !!(srsr & mask); > + > + return 0; > +} > + > +static int pruss_intc_irq_set_irqchip_state(struct irq_data *data, > + enum irqchip_irq_state which, > + bool state) > +{ > + struct pruss_intc *intc = irq_data_get_irq_chip_data(data); > + > + if (which != IRQCHIP_STATE_PENDING) > + return -EINVAL; > + > + if (state) > + pruss_intc_write_reg(intc, PRU_INTC_SISR, data->hwirq); > + else > + pruss_intc_write_reg(intc, PRU_INTC_SICR, data->hwirq); > + > + return 0; > +} > + > static struct irq_chip pruss_irqchip = { > .name = "pruss-intc", > .irq_ack = pruss_intc_irq_ack, > @@ -152,6 +189,8 @@ static struct irq_chip pruss_irqchip = { > .irq_unmask = pruss_intc_irq_unmask, > .irq_request_resources = pruss_intc_irq_reqres, > .irq_release_resources = pruss_intc_irq_relres, > + .irq_get_irqchip_state = pruss_intc_irq_get_irqchip_state, > + .irq_set_irqchip_state = pruss_intc_irq_set_irqchip_state, > }; > > static int pruss_intc_irq_domain_map(struct irq_domain *d, unsigned > int virq, Thanks, M. -- Jazz is not dead. It just smells funny... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel