[04/11] ARM: sa1100: make cpufreq driver build standalone
Commit Message
From: Arnd Bergmann <arnd@arndb.de>
Commit 59a2e613d07f ("cpufreq: sa11x0: move cpufreq driver
to drivers/cpufreq") added an unnecessary reference to
mach/generic.h. Just remove it again after moving the code
into the corresponding driver.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/arm/mach-sa1100/generic.c | 32 ---------------------
arch/arm/mach-sa1100/generic.h | 4 ---
arch/arm/mach-sa1100/include/mach/generic.h | 1 -
drivers/cpufreq/sa1110-cpufreq.c | 32 +++++++++++++++++++++
4 files changed, 32 insertions(+), 37 deletions(-)
delete mode 100644 arch/arm/mach-sa1100/include/mach/generic.h
Comments
On 21-10-22, 17:49, Arnd Bergmann wrote:
> --- a/drivers/cpufreq/sa1110-cpufreq.c
> +++ b/drivers/cpufreq/sa1110-cpufreq.c
> @@ -29,6 +29,38 @@
>
> #undef DEBUG
>
> +#define NR_FREQS 16
> +
> +/*
> + * This table is setup for a 3.6864MHz Crystal.
> + */
> +static struct cpufreq_frequency_table sa11x0_freq_table[NR_FREQS+1] = {
> + { .frequency = 59000, /* 59.0 MHz */},
> + { .frequency = 73700, /* 73.7 MHz */},
> + { .frequency = 88500, /* 88.5 MHz */},
> + { .frequency = 103200, /* 103.2 MHz */},
> + { .frequency = 118000, /* 118.0 MHz */},
> + { .frequency = 132700, /* 132.7 MHz */},
> + { .frequency = 147500, /* 147.5 MHz */},
> + { .frequency = 162200, /* 162.2 MHz */},
> + { .frequency = 176900, /* 176.9 MHz */},
> + { .frequency = 191700, /* 191.7 MHz */},
> + { .frequency = 206400, /* 206.4 MHz */},
> + { .frequency = 221200, /* 221.2 MHz */},
> + { .frequency = 235900, /* 235.9 MHz */},
> + { .frequency = 250700, /* 250.7 MHz */},
> + { .frequency = 265400, /* 265.4 MHz */},
> + { .frequency = 280200, /* 280.2 MHz */},
> + { .frequency = CPUFREQ_TABLE_END, },
> +};
> +
> +static unsigned int sa11x0_getspeed(unsigned int cpu)
> +{
> + if (cpu)
> + return 0;
> + return sa11x0_freq_table[PPCR & 0xf].frequency;
> +}
> +
> struct sdram_params {
> const char name[20];
> u_char rows; /* bits */
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
On Fri, Oct 21, 2022 at 05:49:34PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> Commit 59a2e613d07f ("cpufreq: sa11x0: move cpufreq driver
> to drivers/cpufreq") added an unnecessary reference to
> mach/generic.h. Just remove it again after moving the code
> into the corresponding driver.
So how does arch/arm/mach-sa1100/clock.c get the MPLL rate with this
change?
On Tue, Oct 25, 2022, at 10:28, Russell King (Oracle) wrote:
> On Fri, Oct 21, 2022 at 05:49:34PM +0200, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>>
>> Commit 59a2e613d07f ("cpufreq: sa11x0: move cpufreq driver
>> to drivers/cpufreq") added an unnecessary reference to
>> mach/generic.h. Just remove it again after moving the code
>> into the corresponding driver.
>
> So how does arch/arm/mach-sa1100/clock.c get the MPLL rate with this
> change?
You are right, that's broken. It works for the defconfigs that
enable the cpufreq driver, but it seems I need to improve my
randconfig build testing to make sure I find problems like this
sooner.
I don't think anything depends on this patch, so I've dropped
it from my series now.
Thanks,
Arnd
On Tue, Oct 25, 2022 at 12:14:19PM +0200, Arnd Bergmann wrote:
> On Tue, Oct 25, 2022, at 10:28, Russell King (Oracle) wrote:
> > On Fri, Oct 21, 2022 at 05:49:34PM +0200, Arnd Bergmann wrote:
> >> From: Arnd Bergmann <arnd@arndb.de>
> >>
> >> Commit 59a2e613d07f ("cpufreq: sa11x0: move cpufreq driver
> >> to drivers/cpufreq") added an unnecessary reference to
> >> mach/generic.h. Just remove it again after moving the code
> >> into the corresponding driver.
> >
> > So how does arch/arm/mach-sa1100/clock.c get the MPLL rate with this
> > change?
>
> You are right, that's broken. It works for the defconfigs that
> enable the cpufreq driver,
Umm. How? I think your testing must be seriously flawed!
You add sa11x0_getspeed() to the sa1110 cpufreq driver as a static
function, which means it won't be visible to clock.c - and clock.c
is always built, and always references sa11x0_getspeed()... so you
should be getting an unconditional build failure at link time and
a compiler warning that sa11x0_getspeed() is not declared.
Are you not seeing that?
@@ -39,38 +39,6 @@
#include "generic.h"
#include <clocksource/pxa.h>
-#define NR_FREQS 16
-
-/*
- * This table is setup for a 3.6864MHz Crystal.
- */
-struct cpufreq_frequency_table sa11x0_freq_table[NR_FREQS+1] = {
- { .frequency = 59000, /* 59.0 MHz */},
- { .frequency = 73700, /* 73.7 MHz */},
- { .frequency = 88500, /* 88.5 MHz */},
- { .frequency = 103200, /* 103.2 MHz */},
- { .frequency = 118000, /* 118.0 MHz */},
- { .frequency = 132700, /* 132.7 MHz */},
- { .frequency = 147500, /* 147.5 MHz */},
- { .frequency = 162200, /* 162.2 MHz */},
- { .frequency = 176900, /* 176.9 MHz */},
- { .frequency = 191700, /* 191.7 MHz */},
- { .frequency = 206400, /* 206.4 MHz */},
- { .frequency = 221200, /* 221.2 MHz */},
- { .frequency = 235900, /* 235.9 MHz */},
- { .frequency = 250700, /* 250.7 MHz */},
- { .frequency = 265400, /* 265.4 MHz */},
- { .frequency = 280200, /* 280.2 MHz */},
- { .frequency = CPUFREQ_TABLE_END, },
-};
-
-unsigned int sa11x0_getspeed(unsigned int cpu)
-{
- if (cpu)
- return 0;
- return sa11x0_freq_table[PPCR & 0xf].frequency;
-}
-
/*
* Default power-off for SA1100
*/
@@ -4,7 +4,6 @@
*
* Author: Nicolas Pitre
*/
-#include <linux/cpufreq.h>
#include <linux/reboot.h>
extern void sa1100_timer_init(void);
@@ -21,9 +20,6 @@ extern void sa11x0_init_late(void);
extern void sa1110_mb_enable(void);
extern void sa1110_mb_disable(void);
-extern struct cpufreq_frequency_table sa11x0_freq_table[];
-extern unsigned int sa11x0_getspeed(unsigned int cpu);
-
struct flash_platform_data;
struct resource;
deleted file mode 100644
@@ -1 +0,0 @@
-#include "../../generic.h"
@@ -29,6 +29,38 @@
#undef DEBUG
+#define NR_FREQS 16
+
+/*
+ * This table is setup for a 3.6864MHz Crystal.
+ */
+static struct cpufreq_frequency_table sa11x0_freq_table[NR_FREQS+1] = {
+ { .frequency = 59000, /* 59.0 MHz */},
+ { .frequency = 73700, /* 73.7 MHz */},
+ { .frequency = 88500, /* 88.5 MHz */},
+ { .frequency = 103200, /* 103.2 MHz */},
+ { .frequency = 118000, /* 118.0 MHz */},
+ { .frequency = 132700, /* 132.7 MHz */},
+ { .frequency = 147500, /* 147.5 MHz */},
+ { .frequency = 162200, /* 162.2 MHz */},
+ { .frequency = 176900, /* 176.9 MHz */},
+ { .frequency = 191700, /* 191.7 MHz */},
+ { .frequency = 206400, /* 206.4 MHz */},
+ { .frequency = 221200, /* 221.2 MHz */},
+ { .frequency = 235900, /* 235.9 MHz */},
+ { .frequency = 250700, /* 250.7 MHz */},
+ { .frequency = 265400, /* 265.4 MHz */},
+ { .frequency = 280200, /* 280.2 MHz */},
+ { .frequency = CPUFREQ_TABLE_END, },
+};
+
+static unsigned int sa11x0_getspeed(unsigned int cpu)
+{
+ if (cpu)
+ return 0;
+ return sa11x0_freq_table[PPCR & 0xf].frequency;
+}
+
struct sdram_params {
const char name[20];
u_char rows; /* bits */