ARM: 6483/1: arm & sh: factorised duplicated clkdev.c

factorise some generic infrastructure to assist looking up struct clks
for the ARM & SH architecture.

as the code is identical at 99%

put the arch specific code for allocation as example in asm/clkdev.h

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
Jean-Christop PLAGNIOL-VILLARD 2010-11-17 10:04:33 +01:00 committed by Russell King
parent 64d2dc384e
commit 6d803ba736
72 changed files with 157 additions and 336 deletions

View File

@ -221,7 +221,7 @@ config ARCH_INTEGRATOR
bool "ARM Ltd. Integrator family" bool "ARM Ltd. Integrator family"
select ARM_AMBA select ARM_AMBA
select ARCH_HAS_CPUFREQ select ARCH_HAS_CPUFREQ
select COMMON_CLKDEV select CLKDEV_LOOKUP
select ICST select ICST
select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS
select PLAT_VERSATILE select PLAT_VERSATILE
@ -231,7 +231,7 @@ config ARCH_INTEGRATOR
config ARCH_REALVIEW config ARCH_REALVIEW
bool "ARM Ltd. RealView family" bool "ARM Ltd. RealView family"
select ARM_AMBA select ARM_AMBA
select COMMON_CLKDEV select CLKDEV_LOOKUP
select ICST select ICST
select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS
select ARCH_WANT_OPTIONAL_GPIOLIB select ARCH_WANT_OPTIONAL_GPIOLIB
@ -245,7 +245,7 @@ config ARCH_VERSATILE
bool "ARM Ltd. Versatile family" bool "ARM Ltd. Versatile family"
select ARM_AMBA select ARM_AMBA
select ARM_VIC select ARM_VIC
select COMMON_CLKDEV select CLKDEV_LOOKUP
select ICST select ICST
select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS
select ARCH_WANT_OPTIONAL_GPIOLIB select ARCH_WANT_OPTIONAL_GPIOLIB
@ -259,7 +259,7 @@ config ARCH_VEXPRESS
select ARCH_WANT_OPTIONAL_GPIOLIB select ARCH_WANT_OPTIONAL_GPIOLIB
select ARM_AMBA select ARM_AMBA
select ARM_TIMER_SP804 select ARM_TIMER_SP804
select COMMON_CLKDEV select CLKDEV_LOOKUP
select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS
select HAVE_CLK select HAVE_CLK
select ICST select ICST
@ -280,7 +280,7 @@ config ARCH_BCMRING
depends on MMU depends on MMU
select CPU_V6 select CPU_V6
select ARM_AMBA select ARM_AMBA
select COMMON_CLKDEV select CLKDEV_LOOKUP
select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS
select ARCH_WANT_OPTIONAL_GPIOLIB select ARCH_WANT_OPTIONAL_GPIOLIB
help help
@ -327,7 +327,7 @@ config ARCH_EP93XX
select CPU_ARM920T select CPU_ARM920T
select ARM_AMBA select ARM_AMBA
select ARM_VIC select ARM_VIC
select COMMON_CLKDEV select CLKDEV_LOOKUP
select ARCH_REQUIRE_GPIOLIB select ARCH_REQUIRE_GPIOLIB
select ARCH_HAS_HOLES_MEMORYMODEL select ARCH_HAS_HOLES_MEMORYMODEL
select ARCH_USES_GETTIMEOFFSET select ARCH_USES_GETTIMEOFFSET
@ -347,14 +347,14 @@ config ARCH_MXC
bool "Freescale MXC/iMX-based" bool "Freescale MXC/iMX-based"
select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS
select ARCH_REQUIRE_GPIOLIB select ARCH_REQUIRE_GPIOLIB
select COMMON_CLKDEV select CLKDEV_LOOKUP
help help
Support for Freescale MXC/iMX-based family of processors Support for Freescale MXC/iMX-based family of processors
config ARCH_STMP3XXX config ARCH_STMP3XXX
bool "Freescale STMP3xxx" bool "Freescale STMP3xxx"
select CPU_ARM926T select CPU_ARM926T
select COMMON_CLKDEV select CLKDEV_LOOKUP
select ARCH_REQUIRE_GPIOLIB select ARCH_REQUIRE_GPIOLIB
select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS
select USB_ARCH_HAS_EHCI select USB_ARCH_HAS_EHCI
@ -472,7 +472,7 @@ config ARCH_LPC32XX
select HAVE_IDE select HAVE_IDE
select ARM_AMBA select ARM_AMBA
select USB_ARCH_HAS_OHCI select USB_ARCH_HAS_OHCI
select COMMON_CLKDEV select CLKDEV_LOOKUP
select GENERIC_TIME select GENERIC_TIME
select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS
help help
@ -506,7 +506,7 @@ config ARCH_MMP
bool "Marvell PXA168/910/MMP2" bool "Marvell PXA168/910/MMP2"
depends on MMU depends on MMU
select ARCH_REQUIRE_GPIOLIB select ARCH_REQUIRE_GPIOLIB
select COMMON_CLKDEV select CLKDEV_LOOKUP
select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS
select TICK_ONESHOT select TICK_ONESHOT
select PLAT_PXA select PLAT_PXA
@ -539,7 +539,7 @@ config ARCH_W90X900
bool "Nuvoton W90X900 CPU" bool "Nuvoton W90X900 CPU"
select CPU_ARM926T select CPU_ARM926T
select ARCH_REQUIRE_GPIOLIB select ARCH_REQUIRE_GPIOLIB
select COMMON_CLKDEV select CLKDEV_LOOKUP
select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS
help help
Support for Nuvoton (Winbond logic dept.) ARM9 processor, Support for Nuvoton (Winbond logic dept.) ARM9 processor,
@ -553,7 +553,7 @@ config ARCH_W90X900
config ARCH_NUC93X config ARCH_NUC93X
bool "Nuvoton NUC93X CPU" bool "Nuvoton NUC93X CPU"
select CPU_ARM926T select CPU_ARM926T
select COMMON_CLKDEV select CLKDEV_LOOKUP
help help
Support for Nuvoton (Winbond logic dept.) NUC93X MCU,The NUC93X is a Support for Nuvoton (Winbond logic dept.) NUC93X MCU,The NUC93X is a
low-power and high performance MPEG-4/JPEG multimedia controller chip. low-power and high performance MPEG-4/JPEG multimedia controller chip.
@ -564,7 +564,7 @@ config ARCH_TEGRA
select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS
select GENERIC_GPIO select GENERIC_GPIO
select HAVE_CLK select HAVE_CLK
select COMMON_CLKDEV select CLKDEV_LOOKUP
select ARCH_HAS_BARRIERS if CACHE_L2X0 select ARCH_HAS_BARRIERS if CACHE_L2X0
select ARCH_HAS_CPUFREQ select ARCH_HAS_CPUFREQ
help help
@ -574,7 +574,7 @@ config ARCH_TEGRA
config ARCH_PNX4008 config ARCH_PNX4008
bool "Philips Nexperia PNX4008 Mobile" bool "Philips Nexperia PNX4008 Mobile"
select CPU_ARM926T select CPU_ARM926T
select COMMON_CLKDEV select CLKDEV_LOOKUP
select ARCH_USES_GETTIMEOFFSET select ARCH_USES_GETTIMEOFFSET
help help
This enables support for Philips PNX4008 mobile platform. This enables support for Philips PNX4008 mobile platform.
@ -584,7 +584,7 @@ config ARCH_PXA
depends on MMU depends on MMU
select ARCH_MTD_XIP select ARCH_MTD_XIP
select ARCH_HAS_CPUFREQ select ARCH_HAS_CPUFREQ
select COMMON_CLKDEV select CLKDEV_LOOKUP
select ARCH_REQUIRE_GPIOLIB select ARCH_REQUIRE_GPIOLIB
select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS
select TICK_ONESHOT select TICK_ONESHOT
@ -761,7 +761,7 @@ config ARCH_TCC_926
bool "Telechips TCC ARM926-based systems" bool "Telechips TCC ARM926-based systems"
select CPU_ARM926T select CPU_ARM926T
select HAVE_CLK select HAVE_CLK
select COMMON_CLKDEV select CLKDEV_LOOKUP
select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS
help help
Support for Telechips TCC ARM926-based systems. Support for Telechips TCC ARM926-based systems.
@ -785,7 +785,7 @@ config ARCH_U300
select ARM_AMBA select ARM_AMBA
select ARM_VIC select ARM_VIC
select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS
select COMMON_CLKDEV select CLKDEV_LOOKUP
select GENERIC_GPIO select GENERIC_GPIO
help help
Support for ST-Ericsson U300 series mobile platforms. Support for ST-Ericsson U300 series mobile platforms.
@ -795,7 +795,7 @@ config ARCH_U8500
select CPU_V7 select CPU_V7
select ARM_AMBA select ARM_AMBA
select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS
select COMMON_CLKDEV select CLKDEV_LOOKUP
select ARCH_REQUIRE_GPIOLIB select ARCH_REQUIRE_GPIOLIB
help help
Support for ST-Ericsson's Ux500 architecture Support for ST-Ericsson's Ux500 architecture
@ -805,7 +805,7 @@ config ARCH_NOMADIK
select ARM_AMBA select ARM_AMBA
select ARM_VIC select ARM_VIC
select CPU_ARM926T select CPU_ARM926T
select COMMON_CLKDEV select CLKDEV_LOOKUP
select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS
select ARCH_REQUIRE_GPIOLIB select ARCH_REQUIRE_GPIOLIB
help help
@ -817,7 +817,7 @@ config ARCH_DAVINCI
select ARCH_REQUIRE_GPIOLIB select ARCH_REQUIRE_GPIOLIB
select ZONE_DMA select ZONE_DMA
select HAVE_IDE select HAVE_IDE
select COMMON_CLKDEV select CLKDEV_LOOKUP
select GENERIC_ALLOCATOR select GENERIC_ALLOCATOR
select ARCH_HAS_HOLES_MEMORYMODEL select ARCH_HAS_HOLES_MEMORYMODEL
help help
@ -837,7 +837,7 @@ config PLAT_SPEAR
bool "ST SPEAr" bool "ST SPEAr"
select ARM_AMBA select ARM_AMBA
select ARCH_REQUIRE_GPIOLIB select ARCH_REQUIRE_GPIOLIB
select COMMON_CLKDEV select CLKDEV_LOOKUP
select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS
select HAVE_CLK select HAVE_CLK
help help

View File

@ -37,7 +37,3 @@ config SHARP_PARAM
config SHARP_SCOOP config SHARP_SCOOP
bool bool
config COMMON_CLKDEV
bool
select HAVE_CLK

View File

@ -16,4 +16,3 @@ obj-$(CONFIG_SHARP_SCOOP) += scoop.o
obj-$(CONFIG_ARCH_IXP2000) += uengine.o obj-$(CONFIG_ARCH_IXP2000) += uengine.o
obj-$(CONFIG_ARCH_IXP23XX) += uengine.o obj-$(CONFIG_ARCH_IXP23XX) += uengine.o
obj-$(CONFIG_PCI_HOST_ITE8152) += it8152.o obj-$(CONFIG_PCI_HOST_ITE8152) += it8152.o
obj-$(CONFIG_COMMON_CLKDEV) += clkdev.o

View File

@ -12,23 +12,13 @@
#ifndef __ASM_CLKDEV_H #ifndef __ASM_CLKDEV_H
#define __ASM_CLKDEV_H #define __ASM_CLKDEV_H
struct clk; #include <linux/slab.h>
struct device;
struct clk_lookup { #include <mach/clkdev.h>
struct list_head node;
const char *dev_id;
const char *con_id;
struct clk *clk;
};
struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id, static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size)
const char *dev_fmt, ...); {
return kzalloc(size, GFP_KERNEL);
void clkdev_add(struct clk_lookup *cl); }
void clkdev_drop(struct clk_lookup *cl);
void clkdev_add_table(struct clk_lookup *, size_t);
int clk_add_alias(const char *, const char *, char *, struct device *);
#endif #endif

View File

@ -21,13 +21,12 @@
#include <linux/string.h> #include <linux/string.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/clkdev.h>
#include <mach/csp/hw_cfg.h> #include <mach/csp/hw_cfg.h>
#include <mach/csp/chipcHw_def.h> #include <mach/csp/chipcHw_def.h>
#include <mach/csp/chipcHw_reg.h> #include <mach/csp/chipcHw_reg.h>
#include <mach/csp/chipcHw_inline.h> #include <mach/csp/chipcHw_inline.h>
#include <asm/clkdev.h>
#include "clock.h" #include "clock.h"
#define clk_is_primary(x) ((x)->type & CLK_TYPE_PRIMARY) #define clk_is_primary(x) ((x)->type & CLK_TYPE_PRIMARY)

View File

@ -30,10 +30,10 @@
#include <linux/amba/bus.h> #include <linux/amba/bus.h>
#include <linux/clocksource.h> #include <linux/clocksource.h>
#include <linux/clockchips.h> #include <linux/clockchips.h>
#include <linux/clkdev.h>
#include <mach/csp/mm_addr.h> #include <mach/csp/mm_addr.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm/clkdev.h>
#include <linux/io.h> #include <linux/io.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/hardware/arm_timer.h> #include <asm/hardware/arm_timer.h>

View File

@ -68,7 +68,7 @@
#ifndef __ASSEMBLER__ #ifndef __ASSEMBLER__
#include <linux/list.h> #include <linux/list.h>
#include <asm/clkdev.h> #include <linux/clkdev.h>
#define PLLSTAT_GOSTAT BIT(0) #define PLLSTAT_GOSTAT BIT(0)
#define PLLCMD_GOSET BIT(0) #define PLLCMD_GOSET BIT(0)

View File

@ -19,10 +19,10 @@
#include <linux/string.h> #include <linux/string.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/clkdev.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm/clkdev.h>
#include <asm/div64.h> #include <asm/div64.h>

View File

@ -22,8 +22,7 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/clkdev.h>
#include <asm/clkdev.h>
#include <mach/clock.h> #include <mach/clock.h>
#include <mach/hardware.h> #include <mach/hardware.h>

View File

@ -21,11 +21,11 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/clkdev.h>
#include <mach/clock.h> #include <mach/clock.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/common.h> #include <mach/common.h>
#include <asm/clkdev.h>
#include <asm/div64.h> #include <asm/div64.h>
#define IO_ADDR_CCM(off) (MX21_IO_ADDRESS(MX21_CCM_BASE_ADDR + (off))) #define IO_ADDR_CCM(off) (MX21_IO_ADDRESS(MX21_CCM_BASE_ADDR + (off)))

View File

@ -21,8 +21,8 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/clkdev.h>
#include <asm/clkdev.h>
#include <asm/div64.h> #include <asm/div64.h>
#include <mach/clock.h> #include <mach/clock.h>

View File

@ -21,9 +21,8 @@
#include <linux/amba/bus.h> #include <linux/amba/bus.h>
#include <linux/amba/serial.h> #include <linux/amba/serial.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/clkdev.h>
#include <asm/clkdev.h>
#include <mach/clkdev.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/platform.h> #include <mach/platform.h>
#include <asm/irq.h> #include <asm/irq.h>

View File

@ -22,9 +22,8 @@
#include <linux/amba/clcd.h> #include <linux/amba/clcd.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/clkdev.h>
#include <asm/clkdev.h>
#include <mach/clkdev.h>
#include <asm/hardware/icst.h> #include <asm/hardware/icst.h>
#include <mach/lm.h> #include <mach/lm.h>
#include <mach/impd1.h> #include <mach/impd1.h>

View File

@ -21,9 +21,8 @@
#include <linux/amba/mmci.h> #include <linux/amba/mmci.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/gfp.h> #include <linux/gfp.h>
#include <linux/clkdev.h>
#include <asm/clkdev.h>
#include <mach/clkdev.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/platform.h> #include <mach/platform.h>
#include <asm/irq.h> #include <asm/irq.h>

View File

@ -90,10 +90,9 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/amba/bus.h> #include <linux/amba/bus.h>
#include <linux/amba/clcd.h> #include <linux/amba/clcd.h>
#include <linux/clkdev.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm/clkdev.h>
#include <mach/clkdev.h>
#include <mach/platform.h> #include <mach/platform.h>
#include "clock.h" #include "clock.h"
#include "common.h" #include "common.h"

View File

@ -6,7 +6,7 @@
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <asm/clkdev.h> #include <linux/clkdev.h>
struct clkops { struct clkops {
void (*enable)(struct clk *); void (*enable)(struct clk *);

View File

@ -21,8 +21,7 @@
#include <linux/list.h> #include <linux/list.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/clkdev.h>
#include <asm/clkdev.h>
#include <mach/clock.h> #include <mach/clock.h>
#include <mach/hardware.h> #include <mach/hardware.h>

View File

@ -23,8 +23,8 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/clkdev.h>
#include <asm/clkdev.h>
#include <asm/div64.h> #include <asm/div64.h>
#include <mach/clock.h> #include <mach/clock.h>

View File

@ -21,8 +21,7 @@
#include <linux/list.h> #include <linux/list.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/clkdev.h>
#include <asm/clkdev.h>
#include <mach/clock.h> #include <mach/clock.h>
#include <mach/hardware.h> #include <mach/hardware.h>

View File

@ -14,8 +14,8 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/clkdev.h>
#include <asm/clkdev.h>
#include <asm/div64.h> #include <asm/div64.h>
#include <mach/hardware.h> #include <mach/hardware.h>

View File

@ -2,12 +2,12 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/clkdev.h>
#include <mach/clock.h> #include <mach/clock.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/common.h> #include <mach/common.h>
#include <asm/clkdev.h>
#include <asm/bug.h> #include <asm/bug.h>
#include <asm/div64.h> #include <asm/div64.h>

View File

@ -7,7 +7,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <asm/clkdev.h> #include <linux/clkdev.h>
#include "clock.h" #include "clock.h"
/* /*

View File

@ -10,7 +10,7 @@
* the Free Software Foundation; either version 2 of the License. * the Free Software Foundation; either version 2 of the License.
*/ */
#include <asm/clkdev.h> #include <linux/clkdev.h>
void nuc93x_clk_enable(struct clk *clk, int enable); void nuc93x_clk_enable(struct clk *clk, int enable);
void clks_register(struct clk_lookup *clks, size_t num); void clks_register(struct clk_lookup *clks, size_t num);

View File

@ -17,9 +17,9 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/clkdev.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/clkdev.h>
#include <plat/cpu.h> #include <plat/cpu.h>
#include <plat/usb.h> #include <plat/usb.h>

View File

@ -26,10 +26,10 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/clkdev.h>
#include <plat/cpu.h> #include <plat/cpu.h>
#include <plat/clock.h> #include <plat/clock.h>
#include <asm/clkdev.h>
#include "clock.h" #include "clock.h"
#include "prm.h" #include "prm.h"

View File

@ -21,8 +21,7 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/clkdev.h>
#include <asm/clkdev.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/clock.h> #include <mach/clock.h>

View File

@ -11,8 +11,8 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/clkdev.h>
#include <asm/clkdev.h>
#include <mach/pxa2xx-regs.h> #include <mach/pxa2xx-regs.h>
#include <mach/hardware.h> #include <mach/hardware.h>

View File

@ -1,4 +1,4 @@
#include <asm/clkdev.h> #include <linux/clkdev.h>
struct clkops { struct clkops {
void (*enable)(struct clk *); void (*enable)(struct clk *);

View File

@ -30,8 +30,8 @@
#include <linux/ata_platform.h> #include <linux/ata_platform.h>
#include <linux/amba/mmci.h> #include <linux/amba/mmci.h>
#include <linux/gfp.h> #include <linux/gfp.h>
#include <linux/clkdev.h>
#include <asm/clkdev.h>
#include <asm/system.h> #include <asm/system.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm/irq.h> #include <asm/irq.h>
@ -47,7 +47,6 @@
#include <asm/hardware/gic.h> #include <asm/hardware/gic.h>
#include <mach/clkdev.h>
#include <mach/platform.h> #include <mach/platform.h>
#include <mach/irqs.h> #include <mach/irqs.h>
#include <plat/timer-sp.h> #include <plat/timer-sp.h>

View File

@ -6,7 +6,7 @@ config ARCH_SH7367
bool "SH-Mobile G3 (SH7367)" bool "SH-Mobile G3 (SH7367)"
select CPU_V6 select CPU_V6
select HAVE_CLK select HAVE_CLK
select COMMON_CLKDEV select CLKDEV_LOOKUP
select SH_CLK_CPG select SH_CLK_CPG
select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS
@ -14,7 +14,7 @@ config ARCH_SH7377
bool "SH-Mobile G4 (SH7377)" bool "SH-Mobile G4 (SH7377)"
select CPU_V7 select CPU_V7
select HAVE_CLK select HAVE_CLK
select COMMON_CLKDEV select CLKDEV_LOOKUP
select SH_CLK_CPG select SH_CLK_CPG
select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS
@ -22,7 +22,7 @@ config ARCH_SH7372
bool "SH-Mobile AP4 (SH7372)" bool "SH-Mobile AP4 (SH7372)"
select CPU_V7 select CPU_V7
select HAVE_CLK select HAVE_CLK
select COMMON_CLKDEV select CLKDEV_LOOKUP
select SH_CLK_CPG select SH_CLK_CPG
select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS

View File

@ -20,8 +20,8 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/sh_clk.h> #include <linux/sh_clk.h>
#include <linux/clkdev.h>
#include <mach/common.h> #include <mach/common.h>
#include <asm/clkdev.h>
/* SH7367 registers */ /* SH7367 registers */
#define RTFRQCR 0xe6150000 #define RTFRQCR 0xe6150000

View File

@ -20,8 +20,8 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/sh_clk.h> #include <linux/sh_clk.h>
#include <linux/clkdev.h>
#include <mach/common.h> #include <mach/common.h>
#include <asm/clkdev.h>
/* SH7372 registers */ /* SH7372 registers */
#define FRQCRA 0xe6150000 #define FRQCRA 0xe6150000

View File

@ -20,8 +20,8 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/sh_clk.h> #include <linux/sh_clk.h>
#include <linux/clkdev.h>
#include <mach/common.h> #include <mach/common.h>
#include <asm/clkdev.h>
/* SH7377 registers */ /* SH7377 registers */
#define RTFRQCR 0xe6150000 #define RTFRQCR 0xe6150000

View File

@ -12,8 +12,7 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/clkdev.h>
#include <asm/clkdev.h>
#include <mach/clock.h> #include <mach/clock.h>
#include <mach/irqs.h> #include <mach/irqs.h>

View File

@ -25,7 +25,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
#include <asm/clkdev.h> #include <linux/clkdev.h>
#include "clock.h" #include "clock.h"
#include "board.h" #include "board.h"

View File

@ -21,7 +21,7 @@
#define __MACH_TEGRA_CLOCK_H #define __MACH_TEGRA_CLOCK_H
#include <linux/list.h> #include <linux/list.h>
#include <asm/clkdev.h> #include <linux/clkdev.h>
#define DIV_BUS (1 << 0) #define DIV_BUS (1 << 0)
#define DIV_U71 (1 << 1) #define DIV_U71 (1 << 1)

View File

@ -24,8 +24,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/hrtimer.h> #include <linux/hrtimer.h>
#include <linux/clkdev.h>
#include <asm/clkdev.h>
#include <mach/iomap.h> #include <mach/iomap.h>

View File

@ -25,8 +25,8 @@
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/clkdev.h>
#include <asm/clkdev.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/syscon.h> #include <mach/syscon.h>

View File

@ -13,8 +13,7 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/clkdev.h>
#include <asm/clkdev.h>
#include <plat/mtu.h> #include <plat/mtu.h>
#include <mach/hardware.h> #include <mach/hardware.h>

View File

@ -31,8 +31,8 @@
#include <linux/amba/pl022.h> #include <linux/amba/pl022.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/gfp.h> #include <linux/gfp.h>
#include <linux/clkdev.h>
#include <asm/clkdev.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/leds.h> #include <asm/leds.h>
@ -46,7 +46,6 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <asm/mach/time.h> #include <asm/mach/time.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <mach/clkdev.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/platform.h> #include <mach/platform.h>
#include <plat/timer-sp.h> #include <plat/timer-sp.h>

View File

@ -8,8 +8,8 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/amba/bus.h> #include <linux/amba/bus.h>
#include <linux/amba/clcd.h> #include <linux/amba/clcd.h>
#include <linux/clkdev.h>
#include <asm/clkdev.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/hardware/arm_timer.h> #include <asm/hardware/arm_timer.h>
#include <asm/hardware/cache-l2x0.h> #include <asm/hardware/cache-l2x0.h>
@ -18,7 +18,6 @@
#include <asm/pmu.h> #include <asm/pmu.h>
#include <asm/smp_twd.h> #include <asm/smp_twd.h>
#include <mach/clkdev.h>
#include <mach/ct-ca9x4.h> #include <mach/ct-ca9x4.h>
#include <plat/timer-sp.h> #include <plat/timer-sp.h>

View File

@ -11,15 +11,14 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/sysdev.h> #include <linux/sysdev.h>
#include <linux/usb/isp1760.h> #include <linux/usb/isp1760.h>
#include <linux/clkdev.h>
#include <asm/clkdev.h>
#include <asm/sizes.h> #include <asm/sizes.h>
#include <asm/mach/flash.h> #include <asm/mach/flash.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <asm/mach/time.h> #include <asm/mach/time.h>
#include <asm/hardware/arm_timer.h> #include <asm/hardware/arm_timer.h>
#include <mach/clkdev.h>
#include <mach/motherboard.h> #include <mach/motherboard.h>
#include <plat/timer-sp.h> #include <plat/timer-sp.h>

View File

@ -10,7 +10,7 @@
* the Free Software Foundation; either version 2 of the License. * the Free Software Foundation; either version 2 of the License.
*/ */
#include <asm/clkdev.h> #include <linux/clkdev.h>
void nuc900_clk_enable(struct clk *clk, int enable); void nuc900_clk_enable(struct clk *clk, int enable);
void nuc900_subclk_enable(struct clk *clk, int enable); void nuc900_subclk_enable(struct clk *clk, int enable);

View File

@ -11,13 +11,13 @@ choice
config ARCH_OMAP1 config ARCH_OMAP1
bool "TI OMAP1" bool "TI OMAP1"
select COMMON_CLKDEV select CLKDEV_LOOKUP
help help
"Systems based on omap7xx, omap15xx or omap16xx" "Systems based on omap7xx, omap15xx or omap16xx"
config ARCH_OMAP2PLUS config ARCH_OMAP2PLUS
bool "TI OMAP2/3/4" bool "TI OMAP2/3/4"
select COMMON_CLKDEV select CLKDEV_LOOKUP
help help
"Systems based on OMAP2, OMAP3 or OMAP4" "Systems based on OMAP2, OMAP3 or OMAP4"

View File

@ -8,7 +8,7 @@
#ifndef __ARCH_ARM_PLAT_OMAP_INCLUDE_PLAT_CLKDEV_OMAP_H #ifndef __ARCH_ARM_PLAT_OMAP_INCLUDE_PLAT_CLKDEV_OMAP_H
#define __ARCH_ARM_PLAT_OMAP_INCLUDE_PLAT_CLKDEV_OMAP_H #define __ARCH_ARM_PLAT_OMAP_INCLUDE_PLAT_CLKDEV_OMAP_H
#include <asm/clkdev.h> #include <linux/clkdev.h>
struct omap_clk { struct omap_clk {
u16 cpu; u16 cpu;

View File

@ -15,7 +15,7 @@
#define __PLAT_CLOCK_H #define __PLAT_CLOCK_H
#include <linux/list.h> #include <linux/list.h>
#include <asm/clkdev.h> #include <linux/clkdev.h>
#include <linux/types.h> #include <linux/types.h>
/* clk structure flags */ /* clk structure flags */

View File

@ -25,9 +25,9 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/clkdev.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/clkdev.h>
#include <mach/platform.h> #include <mach/platform.h>
#include <mach/regs-clkctrl.h> #include <mach/regs-clkctrl.h>

View File

@ -1,7 +1,7 @@
config SUPERH config SUPERH
def_bool y def_bool y
select EMBEDDED select EMBEDDED
select HAVE_CLK select CLKDEV_LOOKUP
select HAVE_IDE if HAS_IOPORT select HAVE_IDE if HAS_IOPORT
select HAVE_MEMBLOCK select HAVE_MEMBLOCK
select HAVE_OPROFILE select HAVE_OPROFILE

View File

@ -24,10 +24,10 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/usb/r8a66597.h> #include <linux/usb/r8a66597.h>
#include <linux/usb/m66592.h> #include <linux/usb/m66592.h>
#include <linux/clkdev.h>
#include <net/ax88796.h> #include <net/ax88796.h>
#include <asm/machvec.h> #include <asm/machvec.h>
#include <mach/highlander.h> #include <mach/highlander.h>
#include <asm/clkdev.h>
#include <asm/clock.h> #include <asm/clock.h>
#include <asm/heartbeat.h> #include <asm/heartbeat.h>
#include <asm/io.h> #include <asm/io.h>

View File

@ -1,9 +1,5 @@
/* /*
* arch/sh/include/asm/clkdev.h * Copyright (C) 2010 Paul Mundt <lethal@linux-sh.org>
*
* Cloned from arch/arm/include/asm/clkdev.h:
*
* Copyright (C) 2008 Russell King.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
@ -11,25 +7,25 @@
* *
* Helper for the clk API to assist looking up a struct clk. * Helper for the clk API to assist looking up a struct clk.
*/ */
#ifndef __ASM_CLKDEV_H
#define __ASM_CLKDEV_H
struct clk; #ifndef __CLKDEV__H_
#define __CLKDEV__H_
struct clk_lookup { #include <linux/bootmem.h>
struct list_head node; #include <linux/mm.h>
const char *dev_id; #include <linux/slab.h>
const char *con_id;
struct clk *clk;
};
struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id, #include <asm/clock.h>
const char *dev_fmt, ...);
void clkdev_add(struct clk_lookup *cl); static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size)
void clkdev_drop(struct clk_lookup *cl); {
if (!slab_is_available())
return alloc_bootmem_low_pages(size);
else
return kzalloc(size, GFP_KERNEL);
}
void clkdev_add_table(struct clk_lookup *, size_t); #define __clk_put(clk)
int clk_add_alias(const char *, const char *, char *, struct device *); #define __clk_get(clk) ({ 1; })
#endif #endif /* __CLKDEV_H__ */

View File

@ -11,7 +11,7 @@ endif
CFLAGS_REMOVE_return_address.o = -pg CFLAGS_REMOVE_return_address.o = -pg
obj-y := clkdev.o debugtraps.o dma-nommu.o dumpstack.o \ obj-y := debugtraps.o dma-nommu.o dumpstack.o \
idle.o io.o irq.o irq_$(BITS).o kdebugfs.o \ idle.o io.o irq.o irq_$(BITS).o kdebugfs.o \
machvec.o nmi_debug.o process.o \ machvec.o nmi_debug.o process.o \
process_$(BITS).o ptrace.o ptrace_$(BITS).o \ process_$(BITS).o ptrace.o ptrace_$(BITS).o \

View File

@ -1,171 +0,0 @@
/*
* arch/sh/kernel/clkdev.c
*
* Cloned from arch/arm/common/clkdev.c:
*
* Copyright (C) 2008 Russell King.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Helper for the clk API to assist looking up a struct clk.
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/device.h>
#include <linux/list.h>
#include <linux/errno.h>
#include <linux/err.h>
#include <linux/string.h>
#include <linux/mutex.h>
#include <linux/clk.h>
#include <linux/slab.h>
#include <linux/bootmem.h>
#include <linux/mm.h>
#include <asm/clock.h>
#include <asm/clkdev.h>
static LIST_HEAD(clocks);
static DEFINE_MUTEX(clocks_mutex);
/*
* Find the correct struct clk for the device and connection ID.
* We do slightly fuzzy matching here:
* An entry with a NULL ID is assumed to be a wildcard.
* If an entry has a device ID, it must match
* If an entry has a connection ID, it must match
* Then we take the most specific entry - with the following
* order of precedence: dev+con > dev only > con only.
*/
static struct clk *clk_find(const char *dev_id, const char *con_id)
{
struct clk_lookup *p;
struct clk *clk = NULL;
int match, best = 0;
list_for_each_entry(p, &clocks, node) {
match = 0;
if (p->dev_id) {
if (!dev_id || strcmp(p->dev_id, dev_id))
continue;
match += 2;
}
if (p->con_id) {
if (!con_id || strcmp(p->con_id, con_id))
continue;
match += 1;
}
if (match == 0)
continue;
if (match > best) {
clk = p->clk;
best = match;
}
}
return clk;
}
struct clk *clk_get_sys(const char *dev_id, const char *con_id)
{
struct clk *clk;
mutex_lock(&clocks_mutex);
clk = clk_find(dev_id, con_id);
mutex_unlock(&clocks_mutex);
return clk ? clk : ERR_PTR(-ENOENT);
}
EXPORT_SYMBOL(clk_get_sys);
void clkdev_add(struct clk_lookup *cl)
{
mutex_lock(&clocks_mutex);
list_add_tail(&cl->node, &clocks);
mutex_unlock(&clocks_mutex);
}
EXPORT_SYMBOL(clkdev_add);
void __init clkdev_add_table(struct clk_lookup *cl, size_t num)
{
mutex_lock(&clocks_mutex);
while (num--) {
list_add_tail(&cl->node, &clocks);
cl++;
}
mutex_unlock(&clocks_mutex);
}
#define MAX_DEV_ID 20
#define MAX_CON_ID 16
struct clk_lookup_alloc {
struct clk_lookup cl;
char dev_id[MAX_DEV_ID];
char con_id[MAX_CON_ID];
};
struct clk_lookup * __init_refok
clkdev_alloc(struct clk *clk, const char *con_id, const char *dev_fmt, ...)
{
struct clk_lookup_alloc *cla;
if (!slab_is_available())
cla = alloc_bootmem_low_pages(sizeof(*cla));
else
cla = kzalloc(sizeof(*cla), GFP_KERNEL);
if (!cla)
return NULL;
cla->cl.clk = clk;
if (con_id) {
strlcpy(cla->con_id, con_id, sizeof(cla->con_id));
cla->cl.con_id = cla->con_id;
}
if (dev_fmt) {
va_list ap;
va_start(ap, dev_fmt);
vscnprintf(cla->dev_id, sizeof(cla->dev_id), dev_fmt, ap);
cla->cl.dev_id = cla->dev_id;
va_end(ap);
}
return &cla->cl;
}
EXPORT_SYMBOL(clkdev_alloc);
int clk_add_alias(const char *alias, const char *alias_dev_name, char *id,
struct device *dev)
{
struct clk *r = clk_get(dev, id);
struct clk_lookup *l;
if (IS_ERR(r))
return PTR_ERR(r);
l = clkdev_alloc(r, alias, alias_dev_name);
clk_put(r);
if (!l)
return -ENODEV;
clkdev_add(l);
return 0;
}
EXPORT_SYMBOL(clk_add_alias);
/*
* clkdev_drop - remove a clock dynamically allocated
*/
void clkdev_drop(struct clk_lookup *cl)
{
struct clk_lookup_alloc *cla = container_of(cl, struct clk_lookup_alloc, cl);
mutex_lock(&clocks_mutex);
list_del(&cl->node);
mutex_unlock(&clocks_mutex);
kfree(cla);
}
EXPORT_SYMBOL(clkdev_drop);

View File

@ -2,7 +2,7 @@
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/io.h> #include <linux/io.h>
#include <asm/clkdev.h> #include <linux/clkdev.h>
#include <asm/clock.h> #include <asm/clock.h>
static struct clk master_clk = { static struct clk master_clk = {

View File

@ -48,20 +48,4 @@ int __init clk_init(void)
return ret; return ret;
} }
/*
* Returns a clock. Note that we first try to use device id on the bus
* and clock name. If this fails, we try to use clock name only.
*/
struct clk *clk_get(struct device *dev, const char *con_id)
{
const char *dev_id = dev ? dev_name(dev) : NULL;
return clk_get_sys(dev_id, con_id);
}
EXPORT_SYMBOL_GPL(clk_get);
void clk_put(struct clk *clk)
{
}
EXPORT_SYMBOL_GPL(clk_put);

View File

@ -13,7 +13,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/io.h> #include <linux/io.h>
#include <asm/clkdev.h> #include <linux/clkdev.h>
#include <asm/clock.h> #include <asm/clock.h>
#include <asm/freq.h> #include <asm/freq.h>

View File

@ -21,7 +21,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/io.h> #include <linux/io.h>
#include <asm/clkdev.h> #include <linux/clkdev.h>
#include <asm/clock.h> #include <asm/clock.h>
/* SH7343 registers */ /* SH7343 registers */

View File

@ -21,7 +21,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/io.h> #include <linux/io.h>
#include <asm/clkdev.h> #include <linux/clkdev.h>
#include <asm/clock.h> #include <asm/clock.h>
/* SH7366 registers */ /* SH7366 registers */

View File

@ -21,7 +21,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/io.h> #include <linux/io.h>
#include <asm/clkdev.h> #include <linux/clkdev.h>
#include <asm/clock.h> #include <asm/clock.h>
#include <asm/hwblk.h> #include <asm/hwblk.h>
#include <cpu/sh7722.h> #include <cpu/sh7722.h>

View File

@ -22,7 +22,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <asm/clkdev.h> #include <linux/clkdev.h>
#include <asm/clock.h> #include <asm/clock.h>
#include <asm/hwblk.h> #include <asm/hwblk.h>
#include <cpu/sh7723.h> #include <cpu/sh7723.h>

View File

@ -22,7 +22,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <asm/clkdev.h> #include <linux/clkdev.h>
#include <asm/clock.h> #include <asm/clock.h>
#include <asm/hwblk.h> #include <asm/hwblk.h>
#include <cpu/sh7724.h> #include <cpu/sh7724.h>

View File

@ -12,7 +12,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/io.h> #include <linux/io.h>
#include <asm/clkdev.h> #include <linux/clkdev.h>
#include <asm/clock.h> #include <asm/clock.h>
#include <asm/freq.h> #include <asm/freq.h>

View File

@ -13,7 +13,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/io.h> #include <linux/io.h>
#include <asm/clkdev.h> #include <linux/clkdev.h>
#include <asm/clock.h> #include <asm/clock.h>
#include <asm/freq.h> #include <asm/freq.h>
#include <asm/io.h> #include <asm/io.h>

View File

@ -12,7 +12,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/io.h> #include <linux/io.h>
#include <asm/clkdev.h> #include <linux/clkdev.h>
#include <asm/clock.h> #include <asm/clock.h>
#include <asm/freq.h> #include <asm/freq.h>
#include <asm/io.h> #include <asm/io.h>

View File

@ -14,7 +14,7 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/cpufreq.h> #include <linux/cpufreq.h>
#include <asm/clkdev.h> #include <linux/clkdev.h>
#include <asm/clock.h> #include <asm/clock.h>
#include <asm/freq.h> #include <asm/freq.h>
#include <cpu/sh7785.h> #include <cpu/sh7785.h>

View File

@ -13,7 +13,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/io.h> #include <linux/io.h>
#include <asm/clkdev.h> #include <linux/clkdev.h>
#include <asm/clock.h> #include <asm/clock.h>
#include <asm/freq.h> #include <asm/freq.h>

View File

@ -14,7 +14,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/io.h> #include <linux/io.h>
#include <asm/clkdev.h> #include <linux/clkdev.h>
#include <asm/clock.h> #include <asm/clock.h>
#include <asm/freq.h> #include <asm/freq.h>

View File

@ -111,4 +111,6 @@ source "drivers/xen/Kconfig"
source "drivers/staging/Kconfig" source "drivers/staging/Kconfig"
source "drivers/platform/Kconfig" source "drivers/platform/Kconfig"
source "drivers/clk/Kconfig"
endmenu endmenu

View File

@ -114,3 +114,5 @@ obj-$(CONFIG_VLYNQ) += vlynq/
obj-$(CONFIG_STAGING) += staging/ obj-$(CONFIG_STAGING) += staging/
obj-y += platform/ obj-y += platform/
obj-y += ieee802154/ obj-y += ieee802154/
#common clk code
obj-y += clk/

4
drivers/clk/Kconfig Normal file
View File

@ -0,0 +1,4 @@
config CLKDEV_LOOKUP
bool
select HAVE_CLK

2
drivers/clk/Makefile Normal file
View File

@ -0,0 +1,2 @@
obj-$(CONFIG_CLKDEV_LOOKUP) += clkdev.o

View File

@ -1,5 +1,5 @@
/* /*
* arch/arm/common/clkdev.c * drivers/clk/clkdev.c
* *
* Copyright (C) 2008 Russell King. * Copyright (C) 2008 Russell King.
* *
@ -18,10 +18,7 @@
#include <linux/string.h> #include <linux/string.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/slab.h> #include <linux/clkdev.h>
#include <asm/clkdev.h>
#include <mach/clkdev.h>
static LIST_HEAD(clocks); static LIST_HEAD(clocks);
static DEFINE_MUTEX(clocks_mutex); static DEFINE_MUTEX(clocks_mutex);
@ -120,12 +117,12 @@ struct clk_lookup_alloc {
char con_id[MAX_CON_ID]; char con_id[MAX_CON_ID];
}; };
struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id, struct clk_lookup * __init_refok
const char *dev_fmt, ...) clkdev_alloc(struct clk *clk, const char *con_id, const char *dev_fmt, ...)
{ {
struct clk_lookup_alloc *cla; struct clk_lookup_alloc *cla;
cla = kzalloc(sizeof(*cla), GFP_KERNEL); cla = __clkdev_alloc(sizeof(*cla));
if (!cla) if (!cla)
return NULL; return NULL;

36
include/linux/clkdev.h Normal file
View File

@ -0,0 +1,36 @@
/*
* include/linux/clkdev.h
*
* Copyright (C) 2008 Russell King.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Helper for the clk API to assist looking up a struct clk.
*/
#ifndef __CLKDEV_H
#define __CLKDEV_H
#include <asm/clkdev.h>
struct clk;
struct device;
struct clk_lookup {
struct list_head node;
const char *dev_id;
const char *con_id;
struct clk *clk;
};
struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id,
const char *dev_fmt, ...);
void clkdev_add(struct clk_lookup *cl);
void clkdev_drop(struct clk_lookup *cl);
void clkdev_add_table(struct clk_lookup *, size_t);
int clk_add_alias(const char *, const char *, char *, struct device *);
#endif