MIPS: ath79: Use the common clk API
authorAlban Bedel <albeu@free.fr>
Sun, 19 Apr 2015 12:30:04 +0000 (14:30 +0200)
committerRalf Baechle <ralf@linux-mips.org>
Sun, 21 Jun 2015 19:53:51 +0000 (21:53 +0200)
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>
arch/mips/Kconfig
arch/mips/ath79/clock.c

index e34660cddf9dedfe0b8a747d985cf631dd6573f3..2424ddc43a77b6b7b8bd78117f84d320008a80e3 100644 (file)
@@ -124,6 +124,7 @@ config ATH79
        select CSRC_R4K
        select DMA_NONCOHERENT
        select HAVE_CLK
+       select COMMON_CLK
        select CLKDEV_LOOKUP
        select IRQ_MIPS_CPU
        select MIPS_MACHINE
index 226ddf0a0a971a515a6f17bbdfb0d18f79881d9e..1fcb6917783ce1b157feb83210263fa48239f428 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/err.h>
 #include <linux/clk.h>
 #include <linux/clkdev.h>
+#include <linux/clk-provider.h>
 
 #include <asm/div64.h>
 
 #define AR724X_BASE_FREQ       5000000
 #define AR913X_BASE_FREQ       5000000
 
-struct clk {
-       unsigned long rate;
-};
-
 static void __init ath79_add_sys_clkdev(const char *id, unsigned long rate)
 {
        struct clk *clk;
        int err;
 
-       clk = kzalloc(sizeof(*clk), GFP_KERNEL);
+       clk = clk_register_fixed_rate(NULL, id, NULL, CLK_IS_ROOT, rate);
        if (!clk)
                panic("failed to allocate %s clock structure", id);
 
-       clk->rate = rate;
-
        err = clk_register_clkdev(clk, id, NULL);
        if (err)
                panic("unable to register %s clock device", id);
@@ -468,23 +463,3 @@ ath79_get_sys_clk_rate(const char *id)
 
        return rate;
 }
-
-/*
- * Linux clock API
- */
-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 clk->rate;
-}
-EXPORT_SYMBOL(clk_get_rate);