* [PATCH v2 0/2] MIPS: TXx9: Common Clock Framework Conversion
@ 2016-09-11 8:59 Geert Uytterhoeven
2016-09-11 8:59 ` [PATCH v2 1/2] watchdog: txx9wdt: Add missing clock (un)prepare calls for CCF Geert Uytterhoeven
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2016-09-11 8:59 UTC (permalink / raw)
To: Ralf Baechle, Atsushi Nemoto, Wim Van Sebroeck
Cc: Guenter Roeck, linux-clk, linux-mips, linux-watchdog,
Geert Uytterhoeven
Hi Ralf, Nemoto-san, Wim,
This patch series converts the Toshiba TXx9 platforms from their own
custom minimal clock implementation to the Common Clock Framework.
- Patch 1 adds missing clock (un)prepare calls to the TXx9 watchdog
driver,
- Patch 2 replaces the custom clock implementation by a CCF-based one,
providing a minimal set of clocks.
This has been tested with the watchdog on RBTX4927.
Changes since v1:
- Dropped "spi: spi-txx9: Add missing clock (un)prepare calls for
CCF", which has been accepted in spi/for-next,
- Protect the TX4938_REV_PCODE() check by #ifdef CONFIG_CPU_TX49XX,
- Use new clk_hw-centric clock registration API,
- Add Reviewed-by.
Dependencies:
- Patch 1 can be applied independently,
- Patch 2 depends on patch 1 and on "spi: spi-txx9: Add missing clock
(un)prepare calls for CCF" in spi/for-next,
- The error path in patch 2 depends on "clkdev: Detect errors in
clk_hw_register_clkdev() for mass registration", but this is less
critical.
Wim: Can you please appply patch 1 directly, so we can get at least the
hard dependencies in v4.9?
Thanks!
Geert Uytterhoeven (2):
watchdog: txx9wdt: Add missing clock (un)prepare calls for CCF
MIPS: TXx9: Convert to Common Clock Framework
arch/mips/txx9/Kconfig | 2 +-
arch/mips/txx9/generic/setup.c | 70 +++++++++++++++++++++---------------------
drivers/watchdog/txx9wdt.c | 6 ++--
3 files changed, 39 insertions(+), 39 deletions(-)
--
1.9.1
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/2] watchdog: txx9wdt: Add missing clock (un)prepare calls for CCF
2016-09-11 8:59 [PATCH v2 0/2] MIPS: TXx9: Common Clock Framework Conversion Geert Uytterhoeven
@ 2016-09-11 8:59 ` Geert Uytterhoeven
2016-10-08 14:13 ` Wim Van Sebroeck
2016-09-11 8:59 ` [PATCH v2 2/2] MIPS: TXx9: Convert to Common Clock Framework Geert Uytterhoeven
2016-09-11 14:22 ` [PATCH v2 0/2] MIPS: TXx9: Common Clock Framework Conversion Guenter Roeck
2 siblings, 1 reply; 7+ messages in thread
From: Geert Uytterhoeven @ 2016-09-11 8:59 UTC (permalink / raw)
To: Ralf Baechle, Atsushi Nemoto, Wim Van Sebroeck
Cc: Guenter Roeck, linux-clk, linux-mips, linux-watchdog,
Geert Uytterhoeven
While the custom minimal TXx9 clock implementation doesn't need or use
clock (un)prepare calls (they are dummies if !CONFIG_HAVE_CLK_PREPARE),
they are mandatory when using the Common Clock Framework.
Hence add them, to prepare for the advent of CCF.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
---
Tested on RBTX4927.
v2:
- Add Reviewed-by.
---
drivers/watchdog/txx9wdt.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/watchdog/txx9wdt.c b/drivers/watchdog/txx9wdt.c
index c2da880292bc2f32..6f7a9deb27d05d25 100644
--- a/drivers/watchdog/txx9wdt.c
+++ b/drivers/watchdog/txx9wdt.c
@@ -112,7 +112,7 @@ static int __init txx9wdt_probe(struct platform_device *dev)
txx9_imclk = NULL;
goto exit;
}
- ret = clk_enable(txx9_imclk);
+ ret = clk_prepare_enable(txx9_imclk);
if (ret) {
clk_put(txx9_imclk);
txx9_imclk = NULL;
@@ -144,7 +144,7 @@ static int __init txx9wdt_probe(struct platform_device *dev)
return 0;
exit:
if (txx9_imclk) {
- clk_disable(txx9_imclk);
+ clk_disable_unprepare(txx9_imclk);
clk_put(txx9_imclk);
}
return ret;
@@ -153,7 +153,7 @@ exit:
static int __exit txx9wdt_remove(struct platform_device *dev)
{
watchdog_unregister_device(&txx9wdt);
- clk_disable(txx9_imclk);
+ clk_disable_unprepare(txx9_imclk);
clk_put(txx9_imclk);
return 0;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/2] MIPS: TXx9: Convert to Common Clock Framework
2016-09-11 8:59 [PATCH v2 0/2] MIPS: TXx9: Common Clock Framework Conversion Geert Uytterhoeven
2016-09-11 8:59 ` [PATCH v2 1/2] watchdog: txx9wdt: Add missing clock (un)prepare calls for CCF Geert Uytterhoeven
@ 2016-09-11 8:59 ` Geert Uytterhoeven
2016-09-12 22:32 ` Stephen Boyd
2016-09-13 15:00 ` Atsushi Nemoto
2016-09-11 14:22 ` [PATCH v2 0/2] MIPS: TXx9: Common Clock Framework Conversion Guenter Roeck
2 siblings, 2 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2016-09-11 8:59 UTC (permalink / raw)
To: Ralf Baechle, Atsushi Nemoto, Wim Van Sebroeck
Cc: Guenter Roeck, linux-clk, linux-mips, linux-watchdog,
Geert Uytterhoeven
Replace the custom minimal clock implementation for Toshiba TXx9 by a
basic implementation using the Common Clock Framework.
The only clocks that are provided are those needed by TXx9-specific
drivers ("imbus" and "spi" (TX4938 only)), and their common parent
clock "gbus". Other clocks can be added when needed.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
Tested on RBTX4927.
v2:
- Protect the TX4938_REV_PCODE() check by #ifdef CONFIG_CPU_TX49XX,
- Use new clk_hw-centric clock registration API.
---
arch/mips/txx9/Kconfig | 2 +-
arch/mips/txx9/generic/setup.c | 70 +++++++++++++++++++++---------------------
2 files changed, 36 insertions(+), 36 deletions(-)
diff --git a/arch/mips/txx9/Kconfig b/arch/mips/txx9/Kconfig
index 8c337d60f790db9f..42923478d45ca363 100644
--- a/arch/mips/txx9/Kconfig
+++ b/arch/mips/txx9/Kconfig
@@ -20,7 +20,7 @@ config MACH_TXX9
select SYS_SUPPORTS_32BIT_KERNEL
select SYS_SUPPORTS_LITTLE_ENDIAN
select SYS_SUPPORTS_BIG_ENDIAN
- select HAVE_CLK
+ select COMMON_CLK
config TOSHIBA_JMR3927
bool "Toshiba JMR-TX3927 board"
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c
index ada92db92f87d91a..a1d98b5c8fd67576 100644
--- a/arch/mips/txx9/generic/setup.c
+++ b/arch/mips/txx9/generic/setup.c
@@ -15,7 +15,8 @@
#include <linux/interrupt.h>
#include <linux/string.h>
#include <linux/module.h>
-#include <linux/clk.h>
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
#include <linux/err.h>
#include <linux/gpio/driver.h>
#include <linux/platform_device.h>
@@ -83,40 +84,6 @@ int txx9_ccfg_toeon __initdata;
int txx9_ccfg_toeon __initdata = 1;
#endif
-/* Minimum CLK support */
-
-struct clk *clk_get(struct device *dev, const char *id)
-{
- if (!strcmp(id, "spi-baseclk"))
- return (struct clk *)((unsigned long)txx9_gbus_clock / 2 / 2);
- if (!strcmp(id, "imbus_clk"))
- return (struct clk *)((unsigned long)txx9_gbus_clock / 2);
- return ERR_PTR(-ENOENT);
-}
-EXPORT_SYMBOL(clk_get);
-
-int clk_enable(struct clk *clk)
-{
- return 0;
-}
-EXPORT_SYMBOL(clk_enable);
-
-void clk_disable(struct clk *clk)
-{
-}
-EXPORT_SYMBOL(clk_disable);
-
-unsigned long clk_get_rate(struct clk *clk)
-{
- return (unsigned long)clk;
-}
-EXPORT_SYMBOL(clk_get_rate);
-
-void clk_put(struct clk *clk)
-{
-}
-EXPORT_SYMBOL(clk_put);
-
#define BOARD_VEC(board) extern struct txx9_board_vec board;
#include <asm/txx9/boards.h>
#undef BOARD_VEC
@@ -560,8 +527,41 @@ void __init plat_time_init(void)
txx9_board_vec->time_init();
}
+static void txx9_clk_init(void)
+{
+ struct clk_hw *hw;
+ int error;
+
+ hw = clk_hw_register_fixed_rate(NULL, "gbus", NULL, 0, txx9_gbus_clock);
+ if (IS_ERR(hw)) {
+ error = PTR_ERR(hw);
+ goto fail;
+ }
+
+ hw = clk_hw_register_fixed_factor(NULL, "imbus", "gbus", 0, 1, 2);
+ error = clk_hw_register_clkdev(hw, "imbus_clk", NULL);
+ if (error)
+ goto fail;
+
+#ifdef CONFIG_CPU_TX49XX
+ if (TX4938_REV_PCODE() == 0x4938) {
+ hw = clk_hw_register_fixed_factor(NULL, "spi", "gbus", 0, 1, 4);
+ error = clk_hw_register_clkdev(hw, "spi-baseclk", NULL);
+ if (error)
+ goto fail;
+ }
+#endif
+
+ return;
+
+fail:
+ pr_err("Failed to register clocks: %d\n", error);
+}
+
static int __init _txx9_arch_init(void)
{
+ txx9_clk_init();
+
if (txx9_board_vec->arch_init)
txx9_board_vec->arch_init();
return 0;
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/2] MIPS: TXx9: Common Clock Framework Conversion
2016-09-11 8:59 [PATCH v2 0/2] MIPS: TXx9: Common Clock Framework Conversion Geert Uytterhoeven
2016-09-11 8:59 ` [PATCH v2 1/2] watchdog: txx9wdt: Add missing clock (un)prepare calls for CCF Geert Uytterhoeven
2016-09-11 8:59 ` [PATCH v2 2/2] MIPS: TXx9: Convert to Common Clock Framework Geert Uytterhoeven
@ 2016-09-11 14:22 ` Guenter Roeck
2 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2016-09-11 14:22 UTC (permalink / raw)
To: Geert Uytterhoeven, Ralf Baechle, Atsushi Nemoto,
Wim Van Sebroeck
Cc: linux-clk, linux-mips, linux-watchdog
On 09/11/2016 01:59 AM, Geert Uytterhoeven wrote:
> Hi Ralf, Nemoto-san, Wim,
>
> This patch series converts the Toshiba TXx9 platforms from their own
> custom minimal clock implementation to the Common Clock Framework.
>
> - Patch 1 adds missing clock (un)prepare calls to the TXx9 watchdog
> driver,
> - Patch 2 replaces the custom clock implementation by a CCF-based one,
> providing a minimal set of clocks.
>
> This has been tested with the watchdog on RBTX4927.
>
> Changes since v1:
> - Dropped "spi: spi-txx9: Add missing clock (un)prepare calls for
> CCF", which has been accepted in spi/for-next,
> - Protect the TX4938_REV_PCODE() check by #ifdef CONFIG_CPU_TX49XX,
> - Use new clk_hw-centric clock registration API,
> - Add Reviewed-by.
>
> Dependencies:
> - Patch 1 can be applied independently,
> - Patch 2 depends on patch 1 and on "spi: spi-txx9: Add missing clock
> (un)prepare calls for CCF" in spi/for-next,
> - The error path in patch 2 depends on "clkdev: Detect errors in
> clk_hw_register_clkdev() for mass registration", but this is less
> critical.
>
> Wim: Can you please appply patch 1 directly, so we can get at least the
> hard dependencies in v4.9?
>
It is in my watchdog-next branch, and it has my Reviewed-by:, which
normally means that Wim will apply it.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] MIPS: TXx9: Convert to Common Clock Framework
2016-09-11 8:59 ` [PATCH v2 2/2] MIPS: TXx9: Convert to Common Clock Framework Geert Uytterhoeven
@ 2016-09-12 22:32 ` Stephen Boyd
2016-09-13 15:00 ` Atsushi Nemoto
1 sibling, 0 replies; 7+ messages in thread
From: Stephen Boyd @ 2016-09-12 22:32 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Ralf Baechle, Atsushi Nemoto, Wim Van Sebroeck, Guenter Roeck,
linux-clk, linux-mips, linux-watchdog
On 09/11, Geert Uytterhoeven wrote:
> Replace the custom minimal clock implementation for Toshiba TXx9 by a
> basic implementation using the Common Clock Framework.
>
> The only clocks that are provided are those needed by TXx9-specific
> drivers ("imbus" and "spi" (TX4938 only)), and their common parent
> clock "gbus". Other clocks can be added when needed.
>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] MIPS: TXx9: Convert to Common Clock Framework
2016-09-11 8:59 ` [PATCH v2 2/2] MIPS: TXx9: Convert to Common Clock Framework Geert Uytterhoeven
2016-09-12 22:32 ` Stephen Boyd
@ 2016-09-13 15:00 ` Atsushi Nemoto
1 sibling, 0 replies; 7+ messages in thread
From: Atsushi Nemoto @ 2016-09-13 15:00 UTC (permalink / raw)
To: geert; +Cc: ralf, wim, linux, linux-clk, linux-mips, linux-watchdog
On Sun, 11 Sep 2016 10:59:58 +0200, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> Replace the custom minimal clock implementation for Toshiba TXx9 by a
> basic implementation using the Common Clock Framework.
>
> The only clocks that are provided are those needed by TXx9-specific
> drivers ("imbus" and "spi" (TX4938 only)), and their common parent
> clock "gbus". Other clocks can be added when needed.
>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---
> Tested on RBTX4927.
>
> v2:
> - Protect the TX4938_REV_PCODE() check by #ifdef CONFIG_CPU_TX49XX,
> - Use new clk_hw-centric clock registration API.
Thank you for updated patch.
Reviewed-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
Atsushi Nemoto
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/2] watchdog: txx9wdt: Add missing clock (un)prepare calls for CCF
2016-09-11 8:59 ` [PATCH v2 1/2] watchdog: txx9wdt: Add missing clock (un)prepare calls for CCF Geert Uytterhoeven
@ 2016-10-08 14:13 ` Wim Van Sebroeck
0 siblings, 0 replies; 7+ messages in thread
From: Wim Van Sebroeck @ 2016-10-08 14:13 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Ralf Baechle, Atsushi Nemoto, Guenter Roeck, linux-clk,
linux-mips, linux-watchdog
Hi Geert,
> While the custom minimal TXx9 clock implementation doesn't need or use
> clock (un)prepare calls (they are dummies if !CONFIG_HAVE_CLK_PREPARE),
> they are mandatory when using the Common Clock Framework.
>
> Hence add them, to prepare for the advent of CCF.
>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
This patch was added to linux-watchdog-next almost 2 weeks ago.
Kind regards,
Wim.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-10-08 14:13 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-11 8:59 [PATCH v2 0/2] MIPS: TXx9: Common Clock Framework Conversion Geert Uytterhoeven
2016-09-11 8:59 ` [PATCH v2 1/2] watchdog: txx9wdt: Add missing clock (un)prepare calls for CCF Geert Uytterhoeven
2016-10-08 14:13 ` Wim Van Sebroeck
2016-09-11 8:59 ` [PATCH v2 2/2] MIPS: TXx9: Convert to Common Clock Framework Geert Uytterhoeven
2016-09-12 22:32 ` Stephen Boyd
2016-09-13 15:00 ` Atsushi Nemoto
2016-09-11 14:22 ` [PATCH v2 0/2] MIPS: TXx9: Common Clock Framework Conversion Guenter Roeck
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).