Skip to content

Commit 1122430

Browse files
Russell KingRussell King
authored andcommitted
Merge branch 'clks' into devel
2 parents 773e961 + ee569c4 commit 1122430

13 files changed

Lines changed: 65 additions & 271 deletions

File tree

‎arch/arm/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ config ARCH_EP93XX
271271
select ARM_VIC
272272
select GENERIC_GPIO
273273
select HAVE_CLK
274+
select COMMON_CLKDEV
274275
select ARCH_REQUIRE_GPIOLIB
275276
help
276277
This enables support for the Cirrus EP93xx series of CPUs.

‎arch/arm/mach-aaec2000/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44

55
# Common support (must be linked before board specific support)
6-
obj-y += core.o clock.o
6+
obj-y += core.o
77

88
# Specific board support
99
obj-$(CONFIG_MACH_AAED2000) += aaed2000.o

‎arch/arm/mach-aaec2000/clock.c‎

Lines changed: 0 additions & 99 deletions
This file was deleted.

‎arch/arm/mach-aaec2000/clock.h‎

Lines changed: 0 additions & 23 deletions
This file was deleted.

‎arch/arm/mach-aaec2000/core.c‎

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/interrupt.h>
2020
#include <linux/timex.h>
2121
#include <linux/signal.h>
22+
#include <linux/clk.h>
2223

2324
#include <mach/hardware.h>
2425
#include <asm/irq.h>
@@ -30,7 +31,6 @@
3031
#include <asm/mach/map.h>
3132

3233
#include "core.h"
33-
#include "clock.h"
3434

3535
/*
3636
* Common I/O mapping:
@@ -229,9 +229,28 @@ static struct amba_device *amba_devs[] __initdata = {
229229
&clcd_device,
230230
};
231231

232-
static struct clk aaec2000_clcd_clk = {
233-
.name = "CLCDCLK",
234-
};
232+
void clk_disable(struct clk *clk)
233+
{
234+
}
235+
236+
int clk_set_rate(struct clk *clk, unsigned long rate)
237+
{
238+
return 0;
239+
}
240+
241+
int clk_enable(struct clk *clk)
242+
{
243+
return 0;
244+
}
245+
246+
struct clk *clk_get(struct device *dev, const char *id)
247+
{
248+
return dev && strcmp(dev_name(dev), "mb:16") == 0 ? NULL : ERR_PTR(-ENOENT);
249+
}
250+
251+
void clk_put(struct clk *clk)
252+
{
253+
}
235254

236255
void __init aaec2000_set_clcd_plat_data(struct aaec2000_clcd_info *clcd)
237256
{
@@ -265,8 +284,6 @@ static int __init aaec2000_init(void)
265284
{
266285
int i;
267286

268-
clk_register(&aaec2000_clcd_clk);
269-
270287
for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
271288
struct amba_device *d = amba_devs[i];
272289
amba_device_register(d, &iomem_resource);

‎arch/arm/mach-ep93xx/clock.c‎

Lines changed: 23 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -16,65 +16,46 @@
1616
#include <linux/module.h>
1717
#include <linux/string.h>
1818
#include <linux/io.h>
19+
20+
#include <asm/clkdev.h>
1921
#include <asm/div64.h>
2022
#include <mach/hardware.h>
2123

2224
struct clk {
23-
char *name;
2425
unsigned long rate;
2526
int users;
2627
u32 enable_reg;
2728
u32 enable_mask;
2829
};
2930

3031
static struct clk clk_uart = {
31-
.name = "UARTCLK",
3232
.rate = 14745600,
3333
};
34-
static struct clk clk_pll1 = {
35-
.name = "pll1",
36-
};
37-
static struct clk clk_f = {
38-
.name = "fclk",
39-
};
40-
static struct clk clk_h = {
41-
.name = "hclk",
42-
};
43-
static struct clk clk_p = {
44-
.name = "pclk",
45-
};
46-
static struct clk clk_pll2 = {
47-
.name = "pll2",
48-
};
34+
static struct clk clk_pll1;
35+
static struct clk clk_f;
36+
static struct clk clk_h;
37+
static struct clk clk_p;
38+
static struct clk clk_pll2;
4939
static struct clk clk_usb_host = {
50-
.name = "usb_host",
5140
.enable_reg = EP93XX_SYSCON_CLOCK_CONTROL,
5241
.enable_mask = EP93XX_SYSCON_CLOCK_USH_EN,
5342
};
5443

55-
56-
static struct clk *clocks[] = {
57-
&clk_uart,
58-
&clk_pll1,
59-
&clk_f,
60-
&clk_h,
61-
&clk_p,
62-
&clk_pll2,
63-
&clk_usb_host,
44+
#define INIT_CK(dev,con,ck) \
45+
{ .dev_id = dev, .con_id = con, .clk = ck }
46+
47+
static struct clk_lookup clocks[] = {
48+
INIT_CK("apb:uart1", NULL, &clk_uart),
49+
INIT_CK("apb:uart2", NULL, &clk_uart),
50+
INIT_CK("apb:uart3", NULL, &clk_uart),
51+
INIT_CK(NULL, "pll1", &clk_pll1),
52+
INIT_CK(NULL, "fclk", &clk_f),
53+
INIT_CK(NULL, "hclk", &clk_h),
54+
INIT_CK(NULL, "pclk", &clk_p),
55+
INIT_CK(NULL, "pll2", &clk_pll2),
56+
INIT_CK(NULL, "usb_host", &clk_usb_host),
6457
};
6558

66-
struct clk *clk_get(struct device *dev, const char *id)
67-
{
68-
int i;
69-
70-
for (i = 0; i < ARRAY_SIZE(clocks); i++) {
71-
if (!strcmp(clocks[i]->name, id))
72-
return clocks[i];
73-
}
74-
75-
return ERR_PTR(-ENOENT);
76-
}
77-
EXPORT_SYMBOL(clk_get);
7859

7960
int clk_enable(struct clk *clk)
8061
{
@@ -106,12 +87,6 @@ unsigned long clk_get_rate(struct clk *clk)
10687
}
10788
EXPORT_SYMBOL(clk_get_rate);
10889

109-
void clk_put(struct clk *clk)
110-
{
111-
}
112-
EXPORT_SYMBOL(clk_put);
113-
114-
11590

11691
static char fclk_divisors[] = { 1, 2, 4, 8, 16, 1, 1, 1 };
11792
static char hclk_divisors[] = { 1, 2, 4, 5, 6, 8, 16, 32 };
@@ -138,6 +113,7 @@ static unsigned long calc_pll_rate(u32 config_word)
138113
static int __init ep93xx_clock_init(void)
139114
{
140115
u32 value;
116+
int i;
141117

142118
value = __raw_readl(EP93XX_SYSCON_CLOCK_SET1);
143119
if (!(value & 0x00800000)) { /* PLL1 bypassed? */
@@ -165,6 +141,8 @@ static int __init ep93xx_clock_init(void)
165141
clk_f.rate / 1000000, clk_h.rate / 1000000,
166142
clk_p.rate / 1000000);
167143

144+
for (i = 0; i < ARRAY_SIZE(clocks); i++)
145+
clkdev_add(&clocks[i]);
168146
return 0;
169147
}
170148
arch_initcall(ep93xx_clock_init);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#ifndef __ASM_MACH_CLKDEV_H
2+
#define __ASM_MACH_CLKDEV_H
3+
4+
#define __clk_get(clk) ({ 1; })
5+
#define __clk_put(clk) do { } while (0)
6+
7+
#endif

0 commit comments

Comments
 (0)