]> Pileus Git - ~andy/linux/commitdiff
ARM: 6483/1: arm & sh: factorised duplicated clkdev.c
authorJean-Christop PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Wed, 17 Nov 2010 09:04:33 +0000 (10:04 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Fri, 26 Nov 2010 10:51:04 +0000 (10:51 +0000)
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>
72 files changed:
arch/arm/Kconfig
arch/arm/common/Kconfig
arch/arm/common/Makefile
arch/arm/include/asm/clkdev.h
arch/arm/mach-bcmring/clock.c
arch/arm/mach-bcmring/core.c
arch/arm/mach-davinci/clock.h
arch/arm/mach-ep93xx/clock.c
arch/arm/mach-imx/clock-imx1.c
arch/arm/mach-imx/clock-imx21.c
arch/arm/mach-imx/clock-imx27.c
arch/arm/mach-integrator/core.c
arch/arm/mach-integrator/impd1.c
arch/arm/mach-integrator/integrator_cp.c
arch/arm/mach-lpc32xx/clock.c
arch/arm/mach-mmp/clock.h
arch/arm/mach-mx25/clock.c
arch/arm/mach-mx3/clock-imx31.c
arch/arm/mach-mx3/clock-imx35.c
arch/arm/mach-mx5/clock-mx51.c
arch/arm/mach-mxc91231/clock.c
arch/arm/mach-nomadik/clock.c
arch/arm/mach-nuc93x/clock.h
arch/arm/mach-omap1/clock.c
arch/arm/mach-omap2/dpll3xxx.c
arch/arm/mach-pnx4008/clock.c
arch/arm/mach-pxa/clock.c
arch/arm/mach-pxa/clock.h
arch/arm/mach-realview/core.c
arch/arm/mach-shmobile/Kconfig
arch/arm/mach-shmobile/clock-sh7367.c
arch/arm/mach-shmobile/clock-sh7372.c
arch/arm/mach-shmobile/clock-sh7377.c
arch/arm/mach-tcc8k/clock.c
arch/arm/mach-tegra/clock.c
arch/arm/mach-tegra/clock.h
arch/arm/mach-tegra/tegra2_clocks.c
arch/arm/mach-u300/clock.c
arch/arm/mach-ux500/clock.c
arch/arm/mach-versatile/core.c
arch/arm/mach-vexpress/ct-ca9x4.c
arch/arm/mach-vexpress/v2m.c
arch/arm/mach-w90x900/clock.h
arch/arm/plat-omap/Kconfig
arch/arm/plat-omap/include/plat/clkdev_omap.h
arch/arm/plat-spear/include/plat/clock.h
arch/arm/plat-stmp3xxx/clock.c
arch/sh/Kconfig
arch/sh/boards/mach-highlander/setup.c
arch/sh/include/asm/clkdev.h
arch/sh/kernel/Makefile
arch/sh/kernel/clkdev.c [deleted file]
arch/sh/kernel/cpu/clock-cpg.c
arch/sh/kernel/cpu/clock.c
arch/sh/kernel/cpu/sh4/clock-sh4-202.c
arch/sh/kernel/cpu/sh4a/clock-sh7343.c
arch/sh/kernel/cpu/sh4a/clock-sh7366.c
arch/sh/kernel/cpu/sh4a/clock-sh7722.c
arch/sh/kernel/cpu/sh4a/clock-sh7723.c
arch/sh/kernel/cpu/sh4a/clock-sh7724.c
arch/sh/kernel/cpu/sh4a/clock-sh7757.c
arch/sh/kernel/cpu/sh4a/clock-sh7763.c
arch/sh/kernel/cpu/sh4a/clock-sh7780.c
arch/sh/kernel/cpu/sh4a/clock-sh7785.c
arch/sh/kernel/cpu/sh4a/clock-sh7786.c
arch/sh/kernel/cpu/sh4a/clock-shx3.c
drivers/Kconfig
drivers/Makefile
drivers/clk/Kconfig [new file with mode: 0644]
drivers/clk/Makefile [new file with mode: 0644]
drivers/clk/clkdev.c [moved from arch/arm/common/clkdev.c with 93% similarity]
include/linux/clkdev.h [new file with mode: 0644]

index a19a5266d5fc989327d2f5e82b8068e13462a5b8..0e51342b3c024ebb64040ed3c547a1b1125a61f8 100644 (file)
@@ -221,7 +221,7 @@ config ARCH_INTEGRATOR
        bool "ARM Ltd. Integrator family"
        select ARM_AMBA
        select ARCH_HAS_CPUFREQ
-       select COMMON_CLKDEV
+       select CLKDEV_LOOKUP
        select ICST
        select GENERIC_CLOCKEVENTS
        select PLAT_VERSATILE
@@ -231,7 +231,7 @@ config ARCH_INTEGRATOR
 config ARCH_REALVIEW
        bool "ARM Ltd. RealView family"
        select ARM_AMBA
-       select COMMON_CLKDEV
+       select CLKDEV_LOOKUP
        select ICST
        select GENERIC_CLOCKEVENTS
        select ARCH_WANT_OPTIONAL_GPIOLIB
@@ -245,7 +245,7 @@ config ARCH_VERSATILE
        bool "ARM Ltd. Versatile family"
        select ARM_AMBA
        select ARM_VIC
-       select COMMON_CLKDEV
+       select CLKDEV_LOOKUP
        select ICST
        select GENERIC_CLOCKEVENTS
        select ARCH_WANT_OPTIONAL_GPIOLIB
@@ -259,7 +259,7 @@ config ARCH_VEXPRESS
        select ARCH_WANT_OPTIONAL_GPIOLIB
        select ARM_AMBA
        select ARM_TIMER_SP804
-       select COMMON_CLKDEV
+       select CLKDEV_LOOKUP
        select GENERIC_CLOCKEVENTS
        select HAVE_CLK
        select ICST
@@ -280,7 +280,7 @@ config ARCH_BCMRING
        depends on MMU
        select CPU_V6
        select ARM_AMBA
-       select COMMON_CLKDEV
+       select CLKDEV_LOOKUP
        select GENERIC_CLOCKEVENTS
        select ARCH_WANT_OPTIONAL_GPIOLIB
        help
@@ -327,7 +327,7 @@ config ARCH_EP93XX
        select CPU_ARM920T
        select ARM_AMBA
        select ARM_VIC
-       select COMMON_CLKDEV
+       select CLKDEV_LOOKUP
        select ARCH_REQUIRE_GPIOLIB
        select ARCH_HAS_HOLES_MEMORYMODEL
        select ARCH_USES_GETTIMEOFFSET
@@ -347,14 +347,14 @@ config ARCH_MXC
        bool "Freescale MXC/iMX-based"
        select GENERIC_CLOCKEVENTS
        select ARCH_REQUIRE_GPIOLIB
-       select COMMON_CLKDEV
+       select CLKDEV_LOOKUP
        help
          Support for Freescale MXC/iMX-based family of processors
 
 config ARCH_STMP3XXX
        bool "Freescale STMP3xxx"
        select CPU_ARM926T
-       select COMMON_CLKDEV
+       select CLKDEV_LOOKUP
        select ARCH_REQUIRE_GPIOLIB
        select GENERIC_CLOCKEVENTS
        select USB_ARCH_HAS_EHCI
@@ -472,7 +472,7 @@ config ARCH_LPC32XX
        select HAVE_IDE
        select ARM_AMBA
        select USB_ARCH_HAS_OHCI
-       select COMMON_CLKDEV
+       select CLKDEV_LOOKUP
        select GENERIC_TIME
        select GENERIC_CLOCKEVENTS
        help
@@ -506,7 +506,7 @@ config ARCH_MMP
        bool "Marvell PXA168/910/MMP2"
        depends on MMU
        select ARCH_REQUIRE_GPIOLIB
-       select COMMON_CLKDEV
+       select CLKDEV_LOOKUP
        select GENERIC_CLOCKEVENTS
        select TICK_ONESHOT
        select PLAT_PXA
@@ -539,7 +539,7 @@ config ARCH_W90X900
        bool "Nuvoton W90X900 CPU"
        select CPU_ARM926T
        select ARCH_REQUIRE_GPIOLIB
-       select COMMON_CLKDEV
+       select CLKDEV_LOOKUP
        select GENERIC_CLOCKEVENTS
        help
          Support for Nuvoton (Winbond logic dept.) ARM9 processor,
@@ -553,7 +553,7 @@ config ARCH_W90X900
 config ARCH_NUC93X
        bool "Nuvoton NUC93X CPU"
        select CPU_ARM926T
-       select COMMON_CLKDEV
+       select CLKDEV_LOOKUP
        help
          Support for Nuvoton (Winbond logic dept.) NUC93X MCU,The NUC93X is a
          low-power and high performance MPEG-4/JPEG multimedia controller chip.
@@ -564,7 +564,7 @@ config ARCH_TEGRA
        select GENERIC_CLOCKEVENTS
        select GENERIC_GPIO
        select HAVE_CLK
-       select COMMON_CLKDEV
+       select CLKDEV_LOOKUP
        select ARCH_HAS_BARRIERS if CACHE_L2X0
        select ARCH_HAS_CPUFREQ
        help
@@ -574,7 +574,7 @@ config ARCH_TEGRA
 config ARCH_PNX4008
        bool "Philips Nexperia PNX4008 Mobile"
        select CPU_ARM926T
-       select COMMON_CLKDEV
+       select CLKDEV_LOOKUP
        select ARCH_USES_GETTIMEOFFSET
        help
          This enables support for Philips PNX4008 mobile platform.
@@ -584,7 +584,7 @@ config ARCH_PXA
        depends on MMU
        select ARCH_MTD_XIP
        select ARCH_HAS_CPUFREQ
-       select COMMON_CLKDEV
+       select CLKDEV_LOOKUP
        select ARCH_REQUIRE_GPIOLIB
        select GENERIC_CLOCKEVENTS
        select TICK_ONESHOT
@@ -761,7 +761,7 @@ config ARCH_TCC_926
        bool "Telechips TCC ARM926-based systems"
        select CPU_ARM926T
        select HAVE_CLK
-       select COMMON_CLKDEV
+       select CLKDEV_LOOKUP
        select GENERIC_CLOCKEVENTS
        help
          Support for Telechips TCC ARM926-based systems.
@@ -785,7 +785,7 @@ config ARCH_U300
        select ARM_AMBA
        select ARM_VIC
        select GENERIC_CLOCKEVENTS
-       select COMMON_CLKDEV
+       select CLKDEV_LOOKUP
        select GENERIC_GPIO
        help
          Support for ST-Ericsson U300 series mobile platforms.
@@ -795,7 +795,7 @@ config ARCH_U8500
        select CPU_V7
        select ARM_AMBA
        select GENERIC_CLOCKEVENTS
-       select COMMON_CLKDEV
+       select CLKDEV_LOOKUP
        select ARCH_REQUIRE_GPIOLIB
        help
          Support for ST-Ericsson's Ux500 architecture
@@ -805,7 +805,7 @@ config ARCH_NOMADIK
        select ARM_AMBA
        select ARM_VIC
        select CPU_ARM926T
-       select COMMON_CLKDEV
+       select CLKDEV_LOOKUP
        select GENERIC_CLOCKEVENTS
        select ARCH_REQUIRE_GPIOLIB
        help
@@ -817,7 +817,7 @@ config ARCH_DAVINCI
        select ARCH_REQUIRE_GPIOLIB
        select ZONE_DMA
        select HAVE_IDE
-       select COMMON_CLKDEV
+       select CLKDEV_LOOKUP
        select GENERIC_ALLOCATOR
        select ARCH_HAS_HOLES_MEMORYMODEL
        help
@@ -837,7 +837,7 @@ config PLAT_SPEAR
        bool "ST SPEAr"
        select ARM_AMBA
        select ARCH_REQUIRE_GPIOLIB
-       select COMMON_CLKDEV
+       select CLKDEV_LOOKUP
        select GENERIC_CLOCKEVENTS
        select HAVE_CLK
        help
index 0a34c8186924415398601d46d488a2b011136219..778655f0257a9f27f73d3c1a0fddd81eb28919f4 100644 (file)
@@ -37,7 +37,3 @@ config SHARP_PARAM
 
 config SHARP_SCOOP
        bool
-
-config COMMON_CLKDEV
-       bool
-       select HAVE_CLK
index e6e8664a94139cd7e4086020d537ded4ca087f9e..799e140274f15597240e59e6d44d29331044de0f 100644 (file)
@@ -16,4 +16,3 @@ obj-$(CONFIG_SHARP_SCOOP)     += scoop.o
 obj-$(CONFIG_ARCH_IXP2000)     += uengine.o
 obj-$(CONFIG_ARCH_IXP23XX)     += uengine.o
 obj-$(CONFIG_PCI_HOST_ITE8152)  += it8152.o
-obj-$(CONFIG_COMMON_CLKDEV)    += clkdev.o
index b56c1389b6fa49da16bb940a04931480a4466c84..765d3322236942473fb342ad49a32746200f6bc3 100644 (file)
 #ifndef __ASM_CLKDEV_H
 #define __ASM_CLKDEV_H
 
-struct clk;
-struct device;
+#include <linux/slab.h>
 
-struct clk_lookup {
-       struct list_head        node;
-       const char              *dev_id;
-       const char              *con_id;
-       struct clk              *clk;
-};
+#include <mach/clkdev.h>
 
-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 *);
+static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size)
+{
+       return kzalloc(size, GFP_KERNEL);
+}
 
 #endif
index 14bafc38f2dcc05e51443db5f90f7d1e0d356f4b..ad237a42d265ec6033c85d7684f16940551c17ad 100644 (file)
 #include <linux/string.h>
 #include <linux/clk.h>
 #include <linux/spinlock.h>
+#include <linux/clkdev.h>
 #include <mach/csp/hw_cfg.h>
 #include <mach/csp/chipcHw_def.h>
 #include <mach/csp/chipcHw_reg.h>
 #include <mach/csp/chipcHw_inline.h>
 
-#include <asm/clkdev.h>
-
 #include "clock.h"
 
 #define clk_is_primary(x)       ((x)->type & CLK_TYPE_PRIMARY)
index d3f959e92b2dd2ef15e129a3bd79e52801811efe..ed96ef400474b4f3a4dbaec9153d3481380c1639 100644 (file)
 #include <linux/amba/bus.h>
 #include <linux/clocksource.h>
 #include <linux/clockchips.h>
+#include <linux/clkdev.h>
 
 #include <mach/csp/mm_addr.h>
 #include <mach/hardware.h>
-#include <asm/clkdev.h>
 #include <linux/io.h>
 #include <asm/irq.h>
 #include <asm/hardware/arm_timer.h>
index 11099980b58bdfc2342ba67a8ccd373f07fb4fdf..0dd22031ec6222467a4a3a5ccb0eb27405e1d510 100644 (file)
@@ -68,7 +68,7 @@
 #ifndef __ASSEMBLER__
 
 #include <linux/list.h>
-#include <asm/clkdev.h>
+#include <linux/clkdev.h>
 
 #define PLLSTAT_GOSTAT BIT(0)
 #define PLLCMD_GOSET   BIT(0)
index ef06c66a6f1630cbab1ec79487382dc8704f4049..ca4de71050973184945297febfc7b2111103f76c 100644 (file)
 #include <linux/string.h>
 #include <linux/io.h>
 #include <linux/spinlock.h>
+#include <linux/clkdev.h>
 
 #include <mach/hardware.h>
 
-#include <asm/clkdev.h>
 #include <asm/div64.h>
 
 
index daca30b2d5b1ad5d77c03e8166910a8b7ca5a066..3938a563b2807d70f89d4eedcb4e2a2d9537a170 100644 (file)
@@ -22,8 +22,7 @@
 #include <linux/err.h>
 #include <linux/clk.h>
 #include <linux/io.h>
-
-#include <asm/clkdev.h>
+#include <linux/clkdev.h>
 
 #include <mach/clock.h>
 #include <mach/hardware.h>
index cf15ea516a72c4e177d1d4d66374ea0a4ed8676f..d7056559715a0de656f4064b95f01381935fa60d 100644 (file)
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/module.h>
+#include <linux/clkdev.h>
 
 #include <mach/clock.h>
 #include <mach/hardware.h>
 #include <mach/common.h>
-#include <asm/clkdev.h>
 #include <asm/div64.h>
 
 #define IO_ADDR_CCM(off)       (MX21_IO_ADDRESS(MX21_CCM_BASE_ADDR + (off)))
index 98a25bada783fef44c1c5911dcc5cd7ca7ab8c9a..ca1017b9028d0a2bc9c186236fe3a3d5277aeaca 100644 (file)
@@ -21,8 +21,8 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/module.h>
+#include <linux/clkdev.h>
 
-#include <asm/clkdev.h>
 #include <asm/div64.h>
 
 #include <mach/clock.h>
index 8f4fb6d638f7ea66717a5afb5d962ef0d88723a3..b8e884b450da7454e77b9fe3d030f2729aacd8aa 100644 (file)
@@ -21,9 +21,8 @@
 #include <linux/amba/bus.h>
 #include <linux/amba/serial.h>
 #include <linux/io.h>
+#include <linux/clkdev.h>
 
-#include <asm/clkdev.h>
-#include <mach/clkdev.h>
 #include <mach/hardware.h>
 #include <mach/platform.h>
 #include <asm/irq.h>
index fd684bf205e5d228b11ccf13685d9ed14229be96..5db574f8ae3fd218d393898512930adf53fe2bf3 100644 (file)
@@ -22,9 +22,8 @@
 #include <linux/amba/clcd.h>
 #include <linux/io.h>
 #include <linux/slab.h>
+#include <linux/clkdev.h>
 
-#include <asm/clkdev.h>
-#include <mach/clkdev.h>
 #include <asm/hardware/icst.h>
 #include <mach/lm.h>
 #include <mach/impd1.h>
index 6258c90d020c30edf75faa7f06976d6cedef2e7e..9403d2fa13a39fd58877b6c47f48fafc3f22b4cb 100644 (file)
@@ -21,9 +21,8 @@
 #include <linux/amba/mmci.h>
 #include <linux/io.h>
 #include <linux/gfp.h>
+#include <linux/clkdev.h>
 
-#include <asm/clkdev.h>
-#include <mach/clkdev.h>
 #include <mach/hardware.h>
 #include <mach/platform.h>
 #include <asm/irq.h>
index 32d63796430aa12d91e7391fdc7f293bfca92f0d..da0e6498110a4f6400274b74015e964ab81566f5 100644 (file)
 #include <linux/clk.h>
 #include <linux/amba/bus.h>
 #include <linux/amba/clcd.h>
+#include <linux/clkdev.h>
 
 #include <mach/hardware.h>
-#include <asm/clkdev.h>
-#include <mach/clkdev.h>
 #include <mach/platform.h>
 #include "clock.h"
 #include "common.h"
index 016ae94691c04cd42838c9b0af352b68a6e7cacc..9b027d7491f5e9ba854e496568eaa2fafdc9be5e 100644 (file)
@@ -6,7 +6,7 @@
  *  published by the Free Software Foundation.
  */
 
-#include <asm/clkdev.h>
+#include <linux/clkdev.h>
 
 struct clkops {
        void                    (*enable)(struct clk *);
index 9e4a5578c2fb9dc6a392aa07b5fb085dde900651..00dcb08019e96e2b41e127edd2a62ef1c52f8c9b 100644 (file)
@@ -21,8 +21,7 @@
 #include <linux/list.h>
 #include <linux/clk.h>
 #include <linux/io.h>
-
-#include <asm/clkdev.h>
+#include <linux/clkdev.h>
 
 #include <mach/clock.h>
 #include <mach/hardware.h>
index 109e98f323e0568a299d46f1481ee3a31116476e..1cd8b40b7676c1f7d0feb5ddae10a4fb9a264df6 100644 (file)
@@ -23,8 +23,8 @@
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/io.h>
+#include <linux/clkdev.h>
 
-#include <asm/clkdev.h>
 #include <asm/div64.h>
 
 #include <mach/clock.h>
index 61e4a318980a2bc9fe4fa25c7de02a08a7b89bb8..819dd809615a430c59a161eef21edc186ed14b7b 100644 (file)
@@ -21,8 +21,7 @@
 #include <linux/list.h>
 #include <linux/clk.h>
 #include <linux/io.h>
-
-#include <asm/clkdev.h>
+#include <linux/clkdev.h>
 
 #include <mach/clock.h>
 #include <mach/hardware.h>
index 8ac36d88292764634b7897f5e55a6bfb3615b293..5975edb47de82ad76e9518bb77a15410faf1fd89 100644 (file)
@@ -14,8 +14,8 @@
 #include <linux/delay.h>
 #include <linux/clk.h>
 #include <linux/io.h>
+#include <linux/clkdev.h>
 
-#include <asm/clkdev.h>
 #include <asm/div64.h>
 
 #include <mach/hardware.h>
index 5c85075d8a56b9b6c40059785dd9a4cd69658632..9fab505f1eb1a2c73b14ea489553442956782af0 100644 (file)
@@ -2,12 +2,12 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/io.h>
+#include <linux/clkdev.h>
 
 #include <mach/clock.h>
 #include <mach/hardware.h>
 #include <mach/common.h>
 
-#include <asm/clkdev.h>
 #include <asm/bug.h>
 #include <asm/div64.h>
 
index 89f793adf77643093c9e465c35447553102ae295..48a59f24e10c16bd6aed13b846f86973e2a9324a 100644 (file)
@@ -7,7 +7,7 @@
 #include <linux/module.h>
 #include <linux/errno.h>
 #include <linux/clk.h>
-#include <asm/clkdev.h>
+#include <linux/clkdev.h>
 #include "clock.h"
 
 /*
index 18e51be4816f7bece014b71f8ac16f380ab416f1..4de1f1da9dc52d43c2898cbfa1d1d5a38efc382f 100644 (file)
@@ -10,7 +10,7 @@
  * 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 clks_register(struct clk_lookup *clks, size_t num);
index b8c7fb9d792108adbccb8b342083c7551830924f..84ef70476b511e1005b75f7e80b633ef3a66c7fd 100644 (file)
@@ -17,9 +17,9 @@
 #include <linux/err.h>
 #include <linux/clk.h>
 #include <linux/io.h>
+#include <linux/clkdev.h>
 
 #include <asm/mach-types.h>
-#include <asm/clkdev.h>
 
 #include <plat/cpu.h>
 #include <plat/usb.h>
index ed8d330522f18043a0b8ce6be06023a92988e988..ebb888f59365c29ffe8567bbaa6321de9358d9b4 100644 (file)
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/bitops.h>
+#include <linux/clkdev.h>
 
 #include <plat/cpu.h>
 #include <plat/clock.h>
-#include <asm/clkdev.h>
 
 #include "clock.h"
 #include "prm.h"
index 9d1975fa4d9f2c2e71e3782c7716bd66c5c67dff..a4a3819c96cbf2777da665a5ccef10323f7caab5 100644 (file)
@@ -21,8 +21,7 @@
 #include <linux/err.h>
 #include <linux/delay.h>
 #include <linux/io.h>
-
-#include <asm/clkdev.h>
+#include <linux/clkdev.h>
 
 #include <mach/hardware.h>
 #include <mach/clock.h>
index abba0089a2ae0d6af3ca35a9bf961d9a5a65406e..4e4a84be96baccc41fab586fd02042a0dd730ce0 100644 (file)
@@ -11,8 +11,8 @@
 #include <linux/spinlock.h>
 #include <linux/platform_device.h>
 #include <linux/delay.h>
+#include <linux/clkdev.h>
 
-#include <asm/clkdev.h>
 #include <mach/pxa2xx-regs.h>
 #include <mach/hardware.h>
 
index d8488742b8075179fd4d66026d79730e00505a21..12cc0e87e6c43e880b1876901c00bc7491e76679 100644 (file)
@@ -1,4 +1,4 @@
-#include <asm/clkdev.h>
+#include <linux/clkdev.h>
 
 struct clkops {
        void                    (*enable)(struct clk *);
index 07c08151dfe6434be39b510e215acd79e86ea297..3d915b1ccdb51d5c24cacd437d586918c2be5bea 100644 (file)
@@ -30,8 +30,8 @@
 #include <linux/ata_platform.h>
 #include <linux/amba/mmci.h>
 #include <linux/gfp.h>
+#include <linux/clkdev.h>
 
-#include <asm/clkdev.h>
 #include <asm/system.h>
 #include <mach/hardware.h>
 #include <asm/irq.h>
@@ -47,7 +47,6 @@
 
 #include <asm/hardware/gic.h>
 
-#include <mach/clkdev.h>
 #include <mach/platform.h>
 #include <mach/irqs.h>
 #include <plat/timer-sp.h>
index 54b479c35ee01d2db0f2f5c75f9786f329293146..f8f06e9fec35d357beceb96004b4c416fdfa8d91 100644 (file)
@@ -6,7 +6,7 @@ config ARCH_SH7367
        bool "SH-Mobile G3 (SH7367)"
        select CPU_V6
        select HAVE_CLK
-       select COMMON_CLKDEV
+       select CLKDEV_LOOKUP
        select SH_CLK_CPG
        select GENERIC_CLOCKEVENTS
 
@@ -14,7 +14,7 @@ config ARCH_SH7377
        bool "SH-Mobile G4 (SH7377)"
        select CPU_V7
        select HAVE_CLK
-       select COMMON_CLKDEV
+       select CLKDEV_LOOKUP
        select SH_CLK_CPG
        select GENERIC_CLOCKEVENTS
 
@@ -22,7 +22,7 @@ config ARCH_SH7372
        bool "SH-Mobile AP4 (SH7372)"
        select CPU_V7
        select HAVE_CLK
-       select COMMON_CLKDEV
+       select CLKDEV_LOOKUP
        select SH_CLK_CPG
        select GENERIC_CLOCKEVENTS
 
index 9f78729098f2721bdd3b46c866ea6fed1a7e08e0..6b186aefcbd63792e22167e47fda0d02a9d9fcef 100644 (file)
@@ -20,8 +20,8 @@
 #include <linux/kernel.h>
 #include <linux/io.h>
 #include <linux/sh_clk.h>
+#include <linux/clkdev.h>
 #include <mach/common.h>
-#include <asm/clkdev.h>
 
 /* SH7367 registers */
 #define RTFRQCR    0xe6150000
index 8565aefa21fd3c2e62877c3de33a43d8390dda76..445112adba460c9b65b6fc7381a4f5cdfa6c473f 100644 (file)
@@ -20,8 +20,8 @@
 #include <linux/kernel.h>
 #include <linux/io.h>
 #include <linux/sh_clk.h>
+#include <linux/clkdev.h>
 #include <mach/common.h>
-#include <asm/clkdev.h>
 
 /* SH7372 registers */
 #define FRQCRA         0xe6150000
index f91395aeb9abadd50b13c037670d23260e841920..95942466e63f212fb89c8d7392c15b7507afcb34 100644 (file)
@@ -20,8 +20,8 @@
 #include <linux/kernel.h>
 #include <linux/io.h>
 #include <linux/sh_clk.h>
+#include <linux/clkdev.h>
 #include <mach/common.h>
-#include <asm/clkdev.h>
 
 /* SH7377 registers */
 #define RTFRQCR    0xe6150000
index ba32a15127ab7afdd7fe53354dafd902c2939fca..3970a9cdce26e3d3afc39c1d7630639238744769 100644 (file)
@@ -12,8 +12,7 @@
 #include <linux/io.h>
 #include <linux/module.h>
 #include <linux/spinlock.h>
-
-#include <asm/clkdev.h>
+#include <linux/clkdev.h>
 
 #include <mach/clock.h>
 #include <mach/irqs.h>
index ae19f95585be119c51456a9d2d75183fc3b1ff4c..77948e0f49098e5decc0858257e26a0e30537d59 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/slab.h>
 #include <linux/seq_file.h>
 #include <linux/regulator/consumer.h>
-#include <asm/clkdev.h>
+#include <linux/clkdev.h>
 
 #include "clock.h"
 #include "board.h"
index 94fd859770f1a992a0bd001e265a781c3bf7448b..083a4cfc6cf0d0ef635a74950a5557415e31e9b1 100644 (file)
@@ -21,7 +21,7 @@
 #define __MACH_TEGRA_CLOCK_H
 
 #include <linux/list.h>
-#include <asm/clkdev.h>
+#include <linux/clkdev.h>
 
 #define DIV_BUS                        (1 << 0)
 #define DIV_U71                        (1 << 1)
index ae3b308e22a4d158b464d8b47f383a7509cf6efd..f0dae6d8ba520a5046848dc7710caa92624a4f0d 100644 (file)
@@ -24,8 +24,7 @@
 #include <linux/delay.h>
 #include <linux/io.h>
 #include <linux/hrtimer.h>
-
-#include <asm/clkdev.h>
+#include <linux/clkdev.h>
 
 #include <mach/iomap.h>
 
index 7458fc6df5c67b466184bc6a4a317745304101ee..fabcc49abe80c7e63bbec3cedc275d60ad6c4728 100644 (file)
@@ -25,8 +25,8 @@
 #include <linux/timer.h>
 #include <linux/io.h>
 #include <linux/seq_file.h>
+#include <linux/clkdev.h>
 
-#include <asm/clkdev.h>
 #include <mach/hardware.h>
 #include <mach/syscon.h>
 
index 1675047daf20f74f5f00a1a7e88feab2e5c4f281..531de5c63641566a32a4640bd07e87276049f0fc 100644 (file)
@@ -13,8 +13,7 @@
 #include <linux/err.h>
 #include <linux/clk.h>
 #include <linux/io.h>
-
-#include <asm/clkdev.h>
+#include <linux/clkdev.h>
 
 #include <plat/mtu.h>
 #include <mach/hardware.h>
index e38acb0f89c884b961bdb1dc11fa59b1a0112bc0..8c1ca1d63538f9b0dbfda7152972bb41b05014a0 100644 (file)
@@ -31,8 +31,8 @@
 #include <linux/amba/pl022.h>
 #include <linux/io.h>
 #include <linux/gfp.h>
+#include <linux/clkdev.h>
 
-#include <asm/clkdev.h>
 #include <asm/system.h>
 #include <asm/irq.h>
 #include <asm/leds.h>
@@ -46,7 +46,6 @@
 #include <asm/mach/irq.h>
 #include <asm/mach/time.h>
 #include <asm/mach/map.h>
-#include <mach/clkdev.h>
 #include <mach/hardware.h>
 #include <mach/platform.h>
 #include <plat/timer-sp.h>
index c2e405a9e0256141d62dfad2f359bfa7bac87555..26a02eb5757162b1804ba75dd96143d4e93999d6 100644 (file)
@@ -8,8 +8,8 @@
 #include <linux/platform_device.h>
 #include <linux/amba/bus.h>
 #include <linux/amba/clcd.h>
+#include <linux/clkdev.h>
 
-#include <asm/clkdev.h>
 #include <asm/pgtable.h>
 #include <asm/hardware/arm_timer.h>
 #include <asm/hardware/cache-l2x0.h>
@@ -18,7 +18,6 @@
 #include <asm/pmu.h>
 #include <asm/smp_twd.h>
 
-#include <mach/clkdev.h>
 #include <mach/ct-ca9x4.h>
 
 #include <plat/timer-sp.h>
index 7eaa232180a5ae627c3639ba642755444a5d3e27..d374a78986e8b438e7f9cea51aebb2de499ee46c 100644 (file)
 #include <linux/spinlock.h>
 #include <linux/sysdev.h>
 #include <linux/usb/isp1760.h>
+#include <linux/clkdev.h>
 
-#include <asm/clkdev.h>
 #include <asm/sizes.h>
 #include <asm/mach/flash.h>
 #include <asm/mach/map.h>
 #include <asm/mach/time.h>
 #include <asm/hardware/arm_timer.h>
 
-#include <mach/clkdev.h>
 #include <mach/motherboard.h>
 
 #include <plat/timer-sp.h>
index c56ddab3d9128acce33ba0d293a3dcfa29bcd08c..b88a1b16b2e965b29c88417b0c153e662a382e5f 100644 (file)
@@ -10,7 +10,7 @@
  * 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_subclk_enable(struct clk *clk, int enable);
index 92c5bb7909f5632c6d0132813292e655a1d16161..c9408434a855ecaf648c63cbc83efb4699f3a5f2 100644 (file)
@@ -11,13 +11,13 @@ choice
 
 config ARCH_OMAP1
        bool "TI OMAP1"
-       select COMMON_CLKDEV
+       select CLKDEV_LOOKUP
        help
          "Systems based on omap7xx, omap15xx or omap16xx"
 
 config ARCH_OMAP2PLUS
        bool "TI OMAP2/3/4"
-       select COMMON_CLKDEV
+       select CLKDEV_LOOKUP
        help
          "Systems based on OMAP2, OMAP3 or OMAP4"
 
index bb937f3fabed3b9f88b9cb98df6109748d3d312b..4b2028ab4d2b5ca0047297ac7532be2add5a4002 100644 (file)
@@ -8,7 +8,7 @@
 #ifndef __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 {
        u16                             cpu;
index 298bafc0a52f71d4edfa91fca8c146204329216e..2572260f990f1494f98fff245d338a8dae15ad0b 100644 (file)
@@ -15,7 +15,7 @@
 #define __PLAT_CLOCK_H
 
 #include <linux/list.h>
-#include <asm/clkdev.h>
+#include <linux/clkdev.h>
 #include <linux/types.h>
 
 /* clk structure flags */
index e593a2a801c63370efea993d529adf8b8960e0f4..2e712e17ce7257757c4592587ce63b296e39f995 100644 (file)
@@ -25,9 +25,9 @@
 #include <linux/err.h>
 #include <linux/delay.h>
 #include <linux/io.h>
+#include <linux/clkdev.h>
 
 #include <asm/mach-types.h>
-#include <asm/clkdev.h>
 #include <mach/platform.h>
 #include <mach/regs-clkctrl.h>
 
index 5c075f562ebae912476974f20faee1bfaeec707d..cfc510608039b3e87063e6f649fb8426758931fd 100644 (file)
@@ -1,7 +1,7 @@
 config SUPERH
        def_bool y
        select EMBEDDED
-       select HAVE_CLK
+       select CLKDEV_LOOKUP
        select HAVE_IDE if HAS_IOPORT
        select HAVE_MEMBLOCK
        select HAVE_OPROFILE
index a5ecfbacaf36b37c3f812c5ca9b2189a3c077447..87618c91d1781881140d7e55fbf7e2a718d1c142 100644 (file)
 #include <linux/interrupt.h>
 #include <linux/usb/r8a66597.h>
 #include <linux/usb/m66592.h>
+#include <linux/clkdev.h>
 #include <net/ax88796.h>
 #include <asm/machvec.h>
 #include <mach/highlander.h>
-#include <asm/clkdev.h>
 #include <asm/clock.h>
 #include <asm/heartbeat.h>
 #include <asm/io.h>
index 5645f358128b62586ccfdcaf42022deb2db5c3ce..6ba91868201ce947f625a5c982c0b4ec3a290653 100644 (file)
@@ -1,9 +1,5 @@
 /*
- *  arch/sh/include/asm/clkdev.h
- *
- * Cloned from arch/arm/include/asm/clkdev.h:
- *
- *  Copyright (C) 2008 Russell King.
+ *  Copyright (C) 2010 Paul Mundt <lethal@linux-sh.org>
  *
  * 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
  *
  * 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 {
-       struct list_head        node;
-       const char              *dev_id;
-       const char              *con_id;
-       struct clk              *clk;
-};
+#include <linux/bootmem.h>
+#include <linux/mm.h>
+#include <linux/slab.h>
 
-struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id,
-       const char *dev_fmt, ...);
+#include <asm/clock.h>
 
-void clkdev_add(struct clk_lookup *cl);
-void clkdev_drop(struct clk_lookup *cl);
+static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size)
+{
+       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);
-int clk_add_alias(const char *, const char *, char *, struct device *);
+#define __clk_put(clk)
+#define __clk_get(clk) ({ 1; })
 
-#endif
+#endif /* __CLKDEV_H__ */
index 8eed6a4854463418c26dfd7410874481706e5adf..cf652217952382622273c6c0663b958cb9d42824 100644 (file)
@@ -11,7 +11,7 @@ endif
 
 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                   \
           machvec.o nmi_debug.o process.o                              \
           process_$(BITS).o ptrace.o ptrace_$(BITS).o                  \
diff --git a/arch/sh/kernel/clkdev.c b/arch/sh/kernel/clkdev.c
deleted file mode 100644 (file)
index 1f800ef..0000000
+++ /dev/null
@@ -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);
index e2f63d68da5153d2d754798719b0f3f7fde39c8d..dd0e0f2113598801270737de56eb3c8d4672a112 100644 (file)
@@ -2,7 +2,7 @@
 #include <linux/compiler.h>
 #include <linux/slab.h>
 #include <linux/io.h>
-#include <asm/clkdev.h>
+#include <linux/clkdev.h>
 #include <asm/clock.h>
 
 static struct clk master_clk = {
index 50f887dda56550bde11bc85101000ca224a4e75a..4187cf4fe18583b74533536e9c491dee3246dcc9 100644 (file)
@@ -48,20 +48,4 @@ int __init clk_init(void)
        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);
 
index 4eabc68cd75325cb9952914879cb2b7235bac3a3..6c1492b8431a2ca5f0f8c0d71166dd8610ba1434 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/kernel.h>
 #include <linux/err.h>
 #include <linux/io.h>
-#include <asm/clkdev.h>
+#include <linux/clkdev.h>
 #include <asm/clock.h>
 #include <asm/freq.h>
 
index 71291ae201b9f4ed0c5693bdbe3dfd529795ad29..93c646072c1b93005bb6b13dff60c5afeb882854 100644 (file)
@@ -21,7 +21,7 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/io.h>
-#include <asm/clkdev.h>
+#include <linux/clkdev.h>
 #include <asm/clock.h>
 
 /* SH7343 registers */
index 7ce5bbcd4084d0fd8efc4032ace6a11241e27b13..049dc0628ccc196d48c75a0aa4f8a2469f0575f2 100644 (file)
@@ -21,7 +21,7 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/io.h>
-#include <asm/clkdev.h>
+#include <linux/clkdev.h>
 #include <asm/clock.h>
 
 /* SH7366 registers */
index 2030f3d9fac7e59ddcb725295e4bf555bf272223..9d23a36f0647b97a6b5afc24ac4f7078262f57b1 100644 (file)
@@ -21,7 +21,7 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/io.h>
-#include <asm/clkdev.h>
+#include <linux/clkdev.h>
 #include <asm/clock.h>
 #include <asm/hwblk.h>
 #include <cpu/sh7722.h>
index d3938f0d37029775743265fe46319d0d03b9c70f..55493cd5bd8f3b5ce3860431882c6341539d2efb 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/kernel.h>
 #include <linux/io.h>
 #include <linux/clk.h>
-#include <asm/clkdev.h>
+#include <linux/clkdev.h>
 #include <asm/clock.h>
 #include <asm/hwblk.h>
 #include <cpu/sh7723.h>
index 2d9700c6b53a07426bdc6253e55a62effed962c0..527936bb3ce0ffd58aef72f473eb5db3e3c69536 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/kernel.h>
 #include <linux/io.h>
 #include <linux/clk.h>
-#include <asm/clkdev.h>
+#include <linux/clkdev.h>
 #include <asm/clock.h>
 #include <asm/hwblk.h>
 #include <cpu/sh7724.h>
index ce39a2ae8c6cd8a8140a9bd8a09a977b75a48a27..e073e3eb4c3de8e3933a919c27ec194ab4f29e25 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/io.h>
-#include <asm/clkdev.h>
+#include <linux/clkdev.h>
 #include <asm/clock.h>
 #include <asm/freq.h>
 
index 1f1df48008cdfaf7bfe4d15e6a2ba375c3d7583f..599630fc4d3bd952ae04bd4fb11565f7a0546a30 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/io.h>
-#include <asm/clkdev.h>
+#include <linux/clkdev.h>
 #include <asm/clock.h>
 #include <asm/freq.h>
 #include <asm/io.h>
index 62d706350060089add0e76aa4c1f3b5b3fd00dac..8894926479a614234302af0f7f51fbc3e9f56266 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/io.h>
-#include <asm/clkdev.h>
+#include <linux/clkdev.h>
 #include <asm/clock.h>
 #include <asm/freq.h>
 #include <asm/io.h>
index c3e458aaa2b7ecc167da7bb0d31cd51911970768..2d960247f3ebff7e8e4b55865176ed3244b0aa56 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/cpufreq.h>
-#include <asm/clkdev.h>
+#include <linux/clkdev.h>
 #include <asm/clock.h>
 #include <asm/freq.h>
 #include <cpu/sh7785.h>
index 597c9fbe49c6d88e45a248c424400422e949188f..42e403be9076da889384ec7544627bd144e47f1a 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/kernel.h>
 #include <linux/clk.h>
 #include <linux/io.h>
-#include <asm/clkdev.h>
+#include <linux/clkdev.h>
 #include <asm/clock.h>
 #include <asm/freq.h>
 
index 4f70df6b6169cb5170261f60f28cdf4b66b4107a..1afdb93b8ccb28d9c3ce42517288934496a718cc 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/io.h>
-#include <asm/clkdev.h>
+#include <linux/clkdev.h>
 #include <asm/clock.h>
 #include <asm/freq.h>
 
index a2b902f4d43706334e87b30656b1addc399b1c77..3d93b3a3d630ca9e71f7775691a5071546f45746 100644 (file)
@@ -111,4 +111,6 @@ source "drivers/xen/Kconfig"
 source "drivers/staging/Kconfig"
 
 source "drivers/platform/Kconfig"
+
+source "drivers/clk/Kconfig"
 endmenu
index 14cf9077bb2bcf4f01025518b11b0e87e072e9b5..4af7d5b124ce238280bf45da2122fb755a2f55c8 100644 (file)
@@ -114,3 +114,5 @@ obj-$(CONFIG_VLYNQ)         += vlynq/
 obj-$(CONFIG_STAGING)          += staging/
 obj-y                          += platform/
 obj-y                          += ieee802154/
+#common clk code
+obj-y                          += clk/
diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
new file mode 100644 (file)
index 0000000..4168c88
--- /dev/null
@@ -0,0 +1,4 @@
+
+config CLKDEV_LOOKUP
+       bool
+       select HAVE_CLK
diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
new file mode 100644 (file)
index 0000000..07613fa
--- /dev/null
@@ -0,0 +1,2 @@
+
+obj-$(CONFIG_CLKDEV_LOOKUP)    += clkdev.o
similarity index 93%
rename from arch/arm/common/clkdev.c
rename to drivers/clk/clkdev.c
index e2b2bb66e09490e0761c8949cea58f466acb6384..0fc0a79852de0f919bd2ac9ac117533ed8a0f991 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  arch/arm/common/clkdev.c
+ * drivers/clk/clkdev.c
  *
  *  Copyright (C) 2008 Russell King.
  *
 #include <linux/string.h>
 #include <linux/mutex.h>
 #include <linux/clk.h>
-#include <linux/slab.h>
-
-#include <asm/clkdev.h>
-#include <mach/clkdev.h>
+#include <linux/clkdev.h>
 
 static LIST_HEAD(clocks);
 static DEFINE_MUTEX(clocks_mutex);
@@ -120,12 +117,12 @@ struct clk_lookup_alloc {
        char    con_id[MAX_CON_ID];
 };
 
-struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id,
-       const char *dev_fmt, ...)
+struct clk_lookup * __init_refok
+clkdev_alloc(struct clk *clk, const char *con_id, const char *dev_fmt, ...)
 {
        struct clk_lookup_alloc *cla;
 
-       cla = kzalloc(sizeof(*cla), GFP_KERNEL);
+       cla = __clkdev_alloc(sizeof(*cla));
        if (!cla)
                return NULL;
 
diff --git a/include/linux/clkdev.h b/include/linux/clkdev.h
new file mode 100644 (file)
index 0000000..457bcb0
--- /dev/null
@@ -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