Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6f6682809b994fd9a61081fa0410df31481d5f7f
Commit:     6f6682809b994fd9a61081fa0410df31481d5f7f
Parent:     21ccdd31e9c70f42b00d9ea152f6c4e0ff3f536e
Author:     Domen Puncer <[EMAIL PROTECTED]>
AuthorDate: Fri Sep 21 00:00:11 2007 +1000
Committer:  Paul Mackerras <[EMAIL PROTECTED]>
CommitDate: Wed Oct 3 09:11:56 2007 +1000

    [POWERPC] clk.h interface for platforms
    
    This provides an implementation of the <linux/clk.h> interface for
    arch/powerpc using a set of function pointers in clk_functions.
    Platforms that want to support this interface should fill
    clk_functions and select CONFIG_PPC_CLOCK in Kconfig.
    
    Signed-off-by: Domen Puncer <[EMAIL PROTECTED]>
    Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>
---
 arch/powerpc/Kconfig                |    4 ++
 arch/powerpc/kernel/Makefile        |    1 +
 arch/powerpc/kernel/clock.c         |   82 +++++++++++++++++++++++++++++++++++
 arch/powerpc/platforms/52xx/Kconfig |    1 +
 include/asm-powerpc/clk_interface.h |   20 ++++++++
 5 files changed, 108 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 66a3295..26126d2 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -663,3 +663,7 @@ config KEYS_COMPAT
        default y
 
 source "crypto/Kconfig"
+
+config PPC_CLOCK
+       bool
+       default n
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 967afc5..b37165e 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -24,6 +24,7 @@ obj-$(CONFIG_PPC64)           += vdso64/
 obj-$(CONFIG_ALTIVEC)          += vecemu.o vector.o
 obj-$(CONFIG_PPC_970_NAP)      += idle_power4.o
 obj-$(CONFIG_PPC_OF)           += of_device.o of_platform.o prom_parse.o
+obj-$(CONFIG_PPC_CLOCK)                += clock.o
 procfs-$(CONFIG_PPC64)         := proc_ppc64.o
 obj-$(CONFIG_PROC_FS)          += $(procfs-y)
 rtaspci-$(CONFIG_PPC64)-$(CONFIG_PCI)  := rtas_pci.o
diff --git a/arch/powerpc/kernel/clock.c b/arch/powerpc/kernel/clock.c
new file mode 100644
index 0000000..ce668f5
--- /dev/null
+++ b/arch/powerpc/kernel/clock.c
@@ -0,0 +1,82 @@
+/*
+ * Dummy clk implementations for powerpc.
+ * These need to be overridden in platform code.
+ */
+
+#include <linux/clk.h>
+#include <linux/err.h>
+#include <linux/errno.h>
+#include <linux/module.h>
+#include <asm/clk_interface.h>
+
+struct clk_interface clk_functions;
+
+struct clk *clk_get(struct device *dev, const char *id)
+{
+       if (clk_functions.clk_get)
+               return clk_functions.clk_get(dev, id);
+       return ERR_PTR(-ENOSYS);
+}
+EXPORT_SYMBOL(clk_get);
+
+void clk_put(struct clk *clk)
+{
+       if (clk_functions.clk_put)
+               clk_functions.clk_put(clk);
+}
+EXPORT_SYMBOL(clk_put);
+
+int clk_enable(struct clk *clk)
+{
+       if (clk_functions.clk_enable)
+               return clk_functions.clk_enable(clk);
+       return -ENOSYS;
+}
+EXPORT_SYMBOL(clk_enable);
+
+void clk_disable(struct clk *clk)
+{
+       if (clk_functions.clk_disable)
+               clk_functions.clk_disable(clk);
+}
+EXPORT_SYMBOL(clk_disable);
+
+unsigned long clk_get_rate(struct clk *clk)
+{
+       if (clk_functions.clk_get_rate)
+               return clk_functions.clk_get_rate(clk);
+       return 0;
+}
+EXPORT_SYMBOL(clk_get_rate);
+
+long clk_round_rate(struct clk *clk, unsigned long rate)
+{
+       if (clk_functions.clk_round_rate)
+               return clk_functions.clk_round_rate(clk, rate);
+       return -ENOSYS;
+}
+EXPORT_SYMBOL(clk_round_rate);
+
+int clk_set_rate(struct clk *clk, unsigned long rate)
+{
+       if (clk_functions.clk_set_rate)
+               return clk_functions.clk_set_rate(clk, rate);
+       return -ENOSYS;
+}
+EXPORT_SYMBOL(clk_set_rate);
+
+struct clk *clk_get_parent(struct clk *clk)
+{
+       if (clk_functions.clk_get_parent)
+               return clk_functions.clk_get_parent(clk);
+       return ERR_PTR(-ENOSYS);
+}
+EXPORT_SYMBOL(clk_get_parent);
+
+int clk_set_parent(struct clk *clk, struct clk *parent)
+{
+       if (clk_functions.clk_set_parent)
+               return clk_functions.clk_set_parent(clk, parent);
+       return -ENOSYS;
+}
+EXPORT_SYMBOL(clk_set_parent);
diff --git a/arch/powerpc/platforms/52xx/Kconfig 
b/arch/powerpc/platforms/52xx/Kconfig
index 9ddf251..2938d49 100644
--- a/arch/powerpc/platforms/52xx/Kconfig
+++ b/arch/powerpc/platforms/52xx/Kconfig
@@ -1,6 +1,7 @@
 config PPC_MPC52xx
        bool
        select FSL_SOC
+       select PPC_CLOCK
        default n
 
 config PPC_MPC5200
diff --git a/include/asm-powerpc/clk_interface.h 
b/include/asm-powerpc/clk_interface.h
new file mode 100644
index 0000000..ab1882c
--- /dev/null
+++ b/include/asm-powerpc/clk_interface.h
@@ -0,0 +1,20 @@
+#ifndef __ASM_POWERPC_CLK_INTERFACE_H
+#define __ASM_POWERPC_CLK_INTERFACE_H
+
+#include <linux/clk.h>
+
+struct clk_interface {
+       struct clk*     (*clk_get)      (struct device *dev, const char *id);
+       int             (*clk_enable)   (struct clk *clk);
+       void            (*clk_disable)  (struct clk *clk);
+       unsigned long   (*clk_get_rate) (struct clk *clk);
+       void            (*clk_put)      (struct clk *clk);
+       long            (*clk_round_rate) (struct clk *clk, unsigned long rate);
+       int             (*clk_set_rate) (struct clk *clk, unsigned long rate);
+       int             (*clk_set_parent) (struct clk *clk, struct clk *parent);
+       struct clk*     (*clk_get_parent) (struct clk *clk);
+};
+
+extern struct clk_interface clk_functions;
+
+#endif /* __ASM_POWERPC_CLK_INTERFACE_H */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to