From patchwork Thu Nov 19 01:05:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suman Anna X-Patchwork-Id: 11916295 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1DC4C6369E for ; Thu, 19 Nov 2020 01:06:46 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 49DED22363 for ; Thu, 19 Nov 2020 01:06:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="V4f6IUU/"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ti.com header.i=@ti.com header.b="v70/1Z6J" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 49DED22363 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=+vSyEayV2kn1o2K9ICfej5uzk58S3W9Pklwp8R2mwXg=; b=V4f6IUU/81VcQs0GWU9n+j7qc cETJ9n0EbwhBV9kN8xdEc78OU7sv4drrtz0ApR1kXMmsbTQd0Vs5YazzSgA9xqYZSbp5Y7hf3+xs6 0KmrBbSSAhRh+ypiv8FTAw8gw7vEf7ZYgwthb7CtoZUuEqfT0rGMGD8VKkNzK7cvomxFcQYos2zdJ l+Z8xzAzwfVk6N35NrzxNgglE09UYolAscN5C/6qHpE5qnHoEyeUfAQTgGgN4YddeaB9MNUUkKH9v M83era/f39cA6QGgjyzJvfcNIUHb78X4IX4+XYVMO9EDT5cNeDXVOlq19MpWUNM955X5i/oXE0brl mF0Fm0Kgw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfYOe-0000DD-Um; Thu, 19 Nov 2020 01:06:01 +0000 Received: from fllv0016.ext.ti.com ([198.47.19.142]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfYOU-0000CI-0b for linux-arm-kernel@lists.infradead.org; Thu, 19 Nov 2020 01:05:51 +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 0AJ15lrJ035171; Wed, 18 Nov 2020 19:05:47 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1605747947; bh=UWoxl2yYZsVlDBS/IWm40lAm6V7kxSUa0dxqsHXyHQs=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=v70/1Z6JLPnhLYR/NYfVAqBaneBLEdhLuv6SaBLwYKtILQlX4z+3eR2Ws8hrTBnc5 faGXEe4+eKzJF0zYAlPejJQuyHcwgtm0XK/LthmHJVmdizyNQDDxseK8nzWH1tvSYf OUG6sWYRH9gwHMny6hRDgK3mKiWMnt5n4bARuQ4s= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 0AJ15l5V052384 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 18 Nov 2020 19:05:47 -0600 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 18 Nov 2020 19:05:46 -0600 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 18 Nov 2020 19:05:46 -0600 Received: from fllv0103.dal.design.ti.com (fllv0103.dal.design.ti.com [10.247.120.73]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 0AJ15kFk056335; Wed, 18 Nov 2020 19:05:46 -0600 Received: from localhost ([10.250.38.244]) by fllv0103.dal.design.ti.com (8.14.7/8.14.7) with ESMTP id 0AJ15kVO076056; Wed, 18 Nov 2020 19:05:46 -0600 From: Suman Anna To: Bjorn Andersson , Mathieu Poirier , Rob Herring Subject: [PATCH 1/3] dt-bindings: remoteproc: k3-r5f: Update bindings for J7200 SoCs Date: Wed, 18 Nov 2020 19:05:29 -0600 Message-ID: <20201119010531.21083-2-s-anna@ti.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201119010531.21083-1-s-anna@ti.com> References: <20201119010531.21083-1-s-anna@ti.com> 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-20201118_200550_286339_50B1BF41 X-CRM114-Status: GOOD ( 12.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Lokesh Vutla , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The TI K3 J7200 SoCs have two dual-core Arm R5F clusters/subsystems, with 2 R5F cores each, one in each of the MCU and MAIN voltage domains. These clusters are a revised IP version compared to those present on J721E SoCs. Update the K3 R5F remoteproc bindings with the compatible info relevant to these R5F clusters/subsystems on K3 J7200 SoCs. Signed-off-by: Suman Anna --- .../devicetree/bindings/remoteproc/ti,k3-r5f-rproc.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/remoteproc/ti,k3-r5f-rproc.yaml b/Documentation/devicetree/bindings/remoteproc/ti,k3-r5f-rproc.yaml index 4069f0f5e8fa..d905d614502b 100644 --- a/Documentation/devicetree/bindings/remoteproc/ti,k3-r5f-rproc.yaml +++ b/Documentation/devicetree/bindings/remoteproc/ti,k3-r5f-rproc.yaml @@ -32,6 +32,7 @@ properties: enum: - ti,am654-r5fss - ti,j721e-r5fss + - ti,j7200-r5fss power-domains: description: | @@ -95,6 +96,7 @@ patternProperties: enum: - ti,am654-r5f - ti,j721e-r5f + - ti,j7200-r5f reg: items: From patchwork Thu Nov 19 01:05:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suman Anna X-Patchwork-Id: 11916301 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EFA0C63697 for ; Thu, 19 Nov 2020 01:07:52 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2142122260 for ; Thu, 19 Nov 2020 01:07:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="UlspYttZ"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ti.com header.i=@ti.com header.b="BrNxKzRK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2142122260 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=5W+WMLAFHLV3rV4fWbsq9Q3oHklAUkoJQ49qB1oNt/4=; b=UlspYttZe9RBaLfALCFKA8uEr MX9gnXXoJ6cljuxPH1E4ov3496dOYUxXh2aRk9L9gWgmUn90KKsuxykivK5jjQz1P6dSezZsS/nn1 7MMGP+zUbi5YA/T8fDmMM6+kDgis2A9+1tT83b6I/3rX0ktZY0uCSgot/QTFmANkoFcXEU++DpMSi L8sS/Bk1fBBjBW4/o0Dmn5cM89ZPCfZreAnK8WxOQVN3CGywMFSSWqHSQlflplvVXm1AM0enZuUV1 RfzsC5U4GvHUcH+R8kCF44K+SoZagoQ3hrqoPybBYXMDFpDnD3Ac7RTNghsXKYjqyIsO64/MfnIKB XhzTmByNg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfYOi-0000Dz-Ky; Thu, 19 Nov 2020 01:06:04 +0000 Received: from fllv0015.ext.ti.com ([198.47.19.141]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfYOZ-0000Co-Nt for linux-arm-kernel@lists.infradead.org; Thu, 19 Nov 2020 01:05:57 +0000 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 0AJ15qOo070018; Wed, 18 Nov 2020 19:05:52 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1605747952; bh=5PHh617lCH6Ug2fKlt6PCR+qvi9MScqYVwoln/9DNHg=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=BrNxKzRK2gAgNeFnlbq8v6FmpQ3NE+Xw/AnMW0bUBxBbYrHma8XZF3shJV/rEZlQB 6w3Eaefncw7J6tfezlhwAJmDHrBsxkhe3Iv5EkHGtULn8qtuSvRKEUSfOSdIVPmU5E uq5L2Tung0bUszlRfQeEIzHC1Klm+VT5Y0nGJgB4= Received: from DFLE112.ent.ti.com (dfle112.ent.ti.com [10.64.6.33]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 0AJ15qpR052456 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 18 Nov 2020 19:05:52 -0600 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 18 Nov 2020 19:05:52 -0600 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.1979.3 via Frontend Transport; Wed, 18 Nov 2020 19:05:52 -0600 Received: from fllv0103.dal.design.ti.com (fllv0103.dal.design.ti.com [10.247.120.73]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 0AJ15qWP029382; Wed, 18 Nov 2020 19:05:52 -0600 Received: from localhost ([10.250.38.244]) by fllv0103.dal.design.ti.com (8.14.7/8.14.7) with ESMTP id 0AJ15qRa076072; Wed, 18 Nov 2020 19:05:52 -0600 From: Suman Anna To: Bjorn Andersson , Mathieu Poirier , Rob Herring Subject: [PATCH 2/3] remoteproc: k3-r5: Extend support to R5F clusters on J7200 SoCs Date: Wed, 18 Nov 2020 19:05:30 -0600 Message-ID: <20201119010531.21083-3-s-anna@ti.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201119010531.21083-1-s-anna@ti.com> References: <20201119010531.21083-1-s-anna@ti.com> 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-20201118_200556_350749_13D047E9 X-CRM114-Status: GOOD ( 25.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Lokesh Vutla , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The K3 J7200 SoC family has a revised R5F sub-system and contains a subset of the R5F clusters present on J721E SoCs. The K3 J7200 SoCs only have two dual-core Arm R5F clusters/subsystems with 2 R5F cores each. One cluster is present within the MCU voltage domain (MCU_R5FSS0), while the other is present in the MAIN voltage domain (MAIN_R5FSS0). The revised IP has the following two new features: 1. TCMs are auto-initialized during module power-up, and the behavior is programmable through a MMR bit. 2. The LockStep-mode allows the Core1 TCMs to be combined with the Core0 TCMs effectively doubling the amount of TCMs available. The LockStep-mode on previous SoCs could only use the Core0 TCMs. This combined TCMs appear contiguous at the respective Core0 TCM addresses. Extend the support to these clusters in the K3 R5F remoteproc driver using J7200 specific compatibles. Logic for the second feature is added in the next patch. The integration of these clusters is very much similar to J721E SoCs otherwise. Signed-off-by: Suman Anna --- drivers/remoteproc/ti_k3_r5_remoteproc.c | 52 +++++++++++++++++++++++- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/drivers/remoteproc/ti_k3_r5_remoteproc.c b/drivers/remoteproc/ti_k3_r5_remoteproc.c index 40fa7a4d2ec8..66a32dcdd7d0 100644 --- a/drivers/remoteproc/ti_k3_r5_remoteproc.c +++ b/drivers/remoteproc/ti_k3_r5_remoteproc.c @@ -38,6 +38,8 @@ #define PROC_BOOT_CFG_FLAG_R5_TCM_RSTBASE 0x00000800 #define PROC_BOOT_CFG_FLAG_R5_BTCM_EN 0x00001000 #define PROC_BOOT_CFG_FLAG_R5_ATCM_EN 0x00002000 +/* Available from J7200 SoCs onwards */ +#define PROC_BOOT_CFG_FLAG_R5_MEM_INIT_DIS 0x00004000 /* R5 TI-SCI Processor Control Flags */ #define PROC_BOOT_CTRL_FLAG_R5_CORE_HALT 0x00000001 @@ -67,16 +69,26 @@ enum cluster_mode { CLUSTER_MODE_LOCKSTEP, }; +/** + * struct k3_r5_soc_data - match data to handle SoC variations + * @tcm_ecc_autoinit: flag to denote the auto-initialization of TCMs for ECC + */ +struct k3_r5_soc_data { + bool tcm_ecc_autoinit; +}; + /** * struct k3_r5_cluster - K3 R5F Cluster structure * @dev: cached device pointer * @mode: Mode to configure the Cluster - Split or LockStep * @cores: list of R5 cores within the cluster + * @soc_data: SoC-specific feature data for a R5FSS */ struct k3_r5_cluster { struct device *dev; enum cluster_mode mode; struct list_head cores; + const struct k3_r5_soc_data *soc_data; }; /** @@ -362,8 +374,16 @@ static int k3_r5_rproc_prepare(struct rproc *rproc) struct k3_r5_cluster *cluster = kproc->cluster; struct k3_r5_core *core = kproc->core; struct device *dev = kproc->dev; + u32 ctrl = 0, cfg = 0, stat = 0; + u64 boot_vec = 0; + bool mem_init_dis; int ret; + ret = ti_sci_proc_get_status(core->tsp, &boot_vec, &cfg, &ctrl, &stat); + if (ret < 0) + return ret; + mem_init_dis = !!(cfg & PROC_BOOT_CFG_FLAG_R5_MEM_INIT_DIS); + ret = (cluster->mode == CLUSTER_MODE_LOCKSTEP) ? k3_r5_lockstep_release(cluster) : k3_r5_split_release(core); if (ret) { @@ -372,6 +392,17 @@ static int k3_r5_rproc_prepare(struct rproc *rproc) return ret; } + /* + * Newer IP revisions like on J7200 SoCs support h/w auto-initialization + * of TCMs, so there is no need to perform the s/w memzero. This bit is + * configurable through System Firmware, the default value does perform + * auto-init, but account for it in case it is disabled + */ + if (cluster->soc_data->tcm_ecc_autoinit && !mem_init_dis) { + dev_dbg(dev, "leveraging h/w init for TCM memories\n"); + return 0; + } + /* * Zero out both TCMs unconditionally (access from v8 Arm core is not * affected by ATCM & BTCM enable configuration values) so that ECC @@ -1309,15 +1340,23 @@ static int k3_r5_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct device_node *np = dev_of_node(dev); struct k3_r5_cluster *cluster; + const struct k3_r5_soc_data *data; int ret; int num_cores; + data = of_device_get_match_data(&pdev->dev); + if (!data) { + dev_err(dev, "SoC-specific data is not defined\n"); + return -ENODEV; + } + cluster = devm_kzalloc(dev, sizeof(*cluster), GFP_KERNEL); if (!cluster) return -ENOMEM; cluster->dev = dev; cluster->mode = CLUSTER_MODE_LOCKSTEP; + cluster->soc_data = data; INIT_LIST_HEAD(&cluster->cores); ret = of_property_read_u32(np, "ti,cluster-mode", &cluster->mode); @@ -1367,9 +1406,18 @@ static int k3_r5_probe(struct platform_device *pdev) return 0; } +static const struct k3_r5_soc_data am65_j721e_soc_data = { + .tcm_ecc_autoinit = false, +}; + +static const struct k3_r5_soc_data j7200_soc_data = { + .tcm_ecc_autoinit = true, +}; + static const struct of_device_id k3_r5_of_match[] = { - { .compatible = "ti,am654-r5fss", }, - { .compatible = "ti,j721e-r5fss", }, + { .compatible = "ti,am654-r5fss", .data = &am65_j721e_soc_data, }, + { .compatible = "ti,j721e-r5fss", .data = &am65_j721e_soc_data, }, + { .compatible = "ti,j7200-r5fss", .data = &j7200_soc_data, }, { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, k3_r5_of_match); From patchwork Thu Nov 19 01:05:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suman Anna X-Patchwork-Id: 11916299 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 568DCC63798 for ; Thu, 19 Nov 2020 01:06:47 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C81E12468B for ; Thu, 19 Nov 2020 01:06:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="a8tC632+"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ti.com header.i=@ti.com header.b="FKBKZ2Ye" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C81E12468B Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=7VBLvn2cEeLOSALB55Cn7xMaNXzK1/1gM1dUz+pwArE=; b=a8tC632+Eb9ijzQtab1PPpxMa 9+aT0X5EWy9+RXTGbBAdyxIhM6XGp2MHfaiiQwPOhpdV4xWTNj259HHEeaT7WoharKvjdEv2NgzIu WnTyph3oloHCwndRMk6mIjFTB26J5FmpxhoIhX/X6J2/Pde89BhK2NaLR1jJrujJaVmp0GUuVxmfr purtHwsmfHzhN2ozWJ5uT6Kw/mpd8ikaTm5gEQb+q/2wkqb7Ht3/KPjDRfMe/r63w7LKxkjO+aJXR dm5mUEY4o7oCu6ClKQOH2qZxvi4wMuT9z6KFlhvNx7jETDbaN+V9NXVAYDr7dDl5FEtlz8GnwEfpJ MUntakApg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfYOp-0000ES-91; Thu, 19 Nov 2020 01:06:11 +0000 Received: from fllv0016.ext.ti.com ([198.47.19.142]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfYOe-0000DF-5z for linux-arm-kernel@lists.infradead.org; Thu, 19 Nov 2020 01:06:01 +0000 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 0AJ15wn7035211; Wed, 18 Nov 2020 19:05:58 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1605747958; bh=+ID9fu20Z7nRd0w1Ob4OvPNiRzNqfHYUlj5DroPqL2Y=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=FKBKZ2YeAi/YH4CrD4mhe8aauk2jvuiKF3pAYFMmTzXOyFMNz1UebmZMw5Pc8ThgC RcYegxAJdoO8/Drh2UdOjwhJQ9jW85xo/rfD/UskVg7QMK21nQJHDmDjNkm6szB+Ux eGRP/VDqwsfmGwYLpPRPY7d7PC+nwVSY0J8HXjFA= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 0AJ15wpr018646 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 18 Nov 2020 19:05:58 -0600 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 18 Nov 2020 19:05:57 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 18 Nov 2020 19:05:57 -0600 Received: from fllv0103.dal.design.ti.com (fllv0103.dal.design.ti.com [10.247.120.73]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 0AJ15vSq082346; Wed, 18 Nov 2020 19:05:57 -0600 Received: from localhost ([10.250.38.244]) by fllv0103.dal.design.ti.com (8.14.7/8.14.7) with ESMTP id 0AJ15vW7076087; Wed, 18 Nov 2020 19:05:57 -0600 From: Suman Anna To: Bjorn Andersson , Mathieu Poirier , Rob Herring Subject: [PATCH 3/3] remoteproc: k3-r5: Adjust TCM sizes in Split-mode on J7200 SoCs Date: Wed, 18 Nov 2020 19:05:31 -0600 Message-ID: <20201119010531.21083-4-s-anna@ti.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201119010531.21083-1-s-anna@ti.com> References: <20201119010531.21083-1-s-anna@ti.com> 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-20201118_200600_907485_143B9632 X-CRM114-Status: GOOD ( 18.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Lokesh Vutla , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The J7200 SoCs have a revised R5FSS IP that adds a unique feature w.r.t TCM sizing. Each R5F core in a cluster typically has 32 KB each of ATCM and BTCM, with only the Core0 TCMs usable in LockStep mode. This revised IP however doubles the total available TCM in LockStep mode by making the Core1 TCM visible immediately after the corresponding Core0 TCM. The R5F DT nodes on the J7200 SoCs define double (64 KB) the normal TCM size (32 KB) for R5F Core0 for each of ATCM and BTCM to represent the above. This increased TCM memory is only usable in LockStep-mode, and has to be adjusted to the normal 32 KB size in Split mode. Enhance the TI K3 R5F remoteproc for this logic through a new function. The adjustment is a no-op on prior SoCs and relies on the correct DTS node sizes in LockStep-mode on applicable SoCs. Signed-off-by: Suman Anna Reviewed-by: Mathieu Poirier --- drivers/remoteproc/ti_k3_r5_remoteproc.c | 43 ++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/drivers/remoteproc/ti_k3_r5_remoteproc.c b/drivers/remoteproc/ti_k3_r5_remoteproc.c index 66a32dcdd7d0..62b5a4c29456 100644 --- a/drivers/remoteproc/ti_k3_r5_remoteproc.c +++ b/drivers/remoteproc/ti_k3_r5_remoteproc.c @@ -71,9 +71,11 @@ enum cluster_mode { /** * struct k3_r5_soc_data - match data to handle SoC variations + * @tcm_is_double: flag to denote the larger unified TCMs in certain modes * @tcm_ecc_autoinit: flag to denote the auto-initialization of TCMs for ECC */ struct k3_r5_soc_data { + bool tcm_is_double; bool tcm_ecc_autoinit; }; @@ -886,6 +888,43 @@ static void k3_r5_reserved_mem_exit(struct k3_r5_rproc *kproc) of_reserved_mem_device_release(kproc->dev); } +/* + * Each R5F core within a typical R5FSS instance has a total of 64 KB of TCMs, + * split equally into two 32 KB banks between ATCM and BTCM. The TCMs from both + * cores are usable in Split-mode, but only the Core0 TCMs can be used in + * LockStep-mode. The newer revisions of the R5FSS IP maximizes these TCMs by + * leveraging the Core1 TCMs as well in certain modes where they would have + * otherwise been unusable (Eg: LockStep-mode on J7200 SoCs). This is done by + * making a Core1 TCM visible immediately after the corresponding Core0 TCM. + * The SoC memory map uses the larger 64 KB sizes for the Core0 TCMs, and the + * dts representation reflects this increased size on supported SoCs. The Core0 + * TCM sizes therefore have to be adjusted to only half the original size in + * Split mode. + */ +static void k3_r5_adjust_tcm_sizes(struct k3_r5_rproc *kproc) +{ + struct k3_r5_cluster *cluster = kproc->cluster; + struct k3_r5_core *core = kproc->core; + struct device *cdev = core->dev; + struct k3_r5_core *core0; + + if (cluster->mode == CLUSTER_MODE_LOCKSTEP || + !cluster->soc_data->tcm_is_double) + return; + + core0 = list_first_entry(&cluster->cores, struct k3_r5_core, elem); + if (core == core0) { + WARN_ON(core->mem[0].size != SZ_64K); + WARN_ON(core->mem[1].size != SZ_64K); + + core->mem[0].size /= 2; + core->mem[1].size /= 2; + + dev_dbg(cdev, "adjusted TCM sizes, ATCM = 0x%zx BTCM = 0x%zx\n", + core->mem[0].size, core->mem[1].size); + } +} + static int k3_r5_cluster_rproc_init(struct platform_device *pdev) { struct k3_r5_cluster *cluster = platform_get_drvdata(pdev); @@ -933,6 +972,8 @@ static int k3_r5_cluster_rproc_init(struct platform_device *pdev) goto err_config; } + k3_r5_adjust_tcm_sizes(kproc); + ret = k3_r5_reserved_mem_init(kproc); if (ret) { dev_err(dev, "reserved memory init failed, ret = %d\n", @@ -1407,10 +1448,12 @@ static int k3_r5_probe(struct platform_device *pdev) } static const struct k3_r5_soc_data am65_j721e_soc_data = { + .tcm_is_double = false, .tcm_ecc_autoinit = false, }; static const struct k3_r5_soc_data j7200_soc_data = { + .tcm_is_double = true, .tcm_ecc_autoinit = true, };