Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp1799368iof; Tue, 7 Jun 2022 11:32:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwH9feTAX+7B/i5i4TE2fAtRCfqS9I/lAJuKh9alEydLFUmTg3iEevdy9t4Dr+Nz4+rkDsi X-Received: by 2002:a17:90b:4b0a:b0:1e8:6ff0:7ec1 with SMTP id lx10-20020a17090b4b0a00b001e86ff07ec1mr16035366pjb.212.1654626598160; Tue, 07 Jun 2022 11:29:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654626598; cv=none; d=google.com; s=arc-20160816; b=EQyOvVv9QLoql0qUsv+BVSPestcV73k7HQJO5mkOfI/GYqU+nwLsJ3OltTSgVoPieL N5Ps6Q2HW8uYywom6aHYzxHSKbBv0ohiEeJ9i663WYRL8WILs+RIx0SnHOO+g1zZy5fv TG7F9UTqjftH5uVrcmsC0HCrMOvWU52hmBUsTTRsbCcD6twGwOrgs2tKWt88kt1Nj05N OSrkxJETjCM1KOtn3Lhm3WqcMOqzxy3MayvLqDhElxm2ycnpYm7FMISVmTOALqiKljbx mKeEuaMZ1VNecmuOrUkmjTr5yDV48nZkt11PgzkGe4tai1k2xf+JO+XmMcNwe4moFXsx KrPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Cdif7KJdXOI98yjbTpb3S7eZDYdMM1OYv04stK4sVrU=; b=cRkvmE0fX4cI6mTVsTtY0WqImyY4qr7OfbO3SZPpvj97AcJpfGSSbOXy1zRc+xOS8c FacALkgN17nLYeKkjKvBeOs4+t65osqEAKh7gytpuB9gTAO2ryuTr0R5XVSXtOQaiKia o3apU4e/oaKtYRyy00NZuvhQ7vP9I3y9+hlzjlBGgV1BFKq0Fy9D2lygdjp/und/WybC XkBe67INyAcTiuXE1GDh9zVp73qYtl3N0ehzyGWhK5Cf3z4LuoBpvm3oU6ZY1DiEOhk7 W0xSA6JVXv240NZpOTaoVFHBzfBtQmNwy5Zjo/6gd6B8wMlcpckbf+BExC07w/t0y5b2 B4gA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=iI2Rc4xh; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c2-20020a170902d48200b00167552e7cb0si17826487plg.316.2022.06.07.11.29.44; Tue, 07 Jun 2022 11:29:58 -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=iI2Rc4xh; 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 S236727AbiFGE5n (ORCPT + 99 others); Tue, 7 Jun 2022 00:57:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236696AbiFGE5W (ORCPT ); Tue, 7 Jun 2022 00:57:22 -0400 Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD14D305; Mon, 6 Jun 2022 21:57:11 -0700 (PDT) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 2574v7O9026512; Mon, 6 Jun 2022 23:57:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1654577827; bh=Cdif7KJdXOI98yjbTpb3S7eZDYdMM1OYv04stK4sVrU=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=iI2Rc4xhelfcpTnSIXQp5+UOJy0nPmtnGyDlyw0nVemyv9CnammsXK8Dn3XpCLjiR Gs4Vo8T5WRf2hBciLgV2ouSf/pFcNXokDGtZLYB1tt2iOQNexfGlwZv795f3C1P7Ds MIEhqYvNFRQjkOd2VCGhf4hYsRX/Re1K4W9Q68OA= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 2574v7rR030522 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 6 Jun 2022 23:57:07 -0500 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Mon, 6 Jun 2022 23:57:07 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14 via Frontend Transport; Mon, 6 Jun 2022 23:57:07 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 2574v6Ll111771; Mon, 6 Jun 2022 23:57:06 -0500 From: Puranjay Mohan To: CC: , , , , , , , , , , , , , , Subject: [PATCH v5 6/6] remoteproc: pru: add support for configuring GPMUX based on client setup Date: Tue, 7 Jun 2022 10:26:50 +0530 Message-ID: <20220607045650.4999-7-p-mohan@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220607045650.4999-1-p-mohan@ti.com> References: <20220607045650.4999-1-p-mohan@ti.com> MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-5.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_NONE,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: X-Mailing-List: linux-kernel@vger.kernel.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 [s-anna@ti.com: simplify the pru id usage] Signed-off-by: Suman Anna Signed-off-by: Puranjay Mohan --- V4->v5 * This patch was included in v4 and had some checkpatch errors that have been resolved in v5 --- drivers/remoteproc/pru_rproc.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/remoteproc/pru_rproc.c b/drivers/remoteproc/pru_rproc.c index 2977eb50631b..f2c6c55f0f20 100644 --- a/drivers/remoteproc/pru_rproc.c +++ b/drivers/remoteproc/pru_rproc.c @@ -123,6 +123,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; @@ -141,6 +142,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) @@ -250,6 +252,7 @@ struct rproc *pru_rproc_get(struct device_node *np, int index, struct device *dev; const char *fw_name; int ret; + u32 mux; try_module_get(THIS_MODULE); @@ -273,6 +276,22 @@ struct rproc *pru_rproc_get(struct device_node *np, int index, mutex_unlock(&pru->lock); + 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; + } + } + if (pru_id) *pru_id = pru->id; @@ -310,6 +329,7 @@ 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.17.1