From patchwork Wed Mar 30 14:38:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Gupta X-Patchwork-Id: 555217 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF3D4C433FE for ; Wed, 30 Mar 2022 14:38:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242262AbiC3Okb (ORCPT ); Wed, 30 Mar 2022 10:40:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346960AbiC3Oka (ORCPT ); Wed, 30 Mar 2022 10:40:30 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2085.outbound.protection.outlook.com [40.107.92.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B22595372F; Wed, 30 Mar 2022 07:38:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QwSJZ5Y6yIoUXdaZ7ZFlLugipSz/e0EOCi3v8xwkzVu2LbHEGvo6El3IuW8NGp+pmohB4k4pGZYol9UDO23r3Rw+kaNF8F95rPitoEWD9k2s40NQANSIpcFfgmYnyXCdu/NeHS0f0EwnRjGdy73HIq9n4NvZTwgL25mu+1uUHuYxvigq5Fa10eIf8mBUXn4n2OrnIMvMvtzfVUlpIUdRToU5G14Fz/7iQJ4u8MmvrjCOX3i+VoYNFV1nud37YIe25yQ3JxbgnztPlYz3iGvdPoeVbni9qrekGrHb7D0/75nleSoM85zNf3f8fq6UE87jxGuhPDJpdCj+yvpH5xL2lA== 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=vaSt2YuyCgTMOz8xoVKQnbq/RKA9LOyWJI5LPUGvaFQ=; b=Yg2qbaZfcT3NyJsoGUNE3ifdMiqhBrjujkwiHNbvrI73O0qlQAlhqnqwmkreQfhBCQ/e6E5MqOYzc4EyibZs7AE1PyYVc2+da1NGPOdakcb/iUPW4sMHpL+DPelkMs9QT/ismfzVqOzU/WETjXOVi/wAKaxxA7CezuymN3yEsPY+7hmwTxVRR6li1AVSbRtOkwKsrnn6hHiLjgQ2xMAHGnX/l1zkPhqvMTQqNM5sZO5VwD0Ai2wXwiAmZPIsG5aDcJ+UoyFq7xuJZanOYdSf6/r8vh8ajWBy1qwHXz0u0EYsZzQz13nF5ZNvoZdjkTRQHg6j896c6qSCmGIVOIoFWA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vaSt2YuyCgTMOz8xoVKQnbq/RKA9LOyWJI5LPUGvaFQ=; b=Z4znYpVlV3WekZ0rkAXaZGGKZsaL7RnDZluYd3GPSiyV239KF32VwprMdhuZv3nr6poA6kVm7wtzR3Peb/o86rPuO9p2zNUYA16papiIbLgwDmVaoSgHw8MXOjEg8ZncIbCnfuflR7rKrUy1LhmSb+PIxMEaVIIYeOvI2JpobV1pYcVbW0uyeCOhAwAzHyoXrS/6xtRiWcGmPHV0b0Ycv6dRtrm+Oz7wuS5U7VhByM/ww52yocHQ3e6lS19Ft3dd6W3MeNL36meen1P1LtAaUb+FXtWJJorydq46rtO4KF4VwtCdjyUAnfdH//xXNkLCy1Rz6U7AL0S6ldDvq+KxIQ== Received: from MW4PR04CA0371.namprd04.prod.outlook.com (2603:10b6:303:81::16) by CY4PR1201MB0037.namprd12.prod.outlook.com (2603:10b6:910:1c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.16; Wed, 30 Mar 2022 14:38:42 +0000 Received: from CO1NAM11FT044.eop-nam11.prod.protection.outlook.com (2603:10b6:303:81:cafe::3f) by MW4PR04CA0371.outlook.office365.com (2603:10b6:303:81::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.13 via Frontend Transport; Wed, 30 Mar 2022 14:38:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.235) by CO1NAM11FT044.mail.protection.outlook.com (10.13.175.188) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5123.19 via Frontend Transport; Wed, 30 Mar 2022 14:38:42 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Wed, 30 Mar 2022 14:38:41 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Wed, 30 Mar 2022 07:38:41 -0700 Received: from sumitg-l4t.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.986.22 via Frontend Transport; Wed, 30 Mar 2022 07:38:37 -0700 From: Sumit Gupta To: , , , , , , , , , CC: , , , Subject: [Patch v2 1/4] cpufreq: tegra194: add soc data to support multiple soc Date: Wed, 30 Mar 2022 20:08:16 +0530 Message-ID: <20220330143819.27476-2-sumitg@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220330143819.27476-1-sumitg@nvidia.com> References: <20220330143819.27476-1-sumitg@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7d0141bc-13cb-4c65-eb12-08da125afcdf X-MS-TrafficTypeDiagnostic: CY4PR1201MB0037:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3ChG0pVc3ELovR/aw4WxPUbC7UmII6gr2mJIH+gLliqAwMAuJpjxQ848+Ryi9z7lrcum3f5pxnGzGoMJvnsJiu3AQebo5kO0ylrb0phzGknlg8wGiRVrX8GZq0UNC8cLZZ6VPu39D0OblAsM2biK6hpS4hDGrtJ/Cc525vIZ/OrmtRCKxnKbSyDFjEuKyXdhVmfDd4XEhwiYW0nSGB6LrUFhN+l9ic5XT0P+UxdoYfznaJFZdLOvomRCPJ/C0JjoxYdbHji173Uw5B4smjsSUKpFsmZhHnclIqhYUQux3OljLRXKhvTxskdEtuY29sLnFwIsxt7qUl97hCGZLsadn5bYV/XWbDVJS7vO0FxNl1G2gZDNwoyTQ7P9PoDTyYv6WVGMRFtxj3yZm/sOe8hwpIBeDiPVkMxiSRY48DVsuPYYrBlkFNzo/VTdTqe69G+S7YFCwAOmlCFGRYvFlbhStW5piX6xcmAuDOXDAcUmx/3oB1uKb/fsVo3vhijkSjEgLz9eJASn3NI9Btq7GleRv8Vs6KuXmc2ABjUq81lWTBxbGjO3K9fby6k90yCjW3WQg9qNwAWok4/VZwCvBtFh/TxCv0LqO5rENNbcF5+H9QluVylcZrwAhh2sLmhLmScsL5r+jc4c5DlsvM6BGEHXK+GS6k3/HCrWKVrrRnDJJrDgNeo5N0K6b/AxD5Q0EYwzQmhfQ3k3CkrzbZ6NEXselzDWXqPmX9X376xIkuYTfmM= X-Forefront-Antispam-Report: CIP:12.22.5.235; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(110136005)(36756003)(336012)(426003)(186003)(36860700001)(47076005)(356005)(83380400001)(81166007)(107886003)(1076003)(26005)(2616005)(921005)(54906003)(4326008)(86362001)(70206006)(316002)(5660300002)(2906002)(8676002)(7696005)(8936002)(70586007)(6666004)(508600001)(82310400004)(40460700003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2022 14:38:42.3830 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7d0141bc-13cb-4c65-eb12-08da125afcdf X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.235]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT044.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1201MB0037 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Adding SoC data and ops to support multiple SoC's in same driver. Signed-off-by: Sumit Gupta --- drivers/cpufreq/tegra194-cpufreq.c | 142 +++++++++++++++++++++-------- 1 file changed, 105 insertions(+), 37 deletions(-) diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c index ac381db25dbe..2d59b2bd0e1d 100644 --- a/drivers/cpufreq/tegra194-cpufreq.c +++ b/drivers/cpufreq/tegra194-cpufreq.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved + * Copyright (c) 2020 - 2022, NVIDIA CORPORATION. All rights reserved */ #include @@ -35,12 +35,6 @@ enum cluster { MAX_CLUSTERS, }; -struct tegra194_cpufreq_data { - void __iomem *regs; - size_t num_clusters; - struct cpufreq_frequency_table **tables; -}; - struct tegra_cpu_ctr { u32 cpu; u32 coreclk_cnt, last_coreclk_cnt; @@ -52,13 +46,42 @@ struct read_counters_work { struct tegra_cpu_ctr c; }; +struct tegra_cpufreq_ops { + void (*read_counters)(struct tegra_cpu_ctr *c); + void (*set_cpu_ndiv)(struct cpufreq_policy *policy, u64 ndiv); + void (*get_cpu_cluster_id)(u32 cpu, u32 *cpuid, u32 *clusterid); + int (*get_cpu_ndiv)(u32 cpu, u32 cpuid, u32 clusterid, u64 *ndiv); +}; + +struct tegra_cpufreq_soc { + struct tegra_cpufreq_ops *ops; + int maxcpus_per_cluster; +}; + +struct tegra194_cpufreq_data { + void __iomem *regs; + size_t num_clusters; + struct cpufreq_frequency_table **tables; + const struct tegra_cpufreq_soc *soc; +}; + static struct workqueue_struct *read_counters_wq; -static void get_cpu_cluster(void *cluster) +static void tegra_get_cpu_mpidr(void *mpidr) { - u64 mpidr = read_cpuid_mpidr() & MPIDR_HWID_BITMASK; + *((u64 *)mpidr) = read_cpuid_mpidr() & MPIDR_HWID_BITMASK; +} + +static void tegra194_get_cpu_cluster_id(u32 cpu, u32 *cpuid, u32 *clusterid) +{ + u64 mpidr; + + smp_call_function_single(cpu, tegra_get_cpu_mpidr, &mpidr, true); - *((uint32_t *)cluster) = MPIDR_AFFINITY_LEVEL(mpidr, 1); + if (cpuid) + *cpuid = MPIDR_AFFINITY_LEVEL(mpidr, 0); + if (clusterid) + *clusterid = MPIDR_AFFINITY_LEVEL(mpidr, 1); } /* @@ -85,11 +108,24 @@ static inline u32 map_ndiv_to_freq(struct mrq_cpu_ndiv_limits_response return nltbl->ref_clk_hz / KHZ * ndiv / (nltbl->pdiv * nltbl->mdiv); } +static void tegra194_read_counters(struct tegra_cpu_ctr *c) +{ + u64 val; + + val = read_freq_feedback(); + c->last_refclk_cnt = lower_32_bits(val); + c->last_coreclk_cnt = upper_32_bits(val); + udelay(US_DELAY); + val = read_freq_feedback(); + c->refclk_cnt = lower_32_bits(val); + c->coreclk_cnt = upper_32_bits(val); +} + static void tegra_read_counters(struct work_struct *work) { + struct tegra194_cpufreq_data *data = cpufreq_get_driver_data(); struct read_counters_work *read_counters_work; struct tegra_cpu_ctr *c; - u64 val; /* * ref_clk_counter(32 bit counter) runs on constant clk, @@ -107,13 +143,7 @@ static void tegra_read_counters(struct work_struct *work) work); c = &read_counters_work->c; - val = read_freq_feedback(); - c->last_refclk_cnt = lower_32_bits(val); - c->last_coreclk_cnt = upper_32_bits(val); - udelay(US_DELAY); - val = read_freq_feedback(); - c->refclk_cnt = lower_32_bits(val); - c->coreclk_cnt = upper_32_bits(val); + data->soc->ops->read_counters(c); } /* @@ -177,7 +207,7 @@ static unsigned int tegra194_calculate_speed(u32 cpu) return (rate_mhz * KHZ); /* in KHz */ } -static void get_cpu_ndiv(void *ndiv) +static void tegra194_get_cpu_ndiv_sysreg(void *ndiv) { u64 ndiv_val; @@ -186,30 +216,43 @@ static void get_cpu_ndiv(void *ndiv) *(u64 *)ndiv = ndiv_val; } -static void set_cpu_ndiv(void *data) +static int tegra194_get_cpu_ndiv(u32 cpu, u32 cpuid, u32 clusterid, u64 *ndiv) +{ + int ret; + + ret = smp_call_function_single(cpu, tegra194_get_cpu_ndiv_sysreg, &ndiv, true); + + return ret; +} + +static void tegra194_set_cpu_ndiv_sysreg(void *data) { - struct cpufreq_frequency_table *tbl = data; - u64 ndiv_val = (u64)tbl->driver_data; + u64 ndiv_val = *(u64 *)data; asm volatile("msr s3_0_c15_c0_4, %0" : : "r" (ndiv_val)); } +static void tegra194_set_cpu_ndiv(struct cpufreq_policy *policy, u64 ndiv) +{ + on_each_cpu_mask(policy->cpus, tegra194_set_cpu_ndiv_sysreg, &ndiv, true); +} + static unsigned int tegra194_get_speed(u32 cpu) { struct tegra194_cpufreq_data *data = cpufreq_get_driver_data(); struct cpufreq_frequency_table *pos; + u32 cpuid, clusterid; unsigned int rate; u64 ndiv; int ret; - u32 cl; - smp_call_function_single(cpu, get_cpu_cluster, &cl, true); + data->soc->ops->get_cpu_cluster_id(cpu, &cpuid, &clusterid); /* reconstruct actual cpu freq using counters */ rate = tegra194_calculate_speed(cpu); /* get last written ndiv value */ - ret = smp_call_function_single(cpu, get_cpu_ndiv, &ndiv, true); + ret = data->soc->ops->get_cpu_ndiv(cpu, cpuid, clusterid, &ndiv); if (WARN_ON_ONCE(ret)) return rate; @@ -219,7 +262,7 @@ static unsigned int tegra194_get_speed(u32 cpu) * to the last written ndiv value from freq_table. This is * done to return consistent value. */ - cpufreq_for_each_valid_entry(pos, data->tables[cl]) { + cpufreq_for_each_valid_entry(pos, data->tables[clusterid]) { if (pos->driver_data != ndiv) continue; @@ -237,19 +280,22 @@ static unsigned int tegra194_get_speed(u32 cpu) static int tegra194_cpufreq_init(struct cpufreq_policy *policy) { struct tegra194_cpufreq_data *data = cpufreq_get_driver_data(); - u32 cpu; - u32 cl; + int maxcpus_per_cluster = data->soc->maxcpus_per_cluster; + u32 start_cpu, cpu; + u32 clusterid; - smp_call_function_single(policy->cpu, get_cpu_cluster, &cl, true); + data->soc->ops->get_cpu_cluster_id(policy->cpu, NULL, &clusterid); - if (cl >= data->num_clusters || !data->tables[cl]) + if (clusterid >= data->num_clusters || !data->tables[clusterid]) return -EINVAL; + start_cpu = rounddown(policy->cpu, maxcpus_per_cluster); /* set same policy for all cpus in a cluster */ - for (cpu = (cl * 2); cpu < ((cl + 1) * 2); cpu++) - cpumask_set_cpu(cpu, policy->cpus); - - policy->freq_table = data->tables[cl]; + for (cpu = start_cpu; cpu < (start_cpu + maxcpus_per_cluster); cpu++) { + if (cpu_possible(cpu)) + cpumask_set_cpu(cpu, policy->cpus); + } + policy->freq_table = data->tables[clusterid]; policy->cpuinfo.transition_latency = TEGRA_CPUFREQ_TRANSITION_LATENCY; return 0; @@ -259,13 +305,14 @@ static int tegra194_cpufreq_set_target(struct cpufreq_policy *policy, unsigned int index) { struct cpufreq_frequency_table *tbl = policy->freq_table + index; + struct tegra194_cpufreq_data *data = cpufreq_get_driver_data(); /* * Each core writes frequency in per core register. Then both cores * in a cluster run at same frequency which is the maximum frequency * request out of the values requested by both cores in that cluster. */ - on_each_cpu_mask(policy->cpus, set_cpu_ndiv, tbl, true); + data->soc->ops->set_cpu_ndiv(policy, (u64)tbl->driver_data); return 0; } @@ -280,6 +327,18 @@ static struct cpufreq_driver tegra194_cpufreq_driver = { .attr = cpufreq_generic_attr, }; +static struct tegra_cpufreq_ops tegra194_cpufreq_ops = { + .read_counters = tegra194_read_counters, + .get_cpu_cluster_id = tegra194_get_cpu_cluster_id, + .get_cpu_ndiv = tegra194_get_cpu_ndiv, + .set_cpu_ndiv = tegra194_set_cpu_ndiv, +}; + +const struct tegra_cpufreq_soc tegra194_cpufreq_soc = { + .ops = &tegra194_cpufreq_ops, + .maxcpus_per_cluster = 2, +}; + static void tegra194_cpufreq_free_resources(void) { destroy_workqueue(read_counters_wq); @@ -359,6 +418,7 @@ init_freq_table(struct platform_device *pdev, struct tegra_bpmp *bpmp, static int tegra194_cpufreq_probe(struct platform_device *pdev) { + const struct tegra_cpufreq_soc *soc; struct tegra194_cpufreq_data *data; struct tegra_bpmp *bpmp; int err, i; @@ -367,6 +427,15 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev) if (!data) return -ENOMEM; + soc = of_device_get_match_data(&pdev->dev); + + if (soc->ops && soc->maxcpus_per_cluster) { + data->soc = soc; + } else { + dev_err(&pdev->dev, "soc data missing\n"); + return -EINVAL; + } + data->num_clusters = MAX_CLUSTERS; data->tables = devm_kcalloc(&pdev->dev, data->num_clusters, sizeof(*data->tables), GFP_KERNEL); @@ -416,10 +485,9 @@ static int tegra194_cpufreq_remove(struct platform_device *pdev) } static const struct of_device_id tegra194_cpufreq_of_match[] = { - { .compatible = "nvidia,tegra194-ccplex", }, + { .compatible = "nvidia,tegra194-ccplex", .data = &tegra194_cpufreq_soc }, { /* sentinel */ } }; -MODULE_DEVICE_TABLE(of, tegra194_cpufreq_of_match); static struct platform_driver tegra194_ccplex_driver = { .driver = { From patchwork Wed Mar 30 14:38:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Gupta X-Patchwork-Id: 555466 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59767C433F5 for ; Wed, 30 Mar 2022 14:38:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346977AbiC3Okj (ORCPT ); Wed, 30 Mar 2022 10:40:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346978AbiC3Okd (ORCPT ); Wed, 30 Mar 2022 10:40:33 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2042.outbound.protection.outlook.com [40.107.236.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7831A5373E; Wed, 30 Mar 2022 07:38:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IsUamrdKeqMHJhRgwBb0RfQtYEI3wkwJ/TQa6ozXm+MXsUUcT0dVzXTP5P3+NpS75NH4oIs8uu9cFBGy/4nuBx8RQanGQLIUA7FwYhsRtAyMeAk8A/0GpIuCLZEDG4WiRVf4UwZbyImb7p38KuJqy514xDLE5gL7c8oSvP8FbQ8PF++7tBluAXNIPV4w5hvqrwxlAgt/aAt7s58MH5y2zMhmac6G2Hdi+DVL+zbF0zzNaZiBV8CUkll5vFOXhE63527Aa6+QQ72pjfk178/3lfi/Ms60EFkS5mnwJ+gIXoPbX/ZH6XSZJaPCyTteWLITePdc5g6uZ7VdMaHuvXlCtg== 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=r8OE3kOIekGzb6oXA4XitGiU1hzTSd0zw0rG6McU2os=; b=CbUqHdrULdFgUAoVxv6iaGZjJkcCNs5yryWfCEVdyfTZ7H5wM3TQlh4RPmBloS6mfBOOP529yp+L2lXUyu2wv3acIT/qm7Y8wcrpAElvnc9kGN+lMYg+YHIj3TeqCRPjXi0HmO6Ptofd5aKZYzph9H6bZ/VJ75iKWgkCzABlvAAfAGLcz0jhy6cDHGCDjNmgADPKOxrc1iicf6AKQH91+OCcAOxrgW3S5h8DHbvbkLCGpyl0DGp9nC+IuHbPimUP9dUtB2b1e0heD1EpqPKczwRpnVbUMfkQzAvh1Hx4CDwBBZvsdScSAOIlnu4u6vn18fnOvG0FDpEp9ZHw2hiKFA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.236) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=r8OE3kOIekGzb6oXA4XitGiU1hzTSd0zw0rG6McU2os=; b=FgEaLcvIfsC/m9HaGfNajxnE5giXM+xutECvLx0JyQr0yQ8d3VYbbTT38K7+RdVeYblLlSfv8TBfhComEKvu66N3hlTdPbwgYh1sJ6JKh8lbepv16IDxj3fUnJoE067rdh6+I9oEMv9XKWgk1LFuNVvp0cRjWXbe1/fLnnb1X2GmS6W6vbi7qxAxDrAwUU+ljRNwiY6DndGTAKB6OrucDKPq3lTw/npOv+KrUKh5UVO2EzxvXIt1TaLXemsAelRNFPqhbTaR0DhkUBWcgV3Fw7318sKH9OTm5G38puLe6YztsHGcCX0JbNnDwZgeBM52o3spq2ADwEYKB3xJsRHjIw== Received: from BN0PR07CA0017.namprd07.prod.outlook.com (2603:10b6:408:141::31) by BN9PR12MB5244.namprd12.prod.outlook.com (2603:10b6:408:101::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.19; Wed, 30 Mar 2022 14:38:46 +0000 Received: from BN8NAM11FT036.eop-nam11.prod.protection.outlook.com (2603:10b6:408:141:cafe::2) by BN0PR07CA0017.outlook.office365.com (2603:10b6:408:141::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.13 via Frontend Transport; Wed, 30 Mar 2022 14:38:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.236) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.236 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.236; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.236) by BN8NAM11FT036.mail.protection.outlook.com (10.13.177.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5123.19 via Frontend Transport; Wed, 30 Mar 2022 14:38:46 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by DRHQMAIL109.nvidia.com (10.27.9.19) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Wed, 30 Mar 2022 14:38:45 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Wed, 30 Mar 2022 07:38:45 -0700 Received: from sumitg-l4t.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.986.22 via Frontend Transport; Wed, 30 Mar 2022 07:38:41 -0700 From: Sumit Gupta To: , , , , , , , , , CC: , , , Subject: [Patch v2 2/4] dt-bindings: arm: tegra: Add bindins for nvidia,tegra-ccplex-cluster Date: Wed, 30 Mar 2022 20:08:17 +0530 Message-ID: <20220330143819.27476-3-sumitg@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220330143819.27476-1-sumitg@nvidia.com> References: <20220330143819.27476-1-sumitg@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b38b7def-038f-4186-aef2-08da125aff67 X-MS-TrafficTypeDiagnostic: BN9PR12MB5244:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jEYzXdlPRbySFXKe2Y7B9j/X7dprltvK7e4KnErBsvQ/dFjCUW0gLzTHMkKnn6vIFxmwscST8PWIOmdCfR17FbD8M/XjyQGAwRCkqUkFapZQy0G6/P4v1S3qTuZ2fx0aeDDJviloornCvU7TBgZuyunobSNYaiqcgBbWvHvJDwkXCkAzUGN9UB9O/pImGeNSaaFcpw3mB6/aLYpO3EJey+uNbWH8YIMawnd8XKf74CbcHVIGcOUfEx6a5CN8iGGhQLy9hxuViDBh3lA2RbWjAFfMHWfN4vK/UkVG4tqCn6ys1ZY+vHhi2RO2y7dvE9KfUrqgVMopcavy99/XENF/jl6UlFa2dd7FbDVpEk46cMMR2ivrzFSMeQo/Zp96B4+ApMQRU5L3euCaiAzBCXbmrlVfdJ3qQF06vCE9eKYNl76MFX5cbREkm+0RY0x2Q/Kz5d/kyVH8MupKe7l/+vo1DiZf8MANh2JpnPIpgCCWXxHicDn7Y4zjjYzgD6Xy7zJS9S4agng0UwCXTNKP3N3RhfyivIvfGj7PzF2nZs4Yp2dZCl9GxEKnI/STo5UyUHoPQAhvp8cz8JFkDqrylFqPP+9GEcXKCNA6+giaStyKmyHWdkppj58Lp/soX1Bmm54slhCUw18twKdPI7yagFSXE9VcQAFem1avRso2QLBCuNJEZB2QtGudT+4o+b92ve+da4y2gN+O/10FaKK0dP291daCqJ/13xXElRoa+EfqZXiaZ7E280v4zNI4oECeR7mqqvr91dup1jEPY5RXBR49bUrBcGyIKnXibj8cPw2V6SzzsG5wb8rvU/NMEUEiDYmJ5cdqWZiF4FMq6maPQSzVCbcbK97vQbPpmPamLdJSd48= X-Forefront-Antispam-Report: CIP:12.22.5.236; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(8936002)(7696005)(2616005)(40460700003)(356005)(2906002)(508600001)(316002)(81166007)(921005)(82310400004)(1076003)(36860700001)(186003)(110136005)(26005)(336012)(107886003)(70206006)(70586007)(86362001)(426003)(47076005)(54906003)(5660300002)(36756003)(6666004)(8676002)(4326008)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2022 14:38:46.5969 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b38b7def-038f-4186-aef2-08da125aff67 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.236]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT036.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5244 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The Tegra CCPLEX_CLUSTER area contains memory-mapped registers that initiate CPU frequency/voltage transitions. Signed-off-by: Sumit Gupta --- .../tegra/nvidia,tegra-ccplex-cluster.yaml | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/tegra/nvidia,tegra-ccplex-cluster.yaml diff --git a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra-ccplex-cluster.yaml b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra-ccplex-cluster.yaml new file mode 100644 index 000000000000..74afa06f695e --- /dev/null +++ b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra-ccplex-cluster.yaml @@ -0,0 +1,52 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/arm/tegra/nvidia,tegra-ccplex-cluster.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: NVIDIA Tegra CPU_CLUSTER area device tree bindings + +maintainers: + - Sumit Gupta + - Mikko Perttunen + - Jon Hunter + - Thierry Reding + +description: |+ + The Tegra CCPLEX_CLUSTER area contains memory-mapped + registers that initiate CPU frequency/voltage transitions. + +properties: + $nodename: + pattern: "ccplex@([0-9a-f]+)$" + + compatible: + enum: + - nvidia,tegra186-ccplex-cluster + - nvidia,tegra234-ccplex-cluster + + reg: + maxItems: 1 + + nvidia,bpmp: + $ref: '/schemas/types.yaml#/definitions/phandle' + description: | + Specifies the bpmp node that needs to be queried to get + operating point data for all CPUs. + +additionalProperties: true + +required: + - compatible + - reg + - nvidia,bpmp + - status + +examples: + - | + ccplex@e000000 { + compatible = "nvidia,tegra234-ccplex-cluster"; + reg = <0x0 0x0e000000 0x0 0x5ffff>; + nvidia,bpmp = <&bpmp>; + status = "okay"; + }; From patchwork Wed Mar 30 14:38:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Gupta X-Patchwork-Id: 555216 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2253EC433FE for ; Wed, 30 Mar 2022 14:38:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346999AbiC3Okk (ORCPT ); Wed, 30 Mar 2022 10:40:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346998AbiC3Oki (ORCPT ); Wed, 30 Mar 2022 10:40:38 -0400 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam08on2088.outbound.protection.outlook.com [40.107.101.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F673546B9; Wed, 30 Mar 2022 07:38:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l5Scef/kWAQpcbG/b5wL1ba05esITw3AAqB5Ifi3LOOkrKZ3e1Y2zPHl4eyAtjE4VBqrm3sgxqW91EQ5PpLP5eiDx4GAwn+6CIXFi4Peu9cC/oHWt57cDJS5PjLQp5H3blsOD6MooOfRTn3MBqgZdqU9FiAo3FIslA93ckq+VvpnEFV0M5PVhl6/JLUXk3eXMXMhcFFxUedbp1hZq5jyFSRm3uplleoRrgmvQBMREKxHpk4GEIZjikatfyXkYuRytkK8FwwHihEHEDXTnHQkFzho+HzGYarpc3iMgYS2L5As0gzzBibcbasr49MIuxAgJMwPdZUWP8YnKhZrAVTaQQ== 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=0jiZqiuA4bL/Xl4sXyXV/fFxhFrzn1JlNSbgW6WB1YI=; b=TA+vsAlxnoNe1tzFTbqcOVysq8U/Qin0D38CxuscO5S7GCx3Due9+hhax5/I3MQzXEmvW0qPIAJ6mBT5GKoVUAoLGqmPorvX7IfR8xUvbfv3cVuWSeHf5fHMlazjVFFJeNbaN/iGIax3sKpVzNF4T+xFMzVKjQYA933zMw1+7sYh2oYwdxesaOwPV/3N3ai6gTqcZ68KPtCcW4YW/E7D/9LUDuUXU1vaQWrvoMHOAroT0lKVn3aUCd4YpWejUPq+5FFhx8cLww9hiDRCXLIApqRbw1Syx+Ur4eLAltpPLvM7DWe/cejwrYO0v2COxf+n4O+tphIlPQr6JHT2uPe11Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0jiZqiuA4bL/Xl4sXyXV/fFxhFrzn1JlNSbgW6WB1YI=; b=f4s3MBvus0LOjo6yoEAXcHl3SEjzlTwUx6JG7p1q3T4Z6SbsuBRGdg8LkYyZbmxo81T1AaftY/843uQJo4sJHn5ppvZdzudnj7KNpWdzlFWkY8zT/gQRTV9l96u8CjQkAuztIhwTtMZIfC6BjRrxD2rMryk++/kcuW7huj0wWqcHdRsg7nqFkJnYObUUNwPCwR74qATp0XTUDkZeV3yJ8TjqMoDryzIEFoEE63Uj2QWKX71+99mIMj+DtJjXlGe7Vm6LmqhXaxXjrj3LGpo2h0ns6GEzwK9UKjB4MzQnfutq9uo0O8+w2t3BlsZPH0203y65Zx37xtq51bGKn+kWRw== Received: from MW4PR02CA0003.namprd02.prod.outlook.com (2603:10b6:303:16d::30) by MN2PR12MB3150.namprd12.prod.outlook.com (2603:10b6:208:c7::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.17; Wed, 30 Mar 2022 14:38:50 +0000 Received: from CO1NAM11FT056.eop-nam11.prod.protection.outlook.com (2603:10b6:303:16d:cafe::43) by MW4PR02CA0003.outlook.office365.com (2603:10b6:303:16d::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.13 via Frontend Transport; Wed, 30 Mar 2022 14:38:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.235) by CO1NAM11FT056.mail.protection.outlook.com (10.13.175.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5123.19 via Frontend Transport; Wed, 30 Mar 2022 14:38:50 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Wed, 30 Mar 2022 14:38:50 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Wed, 30 Mar 2022 07:38:49 -0700 Received: from sumitg-l4t.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.986.22 via Frontend Transport; Wed, 30 Mar 2022 07:38:45 -0700 From: Sumit Gupta To: , , , , , , , , , CC: , , , Subject: [Patch v2 3/4] arm64: tegra: add node for tegra234 cpufreq Date: Wed, 30 Mar 2022 20:08:18 +0530 Message-ID: <20220330143819.27476-4-sumitg@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220330143819.27476-1-sumitg@nvidia.com> References: <20220330143819.27476-1-sumitg@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e1c2cbc4-06ee-4b60-d467-08da125b01b1 X-MS-TrafficTypeDiagnostic: MN2PR12MB3150:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +Ylf41GvlWdf1x74EmHTobTzy6nL4y3wBzz2etccQxLhrXWnj1U/p1DS2dI4ey5gzSJWN4PxdfLT01RfJk0/udSld14tsyJkECHl8jT6hgtvKp/3eOGzGjb3bcX7Mmryb6jINWGkL8ZyvlFjtn37NkeyfcpGo2uL7eLhcaXZW4uWaltewWNbTjnufhOjitlApJkyz48Gn+zfAzYQN+hHpqelR+iR5H2jw2ityNdFB5PmAeamAOQSDLfWOec5KnSh2IzIiHcuD/x1ss6A8Zzb4O/uW+mlLQmeOFPB74watEE25sOrYHZ7mCUPe50LD7OH9xBGXfByd1a9uI5i29x95eIL35A4EzMSFZMnRRyAhCe0VoaO5pk3XYh/wb0BV6wkRQKemm+K0Rr9bdzZf4yvyWqd/FdH+nv32OSZWx9Sd8s2/rvrtldGRApm8g8PkBWEa8VUhfkSJ3/wp/xoTRNHXSbSNQKJsEPUWrZRvKjWkp1+v8SggmdnYhPuAwX22cl4J8wviEC4FTAyfsJDtPgYITO05F8HWxUK6uaRVmZ3EUmvJgzZYNh3aQaImOBh1+YwdwvPE7po0AdJgJrJTtt2tc3DDT5VzgdZgQtTs3tZsVNEa52cWAm0tHm32u+9UvQLP9yHiLVAXpN3YEN2AIdm6pb1Ska92EoVol59FxdGiG/PedI7cDgQP4dmt3E40NbWTinh8x0SU0t0ItJSw1PlXaao4ep0rwIczxWmD4PoijU= X-Forefront-Antispam-Report: CIP:12.22.5.235; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(46966006)(40470700004)(83380400001)(1076003)(26005)(40460700003)(110136005)(107886003)(2616005)(336012)(70586007)(70206006)(316002)(54906003)(186003)(86362001)(8676002)(4326008)(82310400004)(426003)(508600001)(81166007)(6666004)(36860700001)(8936002)(921005)(47076005)(7696005)(4744005)(5660300002)(36756003)(2906002)(356005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2022 14:38:50.5008 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e1c2cbc4-06ee-4b60-d467-08da125b01b1 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.235]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT056.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3150 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Adding cclpex node to represent Tegra234 cpufreq. Tegra234 uses some of the CRAB (Control Register Access Bus) registers for cpu frequency requests. These registers are memory mapped to CCPLEX_MMCRAB_ARM region. In this node, mapping the range of MMCRAB registers required only for cpu frequency info. Signed-off-by: Sumit Gupta --- arch/arm64/boot/dts/nvidia/tegra234.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm64/boot/dts/nvidia/tegra234.dtsi b/arch/arm64/boot/dts/nvidia/tegra234.dtsi index aaace605bdaa..610207f3f967 100644 --- a/arch/arm64/boot/dts/nvidia/tegra234.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra234.dtsi @@ -1258,6 +1258,13 @@ }; }; + ccplex@e000000 { + compatible = "nvidia,tegra234-ccplex-cluster"; + reg = <0x0 0x0e000000 0x0 0x5ffff>; + nvidia,bpmp = <&bpmp>; + status = "okay"; + }; + sram@40000000 { compatible = "nvidia,tegra234-sysram", "mmio-sram"; reg = <0x0 0x40000000 0x0 0x80000>; From patchwork Wed Mar 30 14:38:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Gupta X-Patchwork-Id: 555465 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A023C433EF for ; Wed, 30 Mar 2022 14:40:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245055AbiC3Oln (ORCPT ); Wed, 30 Mar 2022 10:41:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237914AbiC3Olm (ORCPT ); Wed, 30 Mar 2022 10:41:42 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2080.outbound.protection.outlook.com [40.107.92.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F81F53B54; Wed, 30 Mar 2022 07:39:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cVuNKVccDao4KKLJj81mcJnOZEknM6xw0xcWblWc7FENj/jBs64mHEf/dbYKEOGzcmvYJwz1erYMlcGyENCtlS4+5XDuOjlUeaOGPYpx9qxchanHMFkhlTVr4vxbawp0aNORkdWhJrKMlrbAdWgeUFo3SKnzml3qgJdCFeTj6pyiCwFKpm1ncay6+ZiIky8KDqGPPnnKDtMQgBHFOkssSM6/MED4ReDkyYP/gSmUSbG5jKJp1wM6XA51tQPoSiJI5ra83Hl/Ve0YNblKulEDRN7LH+TO59x1HkO19w425FOIQ5JVsNsGzfLNqaou8w8/fBAwY2Ad7FUmFJKMQGmfBg== 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=Qc4iAL8TXxvbp7/DyB/nsLSUrz912sWCvcI8+//F0VU=; b=leViL+OzNtprXi9TISdZl2a8p1rEk6aC0KZIxnuUvctQhMSXMJtG3YPOD+5S6j6eRezjci1m6fgOAC/2jVDuBcIkK5RQ/oSwEDX8pH6LzDUOtkK6iddUFGAqLlhHMp4Mtb7EMS5FFRG88vQ/F/Pk5BAVIeljAD9WovqjROzCetyWYBi221G6RHhn+EpeARF50p4kR2mWpPljT5ygv783BXyaxg0Z9/9NBhdnw1STR9uba+jUzxn8iHWeC/onkta5vZOPS7SMdnleHr4tvbbOMdnfPgqNjWbVI8pgVmlgZpdvRdD+lFiAFcZY5dGa8J0Sho3AGtQnzZagm/jaHxgtlQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.238) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Qc4iAL8TXxvbp7/DyB/nsLSUrz912sWCvcI8+//F0VU=; b=s7hIqWY8NC2tHLWA88xkdeqosAamlZewdNV3jrElNnCrUN1pRK6YpHKt/K2uze0wcy0TrR2yiCmUsqPb6DFJ76OO0uWlDWh3i8jOMXg2mHVxnwzOZGGARUSUnPDu0yVtm8cY6m/rFUdRydYTUrLOuDvGJwOmZz2vLZNDXT5qGp+9DR5l3Z6+kRA4uESFztapo7hgZqvjj4gA4RI3uR4u1FImNWzgoCTJqTLbFc4l7a3yX0h0ZlHQIxVB2FdXfb6foKifjtV75xCk/kwV2x4I9/AP7yRXuDJm9BEhubEeCA85pNbOre3P3IEi176Wzl5SExtTMy8Ds+A/azFgbBrQTA== Received: from DS7PR03CA0297.namprd03.prod.outlook.com (2603:10b6:5:3ad::32) by BL0PR12MB2481.namprd12.prod.outlook.com (2603:10b6:207:40::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.17; Wed, 30 Mar 2022 14:38:55 +0000 Received: from DM6NAM11FT047.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3ad:cafe::35) by DS7PR03CA0297.outlook.office365.com (2603:10b6:5:3ad::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.13 via Frontend Transport; Wed, 30 Mar 2022 14:38:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.238) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.238 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.238; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.238) by DM6NAM11FT047.mail.protection.outlook.com (10.13.172.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5123.19 via Frontend Transport; Wed, 30 Mar 2022 14:38:54 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Wed, 30 Mar 2022 14:38:54 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Wed, 30 Mar 2022 07:38:53 -0700 Received: from sumitg-l4t.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.986.22 via Frontend Transport; Wed, 30 Mar 2022 07:38:49 -0700 From: Sumit Gupta To: , , , , , , , , , CC: , , , Subject: [Patch v2 4/4] cpufreq: tegra194: Add support for Tegra234 Date: Wed, 30 Mar 2022 20:08:19 +0530 Message-ID: <20220330143819.27476-5-sumitg@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220330143819.27476-1-sumitg@nvidia.com> References: <20220330143819.27476-1-sumitg@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7ee475d2-38b3-462b-7e52-08da125b044e X-MS-TrafficTypeDiagnostic: BL0PR12MB2481:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nBUaeK0jUv42I0674uzDX/aXQZw2ksn2sTwr1xOA8tJMo/dMsr06d7izQTV+LoEXUAgJ+49KFFu+8+qDpYbfkrjitEUIezi4Bk/ByVbmsWy0jaQ4VYL80IHMhsRhA6omKtklFDCHt6eeeQK/oTYTmU+kQyuj/4FbmoZShfnxeK0M/jwNWIvpxnRQ8RDEClJpxz9TuUa4HCsaWyBOUyUeN8L5gItNejdXa2y/mo8rjQA2tUqn+3VJ3AYxgKp1zgj45ESxb5QDXlCuwH10doczrRNjIitNq0BLgyj1+voa03HPe6cuUZXWOBsq9u3cRcvfaetRYw6LQJcA+qTqV7zlxhslb1R9AIWNSUgoc560xngd3tktbXRRcBCnoFG8vLEiM0QH2e8DvJ8E8N6x0TC+NrKpkd+jedzBFydYQDoKD13TJdxIgD3jilGLKJLlx7WXjTlIr/RkFSLF9+wifHYuZz9lDP/7nK9rIDb7FNxo2NQDCesYJqkQ/OUVrJaHbaRRlKB6KhyCM9O2HB9y0WQbXaWYIJmgHJoJw2Cq893SuMF7kEnR3lKRWp4+6gt8OPDaTL+DpuuG1zJ75pfJpaDIvnhAuZ1bAWJwVQ1wefcYnng4GgQq5troUpuo7K0XN/QK96tDxEuqi14vPngQ5+cDoQ96zd0pcLuvBiPqhbuvqOyBKHK51OWhNGzx1/dR10B2hFqFHdYEkJnsq0112YzyXYPTTr7xD6GI7CiY+F5Sm5I= X-Forefront-Antispam-Report: CIP:12.22.5.238; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(40470700004)(46966006)(508600001)(70206006)(2616005)(921005)(107886003)(82310400004)(70586007)(356005)(8676002)(1076003)(47076005)(6666004)(81166007)(7696005)(4326008)(2906002)(83380400001)(40460700003)(110136005)(186003)(316002)(36756003)(26005)(336012)(86362001)(5660300002)(54906003)(36860700001)(426003)(8936002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2022 14:38:54.8673 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7ee475d2-38b3-462b-7e52-08da125b044e X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.238]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT047.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB2481 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org This patch adds driver support for Tegra234 cpufreq. Tegra234 has per core MMIO registers instead of system registers for cpu frequency requests and to read the counters for re-constructing the cpu frequency. Also, MPIDR affinity info in Tegra234 is different from Tegra194. Added ops hooks and soc data for Tegra234. This will help to easily add variants of Tegra234 and future SoC's which use similar logic to {get|set} the cpu frequency. Signed-off-by: Sumit Gupta --- drivers/cpufreq/tegra194-cpufreq.c | 104 +++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c index 2d59b2bd0e1d..2a6a98764a8c 100644 --- a/drivers/cpufreq/tegra194-cpufreq.c +++ b/drivers/cpufreq/tegra194-cpufreq.c @@ -24,6 +24,17 @@ #define CPUFREQ_TBL_STEP_HZ (50 * KHZ * KHZ) #define MAX_CNT ~0U +#define NDIV_MASK 0x1FF + +#define CORE_OFFSET(cpu) (cpu * 8) +#define CMU_CLKS_BASE 0x2000 +#define SCRATCH_FREQ_CORE_REG(data, cpu) (data->regs + CMU_CLKS_BASE + CORE_OFFSET(cpu)) + +#define MMCRAB_CLUSTER_BASE(cl) (0x30000 + (cl * 0x10000)) +#define CLUSTER_ACTMON_BASE(data, cl) \ + (data->regs + (MMCRAB_CLUSTER_BASE(cl) + data->soc->actmon_cntr_base)) +#define CORE_ACTMON_CNTR_REG(data, cl, cpu) (CLUSTER_ACTMON_BASE(data, cl) + CORE_OFFSET(cpu)) + /* cpufreq transisition latency */ #define TEGRA_CPUFREQ_TRANSITION_LATENCY (300 * 1000) /* unit in nanoseconds */ @@ -56,6 +67,7 @@ struct tegra_cpufreq_ops { struct tegra_cpufreq_soc { struct tegra_cpufreq_ops *ops; int maxcpus_per_cluster; + phys_addr_t actmon_cntr_base; }; struct tegra194_cpufreq_data { @@ -72,6 +84,90 @@ static void tegra_get_cpu_mpidr(void *mpidr) *((u64 *)mpidr) = read_cpuid_mpidr() & MPIDR_HWID_BITMASK; } +static void tegra234_get_cpu_cluster_id(u32 cpu, u32 *cpuid, u32 *clusterid) +{ + u64 mpidr; + + smp_call_function_single(cpu, tegra_get_cpu_mpidr, &mpidr, true); + + if (cpuid) + *cpuid = MPIDR_AFFINITY_LEVEL(mpidr, 1); + if (clusterid) + *clusterid = MPIDR_AFFINITY_LEVEL(mpidr, 2); +} + +static int tegra234_get_cpu_ndiv(u32 cpu, u32 cpuid, u32 clusterid, u64 *ndiv) +{ + struct tegra194_cpufreq_data *data = cpufreq_get_driver_data(); + void __iomem *freq_core_reg; + u64 mpidr_id; + + /* use physical id to get address of per core frequency register */ + mpidr_id = (clusterid * data->soc->maxcpus_per_cluster) + cpuid; + freq_core_reg = SCRATCH_FREQ_CORE_REG(data, mpidr_id); + + *ndiv = readl(freq_core_reg) & NDIV_MASK; + + return 0; +} + +static void tegra234_set_cpu_ndiv(struct cpufreq_policy *policy, u64 ndiv) +{ + struct tegra194_cpufreq_data *data = cpufreq_get_driver_data(); + void __iomem *freq_core_reg; + u32 cpu, cpuid, clusterid; + u64 mpidr_id; + + for_each_cpu_and(cpu, policy->cpus, cpu_online_mask) { + data->soc->ops->get_cpu_cluster_id(cpu, &cpuid, &clusterid); + + /* use physical id to get address of per core frequency register */ + mpidr_id = (clusterid * data->soc->maxcpus_per_cluster) + cpuid; + freq_core_reg = SCRATCH_FREQ_CORE_REG(data, mpidr_id); + + writel(ndiv, freq_core_reg); + } +} + +/* + * This register provides access to two counter values with a single + * 64-bit read. The counter values are used to determine the average + * actual frequency a core has run at over a period of time. + * [63:32] PLLP counter: Counts at fixed frequency (408 MHz) + * [31:0] Core clock counter: Counts on every core clock cycle + */ +static void tegra234_read_counters(struct tegra_cpu_ctr *c) +{ + struct tegra194_cpufreq_data *data = cpufreq_get_driver_data(); + void __iomem *actmon_reg; + u32 cpuid, clusterid; + u64 val; + + data->soc->ops->get_cpu_cluster_id(c->cpu, &cpuid, &clusterid); + actmon_reg = CORE_ACTMON_CNTR_REG(data, clusterid, cpuid); + + val = readq(actmon_reg); + c->last_refclk_cnt = upper_32_bits(val); + c->last_coreclk_cnt = lower_32_bits(val); + udelay(US_DELAY); + val = readq(actmon_reg); + c->refclk_cnt = upper_32_bits(val); + c->coreclk_cnt = lower_32_bits(val); +} + +static struct tegra_cpufreq_ops tegra234_cpufreq_ops = { + .read_counters = tegra234_read_counters, + .get_cpu_cluster_id = tegra234_get_cpu_cluster_id, + .get_cpu_ndiv = tegra234_get_cpu_ndiv, + .set_cpu_ndiv = tegra234_set_cpu_ndiv, +}; + +const struct tegra_cpufreq_soc tegra234_cpufreq_soc = { + .ops = &tegra234_cpufreq_ops, + .actmon_cntr_base = 0x9000, + .maxcpus_per_cluster = 4, +}; + static void tegra194_get_cpu_cluster_id(u32 cpu, u32 *cpuid, u32 *clusterid) { u64 mpidr; @@ -442,6 +538,13 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev) if (!data->tables) return -ENOMEM; + if (soc->actmon_cntr_base) { + /* mmio registers are used for frequency request and re-construction */ + data->regs = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(data->regs)) + return PTR_ERR(data->regs); + } + platform_set_drvdata(pdev, data); bpmp = tegra_bpmp_get(&pdev->dev); @@ -486,6 +589,7 @@ static int tegra194_cpufreq_remove(struct platform_device *pdev) static const struct of_device_id tegra194_cpufreq_of_match[] = { { .compatible = "nvidia,tegra194-ccplex", .data = &tegra194_cpufreq_soc }, + { .compatible = "nvidia,tegra234-ccplex-cluster", .data = &tegra234_cpufreq_soc }, { /* sentinel */ } };