aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/Kconfig2
-rw-r--r--arch/arm/mach-nomadik/Makefile2
-rw-r--r--arch/arm/mach-nomadik/clock.c75
-rw-r--r--arch/arm/mach-nomadik/clock.h15
-rw-r--r--arch/arm/mach-nomadik/cpu-8815.c4
-rw-r--r--drivers/clk/Makefile1
-rw-r--r--drivers/clk/clk-nomadik.c47
-rw-r--r--include/linux/platform_data/clk-nomadik.h2
8 files changed, 53 insertions, 95 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index b649c5904a4f..e58bda6b6dde 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -912,7 +912,7 @@ config ARCH_NOMADIK
912 select ARM_AMBA 912 select ARM_AMBA
913 select ARM_VIC 913 select ARM_VIC
914 select CPU_ARM926T 914 select CPU_ARM926T
915 select CLKDEV_LOOKUP 915 select COMMON_CLK
916 select GENERIC_CLOCKEVENTS 916 select GENERIC_CLOCKEVENTS
917 select PINCTRL 917 select PINCTRL
918 select MIGHT_HAVE_CACHE_L2X0 918 select MIGHT_HAVE_CACHE_L2X0
diff --git a/arch/arm/mach-nomadik/Makefile b/arch/arm/mach-nomadik/Makefile
index a6bbd1a7b4e7..a42c9a33d3bf 100644
--- a/arch/arm/mach-nomadik/Makefile
+++ b/arch/arm/mach-nomadik/Makefile
@@ -7,8 +7,6 @@
7 7
8# Object file lists. 8# Object file lists.
9 9
10obj-y += clock.o
11
12# Cpu revision 10# Cpu revision
13obj-$(CONFIG_NOMADIK_8815) += cpu-8815.o 11obj-$(CONFIG_NOMADIK_8815) += cpu-8815.o
14 12
diff --git a/arch/arm/mach-nomadik/clock.c b/arch/arm/mach-nomadik/clock.c
deleted file mode 100644
index 48a59f24e10c..000000000000
--- a/arch/arm/mach-nomadik/clock.c
+++ /dev/null
@@ -1,75 +0,0 @@
1/*
2 * linux/arch/arm/mach-nomadik/clock.c
3 *
4 * Copyright (C) 2009 Alessandro Rubini
5 */
6#include <linux/kernel.h>
7#include <linux/module.h>
8#include <linux/errno.h>
9#include <linux/clk.h>
10#include <linux/clkdev.h>
11#include "clock.h"
12
13/*
14 * The nomadik board uses generic clocks, but the serial pl011 file
15 * calls clk_enable(), clk_disable(), clk_get_rate(), so we provide them
16 */
17unsigned long clk_get_rate(struct clk *clk)
18{
19 return clk->rate;
20}
21EXPORT_SYMBOL(clk_get_rate);
22
23/* enable and disable do nothing */
24int clk_enable(struct clk *clk)
25{
26 return 0;
27}
28EXPORT_SYMBOL(clk_enable);
29
30void clk_disable(struct clk *clk)
31{
32}
33EXPORT_SYMBOL(clk_disable);
34
35static struct clk clk_24 = {
36 .rate = 2400000,
37};
38
39static struct clk clk_48 = {
40 .rate = 48 * 1000 * 1000,
41};
42
43/*
44 * Catch-all default clock to satisfy drivers using the clk API. We don't
45 * model the actual hardware clocks yet.
46 */
47static struct clk clk_default;
48
49#define CLK(_clk, dev) \
50 { \
51 .clk = _clk, \
52 .dev_id = dev, \
53 }
54
55static struct clk_lookup lookups[] = {
56 {
57 .con_id = "apb_pclk",
58 .clk = &clk_default,
59 },
60 CLK(&clk_24, "mtu0"),
61 CLK(&clk_24, "mtu1"),
62 CLK(&clk_48, "uart0"),
63 CLK(&clk_48, "uart1"),
64 CLK(&clk_default, "gpio.0"),
65 CLK(&clk_default, "gpio.1"),
66 CLK(&clk_default, "gpio.2"),
67 CLK(&clk_default, "gpio.3"),
68 CLK(&clk_default, "rng"),
69};
70
71int __init clk_init(void)
72{
73 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
74 return 0;
75}
diff --git a/arch/arm/mach-nomadik/clock.h b/arch/arm/mach-nomadik/clock.h
deleted file mode 100644
index 78da2e7c3985..000000000000
--- a/arch/arm/mach-nomadik/clock.h
+++ /dev/null
@@ -1,15 +0,0 @@
1
2/*
3 * linux/arch/arm/mach-nomadik/clock.h
4 *
5 * Copyright (C) 2009 Alessandro Rubini
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11struct clk {
12 unsigned long rate;
13};
14
15int __init clk_init(void);
diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c
index 88511fef7987..6fd8e46567a4 100644
--- a/arch/arm/mach-nomadik/cpu-8815.c
+++ b/arch/arm/mach-nomadik/cpu-8815.c
@@ -25,6 +25,7 @@
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/irq.h> 26#include <linux/irq.h>
27#include <linux/dma-mapping.h> 27#include <linux/dma-mapping.h>
28#include <linux/platform_data/clk-nomadik.h>
28 29
29#include <plat/gpio-nomadik.h> 30#include <plat/gpio-nomadik.h>
30#include <mach/hardware.h> 31#include <mach/hardware.h>
@@ -35,7 +36,6 @@
35#include <asm/cacheflush.h> 36#include <asm/cacheflush.h>
36#include <asm/hardware/cache-l2x0.h> 37#include <asm/hardware/cache-l2x0.h>
37 38
38#include "clock.h"
39#include "cpu-8815.h" 39#include "cpu-8815.h"
40 40
41/* The 8815 has 4 GPIO blocks, let's register them immediately */ 41/* The 8815 has 4 GPIO blocks, let's register them immediately */
@@ -123,7 +123,7 @@ void __init cpu8815_init_irq(void)
123 * Init clocks here so that they are available for system timer 123 * Init clocks here so that they are available for system timer
124 * initialization. 124 * initialization.
125 */ 125 */
126 clk_init(); 126 nomadik_clk_init();
127} 127}
128 128
129/* 129/*
diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
index b9a5158a30b1..26b6b92942e1 100644
--- a/drivers/clk/Makefile
+++ b/drivers/clk/Makefile
@@ -3,5 +3,6 @@ obj-$(CONFIG_CLKDEV_LOOKUP) += clkdev.o
3obj-$(CONFIG_COMMON_CLK) += clk.o clk-fixed-rate.o clk-gate.o \ 3obj-$(CONFIG_COMMON_CLK) += clk.o clk-fixed-rate.o clk-gate.o \
4 clk-mux.o clk-divider.o clk-fixed-factor.o 4 clk-mux.o clk-divider.o clk-fixed-factor.o
5# SoCs specific 5# SoCs specific
6obj-$(CONFIG_ARCH_NOMADIK) += clk-nomadik.o
6obj-$(CONFIG_ARCH_MXS) += mxs/ 7obj-$(CONFIG_ARCH_MXS) += mxs/
7obj-$(CONFIG_PLAT_SPEAR) += spear/ 8obj-$(CONFIG_PLAT_SPEAR) += spear/
diff --git a/drivers/clk/clk-nomadik.c b/drivers/clk/clk-nomadik.c
new file mode 100644
index 000000000000..517a8ff7121e
--- /dev/null
+++ b/drivers/clk/clk-nomadik.c
@@ -0,0 +1,47 @@
1#include <linux/clk.h>
2#include <linux/clkdev.h>
3#include <linux/err.h>
4#include <linux/io.h>
5#include <linux/clk-provider.h>
6
7/*
8 * The Nomadik clock tree is described in the STN8815A12 DB V4.2
9 * reference manual for the chip, page 94 ff.
10 */
11
12void __init nomadik_clk_init(void)
13{
14 struct clk *clk;
15
16 clk = clk_register_fixed_rate(NULL, "apb_pclk", NULL, CLK_IS_ROOT, 0);
17 clk_register_clkdev(clk, "apb_pclk", NULL);
18 clk_register_clkdev(clk, NULL, "gpio.0");
19 clk_register_clkdev(clk, NULL, "gpio.1");
20 clk_register_clkdev(clk, NULL, "gpio.2");
21 clk_register_clkdev(clk, NULL, "gpio.3");
22 clk_register_clkdev(clk, NULL, "rng");
23
24 /*
25 * The 2.4 MHz TIMCLK reference clock is active at boot time, this is
26 * actually the MXTALCLK @19.2 MHz divided by 8. This clock is used
27 * by the timers and watchdog. See page 105 ff.
28 */
29 clk = clk_register_fixed_rate(NULL, "TIMCLK", NULL, CLK_IS_ROOT,
30 2400000);
31 clk_register_clkdev(clk, NULL, "mtu0");
32 clk_register_clkdev(clk, NULL, "mtu1");
33
34 /*
35 * At boot time, PLL2 is set to generate a set of fixed clocks,
36 * one of them is CLK48, the 48 MHz clock, routed to the UART, MMC/SD
37 * I2C, IrDA, USB and SSP blocks.
38 */
39 clk = clk_register_fixed_rate(NULL, "CLK48", NULL, CLK_IS_ROOT,
40 48000000);
41 clk_register_clkdev(clk, NULL, "uart0");
42 clk_register_clkdev(clk, NULL, "uart1");
43 clk_register_clkdev(clk, NULL, "mmci");
44 clk_register_clkdev(clk, NULL, "ssp");
45 clk_register_clkdev(clk, NULL, "nmk-i2c.0");
46 clk_register_clkdev(clk, NULL, "nmk-i2c.1");
47}
diff --git a/include/linux/platform_data/clk-nomadik.h b/include/linux/platform_data/clk-nomadik.h
new file mode 100644
index 000000000000..5713c87b2477
--- /dev/null
+++ b/include/linux/platform_data/clk-nomadik.h
@@ -0,0 +1,2 @@
1/* Minimal platform data header */
2void nomadik_clk_init(void);