Message ID | 20230601105904.3204260-1-danishanwar@ti.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp227455vqr; Thu, 1 Jun 2023 04:12:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7thVyuo5zGzBpucN6unKXLKEMizmV2rW0CJul5rcYyHv9E9gAaf2tQDWlcAq3GyLf9K8Kf X-Received: by 2002:a05:6a00:3901:b0:64a:f730:154b with SMTP id fh1-20020a056a00390100b0064af730154bmr11900824pfb.5.1685617945972; Thu, 01 Jun 2023 04:12:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685617945; cv=none; d=google.com; s=arc-20160816; b=egovwfLcAAxMenXYwE+FggIJfJxWAFxxF/MvxKMTfIroAOKHO7IM7ZN9bfiIXLtWvF bArgX+3usSxkzJvUsyeKwcW+3+3IaoBiS0DsHziOeU9hMIUODq/wb1XyPDItDTfNTggT rvIaB3Tgj+8KBuv01OD4vAR6gjJfRSIK4K3JYwljl0af617wJ1bh7y8Yz76H5V/E5Y9I hVbnGZ2RDEJlpDlUkZGBcTrjk82LmLoLnrbKns7nrwUBJJntrixUiOPm1XzN45QEoJaD RTwpJm9TVtANYn5CAZk0Mwizfjq5fuMDwDLt3pX2kkJAjB4dK1hvuqbuw9WmtRx8rKBJ gcNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Su7R47v4W5yO6beC23P257B1E8f3gfa6U+NgWZ0c6fE=; b=JETYtsFFPxbjBPkovNyMc15Ub0XVchli5cgNZ7h4Qt2UYCYCcmchLGluYsnNAENaaw Hqp0P0t18h4PYnelmnVLd6vkXsnT3z+LHmR9/fmssvwFSh145W0LQ3yNe3rBufLK1F9g 8hlTvE4FK+tbcCrmQby0dui3O4o2hiV2dsvIGOKaLziIMQ3WnOQ8Zx/iqnm1XrMa90fY a/ti6xarp/ax6MlNZnD8WKTf/f7Ijawx8sLgTianNcpzbY5T6QY4cK1u/3zgmyj+LhGg nnNM484skfSwZ04JzBpZ4M6Hyw9dCFlOtSGBOWeE4Zdbvcnz/JLJ8mx/7S/HfD9WJYzm Ofrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ILYoAtU4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v135-20020a63618d000000b0053ef51d3fa8si1020842pgb.401.2023.06.01.04.12.11; Thu, 01 Jun 2023 04:12:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ILYoAtU4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231818AbjFAK7w (ORCPT <rfc822;limurcpp@gmail.com> + 99 others); Thu, 1 Jun 2023 06:59:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233322AbjFAK7m (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 1 Jun 2023 06:59:42 -0400 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8137012C; Thu, 1 Jun 2023 03:59:22 -0700 (PDT) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 351Ax8s5121002; Thu, 1 Jun 2023 05:59:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1685617148; bh=Su7R47v4W5yO6beC23P257B1E8f3gfa6U+NgWZ0c6fE=; h=From:To:CC:Subject:Date; b=ILYoAtU434Bw9nLblRFw0m8HJnE2yBrkz5O91voAn1RFqb4HjzLJTt0rEpd70S5js MSyhffXPvZIoyUahdsQ397ivTu8wWV5fyldw0HNzAfLMASfH6rMD02GQQfaJgH94Mf 5xgjFPnA8+1Uqt2Uz+lXQzO32ch8AwyRwFWEMAO8= Received: from DLEE105.ent.ti.com (dlee105.ent.ti.com [157.170.170.35]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 351Ax8nS087594 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 1 Jun 2023 05:59:08 -0500 Received: from DLEE103.ent.ti.com (157.170.170.33) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Thu, 1 Jun 2023 05:59:07 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Thu, 1 Jun 2023 05:59:07 -0500 Received: from fllv0122.itg.ti.com (fllv0122.itg.ti.com [10.247.120.72]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 351Ax7ZJ027859; Thu, 1 Jun 2023 05:59:07 -0500 Received: from localhost (uda0501179.dhcp.ti.com [10.24.69.114]) by fllv0122.itg.ti.com (8.14.7/8.14.7) with ESMTP id 351Ax6BY024592; Thu, 1 Jun 2023 05:59:06 -0500 From: MD Danish Anwar <danishanwar@ti.com> To: Mathieu Poirier <mathieu.poirier@linaro.org>, Bjorn Andersson <andersson@kernel.org> CC: <rogerq@kernel.org>, <vigneshr@ti.org>, <nm@ti.com>, <srk@ti.com>, <danishanwar@ti.com>, <linux-kernel@vger.kernel.org>, <linux-remoteproc@vger.kernel.org>, <linux-omap@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org> Subject: [PATCH] remoteproc: pru: add support for configuring GPMUX based on client setup Date: Thu, 1 Jun 2023 16:29:04 +0530 Message-ID: <20230601105904.3204260-1-danishanwar@ti.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767498522926349430?= X-GMAIL-MSGID: =?utf-8?q?1767498522926349430?= |
Series |
remoteproc: pru: add support for configuring GPMUX based on client setup
|
|
Commit Message
MD Danish Anwar
June 1, 2023, 10:59 a.m. UTC
From: Tero Kristo <t-kristo@ti.com> Client device node property ti,pruss-gp-mux-sel can now be used to configure the GPMUX config value for PRU. Signed-off-by: Tero Kristo <t-kristo@ti.com> Signed-off-by: Suman Anna <s-anna@ti.com> Signed-off-by: MD Danish Anwar <danishanwar@ti.com> --- drivers/remoteproc/pru_rproc.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
Comments
Hi MD, On Thu, Jun 01, 2023 at 04:29:04PM +0530, MD Danish Anwar wrote: > From: Tero Kristo <t-kristo@ti.com> > > Client device node property ti,pruss-gp-mux-sel can now be used to > configure the GPMUX config value for PRU. > > Signed-off-by: Tero Kristo <t-kristo@ti.com> > Signed-off-by: Suman Anna <s-anna@ti.com> > Signed-off-by: MD Danish Anwar <danishanwar@ti.com> > --- > drivers/remoteproc/pru_rproc.c | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/drivers/remoteproc/pru_rproc.c b/drivers/remoteproc/pru_rproc.c > index 2874c8d324f7..29d3a5a930c1 100644 > --- a/drivers/remoteproc/pru_rproc.c > +++ b/drivers/remoteproc/pru_rproc.c > @@ -109,6 +109,7 @@ struct pru_private_data { > * @dbg_single_step: debug state variable to set PRU into single step mode > * @dbg_continuous: debug state variable to restore PRU execution mode > * @evt_count: number of mapped events > + * @gpmux_save: saved value for gpmux config > */ > struct pru_rproc { > int id; > @@ -127,6 +128,7 @@ struct pru_rproc { > u32 dbg_single_step; > u32 dbg_continuous; > u8 evt_count; > + u8 gpmux_save; > }; > > static inline u32 pru_control_read_reg(struct pru_rproc *pru, unsigned int reg) > @@ -228,6 +230,7 @@ struct rproc *pru_rproc_get(struct device_node *np, int index, > struct device *dev; > const char *fw_name; > int ret; > + u32 mux; > > rproc = __pru_rproc_get(np, index); > if (IS_ERR(rproc)) > @@ -252,6 +255,22 @@ struct rproc *pru_rproc_get(struct device_node *np, int index, > if (pru_id) > *pru_id = pru->id; > > + ret = pruss_cfg_get_gpmux(pru->pruss, pru->id, &pru->gpmux_save); > + if (ret) { > + dev_err(dev, "failed to get cfg gpmux: %d\n", ret); > + goto err; > + } > + > + ret = of_property_read_u32_index(np, "ti,pruss-gp-mux-sel", index, > + &mux); > + if (!ret) { > + ret = pruss_cfg_set_gpmux(pru->pruss, pru->id, mux); > + if (ret) { > + dev_err(dev, "failed to set cfg gpmux: %d\n", ret); > + goto err; > + } > + } > + It would have been nice to be told in a cover letter that pruss_cfg_get_gpmux() is in linux-next so that I don't have to go fish for it... I am fine with the code in this patch, though the changelog is cryptic and could be enhanced to say "why" this is needed. The above could use some comments to make sure people looking at this code understand that an error from of_property_read_u32_index() is acceptable for backward compatibility. Here I have to suppose pruss_cfg_get_gpmux() has been added to Nishanth's tree. As such the only way for me to apply your patch is if Nishanth sends me a pull request for the patchset that introduced pruss_cfg_get_gpmux(). You can also resend this in the next cycle. Thanks, Mathieu > ret = of_property_read_string_index(np, "firmware-name", index, > &fw_name); > if (!ret) { > @@ -290,6 +309,8 @@ void pru_rproc_put(struct rproc *rproc) > > pru = rproc->priv; > > + pruss_cfg_set_gpmux(pru->pruss, pru->id, pru->gpmux_save); > + > pru_rproc_set_firmware(rproc, NULL); > > mutex_lock(&pru->lock); > -- > 2.34.1 >
On 11:26-20230605, Mathieu Poirier wrote: [...] > Here I have to suppose pruss_cfg_get_gpmux() has been added to Nishanth's tree. > As such the only way for me to apply your patch is if Nishanth sends me a pull > request for the patchset that introduced pruss_cfg_get_gpmux(). You can also > resend this in the next cycle. Yes, I had pulled this in [1] along with a few other driver fixes. I can send you an immutable tag to pull for your tree, if that helps the process along though, it might have a unrelated driver fixup patch as part of the series though.. [1] https://lore.kernel.org/all/168434617580.1538524.11482827517408254591.b4-ty@ti.com/ [2] https://git.kernel.org/pub/scm/linux/kernel/git/ti/linux.git/log/?h=ti-drivers-soc-next
Hi Mathieu, On 05/06/23 10:56 pm, Mathieu Poirier wrote: > Hi MD, > > On Thu, Jun 01, 2023 at 04:29:04PM +0530, MD Danish Anwar wrote: >> From: Tero Kristo <t-kristo@ti.com> >> >> Client device node property ti,pruss-gp-mux-sel can now be used to >> configure the GPMUX config value for PRU. >> >> Signed-off-by: Tero Kristo <t-kristo@ti.com> >> Signed-off-by: Suman Anna <s-anna@ti.com> >> Signed-off-by: MD Danish Anwar <danishanwar@ti.com> >> --- >> drivers/remoteproc/pru_rproc.c | 21 +++++++++++++++++++++ >> 1 file changed, 21 insertions(+) >> >> diff --git a/drivers/remoteproc/pru_rproc.c b/drivers/remoteproc/pru_rproc.c >> index 2874c8d324f7..29d3a5a930c1 100644 >> --- a/drivers/remoteproc/pru_rproc.c >> +++ b/drivers/remoteproc/pru_rproc.c >> @@ -109,6 +109,7 @@ struct pru_private_data { >> * @dbg_single_step: debug state variable to set PRU into single step mode >> * @dbg_continuous: debug state variable to restore PRU execution mode >> * @evt_count: number of mapped events >> + * @gpmux_save: saved value for gpmux config >> */ >> struct pru_rproc { >> int id; >> @@ -127,6 +128,7 @@ struct pru_rproc { >> u32 dbg_single_step; >> u32 dbg_continuous; >> u8 evt_count; >> + u8 gpmux_save; >> }; >> >> static inline u32 pru_control_read_reg(struct pru_rproc *pru, unsigned int reg) >> @@ -228,6 +230,7 @@ struct rproc *pru_rproc_get(struct device_node *np, int index, >> struct device *dev; >> const char *fw_name; >> int ret; >> + u32 mux; >> >> rproc = __pru_rproc_get(np, index); >> if (IS_ERR(rproc)) >> @@ -252,6 +255,22 @@ struct rproc *pru_rproc_get(struct device_node *np, int index, >> if (pru_id) >> *pru_id = pru->id; >> >> + ret = pruss_cfg_get_gpmux(pru->pruss, pru->id, &pru->gpmux_save); >> + if (ret) { >> + dev_err(dev, "failed to get cfg gpmux: %d\n", ret); >> + goto err; >> + } >> + >> + ret = of_property_read_u32_index(np, "ti,pruss-gp-mux-sel", index, >> + &mux); >> + if (!ret) { >> + ret = pruss_cfg_set_gpmux(pru->pruss, pru->id, mux); >> + if (ret) { >> + dev_err(dev, "failed to set cfg gpmux: %d\n", ret); >> + goto err; >> + } >> + } >> + > > It would have been nice to be told in a cover letter that pruss_cfg_get_gpmux() > is in linux-next so that I don't have to go fish for it... > My bad, I should have mentioned it. This patch depends on the soc: ti: pruss series [1] which is merged to Nishant's tree and is part of 'linux-next' but this isn't yet part of mainline linux. > I am fine with the code in this patch, though the changelog is cryptic and could > be enhanced to say "why" this is needed. The above could use some comments to > make sure people looking at this code understand that an error from > of_property_read_u32_index() is acceptable for backward compatibility. > > Here I have to suppose pruss_cfg_get_gpmux() has been added to Nishanth's tree. > As such the only way for me to apply your patch is if Nishanth sends me a pull > request for the patchset that introduced pruss_cfg_get_gpmux(). You can also > resend this in the next cycle. I will fix the changelog and send the next revision in the next cycle. > > Thanks, > Mathieu > [1] https://lore.kernel.org/all/20230414045542.3249939-1-danishanwar@ti.com/
On Mon, 5 Jun 2023 at 14:45, Nishanth Menon <nm@ti.com> wrote: > > On 11:26-20230605, Mathieu Poirier wrote: > [...] > > Here I have to suppose pruss_cfg_get_gpmux() has been added to Nishanth's tree. > > As such the only way for me to apply your patch is if Nishanth sends me a pull > > request for the patchset that introduced pruss_cfg_get_gpmux(). You can also > > resend this in the next cycle. > > Yes, I had pulled this in [1] along with a few other driver fixes. I > can send you an immutable tag to pull for your tree, if that helps the > process along though, it might have a unrelated driver fixup patch as > part of the series though.. > MD has indicated he would rework his patch and send a new revision in the next cycle. > [1] https://lore.kernel.org/all/168434617580.1538524.11482827517408254591.b4-ty@ti.com/ > [2] https://git.kernel.org/pub/scm/linux/kernel/git/ti/linux.git/log/?h=ti-drivers-soc-next > -- > Regards, > Nishanth Menon > Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3 1A34 DDB5 849D 1736 249D
diff --git a/drivers/remoteproc/pru_rproc.c b/drivers/remoteproc/pru_rproc.c index 2874c8d324f7..29d3a5a930c1 100644 --- a/drivers/remoteproc/pru_rproc.c +++ b/drivers/remoteproc/pru_rproc.c @@ -109,6 +109,7 @@ struct pru_private_data { * @dbg_single_step: debug state variable to set PRU into single step mode * @dbg_continuous: debug state variable to restore PRU execution mode * @evt_count: number of mapped events + * @gpmux_save: saved value for gpmux config */ struct pru_rproc { int id; @@ -127,6 +128,7 @@ struct pru_rproc { u32 dbg_single_step; u32 dbg_continuous; u8 evt_count; + u8 gpmux_save; }; static inline u32 pru_control_read_reg(struct pru_rproc *pru, unsigned int reg) @@ -228,6 +230,7 @@ struct rproc *pru_rproc_get(struct device_node *np, int index, struct device *dev; const char *fw_name; int ret; + u32 mux; rproc = __pru_rproc_get(np, index); if (IS_ERR(rproc)) @@ -252,6 +255,22 @@ struct rproc *pru_rproc_get(struct device_node *np, int index, if (pru_id) *pru_id = pru->id; + ret = pruss_cfg_get_gpmux(pru->pruss, pru->id, &pru->gpmux_save); + if (ret) { + dev_err(dev, "failed to get cfg gpmux: %d\n", ret); + goto err; + } + + ret = of_property_read_u32_index(np, "ti,pruss-gp-mux-sel", index, + &mux); + if (!ret) { + ret = pruss_cfg_set_gpmux(pru->pruss, pru->id, mux); + if (ret) { + dev_err(dev, "failed to set cfg gpmux: %d\n", ret); + goto err; + } + } + ret = of_property_read_string_index(np, "firmware-name", index, &fw_name); if (!ret) { @@ -290,6 +309,8 @@ void pru_rproc_put(struct rproc *rproc) pru = rproc->priv; + pruss_cfg_set_gpmux(pru->pruss, pru->id, pru->gpmux_save); + pru_rproc_set_firmware(rproc, NULL); mutex_lock(&pru->lock);