Received: by 10.223.176.5 with SMTP id f5csp867312wra; Tue, 6 Feb 2018 08:40:08 -0800 (PST) X-Google-Smtp-Source: AH8x226QHOXCoVAUj1dpzPYFzaoT4iG6yr3awiULSomkhcnz3EC8nEecl5k8SXpU8BQIvQY+wTxR X-Received: by 10.99.109.70 with SMTP id i67mr2472009pgc.109.1517935207875; Tue, 06 Feb 2018 08:40:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517935207; cv=none; d=google.com; s=arc-20160816; b=v+lh1n80wiEO4BF0kdbrrYJKCzStA9QFnylPpdVC3SiZuBun7Xa+nLVGrlv89S62IC xfGuoqCi8hwLtdsot7HymuZfXihoJj0BkVgUwaYpR5kekKdW9rCOm3hA8HX52VvXOQvZ 1AsugxBcP2BPZ67KFqFf0ptiRyPjwhSujRfthwZsP8xgU3q7Kuv+x6sAZ1d+XvwZYWjs UMH7CDPJ5sZfmI7T07srqdz1psBNdFKuBX+tYKvVP6+xvoiKyz1d3ML/oW8Xo+od3i6c CQZSQ16x5SRJkknPoI+lsQsJ2TdTbuuyyV/mYg/Y3t9JmUKP0gXR2OtiLKfmW7OD1j8h 63fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=GPv/Z2/V5c2EddJBcY+s5skA8wAha23ZkdMZyaplFTM=; b=dV2jBYqaqyMqoESUti+Sq+XELyt5kBw84RXzXB78tXmWEYwWh5xt2NSSdFMnkSb8rL wqP4dHAtK2cu5ff686cT0OFpsC1dlrH4VWonZTfgIZl7M+6h596a5akjUcbhv7pTvv+K +LxlPza91BlalUfnepOlDM9UV2wq589na1T9J8DJfNb003xBT1oLWEI8Xv4pLSD9DYdz Xok0YqJrYS0ihUgbnNu057TIRIYZMEZF5KZ8X0tC84hVomRcXBtDu6YrsTGPSxxAPQxi 0PMkmIhXuQ1lJh5wGuLqLU3XTmBFBYe4DL2lft9FwLHwz50KifXqCpK1ynxeu2bYFz+P fonQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p72si1300888pfa.136.2018.02.06.08.39.53; Tue, 06 Feb 2018 08:40:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752702AbeBFQhn (ORCPT + 99 others); Tue, 6 Feb 2018 11:37:43 -0500 Received: from hqemgate14.nvidia.com ([216.228.121.143]:2243 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752422AbeBFQel (ORCPT ); Tue, 6 Feb 2018 11:34:41 -0500 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com id ; Tue, 06 Feb 2018 08:34:47 -0800 Received: from HQMAIL108.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Tue, 06 Feb 2018 08:34:40 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Tue, 06 Feb 2018 08:34:40 -0800 Received: from UKMAIL101.nvidia.com (10.26.138.13) by HQMAIL108.nvidia.com (172.18.146.13) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Tue, 6 Feb 2018 16:34:40 +0000 Received: from tbergstrom-lnx.Nvidia.com (10.21.24.170) by UKMAIL101.nvidia.com (10.26.138.13) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Tue, 6 Feb 2018 16:34:35 +0000 Received: from tbergstrom-lnx.nvidia.com (localhost [127.0.0.1]) by tbergstrom-lnx.Nvidia.com (Postfix) with ESMTP id 69EC2F80FBE; Tue, 6 Feb 2018 18:34:33 +0200 (EET) From: Peter De Schrijver To: , , , , , , , , , CC: Peter De Schrijver Subject: [PATCH v3 03/11] clk: tegra: dfll registration for multiple SoCs Date: Tue, 6 Feb 2018 18:34:04 +0200 Message-ID: <1517934852-23255-4-git-send-email-pdeschrijver@nvidia.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1517934852-23255-1-git-send-email-pdeschrijver@nvidia.com> References: <1517934852-23255-1-git-send-email-pdeschrijver@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.21.24.170] X-ClientProxiedBy: UKMAIL101.nvidia.com (10.26.138.13) To UKMAIL101.nvidia.com (10.26.138.13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In a future patch, support for the DFLL in Tegra210 will be introduced. This requires support for more than 1 set of CVB and CPU max frequency tables. Signed-off-by: Peter De Schrijver --- drivers/clk/tegra/clk-tegra124-dfll-fcpu.c | 37 ++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/drivers/clk/tegra/clk-tegra124-dfll-fcpu.c b/drivers/clk/tegra/clk-tegra124-dfll-fcpu.c index e2dbb79..6486ad9 100644 --- a/drivers/clk/tegra/clk-tegra124-dfll-fcpu.c +++ b/drivers/clk/tegra/clk-tegra124-dfll-fcpu.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -29,8 +30,15 @@ #include "clk-dfll.h" #include "cvb.h" +struct dfll_fcpu_data { + const unsigned long *cpu_max_freq_table; + unsigned int cpu_max_freq_table_size; + const struct cvb_table *cpu_cvb_tables; + unsigned int cpu_cvb_tables_size; +}; + /* Maximum CPU frequency, indexed by CPU speedo id */ -static const unsigned long cpu_max_freq_table[] = { +static const unsigned long tegra124_cpu_max_freq_table[] = { [0] = 2014500000UL, [1] = 2320500000UL, [2] = 2116500000UL, @@ -80,6 +88,21 @@ }, }; +static const struct dfll_fcpu_data tegra124_dfll_fcpu_data = { + .cpu_max_freq_table = tegra124_cpu_max_freq_table, + .cpu_max_freq_table_size = ARRAY_SIZE(tegra124_cpu_max_freq_table), + .cpu_cvb_tables = tegra124_cpu_cvb_tables, + .cpu_cvb_tables_size = ARRAY_SIZE(tegra124_cpu_cvb_tables) +}; + +static const struct of_device_id tegra124_dfll_fcpu_of_match[] = { + { + .compatible = "nvidia,tegra124-dfll", + .data = &tegra124_dfll_fcpu_data, + }, + { }, +}; + static int get_alignment_from_regulator(struct device *dev, struct rail_alignment *align) { @@ -112,12 +135,17 @@ static int tegra124_dfll_fcpu_probe(struct platform_device *pdev) { int process_id, speedo_id, speedo_value, err; struct tegra_dfll_soc_data *soc; + const struct of_device_id *of_id; + const struct dfll_fcpu_data *fcpu_data; + + of_id = of_match_device(tegra124_dfll_fcpu_of_match, &pdev->dev); + fcpu_data = of_id->data; process_id = tegra_sku_info.cpu_process_id; speedo_id = tegra_sku_info.cpu_speedo_id; speedo_value = tegra_sku_info.cpu_speedo_value; - if (speedo_id >= ARRAY_SIZE(cpu_max_freq_table)) { + if (speedo_id >= fcpu_data->cpu_max_freq_table_size) { dev_err(&pdev->dev, "unknown max CPU freq for speedo_id=%d\n", speedo_id); return -ENODEV; @@ -172,11 +200,6 @@ static int tegra124_dfll_fcpu_remove(struct platform_device *pdev) return 0; } -static const struct of_device_id tegra124_dfll_fcpu_of_match[] = { - { .compatible = "nvidia,tegra124-dfll", }, - { }, -}; - static const struct dev_pm_ops tegra124_dfll_pm_ops = { SET_RUNTIME_PM_OPS(tegra_dfll_runtime_suspend, tegra_dfll_runtime_resume, NULL) -- 1.9.1