From patchwork Thu Feb 9 02:33:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tang yuantian X-Patchwork-Id: 9563927 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 60B1C601C3 for ; Thu, 9 Feb 2017 02:47:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 994C92850E for ; Thu, 9 Feb 2017 02:47:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8C42428512; Thu, 9 Feb 2017 02:47:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAD_ENC_HEADER,BAYES_00 autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DB7302850E for ; Thu, 9 Feb 2017 02:47:30 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cbelb-0007KB-Tc; Thu, 09 Feb 2017 02:47:27 +0000 Received: from mail-by2nam01on0069.outbound.protection.outlook.com ([104.47.34.69] helo=NAM01-BY2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cbelL-000758-PT for linux-arm-kernel@lists.infradead.org; Thu, 09 Feb 2017 02:47:14 +0000 Received: from BLUPR0301CA0023.namprd03.prod.outlook.com (10.162.113.161) by BN1PR0301MB0721.namprd03.prod.outlook.com (10.160.78.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.874.12; Thu, 9 Feb 2017 02:46:49 +0000 Received: from BN1BFFO11FD018.protection.gbl (2a01:111:f400:7c10::1:109) by BLUPR0301CA0023.outlook.office365.com (2a01:111:e400:5259::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.16 via Frontend Transport; Thu, 9 Feb 2017 02:46:49 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none; nxp.com; dmarc=fail action=none header.from=nxp.com; nxp.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD018.mail.protection.outlook.com (10.58.144.81) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.888.7 via Frontend Transport; Thu, 9 Feb 2017 02:46:44 +0000 Received: from titan.ap.freescale.net ([10.192.208.233]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v192kYpO012130; Wed, 8 Feb 2017 19:46:41 -0700 From: To: Subject: [PATCH 2/2 v3] cpufreq: qoriq: Don't look at clock implementation details Date: Thu, 9 Feb 2017 10:33:02 +0800 Message-ID: <1486607582-18367-2-git-send-email-yuantian.tang@nxp.com> X-Mailer: git-send-email 2.1.0.27.g96db324 In-Reply-To: <1486607582-18367-1-git-send-email-yuantian.tang@nxp.com> References: <1486607582-18367-1-git-send-email-yuantian.tang@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131310820095993451; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(336005)(39450400003)(39840400002)(39400400002)(39410400002)(39860400002)(39850400002)(39380400002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(86152003)(77096006)(105606002)(2950100002)(33646002)(305945005)(106466001)(38730400002)(110136004)(8656002)(2351001)(6666003)(86362001)(5003940100001)(356003)(8676002)(6916009)(36756003)(85426001)(81166006)(81156014)(189998001)(47776003)(76176999)(50986999)(104016004)(53936002)(92566002)(2906002)(8936002)(5660300001)(68736007)(626004)(48376002)(50226002)(54906002)(4326007)(97736004)(2876002)(50466002)(21314002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR0301MB0721; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD018; 1:Zygwg/NeMHHXyoUxoOjC/k0Nc5k8oh2b8vcvEGhOE1Fz2xxmW+qwz+rn5+XrWbVYNysfI1qvP1n5oSeMitG2k9XYJNXp9ObkfeJTmaZGhw6iPjPh5cVEwuIl1axfVfRseRiKNm2KRHl2wUY7u9wcBpNSxGNNpHBFXAP0hpX5BtYdWm1gTvCDfeVSpP6NjRuoIY/NppOaOhW5l1RlNYPkN+ATbFWtQvE5OcweJEZ89Xqxb52tulUso8SuV3jlk9pI9oE2yxwKdgnlNx4mxEHWc37p8eIGm6wzb533oRaHV45B9b1eWzZ5Kcr1X7+n+WZRSjM4RN2pfkZoIPYEU+meofbcVbbNIAHcDk6ckVrhRXsej5a+aTDTlUQf297VwwRApegZCBvWWwUEE95Mujc9JNUnAg5faxim2AJkwC4JWiBRtAvjo4HC3or7bMlo3EeX0UPj3ImuoaTJYLVzLndkjnIHbaFONNvXgRqf2erMdCOqkHlu9bhclsHmvoIZV1Je1Hmgitt0IrAdQFumkZeC5DbMFmgNgo3ecgkth5Milgc1YqLVtHQxocIs5fWS7Qc0/ixg6a7uicOKwziNM4bkISx7YbiP4M+LVd/NVr4lRYNOWqdZW8BTb55s6MftFkUWMAe0fCm6EjIpd7GwxjbLUFS6+adD1G/Sx/Zjk/UU95e8jCt0h6o9mIGCCWxlBJIfT8qSuQJZmPGHMPDCArROFndZUsUiyTgNlmmVlT4fnRDruRxhIAaGNTmKTihQ2al9dylDw8JXF3IGQmCDptnFPQ== MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 204f7e3d-4679-4839-450a-08d45095e571 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BN1PR0301MB0721; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0721; 3:IJQ6LLl+yhmHmWNl20yH9j0688QzgMuhQY6dyF2soirK2URJi3iY9C3FZPce/yzpjYHpzHtiT6npwyuaB+rfUKETVgdzNunNqIqru1u/YGpMkhZmc8+bsXxuzZ/Oex/EQJwnzp1gRBp82/PD3o1e19yz3RaSmGZQ4Xg7Q9JrEG+UVWizWdC0Ok2lE43oEKPFILIsh8V/vf3WG7UortH3KzrNI/7PRxbYJneKeeyMTDffVSdUXSCIftp5Zrszh+82TfeCgenzceHMd3V4KBv8+vCkEL1CzZjsJ6HdV91HtzW/cZhaRmdo1bpXdQvVYFatRW9nN513xY/hNrv66z6o3WuRgyhbhikhYmtk+FZXub3MT6mY3SCA4/jHYeCrrts2; 25:DQqiXnMqkSGW3r9J8/YGlmICgxyL/Sao6ujb/kOwXaZiTSwfPkje2w1aKaGuAKNe0LVReW8kVNlanMy0wKZPeuIQ+6hNmfUc9ZXc2hgZU7h7iqr5bMs4z1PdJtMPEIPpcKLbaAjJQC9hMOkhnnfktQ79BjkjQvHHGPFjhmmqSlrWql2gwh1l9nx/0h1AX3xnEB65tulTU2+TF6vjARNQmbS5Ucf/6B1P5dPa82lPvTsDAMoRtZbgdkdQXWAZVvTkKc2bopT1o5w99w1PIUU1vGZKtd22JyLskEfrXLiSlr0/ZcbQzV2pnaRpgJ8wd+wpx2u1cn+bBsKOn5+aZWvXgzrMWwbW1Zz8v+zglotgz02kwQT4haz0Pv5jZA6ZZ3A2E/cUsDwHnrUdk7fICdUben62GHk0W0ytNWhe9yYzhSYsu4Fvp50dRjX95kK6sUvnpmrP1yptwbwUOp8+w5IGRA== X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0721; 31:UYvLMeD/tUA05kyFVL43mJzUP4iPk/HVImq79MU5iOSWE7pGYcvQu/0/5iwq6HOXbKtle3Wx5+r0s+4BDBhLMCtTqRRL7Mz0MCjwvhmLlO2gBCGerwFOD8XWT8gmJsetFO7tJf4Go87vG9NvOK+HpcLJb7GnWz5vxU/a8u8Ex1AU6e7H34t0jMtxsC+lvV/fH13GF6ooOunmtB9+xcgZMk3nE/5caANr1RaTryzouwVghxUwXqQzI39nnOwn8JUGwwlTdRdHPJ1mHw1qDKstqQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(8121501046)(13024025)(20170203043)(13023025)(5005006)(13015025)(13018025)(13017025)(2017020702029)(3002001)(10201501046)(6055026)(6096035)(20161123559025)(20161123561025)(20161123565025)(20161123563025)(20161123556025); SRVR:BN1PR0301MB0721; BCL:0; PCL:0; RULEID:(400006); SRVR:BN1PR0301MB0721; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0721; 4:p0LJ/EOgIZeyS8yoVZG01mQbg9eD6LSbj9lxN/f8uOQNiFRQEe56U8AnAEHXmeOfhfm9pPSHHnXW6B01/ppXHHzWLvuz9peCw+cJxBCt2Il0CdHG1mFjJ00BIchDqVcZchdXOZvyxWINJQOyZ7WzNzxrd0HajlncFROUiOjI/gltBHlG80UV5quZcq6Ml54GztI9cjLm0KcR7JkB0RkEUQCUGrOhWGB51waKkALwmw79GaevsLzgZwkjYvUsHythN0CcZo6W6zzGovGQhrNo4f+EEugOdHkv3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EZETdyFWsZG18EHjuHsJhI?= =?us-ascii?Q?cvHEsaAQplN3FYDNewC7xvAK+JQXw/TYfWLSSt5hiaaL7jnwzzkGWVM+mD0X?= =?us-ascii?Q?I7kpP/O30fH1IBXOldZrRvjG5Dng=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0721; 6:W27VfMNqA4bzMX5ak6JD+pDh5AFW3L4Y9AUOqUN3u9jSFc06Trssc3z7BqTvnEB6tv1tkA14D7S852Y3LLajR2tT4i42mZJmOZWaitfZ/i6ZW2V1U/Si+I4i71kAvKcMvdQZ3tK68U8mFlJRIChm2JZpmTeK6KSFTkJdJkxABRS06wbzGx4dyXmcsdlnuXoDWFs1eDGn3sK76/A57zshzPW2SlgjMczjmEmyEaLD2sHFVfl6Sc+ghs7EciNo0g6W7xadDiAXBR0PrluWue8jyLqXRSv4wqrVOXyvYdy8XSKFM9cevUOcOL48373aS9HO0VB31KOHOXgYvNTvEnKkKFe+ln8rY0oHjizERmPOZbozTVuakuorfkt4lo9Dixld+CAgJx3tHJhiOpkAqr/Luu3x/GK9nWexUs16s7oW80+C6FZkXdGMQf/m1PnHt/P4; 5:px+Qi6a1QlT6K9nrHRumQb+8cRj/FW0/10SipquYnVQqupAdc24DDeBCjRvP5dPuOVraWzmu0+tC2fm80+5+ruW9oyFhx4zstLgWsKRDpvN9J1vYunHUiWOl5EmmsRpEtM/a+hVs8L9xF1jj8T4FlYLn+DiRhWmbKTKxduZ2AJJ1Diyok2inSFHj0XjgkmQj; 24:drR6H6sFirzaYt8evd3fH4/sOBWiG+InhZCCkKkxED1+ybKAEGFlyVVEle4mWESW1FH9mroJSF0AK/7L2gDIswx33yWobiG3c3r3pVqLJoE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0721; 7:a+ttM3tBTzPezZEZk7jJGFMPhvSZKwW2dfu/qe3ngukFn4hOjsb6wlIEg/eYPcDvFSoRzd+Wbpf7n9WHs81VF5lGiAmtNbLZ0KCia0ktV/sKS4npIRKgJ6Z+jXOURiQVJSZIFoJ9CpQqt8VbtjegLOJBuwK5MXFSw/f+Q+bN08JaVrQqcS31IT9hx1c3vOikiBI4f0u9jfGkepr2MChod2dEhoDQTxkJhEAC1ylw8H9HabQx1lbfXD5bNcGm36AHzlJfr13vE3i3oQNui+T4UvsrpAaPE8fEw7VTDtyc90GOlGZG/Wtib5NL06rQDHffFKkXRNg9fIl01zbunIjPoSkn2RfPT3a1TuqwjSIxKTjyDg4EHOuy1n+SJ1il8QdXmjJIP/kU0oDGhx4BDcQZad7+64O8NVBZPGclAJPaBo+D9ukckAaEDvNftSmhhPcniQAgIKl0mo7zTsaPCq5ydeJNGTFvWfK2TDIRGf3Pr5BPFDVCSgPefSSr8yK8kRIYmcBepXPSsW99qWAVI2F2K7dCE6pZ5fyvHBFnrXB61eLPDR70wnWmAWKnv4gZwIH4 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2017 02:46:44.3733 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1PR0301MB0721 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170208_184711_908910_590D8155 X-CRM114-Status: GOOD ( 26.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pm@vger.kernel.org, viresh.kumar@linaro.org, linux-kernel@vger.kernel.org, leoyang.li@nxp.com, Scott Wood , Tang Yuantian , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tang Yuantian Get the CPU clock's potential parent clocks from the clock interface itself, rather than manually parsing the clocks property to find a phandle, looking at the clock-names property of that, and assuming that those are valid parent clocks for the cpu clock. This is necessary now that the clocks are generated based on the clock driver's knowledge of the chip rather than a fragile device-tree description of the mux options. We can now rely on the clock driver to ensure that the mux only exposes options that are valid. The cpufreq driver was currently being overly conservative in some cases -- for example, the "min_cpufreq = get_bus_freq()" restriction only applies to chips with erratum A-004510, and whether the freq_mask used on p5020 is needed depends on the actual frequencies of the PLLs (FWIW, p5040 has a similar limitation but its .freq_mask was zero) -- and the frequency mask mechanism made assumptions about particular parent clock indices that are no longer valid. Signed-off-by: Scott Wood Signed-off-by: Tang Yuantian Acked-by: Viresh Kumar --- v2: - added more soc compatible strings v3: - Remove the now-unused pnode and the call to of_node_put() drivers/cpufreq/qoriq-cpufreq.c | 148 +++++++++++++--------------------------- 1 file changed, 49 insertions(+), 99 deletions(-) diff --git a/drivers/cpufreq/qoriq-cpufreq.c b/drivers/cpufreq/qoriq-cpufreq.c index 53d8c3f..a6fefac 100644 --- a/drivers/cpufreq/qoriq-cpufreq.c +++ b/drivers/cpufreq/qoriq-cpufreq.c @@ -11,6 +11,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include +#include #include #include #include @@ -37,53 +38,20 @@ struct cpu_data { struct thermal_cooling_device *cdev; }; +/* + * Don't use cpufreq on this SoC -- used when the SoC would have otherwise + * matched a more generic compatible. + */ +#define SOC_BLACKLIST 1 + /** * struct soc_data - SoC specific data - * @freq_mask: mask the disallowed frequencies - * @flag: unique flags + * @flags: SOC_xxx */ struct soc_data { - u32 freq_mask[4]; - u32 flag; -}; - -#define FREQ_MASK 1 -/* see hardware specification for the allowed frqeuencies */ -static const struct soc_data sdata[] = { - { /* used by p2041 and p3041 */ - .freq_mask = {0x8, 0x8, 0x2, 0x2}, - .flag = FREQ_MASK, - }, - { /* used by p5020 */ - .freq_mask = {0x8, 0x2}, - .flag = FREQ_MASK, - }, - { /* used by p4080, p5040 */ - .freq_mask = {0}, - .flag = 0, - }, + u32 flags; }; -/* - * the minimum allowed core frequency, in Hz - * for chassis v1.0, >= platform frequency - * for chassis v2.0, >= platform frequency / 2 - */ -static u32 min_cpufreq; -static const u32 *fmask; - -#if defined(CONFIG_ARM) -static int get_cpu_physical_id(int cpu) -{ - return topology_core_id(cpu); -} -#else -static int get_cpu_physical_id(int cpu) -{ - return get_hard_smp_processor_id(cpu); -} -#endif - static u32 get_bus_freq(void) { struct device_node *soc; @@ -101,9 +69,10 @@ static u32 get_bus_freq(void) return sysfreq; } -static struct device_node *cpu_to_clk_node(int cpu) +static struct clk *cpu_to_clk(int cpu) { - struct device_node *np, *clk_np; + struct device_node *np; + struct clk *clk; if (!cpu_present(cpu)) return NULL; @@ -112,37 +81,28 @@ static struct device_node *cpu_to_clk_node(int cpu) if (!np) return NULL; - clk_np = of_parse_phandle(np, "clocks", 0); - if (!clk_np) - return NULL; - + clk = of_clk_get(np, 0); of_node_put(np); - - return clk_np; + return clk; } /* traverse cpu nodes to get cpu mask of sharing clock wire */ static void set_affected_cpus(struct cpufreq_policy *policy) { - struct device_node *np, *clk_np; struct cpumask *dstp = policy->cpus; + struct clk *clk; int i; - np = cpu_to_clk_node(policy->cpu); - if (!np) - return; - for_each_present_cpu(i) { - clk_np = cpu_to_clk_node(i); - if (!clk_np) + clk = cpu_to_clk(i); + if (IS_ERR(clk)) { + pr_err("%s: no clock for cpu %d\n", __func__, i); continue; + } - if (clk_np == np) + if (clk_is_match(policy->clk, clk)) cpumask_set_cpu(i, dstp); - - of_node_put(clk_np); } - of_node_put(np); } /* reduce the duplicated frequencies in frequency table */ @@ -198,10 +158,11 @@ static void freq_table_sort(struct cpufreq_frequency_table *freq_table, static int qoriq_cpufreq_cpu_init(struct cpufreq_policy *policy) { - struct device_node *np, *pnode; + struct device_node *np; int i, count, ret; - u32 freq, mask; + u32 freq; struct clk *clk; + const struct clk_hw *hwclk; struct cpufreq_frequency_table *table; struct cpu_data *data; unsigned int cpu = policy->cpu; @@ -221,17 +182,13 @@ static int qoriq_cpufreq_cpu_init(struct cpufreq_policy *policy) goto err_nomem2; } - pnode = of_parse_phandle(np, "clocks", 0); - if (!pnode) { - pr_err("%s: could not get clock information\n", __func__); - goto err_nomem2; - } + hwclk = __clk_get_hw(policy->clk); + count = clk_hw_get_num_parents(hwclk); - count = of_property_count_strings(pnode, "clock-names"); data->pclk = kcalloc(count, sizeof(struct clk *), GFP_KERNEL); if (!data->pclk) { pr_err("%s: no memory\n", __func__); - goto err_node; + goto err_nomem2; } table = kcalloc(count + 1, sizeof(*table), GFP_KERNEL); @@ -240,23 +197,11 @@ static int qoriq_cpufreq_cpu_init(struct cpufreq_policy *policy) goto err_pclk; } - if (fmask) - mask = fmask[get_cpu_physical_id(cpu)]; - else - mask = 0x0; - for (i = 0; i < count; i++) { - clk = of_clk_get(pnode, i); + clk = clk_hw_get_parent_by_index(hwclk, i)->clk; data->pclk[i] = clk; freq = clk_get_rate(clk); - /* - * the clock is valid if its frequency is not masked - * and large than minimum allowed frequency. - */ - if (freq < min_cpufreq || (mask & (1 << i))) - table[i].frequency = CPUFREQ_ENTRY_INVALID; - else - table[i].frequency = freq / 1000; + table[i].frequency = freq / 1000; table[i].driver_data = i; } freq_table_redup(table, count); @@ -282,7 +227,6 @@ static int qoriq_cpufreq_cpu_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency = u64temp + 1; of_node_put(np); - of_node_put(pnode); return 0; @@ -290,10 +234,7 @@ static int qoriq_cpufreq_cpu_init(struct cpufreq_policy *policy) kfree(table); err_pclk: kfree(data->pclk); -err_node: - of_node_put(pnode); err_nomem2: - policy->driver_data = NULL; kfree(data); err_np: of_node_put(np); @@ -357,12 +298,25 @@ static struct cpufreq_driver qoriq_cpufreq_driver = { .attr = cpufreq_generic_attr, }; +static const struct soc_data blacklist = { + .flags = SOC_BLACKLIST, +}; + static const struct of_device_id node_matches[] __initconst = { - { .compatible = "fsl,p2041-clockgen", .data = &sdata[0], }, - { .compatible = "fsl,p3041-clockgen", .data = &sdata[0], }, - { .compatible = "fsl,p5020-clockgen", .data = &sdata[1], }, - { .compatible = "fsl,p4080-clockgen", .data = &sdata[2], }, - { .compatible = "fsl,p5040-clockgen", .data = &sdata[2], }, + /* e6500 cannot use cpufreq due to erratum A-008083 */ + { .compatible = "fsl,b4420-clockgen", &blacklist }, + { .compatible = "fsl,b4860-clockgen", &blacklist }, + { .compatible = "fsl,t2080-clockgen", &blacklist }, + { .compatible = "fsl,t4240-clockgen", &blacklist }, + + { .compatible = "fsl,ls1012a-clockgen", }, + { .compatible = "fsl,ls1021a-clockgen", }, + { .compatible = "fsl,ls1043a-clockgen", }, + { .compatible = "fsl,ls1046a-clockgen", }, + { .compatible = "fsl,ls1088a-clockgen", }, + { .compatible = "fsl,ls2080a-clockgen", }, + { .compatible = "fsl,p4080-clockgen", }, + { .compatible = "fsl,qoriq-clockgen-1.0", }, { .compatible = "fsl,qoriq-clockgen-2.0", }, {} }; @@ -380,16 +334,12 @@ static int __init qoriq_cpufreq_init(void) match = of_match_node(node_matches, np); data = match->data; - if (data) { - if (data->flag) - fmask = data->freq_mask; - min_cpufreq = get_bus_freq(); - } else { - min_cpufreq = get_bus_freq() / 2; - } of_node_put(np); + if (data && data->flags & SOC_BLACKLIST) + return -ENODEV; + ret = cpufreq_register_driver(&qoriq_cpufreq_driver); if (!ret) pr_info("Freescale QorIQ CPU frequency scaling driver\n");