summaryrefslogtreecommitdiff
path: root/arch/arm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/Kconfig3
-rw-r--r--arch/arm/mach-bcm2708/Makefile2
-rw-r--r--arch/arm/mach-bcm2708/bcm2708.c79
-rw-r--r--arch/arm/mach-bcm2708/clock.c61
-rw-r--r--arch/arm/mach-bcm2708/clock.h24
5 files changed, 34 insertions, 135 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 9fcd395d2b3f..c495965bd205 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -373,11 +373,10 @@ config ARCH_BCM2708
bool "Broadcom BCM2708 family"
select CPU_V6
select ARM_AMBA
- select HAVE_CLK
select HAVE_SCHED_CLOCK
select NEED_MACH_GPIO_H
select NEED_MACH_MEMORY_H
- select CLKDEV_LOOKUP
+ select COMMON_CLK
select ARCH_HAS_CPUFREQ
select GENERIC_CLOCKEVENTS
select ARM_ERRATA_411920
diff --git a/arch/arm/mach-bcm2708/Makefile b/arch/arm/mach-bcm2708/Makefile
index a722f3fb7257..21e352166d9e 100644
--- a/arch/arm/mach-bcm2708/Makefile
+++ b/arch/arm/mach-bcm2708/Makefile
@@ -2,6 +2,6 @@
# Makefile for the linux kernel.
#
-obj-$(CONFIG_MACH_BCM2708) += clock.o bcm2708.o armctrl.o vcio.o power.o dma.o
+obj-$(CONFIG_MACH_BCM2708) += bcm2708.o armctrl.o vcio.o power.o dma.o
obj-$(CONFIG_BCM2708_GPIO) += bcm2708_gpio.o
obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o
diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c
index 752dd46cefe6..080e26024b0c 100644
--- a/arch/arm/mach-bcm2708/bcm2708.c
+++ b/arch/arm/mach-bcm2708/bcm2708.c
@@ -27,6 +27,8 @@
#include <linux/interrupt.h>
#include <linux/amba/bus.h>
#include <linux/amba/clcd.h>
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
#include <linux/clockchips.h>
#include <linux/cnt32_to_63.h>
#include <linux/io.h>
@@ -57,7 +59,6 @@
#include "bcm2708.h"
#include "armctrl.h"
-#include "clock.h"
#ifdef CONFIG_BCM_VC_CMA
#include <linux/broadcom/vc_cma.h>
@@ -78,7 +79,7 @@
/* command line parameters */
static unsigned boardrev, serial;
-static unsigned uart_clock;
+static unsigned uart_clock = UART0_CLOCK;
static unsigned disk_led_gpio = 16;
static unsigned disk_led_active_low = 1;
static unsigned reboot_part = 0;
@@ -188,51 +189,39 @@ static void __init bcm2708_clocksource_init(void)
}
}
+struct clk __init *bcm2708_clk_register(const char *name, unsigned long fixed_rate)
+{
+ struct clk *clk;
-/*
- * These are fixed clocks.
- */
-static struct clk ref24_clk = {
- .rate = UART0_CLOCK, /* The UART is clocked at 3MHz via APB_CLK */
-};
+ clk = clk_register_fixed_rate(NULL, name, NULL, CLK_IS_ROOT,
+ fixed_rate);
+ if (IS_ERR(clk))
+ pr_err("%s not registered\n", name);
-static struct clk osc_clk = {
-#ifdef CONFIG_ARCH_BCM2708_CHIPIT
- .rate = 27000000,
-#else
- .rate = 500000000, /* ARM clock is set from the VideoCore booter */
-#endif
-};
+ return clk;
+}
-/* warning - the USB needs a clock > 34MHz */
+void __init bcm2708_register_clkdev(struct clk *clk, const char *name)
+{
+ int ret;
-static struct clk sdhost_clk = {
-#ifdef CONFIG_ARCH_BCM2708_CHIPIT
- .rate = 4000000, /* 4MHz */
-#else
- .rate = 250000000, /* 250MHz */
-#endif
-};
+ ret = clk_register_clkdev(clk, NULL, name);
+ if (ret)
+ pr_err("%s alias not registered\n", name);
+}
-static struct clk_lookup lookups[] = {
- { /* UART0 */
- .dev_id = "dev:f1",
- .clk = &ref24_clk,
- },
- { /* USB */
- .dev_id = "bcm2708_usb",
- .clk = &osc_clk,
- }, { /* SPI */
- .dev_id = "bcm2708_spi.0",
- .clk = &sdhost_clk,
- }, { /* BSC0 */
- .dev_id = "bcm2708_i2c.0",
- .clk = &sdhost_clk,
- }, { /* BSC1 */
- .dev_id = "bcm2708_i2c.1",
- .clk = &sdhost_clk,
- }
-};
+void __init bcm2708_init_clocks(void)
+{
+ struct clk *clk;
+
+ clk = bcm2708_clk_register("uart0_clk", uart_clock);
+ bcm2708_register_clkdev(clk, "dev:f1");
+
+ clk = bcm2708_clk_register("sdhost_clk", 250000000);
+ bcm2708_register_clkdev(clk, "bcm2708_spi.0");
+ bcm2708_register_clkdev(clk, "bcm2708_i2c.0");
+ bcm2708_register_clkdev(clk, "bcm2708_i2c.1");
+}
#define UART0_IRQ { IRQ_UART, 0 /*NO_IRQ*/ }
#define UART0_DMA { 15, 14 }
@@ -685,11 +674,7 @@ void __init bcm2708_init(void)
printk("bcm2708.uart_clock = %d\n", uart_clock);
pm_power_off = bcm2708_power_off;
- if (uart_clock)
- lookups[0].clk->rate = uart_clock;
-
- for (i = 0; i < ARRAY_SIZE(lookups); i++)
- clkdev_add(&lookups[i]);
+ bcm2708_init_clocks();
bcm_register_device(&bcm2708_dmaman_device);
bcm_register_device(&bcm2708_dmaengine_device);
diff --git a/arch/arm/mach-bcm2708/clock.c b/arch/arm/mach-bcm2708/clock.c
deleted file mode 100644
index 4fc556e976da..000000000000
--- a/arch/arm/mach-bcm2708/clock.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * linux/arch/arm/mach-bcm2708/clock.c
- *
- * Copyright (C) 2010 Broadcom
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/device.h>
-#include <linux/list.h>
-#include <linux/errno.h>
-#include <linux/err.h>
-#include <linux/string.h>
-#include <linux/clk.h>
-#include <linux/mutex.h>
-
-#include <asm/clkdev.h>
-
-#include "clock.h"
-
-int clk_enable(struct clk *clk)
-{
- return 0;
-}
-EXPORT_SYMBOL(clk_enable);
-
-void clk_disable(struct clk *clk)
-{
-}
-EXPORT_SYMBOL(clk_disable);
-
-unsigned long clk_get_rate(struct clk *clk)
-{
- return clk->rate;
-}
-EXPORT_SYMBOL(clk_get_rate);
-
-long clk_round_rate(struct clk *clk, unsigned long rate)
-{
- return clk->rate;
-}
-EXPORT_SYMBOL(clk_round_rate);
-
-int clk_set_rate(struct clk *clk, unsigned long rate)
-{
- return -EIO;
-}
-EXPORT_SYMBOL(clk_set_rate);
diff --git a/arch/arm/mach-bcm2708/clock.h b/arch/arm/mach-bcm2708/clock.h
deleted file mode 100644
index 5f9d72583853..000000000000
--- a/arch/arm/mach-bcm2708/clock.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * linux/arch/arm/mach-bcm2708/clock.h
- *
- * Copyright (C) 2010 Broadcom
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-struct module;
-
-struct clk {
- unsigned long rate;
-};