Implement a minimum CLK API to pass a base clock to spi_txx9 driver.
This patch also remove old hack (abusing resource framework) which was
only for preliminary version of the spi_txx9 driver.
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
This patch can be folded into a patch in linux-queue tree titled:
"[MIPS] rbtx4938: Convert SPI codes to use generic SPI drivers"
arch/mips/tx4938/toshiba_rbtx4938/setup.c | 37 +++++++++++++++++++++++++---
1 files changed, 33 insertions(+), 4 deletions(-)
diff --git a/arch/mips/tx4938/toshiba_rbtx4938/setup.c
b/arch/mips/tx4938/toshiba_rbtx4938/setup.c
index 330ee43..361d89a 100644
--- a/arch/mips/tx4938/toshiba_rbtx4938/setup.c
+++ b/arch/mips/tx4938/toshiba_rbtx4938/setup.c
@@ -20,6 +20,7 @@
#include <linux/pci.h>
#include <linux/pm.h>
#include <linux/platform_device.h>
+#include <linux/clk.h>
#include <asm/wbflush.h>
#include <asm/reboot.h>
@@ -1121,10 +1122,6 @@ static void __init txx9_spi_init(unsigned long base, int
irq)
}, {
.start = irq,
.flags = IORESOURCE_IRQ,
- }, {
- .name = "baseclk",
- .start = txx9_gbus_clock / 2 / 4,
- .flags = IORESOURCE_IRQ,
},
};
platform_device_register_simple("txx9spi", 0,
@@ -1149,3 +1146,35 @@ static int __init rbtx4938_spi_init(void)
return 0;
}
arch_initcall(rbtx4938_spi_init);
+
+/* Minimum CLK support */
+
+struct clk *clk_get(struct device *dev, const char *id)
+{
+ if (!strcmp(id, "spi-baseclk"))
+ return (struct clk *)(txx9_gbus_clock / 2 / 4);
+ return ERR_PTR(-ENOENT);
+}
+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 (unsigned long)clk;
+}
+EXPORT_SYMBOL(clk_get_rate);
+
+void clk_put(struct clk *clk)
+{
+}
+EXPORT_SYMBOL(clk_put);
|