Skip to content

Commit 71040c3

Browse files
committed
BCM2708: Migrate to the Common Clock Framework
As part of moving towards using Device Tree, the Common Clock Framework has to be used instead of the BCM2708 clock implementation. Selecting COMMON_CLK removes the need to set CLKDEV_LOOKUP and HAVE_CLK explicitly. CONFIG_ARCH_BCM2708_CHIPIT #ifdef's are removed. They are no longer in use. Signed-off-by: Noralf Tronnes <notro@tronnes.org>
1 parent 7842c5f commit 71040c3

File tree

5 files changed

+39
-135
lines changed

5 files changed

+39
-135
lines changed

arch/arm/Kconfig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,11 +388,10 @@ config ARCH_BCM2708
388388
bool "Broadcom BCM2708 family"
389389
select CPU_V6
390390
select ARM_AMBA
391-
select HAVE_CLK
392391
select HAVE_SCHED_CLOCK
393392
select NEED_MACH_GPIO_H
394393
select NEED_MACH_MEMORY_H
395-
select CLKDEV_LOOKUP
394+
select COMMON_CLK
396395
select ARCH_HAS_CPUFREQ
397396
select GENERIC_CLOCKEVENTS
398397
select ARM_ERRATA_411920

arch/arm/mach-bcm2708/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
# Makefile for the linux kernel.
33
#
44

5-
obj-$(CONFIG_MACH_BCM2708) += clock.o bcm2708.o armctrl.o vcio.o power.o dma.o
5+
obj-$(CONFIG_MACH_BCM2708) += bcm2708.o armctrl.o vcio.o power.o dma.o
66
obj-$(CONFIG_BCM2708_GPIO) += bcm2708_gpio.o
77
obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o

arch/arm/mach-bcm2708/bcm2708.c

Lines changed: 37 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
#include <linux/interrupt.h>
2828
#include <linux/amba/bus.h>
2929
#include <linux/amba/clcd.h>
30+
#include <linux/clk-provider.h>
31+
#include <linux/clkdev.h>
3032
#include <linux/clockchips.h>
3133
#include <linux/cnt32_to_63.h>
3234
#include <linux/io.h>
@@ -58,7 +60,6 @@
5860

5961
#include "bcm2708.h"
6062
#include "armctrl.h"
61-
#include "clock.h"
6263

6364
#ifdef CONFIG_BCM_VC_CMA
6465
#include <linux/broadcom/vc_cma.h>
@@ -84,7 +85,7 @@
8485

8586
/* command line parameters */
8687
static unsigned boardrev, serial;
87-
static unsigned uart_clock;
88+
static unsigned uart_clock = UART0_CLOCK;
8889
static unsigned disk_led_gpio = 16;
8990
static unsigned disk_led_active_low = 1;
9091
static unsigned reboot_part = 0;
@@ -196,51 +197,44 @@ static void __init bcm2708_clocksource_init(void)
196197
}
197198
}
198199

200+
struct clk __init *bcm2708_clk_register(const char *name, unsigned long fixed_rate)
201+
{
202+
struct clk *clk;
199203

200-
/*
201-
* These are fixed clocks.
202-
*/
203-
static struct clk ref24_clk = {
204-
.rate = UART0_CLOCK, /* The UART is clocked at 3MHz via APB_CLK */
205-
};
204+
clk = clk_register_fixed_rate(NULL, name, NULL, CLK_IS_ROOT,
205+
fixed_rate);
206+
if (IS_ERR(clk))
207+
pr_err("%s not registered\n", name);
206208

207-
static struct clk osc_clk = {
208-
#ifdef CONFIG_ARCH_BCM2708_CHIPIT
209-
.rate = 27000000,
210-
#else
211-
.rate = 500000000, /* ARM clock is set from the VideoCore booter */
212-
#endif
213-
};
209+
return clk;
210+
}
214211

215-
/* warning - the USB needs a clock > 34MHz */
212+
void __init bcm2708_register_clkdev(struct clk *clk, const char *name)
213+
{
214+
int ret;
216215

217-
static struct clk sdhost_clk = {
218-
#ifdef CONFIG_ARCH_BCM2708_CHIPIT
219-
.rate = 4000000, /* 4MHz */
220-
#else
221-
.rate = 250000000, /* 250MHz */
222-
#endif
223-
};
216+
ret = clk_register_clkdev(clk, NULL, name);
217+
if (ret)
218+
pr_err("%s alias not registered\n", name);
219+
}
224220

225-
static struct clk_lookup lookups[] = {
226-
{ /* UART0 */
227-
.dev_id = "dev:f1",
228-
.clk = &ref24_clk,
229-
},
230-
{ /* USB */
231-
.dev_id = "bcm2708_usb",
232-
.clk = &osc_clk,
233-
}, { /* SPI */
234-
.dev_id = "bcm2708_spi.0",
235-
.clk = &sdhost_clk,
236-
}, { /* BSC0 */
237-
.dev_id = "bcm2708_i2c.0",
238-
.clk = &sdhost_clk,
239-
}, { /* BSC1 */
240-
.dev_id = "bcm2708_i2c.1",
241-
.clk = &sdhost_clk,
242-
}
243-
};
221+
void __init bcm2708_init_clocks(void)
222+
{
223+
struct clk *clk;
224+
225+
clk = bcm2708_clk_register("uart0_clk", uart_clock);
226+
bcm2708_register_clkdev(clk, "dev:f1");
227+
228+
/* ARM clock is set from the VideoCore booter */
229+
/* warning - the USB needs a clock > 34MHz */
230+
clk = bcm2708_clk_register("osc_clk", 500000000);
231+
bcm2708_register_clkdev(clk, "bcm2708_usb");
232+
233+
clk = bcm2708_clk_register("sdhost_clk", 250000000);
234+
bcm2708_register_clkdev(clk, "bcm2708_spi.0");
235+
bcm2708_register_clkdev(clk, "bcm2708_i2c.0");
236+
bcm2708_register_clkdev(clk, "bcm2708_i2c.1");
237+
}
244238

245239
#define UART0_IRQ { IRQ_UART, 0 /*NO_IRQ*/ }
246240
#define UART0_DMA { 15, 14 }
@@ -783,11 +777,7 @@ void __init bcm2708_init(void)
783777
printk("bcm2708.uart_clock = %d\n", uart_clock);
784778
pm_power_off = bcm2708_power_off;
785779

786-
if (uart_clock)
787-
lookups[0].clk->rate = uart_clock;
788-
789-
for (i = 0; i < ARRAY_SIZE(lookups); i++)
790-
clkdev_add(&lookups[i]);
780+
bcm2708_init_clocks();
791781

792782
bcm_register_device(&bcm2708_dmaman_device);
793783
bcm_register_device(&bcm2708_vcio_device);

arch/arm/mach-bcm2708/clock.c

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

arch/arm/mach-bcm2708/clock.h

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

0 commit comments

Comments
 (0)