From patchwork Thu Jun 1 10:59:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: MD Danish Anwar X-Patchwork-Id: 13263515 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 DED4CC77B7A for ; Thu, 1 Jun 2023 10:59:46 +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:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Hs71Nxm6kmInRqyxLkp/C3XfETOXW9VkNU61/mlZpkA=; b=vN0n0kcHR6a66O 9FsLLfOgdHQFDZTcdITcBzYygbWcVTrc7IrCKwMCUrhe9/Rqr6WRO9RnDBx+i8kmICGUiPrRBorie SGSazqVPqphcU8GVafYChkycSdOaWBS2tkmEHowm+B8ctHs8H+CK6DExRJjnsIJjUO5sncpdCjLyZ oB5p7mM0jZFw1p2+c4ljH7P0ymfz/lXQyhVD16/qrgVnF5l+NRNzwFmxl3i7UpyJaNaI1wBaRv2IS kxrfMlRt2Sn6lA+7YBkZ9UrKhMJ3QitzLKfun6DsE4Fj/N3O6Sw7YKSLHspsjVwG778ern5Dzrw5B 6iI5wXcOGbl7QeaxG3Rg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q4g1Z-0039CV-1T; Thu, 01 Jun 2023 10:59:21 +0000 Received: from fllv0016.ext.ti.com ([198.47.19.142]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q4g1W-0039Ay-0e for linux-arm-kernel@lists.infradead.org; Thu, 01 Jun 2023 10:59:20 +0000 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 To: Mathieu Poirier , Bjorn Andersson CC: , , , , , , , , 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 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230601_035918_818120_AE50F9DC X-CRM114-Status: GOOD ( 12.45 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Tero Kristo 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 Signed-off-by: Suman Anna Signed-off-by: MD Danish Anwar --- 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; + } + } + 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);