Add infrastructure for clkdev support on samsung platforms.
Cc: Ben Dooks <[email protected]>
Signed-off-by: Thomas Abraham <[email protected]>
---
arch/arm/plat-samsung/clock.c | 18 ++++++++++++++++++
arch/arm/plat-samsung/include/plat/clock.h | 7 +++++++
2 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/arch/arm/plat-samsung/clock.c b/arch/arm/plat-samsung/clock.c
index 7728928..177580e 100644
--- a/arch/arm/plat-samsung/clock.c
+++ b/arch/arm/plat-samsung/clock.c
@@ -71,6 +71,12 @@ static int clk_null_enable(struct clk *clk, int enable)
return 0;
}
+/*
+ * When all Samsung platforms use clkdev, pdev->id based clock lookup
+ * code can be removed.
+ */
+#ifndef CONFIG_CLKDEV_LOOKUP
+
static int dev_is_s3c_uart(struct device *dev)
{
struct platform_device **pdev = s3c24xx_uart_devs;
@@ -139,6 +145,8 @@ void clk_put(struct clk *clk)
module_put(clk->owner);
}
+#endif /* CONFIG_CLKDEV_LOOKUP */
+
int clk_enable(struct clk *clk)
{
if (IS_ERR(clk) || clk == NULL)
@@ -241,8 +249,10 @@ int clk_set_parent(struct clk *clk, struct clk *parent)
return ret;
}
+#ifndef CONFIG_CLKDEV_LOOKUP
EXPORT_SYMBOL(clk_get);
EXPORT_SYMBOL(clk_put);
+#endif
EXPORT_SYMBOL(clk_enable);
EXPORT_SYMBOL(clk_disable);
EXPORT_SYMBOL(clk_get_rate);
@@ -346,6 +356,7 @@ int s3c24xx_register_clock(struct clk *clk)
if (clk->enable == NULL)
clk->enable = clk_null_enable;
+#ifndef CONFIG_CLKDEV_LOOKUP
/* add to the list of available clocks */
/* Quick check to see if this clock has already been registered. */
@@ -354,6 +365,13 @@ int s3c24xx_register_clock(struct clk *clk)
spin_lock(&clocks_lock);
list_add(&clk->list, &clocks);
spin_unlock(&clocks_lock);
+#else
+ /* fill up the clk_lookup structure and register it*/
+ clk->lookup.dev_id = clk->devname;
+ clk->lookup.con_id = clk->name;
+ clk->lookup.clk = clk;
+ clkdev_add(&clk->lookup);
+#endif
return 0;
}
diff --git a/arch/arm/plat-samsung/include/plat/clock.h
b/arch/arm/plat-samsung/include/plat/clock.h
index 983c578..5f28941 100644
--- a/arch/arm/plat-samsung/include/plat/clock.h
+++ b/arch/arm/plat-samsung/include/plat/clock.h
@@ -10,6 +10,9 @@
*/
#include <linux/spinlock.h>
+#ifdef CONFIG_CLKDEV_LOOKUP
+#include <linux/clkdev.h>
+#endif
struct clk;
@@ -40,6 +43,7 @@ struct clk {
struct module *owner;
struct clk *parent;
const char *name;
+ const char *devname;
int id;
int usage;
unsigned long rate;
@@ -47,6 +51,9 @@ struct clk {
struct clk_ops *ops;
int (*enable)(struct clk *, int enable);
+#ifdef CONFIG_CLKDEV_LOOKUP
+ struct clk_lookup lookup;
+#endif
#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
struct dentry *dent; /* For visible tree hierarchy */
#endif
--
1.6.6.rc2
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html