mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [patch] xtensa: implement CLK API
@ 2009-03-23 15:02 Daniel Glöckner
  0 siblings, 0 replies; only message in thread
From: Daniel Glöckner @ 2009-03-23 15:02 UTC (permalink / raw)
  To: Chris Zankel; +Cc: linux-kernel, Daniel Glöckner

Implement access to the peripheral clock (half of cpu clock) by means
of the generic CLK API.

Signed-off-by: Daniel Glöckner <dg@emlix.com>
---
 arch/xtensa/platforms/s6105/Makefile |    2 +-
 arch/xtensa/platforms/s6105/clocks.c |   49 ++++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+), 1 deletions(-)
 create mode 100644 arch/xtensa/platforms/s6105/clocks.c

diff --git a/arch/xtensa/platforms/s6105/Makefile b/arch/xtensa/platforms/s6105/Makefile
index 0be6194..294427b 100644
--- a/arch/xtensa/platforms/s6105/Makefile
+++ b/arch/xtensa/platforms/s6105/Makefile
@@ -1,3 +1,3 @@
 # Makefile for the Stretch S6105 eval board
 
-obj-y		:= setup.o device.o
+obj-y		:= setup.o device.o clocks.o
diff --git a/arch/xtensa/platforms/s6105/clocks.c b/arch/xtensa/platforms/s6105/clocks.c
new file mode 100644
index 0000000..fcd3bad
--- /dev/null
+++ b/arch/xtensa/platforms/s6105/clocks.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2009 emlix GmbH
+ * Author:	Daniel Gloeckner <dg@emlix.com>
+ */
+
+#include <linux/clk.h>
+#include <linux/err.h>
+#include <linux/module.h>
+#include <linux/string.h>
+#include <asm/param.h>
+#include <asm/timex.h>
+
+struct clk {
+	unsigned long rate;
+};
+
+static struct clk pclk;
+
+struct clk *clk_get(struct device *dev, const char *id)
+{
+	if (!strcmp(id, "PCLK")) {
+		pclk.rate = CCOUNT_PER_JIFFY * HZ / 2;
+		return &pclk;
+	}
+	return ERR_PTR(-ENODEV);
+}
+EXPORT_SYMBOL(clk_get);
+
+int clk_enable(struct clk *clk)
+{
+	return 0;
+}
+EXPORT_SYMBOL(clk_enable);
+
+void clk_disable(struct clk *clk)
+{
+}
+EXPORT_SYMBOL(clk_disable);
+
+unsigned long clk_get_rate(struct clk *clk)
+{
+	return clk->rate;
+}
+EXPORT_SYMBOL(clk_get_rate);
+
+void clk_put(struct clk *clk)
+{
+}
+EXPORT_SYMBOL(clk_put);
-- 
1.6.2.107.ge47ee


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-03-23 15:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-23 15:02 [patch] xtensa: implement CLK API Daniel Glöckner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®