From patchwork Fri Mar 1 18:16:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tanmay Shah X-Patchwork-Id: 208995 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp62323dyc; Fri, 1 Mar 2024 10:18:02 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVJZ2+Pty7+At9o73xPS1N8kwjg4KzTkJcvoBiXrNpSrjXXwlRr2DbPgjSDKVcP5M5qAC5740V7vDO6+XJPMfASloGYpg== X-Google-Smtp-Source: AGHT+IH3URxN93roG+CZj58DVADJLPpB+J1079VkqOUicka/yjHH0FZbHxYcxLwaqfQHJnS7QtSB X-Received: by 2002:a17:906:3846:b0:a3d:ed30:11c8 with SMTP id w6-20020a170906384600b00a3ded3011c8mr1982356ejc.15.1709317082017; Fri, 01 Mar 2024 10:18:02 -0800 (PST) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id kf6-20020a17090776c600b00a449603bea5si606290ejc.636.2024.03.01.10.18.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 10:18:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88891-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=IhcizhTi; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-88891-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88891-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 738B51F235FD for ; Fri, 1 Mar 2024 18:18:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3943439FFB; Fri, 1 Mar 2024 18:17:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="IhcizhTi" Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2074.outbound.protection.outlook.com [40.107.212.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2DA58825; Fri, 1 Mar 2024 18:17:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.212.74 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317033; cv=fail; b=UlCAmmSQ+6wONAaMomm/rV4shOEJxtdynjUA/59bRXldxYT4sNB47swROL5WCvgmNnX/tqnSd9HkU+bsV2XqGj3MRg7898+aJUgTZ74qNHx/PdASgr6HfAqsg60Pv/0Pee5qIAnlGbI/NXtCpwYvduuAnQBD0waW2IHqTdRvYog= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317033; c=relaxed/simple; bh=qDErJv3mMHu7GxRPmcX9r96ekS2YDAPnGo0SzEayMbk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LbtkcCK2qc5bNfpAwwfDTA3S9nEoxMxv66mE2Nu+cpPc1u62URuULL9xegcDdFrq5HjMdEW8wGGaq+uLk95VxKhQRu0nN2R51LjTQpvhZu8a/pB4D6CVCS0tp/94B9qxU3J6wQVApC6CNe1s/XZletJZ8udYA3+UtpzC4QiPKjk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=IhcizhTi; arc=fail smtp.client-ip=40.107.212.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WD5XObqMrQC3poeuL4tNEbnkdA8+uQ1bkwJqLV3ajwWOxyouhRyQAPhxyMqSkJFm/k5rMaotG5TdQgrrNV39/HqX9v/Mz5tChgC8Rm3idsYJ4yGxcljot8uVHOG4FU1zg+kdsTAACnETu4Obh4KP4ko8v5DRMw8MJbjc3IgxIhCOUdqGqqD4yTMl97zzOfXo5cNCYZIO0SW0S5VpVoE82LZW4CJ/420YlDpoUOYODnYlauQcsk1CN4GKNBo/Ny1ScP3SK2r0P2psFmKP6tcZIq6wrm2C1aeUXfMINmWwS5F18K1FpA9Z9aGh+KMbLK1f772oLdG+6c2SoWe7FVyZWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lM9DTxTghBBdcVUVEjO5JQZu4wlEdGOqat/qzIryIUE=; b=M/MTJ4bIPWnLJCIne5pdDRQBZ9YFKS+6I4GxVDh+5C9SjeZW1e1179gZtyw/3VJVM06NF2CvtnIKEfbdxP2IKke5kU8hd+taI5akkJOa6TBSDYhyN+A2LlPPXrV7QrEtUa+Vnp9wXcvaaE3pqgAsuq5DqbopwAsak9Jh+WjoSn5y2oUiZbx28G8sdTiOOwz4jNaXwx0EScOAl5vGyy2VbB8SUwS+zkmRZF3wGZi1fj1NcH69UeMHbYmEb95mLB/3CB9IPPwXBpSJnEvl0HOITjxGxrxRd9rxjEIGEJYmepETNkhoQX8oQ53G3r2YhKRbEPHqIq6UYsL/MqMLjnoWPA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lM9DTxTghBBdcVUVEjO5JQZu4wlEdGOqat/qzIryIUE=; b=IhcizhTiC8wqlMqADJuqpsOJjXCy8OD3GEQYiz17KnmsyyI3qE8751FdKorcdrVlEZj1V27Db9VY67bXp5HWJKWgtlhRy/pe05UG6WrSFciVJAHXNUrgrX6nCD/IUxhSLbG2XT7PyVCDQTvsZ55uRMAhJj9050/6LpmOcQvogvw= Received: from BN9PR03CA0672.namprd03.prod.outlook.com (2603:10b6:408:10e::17) by PH7PR12MB5973.namprd12.prod.outlook.com (2603:10b6:510:1d8::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.47; Fri, 1 Mar 2024 18:17:08 +0000 Received: from BN3PEPF0000B06B.namprd21.prod.outlook.com (2603:10b6:408:10e:cafe::28) by BN9PR03CA0672.outlook.office365.com (2603:10b6:408:10e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.33 via Frontend Transport; Fri, 1 Mar 2024 18:17:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by BN3PEPF0000B06B.mail.protection.outlook.com (10.167.243.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7362.0 via Frontend Transport; Fri, 1 Mar 2024 18:17:07 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 1 Mar 2024 12:17:07 -0600 Received: from xsjtanmays50.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Fri, 1 Mar 2024 12:17:06 -0600 From: Tanmay Shah To: , , , , , , , CC: , , , Subject: [PATCH v12 1/4] remoteproc: zynqmp: fix lockstep mode memory region Date: Fri, 1 Mar 2024 10:16:35 -0800 Message-ID: <20240301181638.814215-2-tanmay.shah@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240301181638.814215-1-tanmay.shah@amd.com> References: <20240301181638.814215-1-tanmay.shah@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Received-SPF: None (SATLEXMB03.amd.com: tanmay.shah@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B06B:EE_|PH7PR12MB5973:EE_ X-MS-Office365-Filtering-Correlation-Id: 6e591d18-3236-4dcb-6ec6-08dc3a1bce69 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ln7N5IgKf9DYCbOOxLX3f7XhVqLmPYLS66X8237OLb1FTHj+rvtichwn4cgg/JgHf5rmqA5HTEah9lOyjmM5EWxKsNIOW75FriLdxf77cr4wIy6TMugQJXWu//8NeMQPZovIXBNgvNnlM1Gfvm5+I7Q2c7zymBeynz81Y03tZk8svkYBhu3ilajYG+51ZnZ7g04xWDaGa/xgYuCd3hb90s3n82kPLG8J9ydJSsRn1Qpw8q3FMdyUiOhq7WTxB8N3e8wzwdhDSXb7L83v6ldphoPM64sOnYVlCwxbeKkk6CtmT1Wzp2zVio4zYvCV0o4102VRNqhdIvhWs0pCiuqdbBhH50MMgtQe5cBQkwpoGzA9LJGSjTbd+qpJDOPGKATaJIfIm3S37GsPo9TSzLCPLz8sVSA/Lxa4T3rfGKqXlncYYe/AXVKxWKZZeM9ujucBee+cGBiOqve4/JNvJWClQDCvkxgy9zPAPreZCaa8BKQO6khZboS7AHFBwE9qxFJngA3h3votv6YhHB/UUZg/dn9WSMl7Rzm0VvuIsD09qeBnrbx1UDe/9mdptMZA9kcErl1z3UK/H2BEOQhGSUXZZTtd+Z593Hb/wiOlp9c54f76X5PrsZ+J5M0GbUnO3iWdBthuU2I6DwgZzQ5vKzfz64K2T7skS0AdtHKbxxX0i4qXUvnithwo5gEXUmK+16OBOKkJI564i1EG7+xbUP/nDPWH/SyMpI0MijeuRhiJw51Im4anQMS/AFjL4ECBodzc X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(36860700004)(82310400014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Mar 2024 18:17:07.9905 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6e591d18-3236-4dcb-6ec6-08dc3a1bce69 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN3PEPF0000B06B.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5973 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792348868312224755 X-GMAIL-MSGID: 1792348868312224755 In lockstep mode, r5 core0 uses TCM of R5 core1. Following is lockstep mode memory region as per hardware reference manual. | *TCM* | *R5 View* | *Linux view* | | R5_0 ATCM (128 KB) | 0x0000_0000 | 0xFFE0_0000 | | R5_0 BTCM (128 KB) | 0x0002_0000 | 0xFFE2_0000 | However, driver shouldn't model it as above because R5 core0 TCM and core1 TCM has different power-domains mapped to it. Hence, TCM address space in lockstep mode should be modeled as 64KB regions only where each region has its own power-domain as following: | *TCM* | *R5 View* | *Linux view* | | R5_0 ATCM0 (64 KB) | 0x0000_0000 | 0xFFE0_0000 | | R5_0 BTCM0 (64 KB) | 0x0002_0000 | 0xFFE2_0000 | | R5_0 ATCM1 (64 KB) | 0x0001_0000 | 0xFFE1_0000 | | R5_0 BTCM1 (64 KB) | 0x0003_0000 | 0xFFE3_0000 | This makes driver maintanance easy and makes design robust for future platorms as well. Signed-off-by: Tanmay Shah --- Changes in v12: - None drivers/remoteproc/xlnx_r5_remoteproc.c | 145 ++---------------------- 1 file changed, 12 insertions(+), 133 deletions(-) diff --git a/drivers/remoteproc/xlnx_r5_remoteproc.c b/drivers/remoteproc/xlnx_r5_remoteproc.c index 4395edea9a64..42b0384d34f2 100644 --- a/drivers/remoteproc/xlnx_r5_remoteproc.c +++ b/drivers/remoteproc/xlnx_r5_remoteproc.c @@ -84,12 +84,12 @@ static const struct mem_bank_data zynqmp_tcm_banks_split[] = { {0xffeb0000UL, 0x20000, 0x10000UL, PD_R5_1_BTCM, "btcm1"}, }; -/* In lockstep mode cluster combines each 64KB TCM and makes 128KB TCM */ +/* In lockstep mode cluster uses each 64KB TCM from second core as well */ static const struct mem_bank_data zynqmp_tcm_banks_lockstep[] = { - {0xffe00000UL, 0x0, 0x20000UL, PD_R5_0_ATCM, "atcm0"}, /* TCM 128KB each */ - {0xffe20000UL, 0x20000, 0x20000UL, PD_R5_0_BTCM, "btcm0"}, - {0, 0, 0, PD_R5_1_ATCM, ""}, - {0, 0, 0, PD_R5_1_BTCM, ""}, + {0xffe00000UL, 0x0, 0x10000UL, PD_R5_0_ATCM, "atcm0"}, /* TCM 64KB each */ + {0xffe20000UL, 0x20000, 0x10000UL, PD_R5_0_BTCM, "btcm0"}, + {0xffe10000UL, 0x10000, 0x10000UL, PD_R5_1_ATCM, "atcm1"}, + {0xffe30000UL, 0x30000, 0x10000UL, PD_R5_1_BTCM, "btcm1"}, }; /** @@ -540,14 +540,14 @@ static int tcm_mem_map(struct rproc *rproc, } /* - * add_tcm_carveout_split_mode() + * add_tcm_banks() * @rproc: single R5 core's corresponding rproc instance * - * allocate and add remoteproc carveout for TCM memory in split mode + * allocate and add remoteproc carveout for TCM memory * * return 0 on success, otherwise non-zero value on failure */ -static int add_tcm_carveout_split_mode(struct rproc *rproc) +static int add_tcm_banks(struct rproc *rproc) { struct rproc_mem_entry *rproc_mem; struct zynqmp_r5_core *r5_core; @@ -580,10 +580,10 @@ static int add_tcm_carveout_split_mode(struct rproc *rproc) ZYNQMP_PM_REQUEST_ACK_BLOCKING); if (ret < 0) { dev_err(dev, "failed to turn on TCM 0x%x", pm_domain_id); - goto release_tcm_split; + goto release_tcm; } - dev_dbg(dev, "TCM carveout split mode %s addr=%llx, da=0x%x, size=0x%lx", + dev_dbg(dev, "TCM carveout %s addr=%llx, da=0x%x, size=0x%lx", bank_name, bank_addr, da, bank_size); rproc_mem = rproc_mem_entry_init(dev, NULL, bank_addr, @@ -593,7 +593,7 @@ static int add_tcm_carveout_split_mode(struct rproc *rproc) if (!rproc_mem) { ret = -ENOMEM; zynqmp_pm_release_node(pm_domain_id); - goto release_tcm_split; + goto release_tcm; } rproc_add_carveout(rproc, rproc_mem); @@ -601,7 +601,7 @@ static int add_tcm_carveout_split_mode(struct rproc *rproc) return 0; -release_tcm_split: +release_tcm: /* If failed, Turn off all TCM banks turned on before */ for (i--; i >= 0; i--) { pm_domain_id = r5_core->tcm_banks[i]->pm_domain_id; @@ -610,127 +610,6 @@ static int add_tcm_carveout_split_mode(struct rproc *rproc) return ret; } -/* - * add_tcm_carveout_lockstep_mode() - * @rproc: single R5 core's corresponding rproc instance - * - * allocate and add remoteproc carveout for TCM memory in lockstep mode - * - * return 0 on success, otherwise non-zero value on failure - */ -static int add_tcm_carveout_lockstep_mode(struct rproc *rproc) -{ - struct rproc_mem_entry *rproc_mem; - struct zynqmp_r5_core *r5_core; - int i, num_banks, ret; - phys_addr_t bank_addr; - size_t bank_size = 0; - struct device *dev; - u32 pm_domain_id; - char *bank_name; - u32 da; - - r5_core = rproc->priv; - dev = r5_core->dev; - - /* Go through zynqmp banks for r5 node */ - num_banks = r5_core->tcm_bank_count; - - /* - * In lockstep mode, TCM is contiguous memory block - * However, each TCM block still needs to be enabled individually. - * So, Enable each TCM block individually. - * Although ATCM and BTCM is contiguous memory block, add two separate - * carveouts for both. - */ - for (i = 0; i < num_banks; i++) { - pm_domain_id = r5_core->tcm_banks[i]->pm_domain_id; - - /* Turn on each TCM bank individually */ - ret = zynqmp_pm_request_node(pm_domain_id, - ZYNQMP_PM_CAPABILITY_ACCESS, 0, - ZYNQMP_PM_REQUEST_ACK_BLOCKING); - if (ret < 0) { - dev_err(dev, "failed to turn on TCM 0x%x", pm_domain_id); - goto release_tcm_lockstep; - } - - bank_size = r5_core->tcm_banks[i]->size; - if (bank_size == 0) - continue; - - bank_addr = r5_core->tcm_banks[i]->addr; - da = r5_core->tcm_banks[i]->da; - bank_name = r5_core->tcm_banks[i]->bank_name; - - /* Register TCM address range, TCM map and unmap functions */ - rproc_mem = rproc_mem_entry_init(dev, NULL, bank_addr, - bank_size, da, - tcm_mem_map, tcm_mem_unmap, - bank_name); - if (!rproc_mem) { - ret = -ENOMEM; - zynqmp_pm_release_node(pm_domain_id); - goto release_tcm_lockstep; - } - - /* If registration is success, add carveouts */ - rproc_add_carveout(rproc, rproc_mem); - - dev_dbg(dev, "TCM carveout lockstep mode %s addr=0x%llx, da=0x%x, size=0x%lx", - bank_name, bank_addr, da, bank_size); - } - - return 0; - -release_tcm_lockstep: - /* If failed, Turn off all TCM banks turned on before */ - for (i--; i >= 0; i--) { - pm_domain_id = r5_core->tcm_banks[i]->pm_domain_id; - zynqmp_pm_release_node(pm_domain_id); - } - return ret; -} - -/* - * add_tcm_banks() - * @rproc: single R5 core's corresponding rproc instance - * - * allocate and add remoteproc carveouts for TCM memory based on cluster mode - * - * return 0 on success, otherwise non-zero value on failure - */ -static int add_tcm_banks(struct rproc *rproc) -{ - struct zynqmp_r5_cluster *cluster; - struct zynqmp_r5_core *r5_core; - struct device *dev; - - r5_core = rproc->priv; - if (!r5_core) - return -EINVAL; - - dev = r5_core->dev; - - cluster = dev_get_drvdata(dev->parent); - if (!cluster) { - dev_err(dev->parent, "Invalid driver data\n"); - return -EINVAL; - } - - /* - * In lockstep mode TCM banks are one contiguous memory region of 256Kb - * In split mode, each TCM bank is 64Kb and not contiguous. - * We add memory carveouts accordingly. - */ - if (cluster->mode == SPLIT_MODE) - return add_tcm_carveout_split_mode(rproc); - else if (cluster->mode == LOCKSTEP_MODE) - return add_tcm_carveout_lockstep_mode(rproc); - - return -EINVAL; -} - /* * zynqmp_r5_parse_fw() * @rproc: single R5 core's corresponding rproc instance From patchwork Fri Mar 1 18:16:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tanmay Shah X-Patchwork-Id: 209049 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp91504dyc; Fri, 1 Mar 2024 11:03:19 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWinGEDKBWvjFv5BreuBHfYhHlaCgEnJXhCZpPI6Ce9tSiqDNcQsSxE17Q1vXL4qpBDjmENN7/5FpliZySQlPU/Yl5BYw== X-Google-Smtp-Source: AGHT+IFenNd/GW4W0ZPGv7i06r2tWuzm2J1hMEi/bS+e94BhJqqKgziIRdeS8SrrE/dbbsTuq/OU X-Received: by 2002:a17:902:f705:b0:1db:df16:2660 with SMTP id h5-20020a170902f70500b001dbdf162660mr3371418plo.12.1709319799210; Fri, 01 Mar 2024 11:03:19 -0800 (PST) Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id j21-20020a170902c3d500b001dbe7ae8e88si3910341plj.568.2024.03.01.11.03.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 11:03:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88893-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=v7NUJBcW; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-88893-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88893-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id D9D30B2597C for ; Fri, 1 Mar 2024 18:18:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0946A3A1C7; Fri, 1 Mar 2024 18:17:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="v7NUJBcW" Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2069.outbound.protection.outlook.com [40.107.94.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 664BFC2C7; Fri, 1 Mar 2024 18:17:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317035; cv=fail; b=tGQtKU8+96ESbWIqKL2yHamhszFxtCcavETiYK19LWHvuG1jrobRlT+KflLNChMERKm7BAIZLgDDrA+R9cY9Gyz4cE+fp7NKLUpwWfPb7l3efN57NVAm77GpjF+ru5vQyPDAKTx+IaET2L4/VWi+uehy6yvQqcuUBWf9CtQcA7w= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317035; c=relaxed/simple; bh=khKv74DYQmIxxkHDNBn/tD9EKqIjHRpGz9WIhVVYj9w=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=j6OjII6j6IXK49Vj9qEpK/03QjXrv6gw0xMaMHfdl7gXOW+i4EH4FJvKJHZfwZBLdugIf8ub4IfKnErm/IS5xN8xg67mEYag5bpzQpM5MYNuPqQRg8fXa5knmyoYjgJY4f2x9zG+yTddJsKsy3f6e9aXfPRQx0HgV/8Q8AzpvRQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=v7NUJBcW; arc=fail smtp.client-ip=40.107.94.69 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ShvH/ksv9e+l/FGd7/tOtoKetF/wubgMEPFQmtwp13KuAASLi5A49cMRjqmDE+xkiZl2d9eAGBj2j1SR0fsZei379sXlS0I/clBmKp8tJybikTeeMq2lBLTLcgOuJAJGCqpXzxvLIBurQ4eJ4lK6lkDFUQsIxk2TLf/Zmi72Tn0syJoBu5wxouq+Ba9QAFMkUJGl83AbHnNJoE57LjbulrJYfPNdGPYhqR51vzRK9tfHVQuM2KVzLP4MgRaEkJZkrK353/FBu40xjQUbYgu7oOo+8qmlsdsEApYytHfElgOwn9Ts1k8lXQR9UIDO+OBmhzVwHGsEPtu6rhoBq8xfIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5QvdQz2M2/fLMvKSQ570m2pRkl/Vtg8xNlpHK6pkgLY=; b=GAJ9833o2pQavqbVeXaN2qj0hXg3TwrNqSti3csDtqgln1bVzfxT/kGSk0d3HtNREU6tPv15Okq0pZdNm8G77lCS7KV8PVIDdfFKRptp4TSPLQ8IFWZsLTt/304uH8RP5Q9Q+LlDNvlmmdRx0OLJKq3XgyounCxT5lp5k1rV9NDQ/ZSE+VPulXu3LiLT1gAAE9icQeQ+nNm62t8y2SP05l/rF3hEKQ5oJMPZdeqQl6YX/RopdwfxCtIYhS8IFrTw9CJ2a/qMvXeUeew7J4q6hW+hucxiGjfUobCnEpRLlXMEOEZMwwK11wLkIZZ4f9GC/ZpPTuhwoiO36t3toeKzdA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5QvdQz2M2/fLMvKSQ570m2pRkl/Vtg8xNlpHK6pkgLY=; b=v7NUJBcWvxjEeNnbMSnsLskD8OMPGufRNWzb2G+NMMFFHqsg1TnkkmPU2rit+J8nXJYhjHXKjE8rX2IpAMu+AlI6bo0gstZYSyEguvqN+14DK2VfaVdFebO5SFNKJy5SDaYTOSr1GKKVixT7lHA7iR+6zCaFSH47YpyX/Pt4bEc= Received: from BN9PR03CA0666.namprd03.prod.outlook.com (2603:10b6:408:10e::11) by SN7PR12MB8603.namprd12.prod.outlook.com (2603:10b6:806:260::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.32; Fri, 1 Mar 2024 18:17:09 +0000 Received: from BN3PEPF0000B06B.namprd21.prod.outlook.com (2603:10b6:408:10e:cafe::27) by BN9PR03CA0666.outlook.office365.com (2603:10b6:408:10e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.34 via Frontend Transport; Fri, 1 Mar 2024 18:17:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by BN3PEPF0000B06B.mail.protection.outlook.com (10.167.243.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7362.0 via Frontend Transport; Fri, 1 Mar 2024 18:17:09 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 1 Mar 2024 12:17:08 -0600 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 1 Mar 2024 12:17:08 -0600 Received: from xsjtanmays50.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Fri, 1 Mar 2024 12:17:07 -0600 From: Tanmay Shah To: , , , , , , , CC: , , , , Radhey Shyam Pandey Subject: [PATCH v12 2/4] dt-bindings: remoteproc: add Tightly Coupled Memory (TCM) bindings Date: Fri, 1 Mar 2024 10:16:36 -0800 Message-ID: <20240301181638.814215-3-tanmay.shah@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240301181638.814215-1-tanmay.shah@amd.com> References: <20240301181638.814215-1-tanmay.shah@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Received-SPF: None (SATLEXMB05.amd.com: tanmay.shah@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B06B:EE_|SN7PR12MB8603:EE_ X-MS-Office365-Filtering-Correlation-Id: d8e33428-863f-46b1-2b19-08dc3a1bcf28 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: f0Zil+mV5KbWj7HO230ErDD7Ww+3c+Ij6H+CMZ/VebL3rqNnI0nU0gUoxH/jptn5wdzsHQI731tohrXY83LvyPb/tIA6bGCpRJH+EKNADE1DptSpRFiJU0u8bE2HE6ntwkWUIO2KVlZ36fKgJXf4sutaRmu+NrQrYA2zwBHRQKpijz4+478V0fWvap5Rll3TKmwKB7GND1Lt3JWQgoedqDUSEUgBA2iSGGLFmYOvpD7/40sps5nFjzbKI3Aw1ens7bShjxqnF5ONsco4vMHnWX0fv61Zgl4FRWDNFCvglf/pUsZjYOwyzg+BxTX/qSfei7LZZF4T8As6fqgeFUrinJb5Z/ZolV5Jmg1joqh5L+KJ32FV7DkRkStBwpfMKfL9IO8sDqGgPEkTuWjaGpBBGCJ+4Wp4cU3qPrCsFzLxnA8lEmkqpQ0F9ZqCekFc/7F3jMhdDdIrKwjKgOCBg/QlEqShSKmKalBf7qzKP9B9CkZ3KM3mr0kaRRCcW3T6BwoBK2qZ1KLvL6X9xEqJygpLMt4rjqsC1z4OKivAAiBJCXl17Klk32rPWlc3VZmT2TLSTn0XH0OIJeGh8hPBScDDpZF2s5ZHKr8dfwXflBjLWnRjkPBF37T+BBDkdXfhqlKWG6ins8TgHtlZcVYJ/G4cUMlD/+E/6dD/U52pPkzfJj+bxrJzaCGIqzlZHFygWnWSacxu6amCQUPMa6Pr14h/gdKd6Wcv8h45UJ+GmhZQ6uf2344J5q+9UP+rNARBOgsr X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(82310400014)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Mar 2024 18:17:09.2562 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d8e33428-863f-46b1-2b19-08dc3a1bcf28 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN3PEPF0000B06B.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB8603 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792351717339238148 X-GMAIL-MSGID: 1792351717339238148 From: Radhey Shyam Pandey Introduce bindings for TCM memory address space on AMD-xilinx Zynq UltraScale+ platform. It will help in defining TCM in device-tree and make it's access platform agnostic and data-driven. Tightly-coupled memories(TCMs) are low-latency memory that provides predictable instruction execution and predictable data load/store timing. Each Cortex-R5F processor contains two 64-bit wide 64 KB memory banks on the ATCM and BTCM ports, for a total of 128 KB of memory. The TCM resources(reg, reg-names and power-domain) are documented for each TCM in the R5 node. The reg and reg-names are made as required properties as we don't want to hardcode TCM addresses for future platforms and for zu+ legacy implementation will ensure that the old dts w/o reg/reg-names works and stable ABI is maintained. It also extends the examples for TCM split and lockstep modes. Signed-off-by: Radhey Shyam Pandey Signed-off-by: Tanmay Shah --- Changes in v12: - add "reg", "reg-names" and "power-domains" in pattern properties - add "reg" and "reg-names" in required list - keep "power-domains" in required list as it was before the change Changes in v11: - Fix yamllint warning and reduce indentation as needed .../remoteproc/xlnx,zynqmp-r5fss.yaml | 188 ++++++++++++++++-- 1 file changed, 168 insertions(+), 20 deletions(-) diff --git a/Documentation/devicetree/bindings/remoteproc/xlnx,zynqmp-r5fss.yaml b/Documentation/devicetree/bindings/remoteproc/xlnx,zynqmp-r5fss.yaml index 78aac69f1060..dc6ce308688f 100644 --- a/Documentation/devicetree/bindings/remoteproc/xlnx,zynqmp-r5fss.yaml +++ b/Documentation/devicetree/bindings/remoteproc/xlnx,zynqmp-r5fss.yaml @@ -20,9 +20,21 @@ properties: compatible: const: xlnx,zynqmp-r5fss + "#address-cells": + const: 2 + + "#size-cells": + const: 2 + + ranges: + description: | + Standard ranges definition providing address translations for + local R5F TCM address spaces to bus addresses. + xlnx,cluster-mode: $ref: /schemas/types.yaml#/definitions/uint32 enum: [0, 1, 2] + default: 1 description: | The RPU MPCore can operate in split mode (Dual-processor performance), Safety lock-step mode(Both RPU cores execute the same code in lock-step, @@ -37,7 +49,7 @@ properties: 2: single cpu mode patternProperties: - "^r5f-[a-f0-9]+$": + "^r5f@[0-9a-f]+$": type: object description: | The RPU is located in the Low Power Domain of the Processor Subsystem. @@ -54,8 +66,17 @@ patternProperties: compatible: const: xlnx,zynqmp-r5f + reg: + minItems: 1 + maxItems: 4 + + reg-names: + minItems: 1 + maxItems: 4 + power-domains: - maxItems: 1 + minItems: 2 + maxItems: 5 mboxes: minItems: 1 @@ -101,35 +122,162 @@ patternProperties: required: - compatible + - reg + - reg-names - power-domains - unevaluatedProperties: false - required: - compatible + - "#address-cells" + - "#size-cells" + - ranges + +allOf: + - if: + properties: + xlnx,cluster-mode: + enum: + - 1 + then: + patternProperties: + "^r5f@[0-9a-f]+$": + type: object + + properties: + reg: + minItems: 1 + items: + - description: ATCM internal memory + - description: BTCM internal memory + - description: extra ATCM memory in lockstep mode + - description: extra BTCM memory in lockstep mode + + reg-names: + minItems: 1 + items: + - const: atcm0 + - const: btcm0 + - const: atcm1 + - const: btcm1 + + else: + patternProperties: + "^r5f@[0-9a-f]+$": + type: object + + properties: + reg: + minItems: 1 + items: + - description: ATCM internal memory + - description: BTCM internal memory + + reg-names: + minItems: 1 + items: + - const: atcm0 + - const: btcm0 + + power-domains: + maxItems: 3 additionalProperties: false examples: - | - remoteproc { - compatible = "xlnx,zynqmp-r5fss"; - xlnx,cluster-mode = <1>; - - r5f-0 { - compatible = "xlnx,zynqmp-r5f"; - power-domains = <&zynqmp_firmware 0x7>; - memory-region = <&rproc_0_fw_image>, <&rpu0vdev0buffer>, <&rpu0vdev0vring0>, <&rpu0vdev0vring1>; - mboxes = <&ipi_mailbox_rpu0 0>, <&ipi_mailbox_rpu0 1>; - mbox-names = "tx", "rx"; + #include + + // Split mode configuration + soc { + #address-cells = <2>; + #size-cells = <2>; + + remoteproc@ffe00000 { + compatible = "xlnx,zynqmp-r5fss"; + xlnx,cluster-mode = <0>; + + #address-cells = <2>; + #size-cells = <2>; + ranges = <0x0 0x0 0x0 0xffe00000 0x0 0x10000>, + <0x0 0x20000 0x0 0xffe20000 0x0 0x10000>, + <0x1 0x0 0x0 0xffe90000 0x0 0x10000>, + <0x1 0x20000 0x0 0xffeb0000 0x0 0x10000>; + + r5f@0 { + compatible = "xlnx,zynqmp-r5f"; + reg = <0x0 0x0 0x0 0x10000>, <0x0 0x20000 0x0 0x10000>; + reg-names = "atcm0", "btcm0"; + power-domains = <&zynqmp_firmware PD_RPU_0>, + <&zynqmp_firmware PD_R5_0_ATCM>, + <&zynqmp_firmware PD_R5_0_BTCM>; + memory-region = <&rproc_0_fw_image>, <&rpu0vdev0buffer>, + <&rpu0vdev0vring0>, <&rpu0vdev0vring1>; + mboxes = <&ipi_mailbox_rpu0 0>, <&ipi_mailbox_rpu0 1>; + mbox-names = "tx", "rx"; + }; + + r5f@1 { + compatible = "xlnx,zynqmp-r5f"; + reg = <0x1 0x0 0x0 0x10000>, <0x1 0x20000 0x0 0x10000>; + reg-names = "atcm0", "btcm0"; + power-domains = <&zynqmp_firmware PD_RPU_1>, + <&zynqmp_firmware PD_R5_1_ATCM>, + <&zynqmp_firmware PD_R5_1_BTCM>; + memory-region = <&rproc_1_fw_image>, <&rpu1vdev0buffer>, + <&rpu1vdev0vring0>, <&rpu1vdev0vring1>; + mboxes = <&ipi_mailbox_rpu1 0>, <&ipi_mailbox_rpu1 1>; + mbox-names = "tx", "rx"; + }; }; + }; + + - | + //Lockstep configuration + soc { + #address-cells = <2>; + #size-cells = <2>; + + remoteproc@ffe00000 { + compatible = "xlnx,zynqmp-r5fss"; + xlnx,cluster-mode = <1>; + + #address-cells = <2>; + #size-cells = <2>; + ranges = <0x0 0x0 0x0 0xffe00000 0x0 0x10000>, + <0x0 0x20000 0x0 0xffe20000 0x0 0x10000>, + <0x0 0x10000 0x0 0xffe10000 0x0 0x10000>, + <0x0 0x30000 0x0 0xffe30000 0x0 0x10000>; + + r5f@0 { + compatible = "xlnx,zynqmp-r5f"; + reg = <0x0 0x0 0x0 0x10000>, + <0x0 0x20000 0x0 0x10000>, + <0x0 0x10000 0x0 0x10000>, + <0x0 0x30000 0x0 0x10000>; + reg-names = "atcm0", "btcm0", "atcm1", "btcm1"; + power-domains = <&zynqmp_firmware PD_RPU_0>, + <&zynqmp_firmware PD_R5_0_ATCM>, + <&zynqmp_firmware PD_R5_0_BTCM>, + <&zynqmp_firmware PD_R5_1_ATCM>, + <&zynqmp_firmware PD_R5_1_BTCM>; + memory-region = <&rproc_0_fw_image>, <&rpu0vdev0buffer>, + <&rpu0vdev0vring0>, <&rpu0vdev0vring1>; + mboxes = <&ipi_mailbox_rpu0 0>, <&ipi_mailbox_rpu0 1>; + mbox-names = "tx", "rx"; + }; - r5f-1 { - compatible = "xlnx,zynqmp-r5f"; - power-domains = <&zynqmp_firmware 0x8>; - memory-region = <&rproc_1_fw_image>, <&rpu1vdev0buffer>, <&rpu1vdev0vring0>, <&rpu1vdev0vring1>; - mboxes = <&ipi_mailbox_rpu1 0>, <&ipi_mailbox_rpu1 1>; - mbox-names = "tx", "rx"; + r5f@1 { + compatible = "xlnx,zynqmp-r5f"; + reg = <0x1 0x0 0x0 0x10000>, <0x1 0x20000 0x0 0x10000>; + reg-names = "atcm0", "btcm0"; + power-domains = <&zynqmp_firmware PD_RPU_1>, + <&zynqmp_firmware PD_R5_1_ATCM>, + <&zynqmp_firmware PD_R5_1_BTCM>; + memory-region = <&rproc_1_fw_image>, <&rpu1vdev0buffer>, + <&rpu1vdev0vring0>, <&rpu1vdev0vring1>; + mboxes = <&ipi_mailbox_rpu1 0>, <&ipi_mailbox_rpu1 1>; + mbox-names = "tx", "rx"; + }; }; }; ... From patchwork Fri Mar 1 18:16:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tanmay Shah X-Patchwork-Id: 208996 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp62619dyc; Fri, 1 Mar 2024 10:18:21 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWaJakkwFEB743+V3N4ytu2ljF1rewgrVDCzj7IEPxB1XivEHeXzQ8zULDK8TgARoiVHRTz1Z1His++PJRhem4A+5e55w== X-Google-Smtp-Source: AGHT+IGsL3dIRPUjqDfV+tfK5gpqo7lUIBEEQFICPEr41PfVhcn7fHgI/FsROVT2ryQST2P5ErD4 X-Received: by 2002:a0c:c60f:0:b0:690:79e:6a7e with SMTP id v15-20020a0cc60f000000b00690079e6a7emr3610976qvi.28.1709317100877; Fri, 01 Mar 2024 10:18:20 -0800 (PST) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id dv4-20020ad44ee4000000b0069006d7edc4si4048606qvb.331.2024.03.01.10.18.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 10:18:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88894-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=4i2WKggf; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-88894-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88894-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 960921C22748 for ; Fri, 1 Mar 2024 18:18:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 92E7E3A8C2; Fri, 1 Mar 2024 18:17:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="4i2WKggf" Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0501B27701; Fri, 1 Mar 2024 18:17:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317036; cv=fail; b=hxvF2Zb0F4rI6BeWho8rAnrp9DzlgWztzZTfmqr5m9INgHLF/+mVLfS4dSySdxkYE+bhTwQICdhDV3kfiXuLdvfjMnriBEXNMGKH39qLu/BSBb+5pqC4u5iZRTaBw86PWkVhrtEH3d87fwoIMkDYa0bTyT6x2NZRyOAAEJVG8EU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317036; c=relaxed/simple; bh=PNG2yGTVDqAX54+DzLfreLsxA5XONm73RBqez1IitUQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uBiCExLBDaiMhy+3OlWtwn0wWRhutIpbDeG/44UmwRcHpnNvp55W12JNKPSsRbO0vlAAY/9DrF5UH6E5SLAzBs0DqWMju4tdBgHp34sarVsQcui+EhSpafsu+v+ipy2cdyxSuqfGkBbaJTjugBcXrArC+MxJKq5kNzI6REEuFOU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=4i2WKggf; arc=fail smtp.client-ip=40.107.236.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XcBdS6QCPhTXDklFIqNacxvb/DcNwvM5wgGGuhNmpMPlecrZWbcIB70IWfAfU8PLfYjB2ZYVvf7wuWsw6ItSZrfSR8ugO+71o2k11Gt+l6z7ccpiZEWrYDPvjXBIX/rAlUinuVabl7rpBfqLDwyy1ax2VysPKhhW++x8lxIuQGdZpBCdl4d9TXuMP0Ky53EWGPihGzONeQLNcciBGlSPEO7E71JcW2KxzlcrxcIjXch5S7rAEAylHqq/3JPCvH+OVKpcTGh0ymR71uEmydp3y4p6rTTx8znlLGDUEkXC5UNu+NxHTVdAPlT9o9VhE636LDrBBd/Ml51aQ0z2eqPEYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MreDkp+FxtXut9dSZ/EM5Nwd8OWHoGBIM13dERcOSmM=; b=LoZcmQDA1T3KTxRIEjPytYMGo+z7EvRI+q641LsiuDNnD1eJJm/6yW+uL7UlPTHoO7vDIsjAlUIG+RiLrVPD2KpwIfbbLno7g6Flg8CiFocVWOSu3Eq2XJj2TGF9X7xq8uMxQt52kw3zKeJPZFb+KOiYwWSz6Q/J5qyDGWSx1oIYtCJt3B3EIn4keA29k4WgoMrrnkjO3xKUOiP8kFeWOj3Nqg4Owx/mKWeNbKd+oWL9lPKqD9aKtXaFlfQNvy60+eICLB74sxouo4zalfGNuy2BeyrZX7/m0PdriymdhSsCUzElPphJamr11WsPZ5EaycxMA90mnXdT5gPlrAQfnw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MreDkp+FxtXut9dSZ/EM5Nwd8OWHoGBIM13dERcOSmM=; b=4i2WKggfR2Jq2VLPSyMh7dUQzsXmNIoQN7MPIXfBbh67+lBgl9BcVVA05L/VvVcL663T7PxbW7JWRVBa6iIOj19uLL25PBTkuGz96rUQKYQdK+61ALpjgHLjEm1YcUX/MMEroCkelY68/eMdAhveIrwHz3DZvZUwI3ZfjRwaygQ= Received: from BN9PR03CA0663.namprd03.prod.outlook.com (2603:10b6:408:10e::8) by BY5PR12MB4194.namprd12.prod.outlook.com (2603:10b6:a03:210::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.41; Fri, 1 Mar 2024 18:17:10 +0000 Received: from BN3PEPF0000B06B.namprd21.prod.outlook.com (2603:10b6:408:10e:cafe::17) by BN9PR03CA0663.outlook.office365.com (2603:10b6:408:10e::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.32 via Frontend Transport; Fri, 1 Mar 2024 18:17:10 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by BN3PEPF0000B06B.mail.protection.outlook.com (10.167.243.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7362.0 via Frontend Transport; Fri, 1 Mar 2024 18:17:10 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 1 Mar 2024 12:17:09 -0600 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 1 Mar 2024 12:17:09 -0600 Received: from xsjtanmays50.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Fri, 1 Mar 2024 12:17:08 -0600 From: Tanmay Shah To: , , , , , , , CC: , , , Subject: [PATCH v12 3/4] dts: zynqmp: add properties for TCM in remoteproc Date: Fri, 1 Mar 2024 10:16:37 -0800 Message-ID: <20240301181638.814215-4-tanmay.shah@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240301181638.814215-1-tanmay.shah@amd.com> References: <20240301181638.814215-1-tanmay.shah@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Received-SPF: None (SATLEXMB05.amd.com: tanmay.shah@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B06B:EE_|BY5PR12MB4194:EE_ X-MS-Office365-Filtering-Correlation-Id: f89d3418-a6cc-4ca1-5db4-08dc3a1bcfdd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 94hBiPxkpUNauf4otxL2zeXiPKxtiVsiJVOcF+hRpJjwih1E5rcC8+QwgMpZrOftSbcWWUcUuwfC1+/OlH6WJ4AxQ6M9XFg5eIVD4DA4QSfOZKHnIBphwxuYs4HZgBRMAiWLDVUALwC+daJLVq4WxQgUTqoJCUBqnGCX6wyO6+QlFDB6f8kVlMPU5Ehshg/pKuYqsa/Pzq6epJADgczGPQEX0RLuY81Q3TLd1Hui4CYdYHjnFnAvHqGguAiqcLBWsgNpKKERmKM5wfUVaS87xU6oIJR8jaF5HajKfHDq+TVTubFXeFRYj+e+PBEodE4MFqNtXSuXdXiKcki5WKOpr0W5Gs/aRNi8hcU7uR9Onqjbn4q32kJsERoy+Lp/+2wxHRJ2p7EXSXdbZJ14+SQvcdEUh3C6v7pHpAK5/zMcXMN+iqDbnDEDiWprExWAlFMNjwj6Ze19ccdIjIrYv55SKJGlsqpl9pJflzh0eyGD78/2OF42gLNpePC0s9ie1NWH6gpmHqcVwCSHeAjNBwJdiljXGbslJ4JapNGAhWDzvt7fe6tFX9bGRjRgucMSSZltn0PaRFZLG6Z6xXkJS55KVb6K8Gw7MRuq6CkSiENr83PzuVbNRi9glDIFbrKOEMEEAAx61Y57mCWEutAEL1ffGBpbX54YVCOwbV/rvkjtNU1OQE782gZcifvHioRkfmVFftFcC8z74HOECThqZfwB99MYOsUEDeQOmvan1hUyaxWPL6xb1MKkr/YI61RB7wyY X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(82310400014)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Mar 2024 18:17:10.4280 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f89d3418-a6cc-4ca1-5db4-08dc3a1bcfdd X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN3PEPF0000B06B.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4194 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792348888247415324 X-GMAIL-MSGID: 1792348888247415324 Add properties as per new bindings in zynqmp remoteproc node to represent TCM address and size. This patch also adds alternative remoteproc node to represent remoteproc cluster in split mode. By default lockstep mode is enabled and users should disable it before using split mode dts. Both device-tree nodes can't be used simultaneously one of them must be disabled. For zcu102-1.0 and zcu102-1.1 board remoteproc split mode dts node is enabled and lockstep mode dts is disabled. Signed-off-by: Tanmay Shah --- .../boot/dts/xilinx/zynqmp-zcu102-rev1.0.dts | 8 +++ arch/arm64/boot/dts/xilinx/zynqmp.dtsi | 65 +++++++++++++++++-- 2 files changed, 68 insertions(+), 5 deletions(-) diff --git a/arch/arm64/boot/dts/xilinx/zynqmp-zcu102-rev1.0.dts b/arch/arm64/boot/dts/xilinx/zynqmp-zcu102-rev1.0.dts index c8f71a1aec89..495ca94b45db 100644 --- a/arch/arm64/boot/dts/xilinx/zynqmp-zcu102-rev1.0.dts +++ b/arch/arm64/boot/dts/xilinx/zynqmp-zcu102-rev1.0.dts @@ -14,6 +14,14 @@ / { compatible = "xlnx,zynqmp-zcu102-rev1.0", "xlnx,zynqmp-zcu102", "xlnx,zynqmp"; }; +&rproc_split { + status = "okay"; +}; + +&rproc_lockstep { + status = "disabled"; +}; + &eeprom { #address-cells = <1>; #size-cells = <1>; diff --git a/arch/arm64/boot/dts/xilinx/zynqmp.dtsi b/arch/arm64/boot/dts/xilinx/zynqmp.dtsi index eaba466804bc..c8a7fd0f3a1e 100644 --- a/arch/arm64/boot/dts/xilinx/zynqmp.dtsi +++ b/arch/arm64/boot/dts/xilinx/zynqmp.dtsi @@ -248,19 +248,74 @@ fpga_full: fpga-full { ranges; }; - remoteproc { + rproc_lockstep: remoteproc@ffe00000 { compatible = "xlnx,zynqmp-r5fss"; xlnx,cluster-mode = <1>; - r5f-0 { + #address-cells = <2>; + #size-cells = <2>; + + ranges = <0x0 0x0 0x0 0xffe00000 0x0 0x10000>, + <0x0 0x20000 0x0 0xffe20000 0x0 0x10000>, + <0x0 0x10000 0x0 0xffe10000 0x0 0x10000>, + <0x0 0x30000 0x0 0xffe30000 0x0 0x10000>; + + r5f@0 { + compatible = "xlnx,zynqmp-r5f"; + reg = <0x0 0x0 0x0 0x10000>, + <0x0 0x20000 0x0 0x10000>, + <0x0 0x10000 0x0 0x10000>, + <0x0 0x30000 0x0 0x10000>; + reg-names = "atcm0", "btcm0", "atcm1", "btcm1"; + power-domains = <&zynqmp_firmware PD_RPU_0>, + <&zynqmp_firmware PD_R5_0_ATCM>, + <&zynqmp_firmware PD_R5_0_BTCM>, + <&zynqmp_firmware PD_R5_1_ATCM>, + <&zynqmp_firmware PD_R5_1_BTCM>; + memory-region = <&rproc_0_fw_image>; + }; + + r5f@1 { + compatible = "xlnx,zynqmp-r5f"; + reg = <0x1 0x0 0x0 0x10000>, <0x1 0x20000 0x0 0x10000>; + reg-names = "atcm0", "btcm0"; + power-domains = <&zynqmp_firmware PD_RPU_1>, + <&zynqmp_firmware PD_R5_1_ATCM>, + <&zynqmp_firmware PD_R5_1_BTCM>; + memory-region = <&rproc_1_fw_image>; + }; + }; + + rproc_split: remoteproc-split@ffe00000 { + status = "disabled"; + compatible = "xlnx,zynqmp-r5fss"; + xlnx,cluster-mode = <0>; + + #address-cells = <2>; + #size-cells = <2>; + + ranges = <0x0 0x0 0x0 0xffe00000 0x0 0x10000>, + <0x0 0x20000 0x0 0xffe20000 0x0 0x10000>, + <0x1 0x0 0x0 0xffe90000 0x0 0x10000>, + <0x1 0x20000 0x0 0xffeb0000 0x0 0x10000>; + + r5f@0 { compatible = "xlnx,zynqmp-r5f"; - power-domains = <&zynqmp_firmware PD_RPU_0>; + reg = <0x0 0x0 0x0 0x10000>, <0x0 0x20000 0x0 0x10000>; + reg-names = "atcm0", "btcm0"; + power-domains = <&zynqmp_firmware PD_RPU_0>, + <&zynqmp_firmware PD_R5_0_ATCM>, + <&zynqmp_firmware PD_R5_0_BTCM>; memory-region = <&rproc_0_fw_image>; }; - r5f-1 { + r5f@1 { compatible = "xlnx,zynqmp-r5f"; - power-domains = <&zynqmp_firmware PD_RPU_1>; + reg = <0x1 0x0 0x0 0x10000>, <0x1 0x20000 0x0 0x10000>; + reg-names = "atcm0", "btcm0"; + power-domains = <&zynqmp_firmware PD_RPU_1>, + <&zynqmp_firmware PD_R5_1_ATCM>, + <&zynqmp_firmware PD_R5_1_BTCM>; memory-region = <&rproc_1_fw_image>; }; }; From patchwork Fri Mar 1 18:16:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tanmay Shah X-Patchwork-Id: 208997 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp63075dyc; Fri, 1 Mar 2024 10:18:52 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXzGJrVzIbgxAudr3VLgwM6VGFqAHvNZKSEDF9OSrnkDTzubMNXpJmBqWQv4rLqQ9TPk6NwD70GPyLJYSex6+aUcdqoEg== X-Google-Smtp-Source: AGHT+IFUkRtTLaHgb6s0m6jMbOS1BGfN0dJdOMU3vITHNq6UEdb1kEdxurNmZfTGWca2zzwBBaxS X-Received: by 2002:a17:902:c204:b0:1dc:e24a:c4cf with SMTP id 4-20020a170902c20400b001dce24ac4cfmr2045734pll.55.1709317132494; Fri, 01 Mar 2024 10:18:52 -0800 (PST) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id cp6-20020a170902e78600b001dccec27e71si3809310plb.384.2024.03.01.10.18.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 10:18:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88892-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=JtuvDovX; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-88892-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88892-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 701CD28C54F for ; Fri, 1 Mar 2024 18:18:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C83043A269; Fri, 1 Mar 2024 18:17:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="JtuvDovX" Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2046.outbound.protection.outlook.com [40.107.220.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E98AE27471; Fri, 1 Mar 2024 18:17:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.46 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317035; cv=fail; b=YTjcQf/+KnL53lfPcSx0zhAqPy4UEzR4hftmtozXCVwx1YCm2MQ7zqooEIpS5rY9NT9kTpm1hiRTzvHAM8ioSU0fqZie+UtqqjllTY2z3oGjwvQRoJUXmdP1OJSXZ41ldWGOqRSy/3Hj/BSmXh4xoqWI9p4WQQK0EWki98wGybQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317035; c=relaxed/simple; bh=oV20fcskrY3IV8D7QtZzvN067JMXZn2h0UEDk1QC1yY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=aEZgcevpTpgCHUbDngYX0uITh87/aGjaVLi8BhGZH7WdTHS8fs2hom5zG27c7JxvinyfzFw48CPW4KFNs7nD2J0KJyRMTAPgvsmPt+nHC504rvw4rsmpCeSOOtElxBvMF9u4wUZySqakAD/NKjf2kqZZpdjV0au1nqQXyiUs9n8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=JtuvDovX; arc=fail smtp.client-ip=40.107.220.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bk0WEZ4KNMvESB6OKd8KJb16qlSK+ZaPuo6lg7GrxWWFQhFfKvaUSC31BpNoUPP7msBtsavNABaRh3XNIbW+p8xSHpVAXcu/9cOPsnqp3i+Xw8o5PA0iL34n9M1nSW+aYF9IdDLRRcfhRquBG1MKuCF2IwIoKwrtyqjxipmiZhHaca9NZIvE9Tnvk3D3rVz2SksPfTvAUmVGEa++HiFUlnLtXnTOSj7Gyx3VhJ/56ttPFiSqrDAW8WY2uyiMsbNqundarKDwyoxOtdK5d3GwmMW0+X4sqFQBQtmtDIbUvfF5jA/K34ibpAQ4AB1WgTsGGsVQyvsCGMzuxEey4yA3aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=j95CTk4QRkepmbOZdlmxZEceZxMUEf1UvyiXuoLtd8A=; b=egdbWxilBNJwyceoM+ObxNj35o8+IywzYcl1+Pn73n+zubBM/8zMZX6909QwFQ9pTJka+rC6fM+HrgbEu8ZTruyGaV+CQvyJgxy59JFU1akwczWjUlQskDYSBpszr150cNqmbXbziK/F0RsOEkr6TH0LzjbuYH6VJFwecIv7jcWB7lK5RRRGIb3mX6VpWCN/dO4aTKvPWnGoKzeuKyEnM5XbdQBQipxCVBuyI7DzapxXOo2MTEarx2q+z/yy9mzh2us8wXvBJApRp+zGhMA93bvCab5dm5nGh9f4uI7h/beO9w3vPfzd8kxAD6KeYcBcWNFBPGHZG+X80b2N2IHJ/A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=j95CTk4QRkepmbOZdlmxZEceZxMUEf1UvyiXuoLtd8A=; b=JtuvDovXadinWITK0Dvua/5ZGPzPe5l0lz7s9FROvfEBAREJZXLq8N4IT6zCB9mZeUtiLAviCElfrYywBdEOPDxEY8DfnpG/D619TJMqguBheN/4Asvo2wLi2TDBKAFa5eHrWMOA887W3VkFVhAAjFiLYj5QF/5+B/znKtwrymY= Received: from BN9PR03CA0687.namprd03.prod.outlook.com (2603:10b6:408:10e::32) by MN2PR12MB4206.namprd12.prod.outlook.com (2603:10b6:208:1d5::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.34; Fri, 1 Mar 2024 18:17:11 +0000 Received: from BN3PEPF0000B06B.namprd21.prod.outlook.com (2603:10b6:408:10e:cafe::f4) by BN9PR03CA0687.outlook.office365.com (2603:10b6:408:10e::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.32 via Frontend Transport; Fri, 1 Mar 2024 18:17:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by BN3PEPF0000B06B.mail.protection.outlook.com (10.167.243.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7362.0 via Frontend Transport; Fri, 1 Mar 2024 18:17:11 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 1 Mar 2024 12:17:10 -0600 Received: from xsjtanmays50.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Fri, 1 Mar 2024 12:17:09 -0600 From: Tanmay Shah To: , , , , , , , CC: , , , Subject: [PATCH v12 4/4] remoteproc: zynqmp: parse TCM from device tree Date: Fri, 1 Mar 2024 10:16:38 -0800 Message-ID: <20240301181638.814215-5-tanmay.shah@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240301181638.814215-1-tanmay.shah@amd.com> References: <20240301181638.814215-1-tanmay.shah@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Received-SPF: None (SATLEXMB03.amd.com: tanmay.shah@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B06B:EE_|MN2PR12MB4206:EE_ X-MS-Office365-Filtering-Correlation-Id: 7692ecae-cc19-4bce-19f8-08dc3a1bd09c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Q9/dvel67m2vLHPftbsClamrR2Ju27MBUUc29fW1myQINp8wompE3FrC7G3YVBd/RydOscfzs0/C6ZcIZfHiwTy9EZ8LfMEk3gWW7G41RAfqMjchTMFSLzlcdSgKPjUEoS1dEhEc8TOIsnDq5GUHk0kH6xPE9zCvKIKCG223evw5tCsODGPAx2+hftQRLDubktdD8TJGudb42mOwwVQFduJA3CbFypXsORmIWxwOd9Y64S5BC62FJQVgctk6yiSjpd14nRMfX9w22NRWNMHzb98VIKBp3xcJGd9rzSBNTzNDjH72jk+CqNh+qYbWhYKZTgAq4CzAbMh7CG+3p6iIi6COLGMxfsJji3fcgdLlR+N3yI1Di3oTky+phA1hMCYJ06AmLD+eWyDogl0VQ0b6BMEILQrhxcfYdomyN2hF5pz7M1/phK20NGDCDl6UE9ud3M9UokJCI3dSo7F/0drxQYrOi6zv/7x6FpdHifBPMRduYaUqZ0oP6+BKF+Py7MfDIheQyPFX32/48uOctS0xBtrm43gw0bgBJELxW9g0UCi3oPu1Gowv1EoyAiaoEvCVXzH6xxBzQmg/4E5AAOl6G6UfxaNFl2mgQtT11jmsVJJXU2J/AGAlzsj/WrU5HvFz+KF4MJxygduMhU9jhwcr36MW3gZWh8sEmfL0tscgDq5BJqd1vnSOJ7rSAuZFZGq5AxMy/gAr9OgAW7+ccsxKTbPPiJfbUGGnpJ81DT89JW8EKtfzU2Y/w2uvRnVlCGb8 X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(82310400014)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Mar 2024 18:17:11.6780 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7692ecae-cc19-4bce-19f8-08dc3a1bd09c X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN3PEPF0000B06B.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4206 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792348921307960770 X-GMAIL-MSGID: 1792348921307960770 ZynqMP TCM information was fixed in driver. Now ZynqMP TCM information is available in device-tree. Parse TCM information in driver as per new bindings. Signed-off-by: Tanmay Shah --- Changes in v12: - None Changes in v11: - Remove redundant initialization of the variable - return correct error code if memory allocation failed drivers/remoteproc/xlnx_r5_remoteproc.c | 112 ++++++++++++++++++++++-- 1 file changed, 107 insertions(+), 5 deletions(-) diff --git a/drivers/remoteproc/xlnx_r5_remoteproc.c b/drivers/remoteproc/xlnx_r5_remoteproc.c index 42b0384d34f2..d4a22caebaad 100644 --- a/drivers/remoteproc/xlnx_r5_remoteproc.c +++ b/drivers/remoteproc/xlnx_r5_remoteproc.c @@ -74,8 +74,8 @@ struct mbox_info { }; /* - * Hardcoded TCM bank values. This will be removed once TCM bindings are - * accepted for system-dt specifications and upstreamed in linux kernel + * Hardcoded TCM bank values. This will stay in driver to maintain backward + * compatibility with device-tree that does not have TCM information. */ static const struct mem_bank_data zynqmp_tcm_banks_split[] = { {0xffe00000UL, 0x0, 0x10000UL, PD_R5_0_ATCM, "atcm0"}, /* TCM 64KB each */ @@ -757,6 +757,103 @@ static struct zynqmp_r5_core *zynqmp_r5_add_rproc_core(struct device *cdev) return ERR_PTR(ret); } +static int zynqmp_r5_get_tcm_node_from_dt(struct zynqmp_r5_cluster *cluster) +{ + int i, j, tcm_bank_count, ret, tcm_pd_idx, pd_count; + struct of_phandle_args out_args; + struct zynqmp_r5_core *r5_core; + struct platform_device *cpdev; + struct mem_bank_data *tcm; + struct device_node *np; + struct resource *res; + u64 abs_addr, size; + struct device *dev; + + for (i = 0; i < cluster->core_count; i++) { + r5_core = cluster->r5_cores[i]; + dev = r5_core->dev; + np = r5_core->np; + + pd_count = of_count_phandle_with_args(np, "power-domains", + "#power-domain-cells"); + + if (pd_count <= 0) { + dev_err(dev, "invalid power-domains property, %d\n", pd_count); + return -EINVAL; + } + + /* First entry in power-domains list is for r5 core, rest for TCM. */ + tcm_bank_count = pd_count - 1; + + if (tcm_bank_count <= 0) { + dev_err(dev, "invalid TCM count %d\n", tcm_bank_count); + return -EINVAL; + } + + r5_core->tcm_banks = devm_kcalloc(dev, tcm_bank_count, + sizeof(struct mem_bank_data *), + GFP_KERNEL); + if (!r5_core->tcm_banks) + return -ENOMEM; + + r5_core->tcm_bank_count = tcm_bank_count; + for (j = 0, tcm_pd_idx = 1; j < tcm_bank_count; j++, tcm_pd_idx++) { + tcm = devm_kzalloc(dev, sizeof(struct mem_bank_data), + GFP_KERNEL); + if (!tcm) + return -ENOMEM; + + r5_core->tcm_banks[j] = tcm; + + /* Get power-domains id of TCM. */ + ret = of_parse_phandle_with_args(np, "power-domains", + "#power-domain-cells", + tcm_pd_idx, &out_args); + if (ret) { + dev_err(r5_core->dev, + "failed to get tcm %d pm domain, ret %d\n", + tcm_pd_idx, ret); + return ret; + } + tcm->pm_domain_id = out_args.args[0]; + of_node_put(out_args.np); + + /* Get TCM address without translation. */ + ret = of_property_read_reg(np, j, &abs_addr, &size); + if (ret) { + dev_err(dev, "failed to get reg property\n"); + return ret; + } + + /* + * Remote processor can address only 32 bits + * so convert 64-bits into 32-bits. This will discard + * any unwanted upper 32-bits. + */ + tcm->da = (u32)abs_addr; + tcm->size = (u32)size; + + cpdev = to_platform_device(dev); + res = platform_get_resource(cpdev, IORESOURCE_MEM, j); + if (!res) { + dev_err(dev, "failed to get tcm resource\n"); + return -EINVAL; + } + + tcm->addr = (u32)res->start; + tcm->bank_name = (char *)res->name; + res = devm_request_mem_region(dev, tcm->addr, tcm->size, + tcm->bank_name); + if (!res) { + dev_err(dev, "failed to request tcm resource\n"); + return -EINVAL; + } + } + } + + return 0; +} + /** * zynqmp_r5_get_tcm_node() * Ideally this function should parse tcm node and store information @@ -835,9 +932,14 @@ static int zynqmp_r5_core_init(struct zynqmp_r5_cluster *cluster, struct zynqmp_r5_core *r5_core; int ret, i; - ret = zynqmp_r5_get_tcm_node(cluster); - if (ret < 0) { - dev_err(dev, "can't get tcm node, err %d\n", ret); + r5_core = cluster->r5_cores[0]; + if (of_find_property(r5_core->np, "reg", NULL)) + ret = zynqmp_r5_get_tcm_node_from_dt(cluster); + else + ret = zynqmp_r5_get_tcm_node(cluster); + + if (ret) { + dev_err(dev, "can't get tcm, err %d\n", ret); return ret; }