Re: [PATCH 31/36] ARM: s3c: cpufreq: use global s3c2412_cpufreq_setrefresh

From: Krzysztof Kozlowski
Date: Wed Oct 23 2019 - 09:44:30 EST


On Thu, Oct 10, 2019 at 10:30:15PM +0200, Arnd Bergmann wrote:
> There are two identical copies of the s3c2412_cpufreq_setrefresh
> function: a static one in the cpufreq driver and a global
> version in iotiming-s3c2412.c.
>
> As the function requires the use of a hardcoded register address
> from a header that we want to not be visible to drivers, just
> move the existing global function and add a declaration in
> one of the cpufreq header files.
>
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
> ---
> drivers/cpufreq/s3c2412-cpufreq.c | 23 --------------------
> include/linux/soc/samsung/s3c-cpufreq-core.h | 1 +
> 2 files changed, 1 insertion(+), 23 deletions(-)
>
> diff --git a/drivers/cpufreq/s3c2412-cpufreq.c b/drivers/cpufreq/s3c2412-cpufreq.c
> index 38dc9e6db633..a77c63e92e1a 100644
> --- a/drivers/cpufreq/s3c2412-cpufreq.c
> +++ b/drivers/cpufreq/s3c2412-cpufreq.c
> @@ -25,8 +25,6 @@
> #include <asm/mach/arch.h>
> #include <asm/mach/map.h>
>
> -#include <mach/s3c2412.h>
> -
> #include <mach/map.h>
>
> #define S3C2410_CLKREG(x) ((x) + S3C24XX_VA_CLKPWR)
> @@ -156,27 +154,6 @@ static void s3c2412_cpufreq_setdivs(struct s3c_cpufreq_config *cfg)
> clk_set_parent(armclk, cfg->divs.dvs ? hclk : fclk);
> }
>
> -static void s3c2412_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg)
> -{
> - struct s3c_cpufreq_board *board = cfg->board;
> - unsigned long refresh;
> -
> - s3c_freq_dbg("%s: refresh %u ns, hclk %lu\n", __func__,
> - board->refresh, cfg->freq.hclk);
> -
> - /* Reduce both the refresh time (in ns) and the frequency (in MHz)
> - * by 10 each to ensure that we do not overflow 32 bit numbers. This
> - * should work for HCLK up to 133MHz and refresh period up to 30usec.
> - */
> -
> - refresh = (board->refresh / 10);
> - refresh *= (cfg->freq.hclk / 100);
> - refresh /= (1 * 1000 * 1000); /* 10^6 */
> -
> - s3c_freq_dbg("%s: setting refresh 0x%08lx\n", __func__, refresh);
> - __raw_writel(refresh, S3C2412_REFRESH);
> -}
> -
> /* set the default cpu frequency information, based on an 200MHz part
> * as we have no other way of detecting the speed rating in software.
> */
> diff --git a/include/linux/soc/samsung/s3c-cpufreq-core.h b/include/linux/soc/samsung/s3c-cpufreq-core.h
> index 4d22be1031b9..eca942559014 100644
> --- a/include/linux/soc/samsung/s3c-cpufreq-core.h
> +++ b/include/linux/soc/samsung/s3c-cpufreq-core.h
> @@ -246,6 +246,7 @@ extern int s3c2412_iotiming_calc(struct s3c_cpufreq_config *cfg,
>
> extern void s3c2412_iotiming_set(struct s3c_cpufreq_config *cfg,
> struct s3c_iotimings *iot);
> +extern void s3c2412_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg);

I think that it does not cover the !CONFIG_S3C2412_IOTIMING case.
Either you need to provide also the empty stub or add default=y to
S3C2412_IOTIMING. Otherwise cpufreq driver might end up without this.

Best regards,
Krzysztof