summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/Makefile2
-rw-r--r--arch/arm/common/Kconfig2
-rw-r--r--arch/arm/common/Makefile5
-rw-r--r--arch/arm/include/asm/clkdev.h15
-rw-r--r--arch/arm/mach-nomadik/Kconfig2
-rw-r--r--arch/arm/mach-nomadik/clock.c7
-rw-r--r--drivers/Kconfig1
-rw-r--r--drivers/Makefile1
-rw-r--r--drivers/clk/Kconfig4
-rw-r--r--drivers/clk/Makefile2
-rw-r--r--drivers/clk/clkdev.c (renamed from arch/arm/common/clkdev.c)24
-rw-r--r--include/linux/clkdev.h36
13 files changed, 64 insertions, 38 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 945528c3d..fa3703627 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -58,7 +58,6 @@ config ARCH_S3C24xx
endchoice
-source arch/arm/common/Kconfig
source arch/arm/cpu/Kconfig
source arch/arm/mach-at91/Kconfig
source arch/arm/mach-ep93xx/Kconfig
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 0fb3adcb3..e404ad039 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -131,7 +131,7 @@ MACH :=
endif
common-y += $(BOARD) $(MACH)
-common-y += arch/arm/lib/ arch/arm/cpu/ arch/arm/common/
+common-y += arch/arm/lib/ arch/arm/cpu/
lds-$(CONFIG_GENERIC_LINKER_SCRIPT) := arch/arm/lib/barebox.lds
lds-$(CONFIG_BOARD_LINKER_SCRIPT) := $(BOARD)/barebox.lds
diff --git a/arch/arm/common/Kconfig b/arch/arm/common/Kconfig
deleted file mode 100644
index e749e45d1..000000000
--- a/arch/arm/common/Kconfig
+++ /dev/null
@@ -1,2 +0,0 @@
-config COMMON_CLKDEV
- bool
diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile
deleted file mode 100644
index 9cc883462..000000000
--- a/arch/arm/common/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-# Makefile for the linux kernel.
-#
-
-obj-$(CONFIG_COMMON_CLKDEV) += clkdev.o
diff --git a/arch/arm/include/asm/clkdev.h b/arch/arm/include/asm/clkdev.h
index b6ec7c627..ad3394588 100644
--- a/arch/arm/include/asm/clkdev.h
+++ b/arch/arm/include/asm/clkdev.h
@@ -12,19 +12,6 @@
#ifndef __ASM_CLKDEV_H
#define __ASM_CLKDEV_H
-struct clk;
-
-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);
+#include <mach/clkdev.h>
#endif
diff --git a/arch/arm/mach-nomadik/Kconfig b/arch/arm/mach-nomadik/Kconfig
index 64894c8f5..3d6eab682 100644
--- a/arch/arm/mach-nomadik/Kconfig
+++ b/arch/arm/mach-nomadik/Kconfig
@@ -13,7 +13,7 @@ choice
config MACH_NOMADIK_8815NHK
bool "ST 8815 Nomadik Hardware Kit (evaluation board)"
select NOMADIK_8815
- select COMMON_CLKDEV
+ select CLKDEV_LOOKUP
endchoice
diff --git a/arch/arm/mach-nomadik/clock.c b/arch/arm/mach-nomadik/clock.c
index c74e0c131..5f34a2cd9 100644
--- a/arch/arm/mach-nomadik/clock.c
+++ b/arch/arm/mach-nomadik/clock.c
@@ -8,7 +8,7 @@
#include <linux/err.h>
#include <linux/clk.h>
#include <init.h>
-#include <asm/clkdev.h>
+#include <linux/clkdev.h>
#include "clock.h"
@@ -34,11 +34,6 @@ void clk_disable(struct clk *clk)
}
EXPORT_SYMBOL(clk_disable);
-int __clk_get(struct clk *clk)
-{
- return 1;
-}
-
/* Create a clock structure with the given name */
int nmdk_clk_create(struct clk *clk, const char *dev_id)
{
diff --git a/drivers/Kconfig b/drivers/Kconfig
index ae9efce37..f7154c62d 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -9,5 +9,6 @@ source "drivers/mtd/Kconfig"
source "drivers/ata/Kconfig"
source "drivers/usb/Kconfig"
source "drivers/video/Kconfig"
+source "drivers/clk/Kconfig"
endmenu
diff --git a/drivers/Makefile b/drivers/Makefile
index bce68bc7b..706e1c8ac 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -7,3 +7,4 @@ obj-$(CONFIG_ATA) += ata/
obj-$(CONFIG_SPI) += spi/
obj-$(CONFIG_I2C) += i2c/
obj-$(CONFIG_VIDEO) += video/
+obj-y += clk/
diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
new file mode 100644
index 000000000..4168c8896
--- /dev/null
+++ b/drivers/clk/Kconfig
@@ -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
index 000000000..07613fa17
--- /dev/null
+++ b/drivers/clk/Makefile
@@ -0,0 +1,2 @@
+
+obj-$(CONFIG_CLKDEV_LOOKUP) += clkdev.o
diff --git a/arch/arm/common/clkdev.c b/drivers/clk/clkdev.c
index 4d253569e..717fea568 100644
--- a/arch/arm/common/clkdev.c
+++ b/drivers/clk/clkdev.c
@@ -1,5 +1,5 @@
/*
- * arch/arm/common/clkdev.c
+ * drivers/clk/lookup_clkdev.c
*
* Copyright (C) 2008 Russell King.
*
@@ -14,14 +14,13 @@
#include <linux/list.h>
#include <errno.h>
#include <linux/err.h>
+#include <linux/string.h>
#include <linux/clk.h>
+#include <linux/clkdev.h>
#include <init.h>
#include <malloc.h>
#include <stdio.h>
-#include <asm/clkdev.h>
-#include <mach/clkdev.h>
-
static LIST_HEAD(clocks);
/*
@@ -31,7 +30,7 @@ static LIST_HEAD(clocks);
* 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 precidence: dev+con > dev only > con only.
+ * order of precedence: dev+con > dev only > con only.
*/
static struct clk *clk_find(const char *dev_id, const char *con_id)
{
@@ -51,12 +50,13 @@ static struct clk *clk_find(const char *dev_id, const char *con_id)
continue;
match += 1;
}
- if (match == 0)
- continue;
if (match > best) {
clk = p->clk;
- best = match;
+ if (match != 3)
+ best = match;
+ else
+ break;
}
}
return clk;
@@ -94,6 +94,14 @@ void clkdev_add(struct clk_lookup *cl)
}
EXPORT_SYMBOL(clkdev_add);
+void __init clkdev_add_table(struct clk_lookup *cl, size_t num)
+{
+ while (num--) {
+ list_add_tail(&cl->node, &clocks);
+ cl++;
+ }
+}
+
#define MAX_DEV_ID 20
#define MAX_CON_ID 16
diff --git a/include/linux/clkdev.h b/include/linux/clkdev.h
new file mode 100644
index 000000000..ae38e1a16
--- /dev/null
+++ b/include/linux/clkdev.h
@@ -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_d;
+
+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_d *);
+
+#endif