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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A837BC64EC4 for ; Wed, 8 Mar 2023 08:35:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=IC0ndBrd1UsGBDL70PPVhAPVjElqU0BGlqAAcTLPhao=; b=FaQ3QBa2f3+Te8 Uyp+8YX08dS19yL+6c9RUxGGrUmARvGX2h9NB0bQvrLdtkg00fHHunD8BjAr8qAHTPbwjyEo/Y6le 6I77OdADu1SA3ep4/YYt92WwLG7z1B93pMu5/wEfJ9yp8UbUtpEenDHbg0YWkej7hGrdxZxAJQ2Rz h0845Bqh4hxYcmsBMG296+rQdbL5oI9WnByt2XdlbBV1sFLnBiHkQ1UaQSQqiraOp8JwoGNqfNptd +5PaFOm6yQpuGN/GaP7LHWgN8BMoofX2giv0TsUkMo/LaqVZu64xq1K6V8m8+62QOR/EmGQs8B9VQ 4tJFDmlbd8+GHEGOaxwg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZpFe-003zeg-30; Wed, 08 Mar 2023 08:34:22 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZpFb-003zdx-CA for linux-arm-kernel@lists.infradead.org; Wed, 08 Mar 2023 08:34:20 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 84B2B616E9; Wed, 8 Mar 2023 08:34:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75CAAC433EF; Wed, 8 Mar 2023 08:34:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678264458; bh=g6FWDWTVvtbUVJ0kus/OK9I+nhtkZyDFnv104tDpUdg=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=KJayE8QeTlag7cnxN2nStkgFonskLPD56vS7wrJt+yEbZIwhYJINJVweCe2mwGX2f LealC9F1CqMnXhkgKUGh/1H2M8d/N8+IAVzeFOW1tyuTTORDlUiU7EapRTleS5DdMz CBfkBuiaUcm5DvlHs6UK1QFx6qN4SuZ5ai812CgrkCg3Q8mbMk6Hdkk2M7vE+d1woQ EQ5o1TtFdU94PHElLD7IXLKn+GRjq1wUrvdLXq2xWIbmZe4a1rfGakc1/6q2ycFmC6 L91jKRyk6/z7unULkymS1imZT2yLyVsBPOB9ipPjS53SudX8BBI4h6otu2iQTIHqq0 TnbJ12NOPyLHw== Message-ID: <2f039534-dd21-7361-0fcd-b91da1636a3a@kernel.org> Date: Wed, 8 Mar 2023 10:34:12 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH v3 4/6] soc: ti: pruss: Add helper functions to set GPI mode, MII_RT_event and XFR Content-Language: en-US To: MD Danish Anwar , "Andrew F. Davis" , Suman Anna , Vignesh Raghavendra , Tero Kristo , Mathieu Poirier , Bjorn Andersson , Santosh Shilimkar , Nishanth Menon Cc: linux-remoteproc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, srk@ti.com, devicetree@vger.kernel.org, netdev@vger.kernel.org References: <20230306110934.2736465-1-danishanwar@ti.com> <20230306110934.2736465-5-danishanwar@ti.com> From: Roger Quadros In-Reply-To: <20230306110934.2736465-5-danishanwar@ti.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230308_003419_518788_099D5BF9 X-CRM114-Status: GOOD ( 21.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Danish, On 06/03/2023 13:09, MD Danish Anwar wrote: > From: Suman Anna > > The PRUSS CFG module is represented as a syscon node and is currently > managed by the PRUSS platform driver. Add easy accessor functions to set > GPI mode, MII_RT event enable/disable and XFR (XIN XOUT) enable/disable > to enable the PRUSS Ethernet usecase. These functions reuse the generic > pruss_cfg_update() API function. > > Signed-off-by: Suman Anna > Co-developed-by: Grzegorz Jaszczyk > Signed-off-by: Grzegorz Jaszczyk > Signed-off-by: Puranjay Mohan > --- > include/linux/remoteproc/pruss.h | 55 ++++++++++++++++++++++++++++++++ > 1 file changed, 55 insertions(+) > > diff --git a/include/linux/remoteproc/pruss.h b/include/linux/remoteproc/pruss.h > index d41bec448f06..7952f250301a 100644 > --- a/include/linux/remoteproc/pruss.h > +++ b/include/linux/remoteproc/pruss.h > @@ -240,4 +240,59 @@ static inline bool is_pru_rproc(struct device *dev) > return true; > } > > +/** > + * pruss_cfg_gpimode() - set the GPI mode of the PRU > + * @pruss: the pruss instance handle > + * @pru_id: id of the PRU core within the PRUSS > + * @mode: GPI mode to set > + * > + * Sets the GPI mode for a given PRU by programming the > + * corresponding PRUSS_CFG_GPCFGx register > + * > + * Return: 0 on success, or an error code otherwise > + */ > +static inline int pruss_cfg_gpimode(struct pruss *pruss, > + enum pruss_pru_id pru_id, > + enum pruss_gpi_mode mode) > +{ > + if (pru_id < 0 || pru_id >= PRUSS_NUM_PRUS) > + return -EINVAL; > + Should we check for invalid gpi mode and error out if so? > + return pruss_cfg_update(pruss, PRUSS_CFG_GPCFG(pru_id), > + PRUSS_GPCFG_PRU_GPI_MODE_MASK, > + mode << PRUSS_GPCFG_PRU_GPI_MODE_SHIFT); > +} > + > +/** > + * pruss_cfg_miirt_enable() - Enable/disable MII RT Events > + * @pruss: the pruss instance > + * @enable: enable/disable > + * > + * Enable/disable the MII RT Events for the PRUSS. > + * > + * Return: 0 on success, or an error code otherwise > + */ > +static inline int pruss_cfg_miirt_enable(struct pruss *pruss, bool enable) > +{ > + u32 set = enable ? PRUSS_MII_RT_EVENT_EN : 0; > + > + return pruss_cfg_update(pruss, PRUSS_CFG_MII_RT, > + PRUSS_MII_RT_EVENT_EN, set); > +} > + > +/** > + * pruss_cfg_xfr_enable() - Enable/disable XIN XOUT shift functionality > + * @pruss: the pruss instance > + * @enable: enable/disable > + * > + * Return: 0 on success, or an error code otherwise > + */ > +static inline int pruss_cfg_xfr_enable(struct pruss *pruss, bool enable) > +{ > + u32 set = enable ? PRUSS_SPP_XFER_SHIFT_EN : 0; > + > + return pruss_cfg_update(pruss, PRUSS_CFG_SPP, > + PRUSS_SPP_XFER_SHIFT_EN, set); > +} > + > #endif /* __LINUX_PRUSS_H */ cheers, -roger _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel