Skip to content

Commit 4410c42

Browse files
committed
mips: ar7: convert to clkdev_lookup
ar7 is one of only two platforms that provide the clock interface but implement a custom version of the clkdev_lookup code. Change this to use the generic version instead. Signed-off-by: Arnd Bergmann <[email protected]>
1 parent 6efb943 commit 4410c42

File tree

2 files changed

+12
-20
lines changed

2 files changed

+12
-20
lines changed

arch/mips/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ config AR7
215215
select SYS_SUPPORTS_ZBOOT_UART16550
216216
select GPIOLIB
217217
select VLYNQ
218+
select CLKDEV_LOOKUP
218219
select HAVE_LEGACY_CLK
219220
help
220221
Support for the Texas Instruments AR7 System-on-a-Chip

arch/mips/ar7/clock.c

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/gcd.h>
1414
#include <linux/io.h>
1515
#include <linux/err.h>
16+
#include <linux/clkdev.h>
1617
#include <linux/clk.h>
1718

1819
#include <asm/addrspace.h>
@@ -424,27 +425,15 @@ unsigned long clk_get_rate(struct clk *clk)
424425
}
425426
EXPORT_SYMBOL(clk_get_rate);
426427

427-
struct clk *clk_get(struct device *dev, const char *id)
428-
{
429-
if (!strcmp(id, "bus"))
430-
return &bus_clk;
428+
static struct clk_lookup ar7_clkdev_table[] = {
429+
CLKDEV_INIT(NULL, "bus", &bus_clk),
431430
/* cpmac and vbus share the same rate */
432-
if (!strcmp(id, "cpmac"))
433-
return &vbus_clk;
434-
if (!strcmp(id, "cpu"))
435-
return &cpu_clk;
436-
if (!strcmp(id, "dsp"))
437-
return &dsp_clk;
438-
if (!strcmp(id, "vbus"))
439-
return &vbus_clk;
440-
return ERR_PTR(-ENOENT);
441-
}
442-
EXPORT_SYMBOL(clk_get);
443-
444-
void clk_put(struct clk *clk)
445-
{
446-
}
447-
EXPORT_SYMBOL(clk_put);
431+
CLKDEV_INIT("cpmac.0", "cpmac", &vbus_clk),
432+
CLKDEV_INIT("cpmac.1", "cpmac", &vbus_clk),
433+
CLKDEV_INIT(NULL, "cpu", &cpu_clk),
434+
CLKDEV_INIT(NULL, "dsp", &dsp_clk),
435+
CLKDEV_INIT(NULL, "vbus", &vbus_clk),
436+
};
448437

449438
void __init ar7_init_clocks(void)
450439
{
@@ -462,6 +451,8 @@ void __init ar7_init_clocks(void)
462451
}
463452
/* adjust vbus clock rate */
464453
vbus_clk.rate = bus_clk.rate / 2;
454+
455+
clkdev_add_table(ar7_clkdev_table, ARRAY_SIZE(ar7_clkdev_table));
465456
}
466457

467458
/* dummy functions, should not be called */

0 commit comments

Comments
 (0)