normalize clk API for older platforms
v2 cover normalize clk API for older platforms
Based on the earlier feedback so far, I have split out the patch per platform, improved the davinci implementation, dropped both ep93xx (which has a proper implementation coming) and mmp (which is dead code anyway), and decided to do the sa1100 implementation differnently (without warning).
Arnd
Arnd Bergmann (3):
ARM: davinci: normalize clk API
ARM: sa1100: normalize clk API
ARM: w90x900: normalize clk API
arch/arm/mach-davinci/clock.c | 9 +++++++++ arch/arm/mach-sa1100/clock.c | 25 +++++++++++++++++++++++++ arch/arm/mach-w90x900/clock.c | 29 +++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+)
Signature · 1 line
2.9.0
PATCH v2 1/3 ARM: davinci: normalize clk API
davinci still has its own clk implementation, but lacks a clk_get_parent() helper, which can lead to link errors in randconfig builds.
This adds the usual implementation.
--- arch/arm/mach-davinci/clock.c | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/arm/mach-davinci/clock.c +9 -0
@@ -218,6 +218,15 @@ int clk_set_parent(struct clk *clk, struct clk *parent) }EXPORT_SYMBOL (clk_set_parent); +struct clk *clk_get_parent (struct clk *clk) +{ +if (!clk) +return NULL ; + +return clk->parent; +} +EXPORT_SYMBOL (clk_get_parent); +int clk_register (struct clk *clk) {if (clk ==NULL ||IS_ERR (clk))
Signature · 1 line
2.9.0
PATCH v2 2/3 ARM: sa1100: normalize clk API
In reply to Arnd Bergmannsa1100 provides its own variant of the clk API rather than using the generic COMMON_CLK API. This generally works, but it causes some link errors with drivers using the clk_set_rate, clk_get_parent, clk_set_parent or clk_round_rate functions when a platform lacks those interfaces.
This adds trivial stub implementations for each of them, based on the behavior of the COMMON_CLK implementation:
- set_rate() and set_parent() report success without doing anything
- round_rate() returns the clk rate
- get_parent() returns NULL.
This adds the minimal bloat and should do the right thing for the simple clock hardware in this SoC.
--- arch/arm/mach-sa1100/clock.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
arch/arm/mach-sa1100/clock.c +25 -0
@@ -35,6 +35,31 @@ struct clk clk_##_name = { \static DEFINE_SPINLOCK (clocks_lock); +/* Dummy clk routine to build generic kernel parts that may be using them */ +long clk_round_rate (struct clk *clk,unsigned long rate) +{ +return clk_get_rate (clk); +} +EXPORT_SYMBOL (clk_round_rate); + +int clk_set_rate (struct clk *clk,unsigned long rate) +{ +return 0 ; +} +EXPORT_SYMBOL (clk_set_rate); + +int clk_set_parent (struct clk *clk,struct clk *parent) +{ +return 0 ; +} +EXPORT_SYMBOL (clk_set_parent); + +struct clk *clk_get_parent (struct clk *clk) +{ +return NULL ; +} +EXPORT_SYMBOL (clk_get_parent); +static void clk_gpio27_enable (struct clk *clk) {/*
Signature · 1 line
2.9.0
PATCH v2 3/3 ARM: w90x900: normalize clk API
In reply to Arnd Bergmannw90x900 still provides its own variant of the clk API rather than using the generic COMMON_CLK API. This generally works, but it causes some link errors with drivers using the clk_set_rate, clk_get_parent, clk_set_parent or clk_round_rate functions when a platform lacks those interfaces.
This adds empty stub implementations for each of them, and I don't even try to do something useful here but instead just print a WARN() message to make it obvious what is going on if they ever end up being called.
The drivers that call these won't be used on these platforms (otherwise we'd get a link error today), so the added code is harmless bloat and will warn about accidental use.
A while ago there was a proposal to change w90x900 to use the common-clk implementation, which would be the way it should be handled properly.
--- arch/arm/mach-w90x900/clock.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
arch/arm/mach-w90x900/clock.c +29 -0
@@ -93,3 +93,32 @@ void nuc900_subclk_enable(struct clk *clk, int enable)__raw_writel (clken,W90X900_VA_CLKPWR +SUBCLK ); } + +/* dummy functions, should not be called */ +long clk_round_rate (struct clk *clk,unsigned long rate) +{ +WARN_ON (clk); +return 0 ; +} +EXPORT_SYMBOL (clk_round_rate); + +int clk_set_rate (struct clk *clk,unsigned long rate) +{ +WARN_ON (clk); +return 0 ; +} +EXPORT_SYMBOL (clk_set_rate); + +int clk_set_parent (struct clk *clk,struct clk *parent) +{ +WARN_ON (clk); +return 0 ; +} +EXPORT_SYMBOL (clk_set_parent); + +struct clk *clk_get_parent (struct clk *clk) +{ +WARN_ON (clk); +return NULL ; +} +EXPORT_SYMBOL (clk_get_parent);
Signature · 1 line
2.9.0