diff options
author | Alban Bedel <albeu@free.fr> | 2015-04-19 08:30:04 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2015-06-21 15:53:51 -0400 |
commit | 411520af8ec9456886359b42628e583ac58e7e44 (patch) | |
tree | c1af936067209afd5d27be90bb30ac4c046d1a7c | |
parent | 24b0e3e84fbf460ea904f4eb85e414e6001c8f37 (diff) |
MIPS: ath79: Use the common clk API
Make the code simpler and open the way for device tree clocks.
[ralf@linux-mips.org: Resolved conflict with 2a552da6 (MIPS/IRQCHIP: Move
irq_chip from arch/mips to drivers/irqchip.)]
Signed-off-by: Alban Bedel <albeu@free.fr>
Cc: linux-mips@linux-mips.org
Cc: Andrew Bresticker <abrestic@chromium.org>
Cc: Qais Yousef <qais.yousef@imgtec.com>
Cc: Wolfram Sang <wsa@the-dreams.de>
Cc: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Cc: Gabor Juhos <juhosg@openwrt.org>
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/9774/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r-- | arch/mips/Kconfig | 1 | ||||
-rw-r--r-- | arch/mips/ath79/clock.c | 29 |
2 files changed, 3 insertions, 27 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index e34660cddf9d..2424ddc43a77 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -124,6 +124,7 @@ config ATH79 | |||
124 | select CSRC_R4K | 124 | select CSRC_R4K |
125 | select DMA_NONCOHERENT | 125 | select DMA_NONCOHERENT |
126 | select HAVE_CLK | 126 | select HAVE_CLK |
127 | select COMMON_CLK | ||
127 | select CLKDEV_LOOKUP | 128 | select CLKDEV_LOOKUP |
128 | select IRQ_MIPS_CPU | 129 | select IRQ_MIPS_CPU |
129 | select MIPS_MACHINE | 130 | select MIPS_MACHINE |
diff --git a/arch/mips/ath79/clock.c b/arch/mips/ath79/clock.c index 226ddf0a0a97..1fcb6917783c 100644 --- a/arch/mips/ath79/clock.c +++ b/arch/mips/ath79/clock.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/err.h> | 17 | #include <linux/err.h> |
18 | #include <linux/clk.h> | 18 | #include <linux/clk.h> |
19 | #include <linux/clkdev.h> | 19 | #include <linux/clkdev.h> |
20 | #include <linux/clk-provider.h> | ||
20 | 21 | ||
21 | #include <asm/div64.h> | 22 | #include <asm/div64.h> |
22 | 23 | ||
@@ -28,21 +29,15 @@ | |||
28 | #define AR724X_BASE_FREQ 5000000 | 29 | #define AR724X_BASE_FREQ 5000000 |
29 | #define AR913X_BASE_FREQ 5000000 | 30 | #define AR913X_BASE_FREQ 5000000 |
30 | 31 | ||
31 | struct clk { | ||
32 | unsigned long rate; | ||
33 | }; | ||
34 | |||
35 | static void __init ath79_add_sys_clkdev(const char *id, unsigned long rate) | 32 | static void __init ath79_add_sys_clkdev(const char *id, unsigned long rate) |
36 | { | 33 | { |
37 | struct clk *clk; | 34 | struct clk *clk; |
38 | int err; | 35 | int err; |
39 | 36 | ||
40 | clk = kzalloc(sizeof(*clk), GFP_KERNEL); | 37 | clk = clk_register_fixed_rate(NULL, id, NULL, CLK_IS_ROOT, rate); |
41 | if (!clk) | 38 | if (!clk) |
42 | panic("failed to allocate %s clock structure", id); | 39 | panic("failed to allocate %s clock structure", id); |
43 | 40 | ||
44 | clk->rate = rate; | ||
45 | |||
46 | err = clk_register_clkdev(clk, id, NULL); | 41 | err = clk_register_clkdev(clk, id, NULL); |
47 | if (err) | 42 | if (err) |
48 | panic("unable to register %s clock device", id); | 43 | panic("unable to register %s clock device", id); |
@@ -468,23 +463,3 @@ ath79_get_sys_clk_rate(const char *id) | |||
468 | 463 | ||
469 | return rate; | 464 | return rate; |
470 | } | 465 | } |
471 | |||
472 | /* | ||
473 | * Linux clock API | ||
474 | */ | ||
475 | int clk_enable(struct clk *clk) | ||
476 | { | ||
477 | return 0; | ||
478 | } | ||
479 | EXPORT_SYMBOL(clk_enable); | ||
480 | |||
481 | void clk_disable(struct clk *clk) | ||
482 | { | ||
483 | } | ||
484 | EXPORT_SYMBOL(clk_disable); | ||
485 | |||
486 | unsigned long clk_get_rate(struct clk *clk) | ||
487 | { | ||
488 | return clk->rate; | ||
489 | } | ||
490 | EXPORT_SYMBOL(clk_get_rate); | ||