Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754641AbcK1KRs (ORCPT ); Mon, 28 Nov 2016 05:17:48 -0500 Received: from mout.kundenserver.de ([212.227.17.10]:56095 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932223AbcK1KRY (ORCPT ); Mon, 28 Nov 2016 05:17:24 -0500 From: Arnd Bergmann To: Markus Mayer Cc: Viresh Kumar , "Rafael J . Wysocki" , Power Management List , Broadcom Kernel List , Linux Kernel Mailing List , Markus Mayer , linux-clk@vger.kernel.org, Device Tree , linux-arm-kernel@lists.infradead.org Subject: fwd, Re: [PATCH v3] cpufreq: brcmstb-cpufreq: CPUfreq driver for older Broadcom STB SoCs Date: Mon, 28 Nov 2016 11:16:48 +0100 Message-ID: <5336918.eLmd7pA3eN@wuerfel> User-Agent: KMail/5.1.3 (Linux/4.4.0-34-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: <20161122213245.17955-1-code@mmayer.net> References: <20161122213245.17955-1-code@mmayer.net> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:UFvtws4lE/E8aC7uYmrMZ8B3a0q6aXHR/Pq0KtRO9K0aNHWRp1I HcssFz22dGbdVicMAOLCm57fxcUtcX6KBH3jX9Gx14BoWE583noUt/rsfIzkfQ0NFzPoRfr Z3reitAG1PZY7s9pn7DHv30GWPwea0SrDQWuKLIfXR/LcXB81F8bp8easH1H3YpI77b0ZWG WpQdsHFi0a/pYXOcaViYQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:qm5lFVLYt3U=:goZEKT9TwsYxhbUenLwq4N SDFAMuzUW2ixndfvfxY/zU7eR6LSQbCmRAOFCtuK57zEoEYw9RHVVlRGX2FWmySBz10ANHfOJ 3oNtP7gbRyCpZIdgy8p7opBY7AcVXbOBV2d/uhzqQmEBVfcfK9TPmFEet5x7iNccpRzzQf7r1 T9uQxQZWImLFaaQ4Are8mw013dmN7jwzXAbYUFOLXlKp2lx+DFRy6TzPg8uLuqCI7ySUvxyf9 XrxXl+CY5waTxpgAX0wgB+ex5lFK/AdXQ+Cx3kfr589C4VQsASsfmLTq1MTfC6A020bWErhJI OlT2ZQDb1hiqyTA4qAlgViai/0ZEX4WPpAN7zA2V1tg4yolerIPW8nTdDbYqtV4zrtOn2jcdX fUGH451bZmahPT+aSxMWrkmLsD0c/Yb1iZQQVdYhC/XLf+4ysDivo87uKmCbQK1q/PNzOi2Gn kVf42mEQ7P6bEwkCBu9Wbhx0OGbR7J7EGRBmIby+SjHIJMv9+F+W3Tkto97JXlE/vztp7MZE4 Kc9hZrARc2BZrWy6seiGk4qKsznfMTJk9vG/KRBnuUD6PfRGkkVFHAAhJ3pJ4VEzzwmWNKlt8 IIHSobv5p1Jbg0ysUikYXiy0xHGPf4Y27+n86B4sWWHT09c64TTaK7CEC/XZgh3LBIAzZuqZx q0+Nd573yeJfLw0+rvjdzd9fNN38YXpzbEmScVClSH7uuSwrDq7KGXLeelmYAWAC+qMy5unsy gW/2QtfGJ6wJyrLi Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2931 Lines: 80 [resending my mail, this time with devicetree, linux-clk, and linux-arm-kernel on cc] On Tuesday, November 22, 2016 1:32:45 PM CET Markus Mayer wrote: > From: Markus Mayer > > This CPUfreq driver provides basic frequency scaling for older Broadcom > STB SoCs that do not use AVS firmware with DVFS support. There is no > support for voltage scaling. > > Signed-off-by: Markus Mayer > Acked-by: Viresh Kumar This causes multiple build errors in linux-next, please fix asap or drop the patch again. My feeling is that it's probably too late to fix it for v4.10, but that's up to Viresh and Rafael of course. > +#define BRCMSTB_CPUFREQ_PREFIX "brcmstb" > +#define BRCMSTB_CPUFREQ_NAME BRCMSTB_CPUFREQ_PREFIX "-cpufreq" > + > +/* We search for these compatible strings. */ > +#define BRCMSTB_DT_CPU_CLK_CTRL "brcm,brcmstb-cpu-clk-div" > +#define BRCMSTB_DT_MEMC_DDR "brcm,brcmstb-memc-ddr" > +#define BRCM_AVS_CPU_DATA "brcm,avs-cpu-data-mem" > + > +/* We also need a few clocks in device tree. These are node names. */ > +#define BRCMSTB_CLK_MDIV_CH0 "cpu_mdiv_ch0" > +#define BRCMSTB_CLK_NDIV_INT "cpu_ndiv_int" > +#define BRCMSTB_CLK_SW_SCB "sw_scb" Not critical but the use of those macros obfuscates the DT interfaces here and made it harder to analyse what was going on. Also, a couple of them are lacking a DT binding. > +static int get_frequencies(const struct cpufreq_policy *policy, > + unsigned int *vco_freq, unsigned int *cpu_freq, > + unsigned int *scb_freq) > +{ > + struct clk *cpu_ndiv_int, *sw_scb; > + > + cpu_ndiv_int = __clk_lookup(BRCMSTB_CLK_NDIV_INT); > + if (!cpu_ndiv_int) > + return -ENODEV; > + > + sw_scb = __clk_lookup(BRCMSTB_CLK_SW_SCB); > + if (!sw_scb) > + return -ENODEV; > + > + /* return frequencies in kHz */ > + *vco_freq = clk_get_rate(cpu_ndiv_int) / 1000; > + *cpu_freq = clk_get_rate(policy->clk) / 1000; > + *scb_freq = clk_get_rate(sw_scb) / 1000; > + > + return 0; > +} You really can't do this: ../drivers/cpufreq/brcmstb-cpufreq.c: In function 'get_frequencies': ../drivers/cpufreq/brcmstb-cpufreq.c:71:17: error: implicit declaration of function '__clk_lookup';did you mean 'key_lookup'? [-Werror=implicit-function-declaration] cpu_ndiv_int = __clk_lookup(BRCMSTB_CLK_NDIV_INT); ^~~~~~~~~~~~ __clk_lookup is an internal API for the clk providers. In particular, relying on undocumented internal names of the clk provider in a device driver is inappropriate. > +static const struct of_device_id brcmstb_cpufreq_match[] = { > + { .compatible = BRCMSTB_DT_CPU_CLK_CTRL }, > + { } > +}; > +MODULE_DEVICE_TABLE(platform, brcmstb_cpufreq_match); This is a simple typo, also causing the build to fail: FATAL: drivers/cpufreq/brcmstb-cpufreq: sizeof(struct platform_device_id)=24 is not a modulo of the size of section __mod_platform___device_table=392. Arnd