Skip to contentSkip to conversation

clk: move IM-PD1 clocks to drivers/clk

PATCH New Linus Walleij 3 participants 4 messages Nov 19, 2012 – Nov 20, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: move IM-PD1 clocks to drivers/clk

The ARM IM-PD1 add-on module has a few clock of its own, let's move also these down to the drivers/clk/versatile driver dir and get rid of any remaining oldschool Integrator clocks.

---
 arch/arm/mach-integrator/impd1.c             | 68 +-------------------
 drivers/clk/versatile/Makefile               |  1 +
 drivers/clk/versatile/clk-impd1.c            | 96 ++++++++++++++++++++++++++++
 drivers/clk/versatile/clk-integrator.c       |  3 +-
 include/linux/platform_data/clk-integrator.h |  1 +
 5 files changed, 102 insertions(+), 67 deletions(-)
 create mode 100644 drivers/clk/versatile/clk-impd1.c
arch/arm/mach-integrator/impd1.c +2 -66
index e428f3a..1ddfb38 100644
@@ -21,10 +21,9 @@
 #include <linux/amba/bus.h>
 #include <linux/amba/clcd.h>
 #include <linux/io.h>
+#include <linux/platform_data/clk-integrator.h>
 #include <linux/slab.h>
-#include <linux/clkdev.h>
 
-#include <asm/hardware/icst.h>
 #include <mach/lm.h>
 #include <mach/impd1.h>
 #include <asm/sizes.h>
@@ -36,45 +35,6 @@ MODULE_PARM_DESC(lmid, "logic module stack position");
 
 struct impd1_module {
 	void __iomem	*base;
-	struct clk	vcos[2];
-	struct clk_lookup *clks[3];
-};
-
-static const struct icst_params impd1_vco_params = {
-	.ref		= 24000000,	/* 24 MHz */
-	.vco_max	= ICST525_VCO_MAX_3V,
-	.vco_min	= ICST525_VCO_MIN,
-	.vd_min		= 12,
-	.vd_max		= 519,
-	.rd_min		= 3,
-	.rd_max		= 120,
-	.s2div		= icst525_s2div,
-	.idx2s		= icst525_idx2s,
-};
-
-static void impd1_setvco(struct clk *clk, struct icst_vco vco)
-{
-	struct impd1_module *impd1 = clk->data;
-	u32 val = vco.v | (vco.r << 9) | (vco.s << 16);
-
-	writel(0xa05f, impd1->base + IMPD1_LOCK);
-	writel(val, clk->vcoreg);
-	writel(0, impd1->base + IMPD1_LOCK);
-
-#ifdef DEBUG
-	vco.v = val & 0x1ff;
-	vco.r = (val >> 9) & 0x7f;
-	vco.s = (val >> 16) & 7;
-
-	pr_debug("IM-PD1: VCO%d clock is %ld Hz\n",
-		 vconr, icst525_hz(&impd1_vco_params, vco));
-#endif
-}
-
-static const struct clk_ops impd1_clk_ops = {
-	.round	= icst_clk_round,
-	.set	= icst_clk_set,
-	.setvco	= impd1_setvco,
 };
 
 void impd1_tweak_control(struct device *dev, u32 mask, u32 val)
@@ -344,10 +304,6 @@ static struct impd1_device impd1_devs[] = {
 	}
 };
 
-static struct clk fixed_14745600 = {
-	.rate = 14745600,
-};
-
 static int impd1_probe(struct lm_device *dev)
 {
 	struct impd1_module *impd1;
@@ -376,23 +332,7 @@ static int impd1_probe(struct lm_device *dev)
 	printk("IM-PD1 found at 0x%08lx\n",
 		(unsigned long)dev->resource.start);
 
-	for (i = 0; i < ARRAY_SIZE(impd1->vcos); i++) {
-		impd1->vcos[i].ops = &impd1_clk_ops,
-		impd1->vcos[i].owner = THIS_MODULE,
-		impd1->vcos[i].params = &impd1_vco_params,
-		impd1->vcos[i].data = impd1;
-	}
-	impd1->vcos[0].vcoreg = impd1->base + IMPD1_OSC1;
-	impd1->vcos[1].vcoreg = impd1->base + IMPD1_OSC2;
-
-	impd1->clks[0] = clkdev_alloc(&impd1->vcos[0], NULL, "lm%x:01000",
-					dev->id);
-	impd1->clks[1] = clkdev_alloc(&fixed_14745600, NULL, "lm%x:00100",
-					dev->id);
-	impd1->clks[2] = clkdev_alloc(&fixed_14745600, NULL, "lm%x:00200",
-					dev->id);
-	for (i = 0; i < ARRAY_SIZE(impd1->clks); i++)
-		clkdev_add(impd1->clks[i]);
+	integrator_impd1_clk_init(impd1->base, dev->id);
 
 	for (i = 0; i < ARRAY_SIZE(impd1_devs); i++) {
 		struct impd1_device *idev = impd1_devs + i;
@@ -431,13 +371,9 @@ static int impd1_remove_one(struct device *dev, void *data)
 static void impd1_remove(struct lm_device *dev)
 {
 	struct impd1_module *impd1 = lm_get_drvdata(dev);
-	int i;
 
 	device_for_each_child(&dev->dev, NULL, impd1_remove_one);
 
-	for (i = 0; i < ARRAY_SIZE(impd1->clks); i++)
-		clkdev_drop(impd1->clks[i]);
-
 	lm_set_drvdata(dev, NULL);
 
 	iounmap(impd1->base);
drivers/clk/versatile/Makefile +1 -0
index c0a0f64..884e362 100644
@@ -1,4 +1,5 @@
 # Makefile for Versatile-specific clocks
 obj-$(CONFIG_ICST)		+= clk-icst.o
 obj-$(CONFIG_ARCH_INTEGRATOR)	+= clk-integrator.o
+obj-$(CONFIG_INTEGRATOR_IMPD1)	+= clk-impd1.o
 obj-$(CONFIG_ARCH_REALVIEW)	+= clk-realview.o
drivers/clk/versatile/clk-impd1.c new file +96 -0

96 lines not on this page · raw message

drivers/clk/versatile/clk-integrator.c +2 -1
index a505392..5aa6ab9 100644
@@ -1,8 +1,9 @@
+#include <linux/clk-provider.h>
 #include <linux/clk.h>
 #include <linux/clkdev.h>
 #include <linux/err.h>
 #include <linux/io.h>
-#include <linux/clk-provider.h>
+#include <linux/platform_data/clk-integrator.h>
 
 #include <mach/hardware.h>
 #include <mach/platform.h>
include/linux/platform_data/clk-integrator.h +1 -0
index 83fe9c2..a8a704d 100644
@@ -1 +1,2 @@
 void integrator_clk_init(bool is_cp);
+void integrator_impd1_clk_init(void __iomem *base, unsigned int id);
Signature · 1 line
1.7.11.7
#1 lore raw

PATCH 1/1 clk: move IM-PD1 clocks to drivers/clk

Quoting Linus Walleij (2012-11-19 10:45:11)

drivers/clk/versatile/clk-impd1.c

Quoted 6 lines
drivers/clk/versatile/clk-impd1.c new file +0 -0
new file mode 100644
index 0000000..28ac702
@@ -0,0 +1,96 @@

What is rule on GPL headers these days? I notice that this file is missing as well as some of the other C files in drivers/clk/versatile/.

I prefer to have GPL headers and also establishing a copyright owner, but maybe I'm out of touch with some new way of doing things?

Quoted 7 lines
drivers/clk/versatile/clk-impd1.c new file +7 -0
+#include <linux/clk-provider.h>
+#include <linux/clk.h>
+#include <linux/clkdev.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/platform_data/clk-integrator.h>
+

<snip>

drivers/clk/versatile/clk-integrator.c

Quoted 5 lines
drivers/clk/versatile/clk-integrator.c +0 -0
index a505392..5aa6ab9 100644
@@ -1,8 +1,9 @@

Same here. I guess I didn't catch this the first time around.

Rest of the patch looks fine so once the header question is answered I'll either take it or you can respin with the headers.

Regards,
Mike

#2 lore raw

PATCH 1/1 clk: move IM-PD1 clocks to drivers/clk

Quoted 10 lines · Mike Turquette

Quoting Linus Walleij (2012-11-19 10:45:11)

drivers/clk/versatile/clk-impd1.c

Quoted 6 lines
drivers/clk/versatile/clk-impd1.c new file +0 -0
new file mode 100644
index 0000000..28ac702
@@ -0,0 +1,96 @@

What is rule on GPL headers these days? I notice that this file is missing as well as some of the other C files in drivers/clk/versatile/.

It's up to the copyright holder.

Arnd

#3 lore raw

PATCH 1/1 clk: move IM-PD1 clocks to drivers/clk

In reply to Mike Turquette
Quoted 2 lines · Mike Turquette

I prefer to have GPL headers and also establishing a copyright owner, but maybe I'm out of touch with some new way of doing things?

Nah, the subsystem maintainer is always right :-)

Quoted 2 lines

Rest of the patch looks fine so once the header question is answered I'll either take it or you can respin with the headers.

I'll respin it adding headers and take a round over the other driver files so you get headers for these too.

Yours,
Linus Walleij