From patchwork Mon Nov 26 07:52:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 151984 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp5329177ljp; Sun, 25 Nov 2018 23:53:54 -0800 (PST) X-Google-Smtp-Source: AJdET5fW+zF2PuzUXPAuYeaAVWAia0fvPC15UtC1tUlqO2jxEmQks56a8xHOsheAXoaZffqCArjn X-Received: by 2002:a62:2781:: with SMTP id n123mr27201236pfn.138.1543218834857; Sun, 25 Nov 2018 23:53:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543218834; cv=none; d=google.com; s=arc-20160816; b=lkNLAXvjaJlwfnZDQCGXiXqeVWeabpkasLZXqa6RNjdmeFYz8y2/W/3S5pBNX8IMpj Vg0mX8xVP3doTXaAdIv/7H/ed66yVD6cMaO1o8qNk7WRivCpBoE59SWqPPCl49XsYhK9 pT7Sy1CNMXyUQYNq/jX4dlVDMcsNcFp7OI4KBxDzLefjZZa42Kwu9BqemF7F+uEySD57 cdVxALmOJptN1Ilv0nld/34fI1ur/tgbl0fBrhj37krl0IFV+frf1+Las/dge9BuUm4/ G4YsuRyCQt9ik4ZXuQjDZH0km+40xqTBVwVJnSw3JA+aCq7AOEK8GSZouzFCT1oVMszE J6wQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=GqjqmJN1O3r0UufVue0451MwIx1hTm8JfiUXI+/XlVI=; b=P2PcRTxVDHEzyFRkajoyfE4ceY07Su7Ojl37absqTM1L+cLrWSwbhkVJKijWbV2Lpi rvwpEzRybpx15wU/DP0dBRX/veN4TcOLvs2YTK+NFkQchTU5P80zSgjiw2HvNPEMGxo/ xkSl3NEd19mSpGtFy7xSWvfoFAk+kagLj611cSKVMezPjIIKci158OQZCdI/ZTZymPFj 3pyeMJvZKV9w6/iAaFpk4cJrh2jaXEjGnBYMxDGGf04j33sZEhHlaHbucdzIL8GqeGVs pAADYD/H8jZIoS/mfDHNjcIFGhoyKmeXygjRLVjcDxVrASpP9p+Ddye/P0X5tdr8lF33 kWzQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=QUARANTINE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x2-v6si61958178plv.413.2018.11.25.23.53.54; Sun, 25 Nov 2018 23:53:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=QUARANTINE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726756AbeKZSrJ (ORCPT + 32 others); Mon, 26 Nov 2018 13:47:09 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:36558 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726287AbeKZSrI (ORCPT ); Mon, 26 Nov 2018 13:47:08 -0500 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id wAQ7rn9U102551; Mon, 26 Nov 2018 01:53:49 -0600 Received: from DLEE111.ent.ti.com (dlee111.ent.ti.com [157.170.170.22]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id wAQ7rnmf084094 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Nov 2018 01:53:49 -0600 Received: from DLEE111.ent.ti.com (157.170.170.22) by DLEE111.ent.ti.com (157.170.170.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Mon, 26 Nov 2018 01:53:46 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE111.ent.ti.com (157.170.170.22) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Mon, 26 Nov 2018 01:53:46 -0600 Received: from dlelxv97.itg.ti.com (dlelxv97.itg.ti.com [172.17.2.193]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id wAQ7rldY009288; Mon, 26 Nov 2018 01:53:47 -0600 Received: from localhost.localdomain (vboxa0400828d.dhcp.ti.com [172.22.237.3]) by dlelxv97.itg.ti.com (8.14.3/8.13.8) with ESMTP id wAQ7qn1R024490; Mon, 26 Nov 2018 01:53:43 -0600 From: Roger Quadros To: , CC: , , , , , , , , , , , , , , , Subject: [PATCH 13/16] remoteproc/pru: add support for configuring GPMUX based on client setup Date: Mon, 26 Nov 2018 09:52:46 +0200 Message-ID: <1543218769-5507-14-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543218769-5507-1-git-send-email-rogerq@ti.com> References: <1543218769-5507-1-git-send-email-rogerq@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org 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 --- drivers/remoteproc/pru_rproc.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki diff --git a/drivers/remoteproc/pru_rproc.c b/drivers/remoteproc/pru_rproc.c index d8b823d..9a08937 100644 --- a/drivers/remoteproc/pru_rproc.c +++ b/drivers/remoteproc/pru_rproc.c @@ -72,6 +72,7 @@ enum pru_mem { * @sdram_da: device address of secondary Data RAM for this PRU * @shrdram_da: device address of shared Data RAM * @fw_name: name of firmware image used during loading + * @gpmux_save: saved value for gpmux config * @lock: mutex to protect client usage * @dbg_single_step: debug state variable to set PRU into single step mode * @dbg_continuous: debug state variable to restore PRU execution mode @@ -95,6 +96,7 @@ struct pru_rproc { u32 sdram_da; u32 shrdram_da; const char *fw_name; + u8 gpmux_save; struct mutex lock; /* client access lock */ u32 dbg_single_step; u32 dbg_continuous; @@ -184,12 +186,16 @@ struct rproc *pru_rproc_get(struct device_node *np, int index) { struct rproc *rproc; struct pru_rproc *pru; + struct device *dev; + int ret; + u32 mux; rproc = __pru_rproc_get(np, index); if (IS_ERR(rproc)) return rproc; pru = rproc->priv; + dev = &rproc->dev; mutex_lock(&pru->lock); @@ -203,7 +209,27 @@ 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; + } + } + return rproc; + +err: + pru_rproc_put(rproc); + return ERR_PTR(ret); } EXPORT_SYMBOL_GPL(pru_rproc_get); @@ -229,6 +255,8 @@ void pru_rproc_put(struct rproc *rproc) if (!pru->client_np) return; + pruss_cfg_set_gpmux(pru->pruss, pru->id, pru->gpmux_save); + mutex_lock(&pru->lock); pru->client_np = NULL; mutex_unlock(&pru->lock);