linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/3] ARM: davinci: normalize clk API
       [not found] <20170721152250.3310552-1-arnd@arndb.de>
@ 2017-07-21 15:22 ` Arnd Bergmann
  2017-07-21 15:22 ` [PATCH v2 2/3] ARM: sa1100: " Arnd Bergmann
  2017-07-21 15:22 ` [PATCH v2 3/3] ARM: w90x900: " Arnd Bergmann
  2 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2017-07-21 15:22 UTC (permalink / raw)
  To: linux-arm-kernel, Sekhar Nori, Kevin Hilman, Russell King
  Cc: Arnd Bergmann, linux-clk, Stephen Boyd, Michael Turquette,
	Hartley Sweeten, Alexander Sverdlin, Eric Miao, Haojian Zhuang,
	Alexandre Bailon, Masahiro Yamada, Dmitry Eremin-Solenikov,
	linux-kernel

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.

Acked-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-davinci/clock.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c
index f5dce9b4e617..f77a4f766050 100644
--- a/arch/arm/mach-davinci/clock.c
+++ b/arch/arm/mach-davinci/clock.c
@@ -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))
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2 2/3] ARM: sa1100: normalize clk API
       [not found] <20170721152250.3310552-1-arnd@arndb.de>
  2017-07-21 15:22 ` [PATCH v2 1/3] ARM: davinci: normalize clk API Arnd Bergmann
@ 2017-07-21 15:22 ` Arnd Bergmann
  2017-07-21 15:22 ` [PATCH v2 3/3] ARM: w90x900: " Arnd Bergmann
  2 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2017-07-21 15:22 UTC (permalink / raw)
  To: linux-arm-kernel, Dmitry Eremin-Solenikov
  Cc: Arnd Bergmann, linux-clk, Stephen Boyd, Michael Turquette,
	Sekhar Nori, Kevin Hilman, Hartley Sweeten, Alexander Sverdlin,
	Eric Miao, Haojian Zhuang, Russell King, Alexandre Bailon,
	Masahiro Yamada, linux-kernel

sa1100 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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-sa1100/clock.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/arch/arm/mach-sa1100/clock.c b/arch/arm/mach-sa1100/clock.c
index 0db46895c82a..7d52cd97d96e 100644
--- a/arch/arm/mach-sa1100/clock.c
+++ b/arch/arm/mach-sa1100/clock.c
@@ -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)
 {
 	/*
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2 3/3] ARM: w90x900: normalize clk API
       [not found] <20170721152250.3310552-1-arnd@arndb.de>
  2017-07-21 15:22 ` [PATCH v2 1/3] ARM: davinci: normalize clk API Arnd Bergmann
  2017-07-21 15:22 ` [PATCH v2 2/3] ARM: sa1100: " Arnd Bergmann
@ 2017-07-21 15:22 ` Arnd Bergmann
  2 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2017-07-21 15:22 UTC (permalink / raw)
  To: linux-arm-kernel, Wan ZongShun
  Cc: Arnd Bergmann, linux-clk, Stephen Boyd, Michael Turquette,
	Sekhar Nori, Kevin Hilman, Hartley Sweeten, Alexander Sverdlin,
	Eric Miao, Haojian Zhuang, Russell King, Alexandre Bailon,
	Masahiro Yamada, Dmitry Eremin-Solenikov, linux-kernel

w90x900 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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-w90x900/clock.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/arch/arm/mach-w90x900/clock.c b/arch/arm/mach-w90x900/clock.c
index ac6fd1a2cb59..3f93fac98d97 100644
--- a/arch/arm/mach-w90x900/clock.c
+++ b/arch/arm/mach-w90x900/clock.c
@@ -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);
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-07-21 15:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20170721152250.3310552-1-arnd@arndb.de>
2017-07-21 15:22 ` [PATCH v2 1/3] ARM: davinci: normalize clk API Arnd Bergmann
2017-07-21 15:22 ` [PATCH v2 2/3] ARM: sa1100: " Arnd Bergmann
2017-07-21 15:22 ` [PATCH v2 3/3] ARM: w90x900: " Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).