Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp100943iof; Sun, 5 Jun 2022 22:23:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWeU3sT+S5s5v01pyBec4cst4/SU+3gYFF0Sg/ozudpCX1efQaMV2QWrn6J0gBb2yC42rj X-Received: by 2002:a63:87c1:0:b0:3fd:c854:e132 with SMTP id i184-20020a6387c1000000b003fdc854e132mr2575498pge.192.1654493024184; Sun, 05 Jun 2022 22:23:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654493024; cv=none; d=google.com; s=arc-20160816; b=vgGUz8RbEbrYD9KjPMXUvrKJIl+qrbQsFKDLSIkF/abMjJ9ZiU5czULk7DnJxTza8Z N8At8LWEzxg2+W8/HiLbmAbX8AjNvWdIhxf0N3iLr3nyxrYhzeQNhryoNN0fQsLbHaIv u9Ze/ukL43kyFWSzxVUr1WERPTsaEyFBfH1zmmVu0u7khCMgnv3l2Vv5f14N5tj8ooZr cL83zR1uijWdaV8xPLgwc6LaXaw4fJU7yukHzXZOIhz0gumdjFKF57KAQww6id1S80yt 28frbAQHn1iz+9d0M/KlBeMV2PGavOzXLj1SHNGsamPQqrqS0Dh4TWhDnq2JUW3lnB3U UJ+A== 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=RUZPQ+k/CYQH8PVfKXR4X3F5fhUjffskd1cfh1MzVPE=; b=kQGR+Zz27l5/LB00in41vngR639liSEdxMsO2vD1BCpxJM/TSx0ZuW6WI8zijDNW75 kE8qxwzeAplnS6CClGPuZPK7TWhnWwbEFyWDLCnDCyKzNxrYiZqX0f1SsJNIoJ6Eiij+ LX/7Al1iKl3idxQPE4gwbWmVvr1bl3u53EZIOgGAD4aXW5njnxzMKhic84ykkrcCH/x8 xozsGeQswbCNzt9EreyhBhpbJsZ6x+7HTEDi3KhukDKInvmBlbjrM+r3ARJaHqpA3D23 N5acx/yivxdnIYgblrMMY7152wOr49KR5s/ja1cFb2hpExE0DwiEK7sC5YW0KPW7WdHO OLJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=mn81pSs2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id c30-20020a631c5e000000b003c21952c7c7si19000074pgm.37.2022.06.05.22.23.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 22:23:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=mn81pSs2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E2CBE1A65F5; Sun, 5 Jun 2022 21:26:13 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235184AbiFCMQC (ORCPT + 99 others); Fri, 3 Jun 2022 08:16:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244189AbiFCMPt (ORCPT ); Fri, 3 Jun 2022 08:15:49 -0400 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 805FC39826; Fri, 3 Jun 2022 05:15:48 -0700 (PDT) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 253CFaNC078403; Fri, 3 Jun 2022 07:15:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1654258536; bh=RUZPQ+k/CYQH8PVfKXR4X3F5fhUjffskd1cfh1MzVPE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=mn81pSs2Fv/sYgGMQm3MtKYsg/rEcAMR2B/hEFHcBb5ft9AVcfsjSIWa+VBo2fk30 stOKiGzocXa9OTpB+tOZdiKt1K7GM4ZkL6c1MtuQCkbtiDxZsZl5eYER3rRkdZW1wx YSJIV5sBmBjQdkxlwfqmmh2algmroMLRSrARlmmw= Received: from DLEE112.ent.ti.com (dlee112.ent.ti.com [157.170.170.23]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 253CFall113689 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 3 Jun 2022 07:15:36 -0500 Received: from DLEE114.ent.ti.com (157.170.170.25) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Fri, 3 Jun 2022 07:15:35 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE114.ent.ti.com (157.170.170.25) 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; Fri, 3 Jun 2022 07:15:36 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 253CFYvT129114; Fri, 3 Jun 2022 07:15:35 -0500 From: Puranjay Mohan To: CC: , , , , , , , , , , , , , , Subject: [PATCH v4 6/6] remoteproc: pru: add support for configuring GPMUX based on client setup Date: Fri, 3 Jun 2022 17:45:20 +0530 Message-ID: <20220603121520.13730-7-p-mohan@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220603121520.13730-1-p-mohan@ti.com> References: <20220603121520.13730-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=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 --- 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..b532069fe259 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