[ARM] integrator: convert to clkdev and lookup clocks by device name

People often point to the Integrator/Versatile/Realview
implementations to justify using the consumer name as the sole
selector for clocks.

Eliminate this excuse by changing the Integrator implementation, so
it provides a better example of how it should be done.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
Russell King
2008-11-08 20:08:08 +00:00
committed by Russell King
parent cf30fb4a4f
commit d72fbdf01f
7 changed files with 91 additions and 119 deletions

View File

@@ -22,13 +22,13 @@
#include <linux/amba/clcd.h>
#include <linux/io.h>
#include <asm/clkdev.h>
#include <mach/clkdev.h>
#include <asm/hardware/icst525.h>
#include <mach/lm.h>
#include <mach/impd1.h>
#include <asm/sizes.h>
#include "clock.h"
static int module_id;
module_param_named(lmid, module_id, int, 0444);
@@ -37,6 +37,7 @@ 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 icst525_params impd1_vco_params = {
@@ -339,9 +340,8 @@ static struct impd1_device impd1_devs[] = {
}
};
static const char *impd1_vconames[2] = {
"CLCDCLK",
"AUXVCO2",
static struct clk fixed_14745600 = {
.rate = 14745600,
};
static int impd1_probe(struct lm_device *dev)
@@ -374,14 +374,20 @@ static int impd1_probe(struct lm_device *dev)
for (i = 0; i < ARRAY_SIZE(impd1->vcos); i++) {
impd1->vcos[i].owner = THIS_MODULE,
impd1->vcos[i].name = impd1_vconames[i],
impd1->vcos[i].params = &impd1_vco_params,
impd1->vcos[i].data = impd1,
impd1->vcos[i].setvco = impd1_setvco;
clk_register(&impd1->vcos[i]);
}
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]);
for (i = 0; i < ARRAY_SIZE(impd1_devs); i++) {
struct impd1_device *idev = impd1_devs + i;
struct amba_device *d;
@@ -434,8 +440,8 @@ static void impd1_remove(struct lm_device *dev)
device_for_each_child(&dev->dev, NULL, impd1_remove_one);
for (i = 0; i < ARRAY_SIZE(impd1->vcos); i++)
clk_unregister(&impd1->vcos[i]);
for (i = 0; i < ARRAY_SIZE(impd1->clks); i++)
clkdev_drop(impd1->clks[i]);
lm_set_drvdata(dev, NULL);