Hi! Paul, what do you say about this? Sylvain suggested it could also be integrated with define_machine interface.
If it's OK, it would be cool if it got merged in next release cycle. Domen On 11/07/07 11:32 +0200, Domen Puncer wrote: > clk interface for arch/powerpc, platforms should fill > clk_functions. > > Signed-off-by: Domen Puncer <[EMAIL PROTECTED]> > > --- > arch/powerpc/kernel/Makefile | 3 - > arch/powerpc/kernel/clock.c | 82 > ++++++++++++++++++++++++++++++++++++ > include/asm-powerpc/clk_interface.h | 20 ++++++++ > 3 files changed, 104 insertions(+), 1 deletion(-) > > Index: work-powerpc.git/arch/powerpc/kernel/clock.c > =================================================================== > --- /dev/null > +++ work-powerpc.git/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); > Index: work-powerpc.git/include/asm-powerpc/clk_interface.h > =================================================================== > --- /dev/null > +++ work-powerpc.git/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 */ > Index: work-powerpc.git/arch/powerpc/kernel/Makefile > =================================================================== > --- work-powerpc.git.orig/arch/powerpc/kernel/Makefile > +++ work-powerpc.git/arch/powerpc/kernel/Makefile > @@ -12,7 +12,8 @@ endif > > obj-y := semaphore.o cputable.o ptrace.o > syscalls.o \ > irq.o align.o signal_32.o pmc.o vdso.o \ > - init_task.o process.o systbl.o idle.o > + init_task.o process.o systbl.o idle.o \ > + clock.o > obj-y += vdso32/ > obj-$(CONFIG_PPC64) += setup_64.o binfmt_elf32.o sys_ppc32.o \ > signal_64.o ptrace32.o \ > _______________________________________________ > Linuxppc-dev mailing list > Linuxppc-dev@ozlabs.org > https://ozlabs.org/mailman/listinfo/linuxppc-dev _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev