Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7298319rdb; Wed, 3 Jan 2024 10:51:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IGi1oI6coiS18/TNsLUkTxG0GOkF2r4K/188FO9v3fZcEBcMCPfeTFI/plvuU2uMxTVr3xs X-Received: by 2002:a9d:7499:0:b0:6db:b931:70f6 with SMTP id t25-20020a9d7499000000b006dbb93170f6mr13614382otk.34.1704307916326; Wed, 03 Jan 2024 10:51:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704307916; cv=pass; d=google.com; s=arc-20160816; b=t13j8eQWkivuwKTQ7S2fVkG75ddLxQ9e57OO41AUDvkT5ilpBWBhifmDU7SMGg+ozI Q0ts54w2SdSjDdCxQ3sze5jtuARH8BIQqY06751V9rCx4jGThfVU7Q/p4mHKO+nBpJZn ihBXxm5UZobfen4a4yWFBhjkjCWg/dte9cFMTUl2fDY4rJ9KFrtkwde3dxNiFd5/m7Iz JUGc/p6OjauEwPfLaFQewFseGLGyON1QCVbA1g2MZqvFAw2S3WgaksxKQgBaKZ+2JhmB iXEjvId4JG8+L/KLsOl0AGoWziUSW3ZgXHnOvF6fRdOy+5aXGQJuYNfzTai89NBnlVX3 uX8w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:date:message-id:dkim-signature; bh=eCHKEIm5sl33nqqIhVG60rmG3u1vhJKt7gZDG8wzRqg=; fh=rlEbySYAPTyfWBDDI9YB7pWtUZGvbApeYtEbxw+LgCo=; b=QpvJByiXBLgOxDynwN/zbqgaxOtQkjj8UsIbKh59k0JrTmMeB6GryteySn4cjXZss1 lRCqL86zRYTtH1ByIrQBt0dYZJ/yzZ48buFKmofwiIdJR+UrN9tLW6ufvSzNQrE+ZomK VZKgBxOy6COlNxyV5wYiXgG9V1TqK4XApgy9rjdT9IuHz7kHXuqPiTYESgSkPtDlPifE eWO5CJVLkg84CkP8cwUSBhF8yTIGSRyWlO4degn8bT8JP3hOPvtXIMtMMTdhPwbrEb4a NQCTYhGrZ/jhHxS1LGC3tcYs6ZVd6soT1cuumFFCuRKPXZ4gXr24UwLsd6NFMjrnFBlM 3ipg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=wbGSalma; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-15886-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15886-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id u21-20020ac858d5000000b00423988a9868si29606102qta.15.2024.01.03.10.51.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 10:51:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15886-linux.lists.archive=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=wbGSalma; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-15886-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15886-linux.lists.archive=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 0A92F1C20D18 for ; Wed, 3 Jan 2024 18:51:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7B5FE1CA94; Wed, 3 Jan 2024 18:51:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="wbGSalma" X-Original-To: linux-kernel@vger.kernel.org Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2087.outbound.protection.outlook.com [40.107.93.87]) (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 BD6141CA86; Wed, 3 Jan 2024 18:51:45 +0000 (UTC) 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=VP7X/qZ2IMkULgTCF9gdyWFw0E6q7lrtfJy3uyvVhgUS1/N2U3grt3ro4qP5fIWxBCXeDQY79KMqEPZp1qbzXkuXI1R4vxV3a3px6Jxt4KJnMvg2tB0jUz4KNciJVCsBsZbx3pY68KQlPqHfdubdf7tMbM3P9Hn8j69+O1g2+M+hk3KZSV0gGrsLAaWaHtrQNK3ORDxNZW7iTsCrPCYpHi20XjmOuKcaRfgZD6tSarWcK5b+iSvP9iYb2vpc/2f9TSGl8Ch0DeXOPDHES8bc4zGRBPij8bNERvWkG2WlNbvukIgAaxVINHoVMFzF1Qz3GD+osaCsnXxCOXhc6ZOUXg== 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=eCHKEIm5sl33nqqIhVG60rmG3u1vhJKt7gZDG8wzRqg=; b=k1tEdVrjiyTbe0lwB6BkDvraqwmI6u0aHHxvDzBAlk/B/VuJr3UPqQnJRevfJPLm438dI63GrauMYCwJ1u6gYmGJ9T9goo9UUhcBeF1qui3gPI4kly8PIiYzC31LBtTEYI8kEI3NGJ8LkZhR5dzQds4lfd5h87uR7PdnNCL3gqUTArh3+WMcNjAajOHygpHnLQEyZPUFkkWryA3TGuAQDlJs9TJYGvnSiUYP0BzCEhMYcERQgYMwbEbwBgQxtwboLQQyOVw6rpKDBdubCbfNQdQ3JnTE7hjepFTcpcLD+JAdGCNo29PM+T8TmTwYDXkUWkclH6ij1/KNaIMUyPlxEQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none 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=eCHKEIm5sl33nqqIhVG60rmG3u1vhJKt7gZDG8wzRqg=; b=wbGSalma5sNwZ2+uT9H9DoW21TZYWDsoRAToT9+G92hG/YcwdR6r3/XqTvaynlwKSjnk4U+K9LQT0o5q39CYLPap7GqPXJ5gvfiCs/4x9NHId8wQWiOMGAojpPvu44U5BFWC+SEY4kaw3peqFa0Qgq27jnTkQOv/5bonlxqlOfE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from BL1PR12MB5874.namprd12.prod.outlook.com (2603:10b6:208:396::17) by MN2PR12MB4344.namprd12.prod.outlook.com (2603:10b6:208:26e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.13; Wed, 3 Jan 2024 18:51:43 +0000 Received: from BL1PR12MB5874.namprd12.prod.outlook.com ([fe80::6452:1eb:50fa:311d]) by BL1PR12MB5874.namprd12.prod.outlook.com ([fe80::6452:1eb:50fa:311d%4]) with mapi id 15.20.7135.023; Wed, 3 Jan 2024 18:51:43 +0000 Message-ID: Date: Wed, 3 Jan 2024 12:51:40 -0600 User-Agent: Mozilla Thunderbird Beta Subject: Re: [PATCH v8 3/3] remoteproc: zynqmp: parse TCM from device tree Content-Language: en-US To: Mathieu Poirier Cc: andersson@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, michal.simek@amd.com, ben.levinsky@amd.com, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20231215235725.1247350-1-tanmay.shah@amd.com> <20231215235725.1247350-4-tanmay.shah@amd.com> From: Tanmay Shah In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: DS7PR03CA0155.namprd03.prod.outlook.com (2603:10b6:5:3b2::10) To BL1PR12MB5874.namprd12.prod.outlook.com (2603:10b6:208:396::17) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL1PR12MB5874:EE_|MN2PR12MB4344:EE_ X-MS-Office365-Filtering-Correlation-Id: c51f31f9-01a0-4d2e-666b-08dc0c8d074c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Db8dA7NZWSzRfcxYC13ratrA7ip6sh642afbs3WydiQkUP8hgtb+XhAWwWt6p45XknfZsBGkgFjT8YSoXh6uoWEoVujYebrCN9TdnUhflmb86IuOxJlSh+e9fYx2wd4P8FfvuPmuZSbslTT/dAYqCDAlDrVFJoU02OJ/ArNq8zPRbVuofaSpCWWX9d7WSS6ezGSyUMQ79YfMfkAWDz9z+61yQ8oVdoVJuBRc3wRFLiOwYRVuVOCkQAqV0B8RBTIJSQ7qSL+aCWsbdEV4KD4uQLq5WuPbNAqqajMIB8kQ7zEBhi3YRO6MCqXfkko69Ql3LuqySNeLhd4fK3DdETSzgsw+DlIL2B7wK7wuJaAgLrWKIS93Y2E0mBfeXRqHRnM8Wkha5TRdEMp5gg2z/9AijGvLNAV26ljWU3iVHOLVsmiWkLIcmc4EGaPqv81++NN+wK9bwjbQK62nb681/YCcDQ7izub2qQ9PEe5ZDufWlkG1KKbhvzplfj5KDiPE8peXRCzyG4c4Ah3bGkbbMpiNUMugVFjfrI/F9VL8ow6EfH0u+LafLst9HQ1kJFcqvWxqFsevehlx1SJvCXTwaN0KLVSRayHOdf8CXR0eFJ0jwlOHHr5Tet3KeWTWoEuxW9lTsEytWNNwbpGJ5PoProbz/w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL1PR12MB5874.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(366004)(136003)(346002)(376002)(396003)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(38100700002)(36756003)(31686004)(31696002)(86362001)(2616005)(26005)(6512007)(6506007)(53546011)(4326008)(8676002)(6486002)(478600001)(316002)(8936002)(83380400001)(66899024)(66946007)(66556008)(6916009)(66476007)(41300700001)(5660300002)(44832011)(2906002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?eUhUK2k2enM4QWdjUFpTOC9udWVVUm1wWUdhOGd2dVJUMXV1d2dGbXlZNGFq?= =?utf-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L0NVZ1hob0NvYWxuT2JiTndCOTdLUDZ2?= =?utf-8?B?MHhRN2pxeVM2TFdLNEUzREQyYmpFckJhcERQUUFZaGUzME1RNi9Ib3NoZ0NL?= =?utf-8?B?ekwzZTI1MkFRVldrWHZQWXNWTnB6WStDZVlyL1d6aGVHeEJEbUhtTHhrTFR5?= =?utf-8?B?T2RHM0ZITXhXbUVHNENXcFFURDJ3aVN4UzJPQmExcnIyVFZ1cjZTdVFGKzEz?= =?utf-8?B?RDNaK2VmejBvYnBQTmRTOGFqYXNpSTVDODFEMG5jWnJQVGVLVldYYnlrOEs1?= =?utf-8?Q?/gNVs7eLgA+M/fNpKC9oKaQ0j?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: c51f31f9-01a0-4d2e-666b-08dc0c8d074c X-MS-Exchange-CrossTenant-AuthSource: BL1PR12MB5874.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2024 18:51:43.3442 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: tYUp+paZ7yMrP+ARu30CJkHqfIPvtr8XUbrox1x6rAkN9OkUUp3zxcKyqwWwP7rB X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4344 On 1/3/24 12:17 PM, Mathieu Poirier wrote: > On Fri, Dec 15, 2023 at 03:57:25PM -0800, Tanmay Shah wrote: > > ZynqMP TCM information is fixed in driver. Now ZynqMP TCM information > > s/"is fixed in driver"/"was fixed in driver" > > > is available in device-tree. Parse TCM information in driver > > as per new bindings. > > > > Signed-off-by: Tanmay Shah > > --- > > > > Changes in v8: > > - parse power-domains property from device-tree and use EEMI calls > > to power on/off TCM instead of using pm domains framework > > - Remove checking of pm_domain_id validation to power on/off tcm > > - Remove spurious change > > > > Changes in v7: > > - move checking of pm_domain_id from previous patch > > - fix mem_bank_data memory allocation > > > > drivers/remoteproc/xlnx_r5_remoteproc.c | 154 +++++++++++++++++++++++- > > 1 file changed, 148 insertions(+), 6 deletions(-) > > > > diff --git a/drivers/remoteproc/xlnx_r5_remoteproc.c b/drivers/remoteproc/xlnx_r5_remoteproc.c > > index 4395edea9a64..36d73dcd93f0 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 */ > > @@ -878,6 +878,139 @@ 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) > > +{ > > + struct of_phandle_args out_args; > > + int tcm_reg_per_r5, tcm_pd_idx; > > + struct zynqmp_r5_core *r5_core; > > + int i, j, tcm_bank_count, ret; > > + 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 = of_node_get(dev_of_node(dev)); > > + tcm_pd_idx = 1; > > + > > + /* we have address cell 2 and size cell as 2 */ > > + tcm_reg_per_r5 = of_property_count_elems_of_size(np, "reg", > > + 4 * sizeof(u32)); > > + if (tcm_reg_per_r5 <= 0) { > > + dev_err(dev, "can't get reg property err %d\n", tcm_reg_per_r5); > > + return -EINVAL; > > + } > > + > > + /* > > + * In lockstep mode, r5 core 0 will use r5 core 1 TCM > > + * power domains as well. so allocate twice of per core TCM > > Twice of what? Please use proper english in your multi line comments, i.e a > capital letter for the first word and a dot at the end. > > > + */ > > + if (cluster->mode == LOCKSTEP_MODE) > > + tcm_bank_count = tcm_reg_per_r5 * 2; > > + else > > + tcm_bank_count = tcm_reg_per_r5; > > + > > + r5_core->tcm_banks = devm_kcalloc(dev, tcm_bank_count, > > + sizeof(struct mem_bank_data *), > > + GFP_KERNEL); > > + if (!r5_core->tcm_banks) > > + ret = -ENOMEM; > > + > > + r5_core->tcm_bank_count = tcm_bank_count; > > + for (j = 0; j < tcm_bank_count; j++) { > > + tcm = devm_kzalloc(dev, sizeof(struct mem_bank_data), > > + GFP_KERNEL); > > + if (!tcm) > > + return -ENOMEM; > > + > > + r5_core->tcm_banks[j] = tcm; > > + > > + /* > > + * In lockstep mode, get second core's TCM power domains id > > + * after first core TCM parsing is done as > > There seems to be words missing at the end of the sentence, and there is no dot. > > > + */ > > + if (j == tcm_reg_per_r5) { > > + /* dec first core node */ > > + of_node_put(np); > > + > > + /* get second core node */ > > + np = of_get_next_child(cluster->dev->of_node, np); > > + > > + /* > > + * reset index of power-domains property list > > + * for second core > > + */ > > + tcm_pd_idx = 1; > > + } > > + > > + /* 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", > > + j, ret); > > + of_node_put(out_args.np); > > I'm pretty sure this isn't needed in error conditions since @out_args would not > have been assigned. > > > + return ret; > > + } > > + tcm->pm_domain_id = out_args.args[0]; > > + of_node_put(out_args.np); > > + tcm_pd_idx++; > > + > > + /* > > + * In lockstep mode, we only need second core's power domain > > + * ids. Other information from second core isn't needed so > > + * ignore it. This forms table as zynqmp_tcm_banks_lockstep > > I don't understand the last sentence of this comment and it is missing a dot at > the end. Comments should be enlightening, the ones I found in this patch are > sowing confusion. > > > + */ > > + if (j >= tcm_reg_per_r5) > > + contiue; > > + > > This condition and the one above (j == tcm_reg_per_r5) is brittle and almost > guaranteed to cause maintenance problems in the future. > > I understand your will to reuse as much code as possible but this is one of the > rare cases where duplicating code is probably better. Please introduce two new > functions, i.e zynqmp_r5_get_tcm_node_from_dt_split() and > zynqmp_r5_get_tcm_node_from_dt_lockstep(), and do all the necessary processing > based on the use case. Ack will fix the documentation and tcm parsing as suggested. > Thanks, > Mathieu > > > + /* get tcm address without translation */ > > + ret = of_property_read_reg(np, j, &abs_addr, &size); > > + if (ret) { > > + of_node_put(np); > > + 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) { > > + of_node_put(np); > > + 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"); > > + of_node_put(np); > > + return -EINVAL; > > + } > > + } > > + } > > + > > + of_node_put(np); > > + return 0; > > +} > > + > > /** > > * zynqmp_r5_get_tcm_node() > > * Ideally this function should parse tcm node and store information > > @@ -956,10 +1089,19 @@ 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); > > - return 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); > > + if (ret) { > > + dev_err(dev, "can't get tcm node from dt, err %d\n", ret); > > + return ret; > > + } > > + } else { > > + ret = zynqmp_r5_get_tcm_node(cluster); > > + if (ret < 0) { > > + dev_err(dev, "can't get tcm node, err %d\n", ret); > > + return ret; > > + } > > } > > > > for (i = 0; i < cluster->core_count; i++) { > > -- > > 2.25.1 > >