aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile/clock-sh73a0.c
diff options
context:
space:
mode:
authorMagnus Damm <damm@opensource.se>2010-11-17 05:59:31 -0500
committerPaul Mundt <lethal@linux-sh.org>2010-11-18 01:45:21 -0500
commit6d9598e24d50a8c72f48a3864327484a30aaee44 (patch)
tree4ff6d28a73306df0fe4853833010ca58a8ab8450 /arch/arm/mach-shmobile/clock-sh73a0.c
parent6d72ad35f1bfaf6e52ca7133cb51ce0e36f17528 (diff)
ARM: mach-shmobile: Initial AG5 and AG5EVM support
This patch adds initial support for Renesas SH-Mobile AG5. At this point the AG5 CPU support is limited to the ARM core, SCIF serial and a CMT timer together with L2 cache and the GIC. The AG5EVM board also supports Ethernet. Future patches will add support for GPIO, INTCS, CPGA and platform data / driver updates for devices such as IIC, LCDC, FSI, KEYSC, CEU and SDHI among others. The code in entry-macro.S will be cleaned up when the ARM IRQ demux code improvements have been merged. Depends on the AG5EVM mach-type recently registered but not yet present in arch/arm/tools/mach-types. As the AG5EVM board comes with 512MiB memory it is recommended to turn on HIGHMEM. Many thanks to Yoshii-san for initial bring up. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/arm/mach-shmobile/clock-sh73a0.c')
-rw-r--r--arch/arm/mach-shmobile/clock-sh73a0.c101
1 files changed, 101 insertions, 0 deletions
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
new file mode 100644
index 000000000000..f2390aefefe8
--- /dev/null
+++ b/arch/arm/mach-shmobile/clock-sh73a0.c
@@ -0,0 +1,101 @@
1/*
2 * sh73a0 clock framework support
3 *
4 * Copyright (C) 2010 Magnus Damm
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19#include <linux/init.h>
20#include <linux/kernel.h>
21#include <linux/io.h>
22#include <linux/sh_clk.h>
23#include <mach/common.h>
24#include <asm/clkdev.h>
25
26#define SMSTPCR0 0xe6150130
27#define SMSTPCR1 0xe6150134
28#define SMSTPCR2 0xe6150138
29#define SMSTPCR3 0xe615013c
30#define SMSTPCR4 0xe6150140
31#define SMSTPCR5 0xe6150144
32
33/* Fixed 32 KHz root clock from EXTALR pin */
34static struct clk r_clk = {
35 .rate = 32768,
36};
37
38/* Temporarily fixed 48 MHz SUB clock */
39static struct clk sub_clk = {
40 .rate = 48000000,
41};
42
43static struct clk *main_clks[] = {
44 &r_clk,
45 &sub_clk,
46};
47
48enum { MSTP219,
49 MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200,
50 MSTP331, MSTP329,
51 MSTP_NR };
52
53#define MSTP(_parent, _reg, _bit, _flags) \
54 SH_CLK_MSTP32(_parent, _reg, _bit, _flags)
55
56static struct clk mstp_clks[MSTP_NR] = {
57 [MSTP219] = MSTP(&sub_clk, SMSTPCR2, 19, 0), /* SCIFA7 */
58 [MSTP207] = MSTP(&sub_clk, SMSTPCR2, 7, 0), /* SCIFA5 */
59 [MSTP206] = MSTP(&sub_clk, SMSTPCR2, 6, 0), /* SCIFB */
60 [MSTP204] = MSTP(&sub_clk, SMSTPCR2, 4, 0), /* SCIFA0 */
61 [MSTP203] = MSTP(&sub_clk, SMSTPCR2, 3, 0), /* SCIFA1 */
62 [MSTP202] = MSTP(&sub_clk, SMSTPCR2, 2, 0), /* SCIFA2 */
63 [MSTP201] = MSTP(&sub_clk, SMSTPCR2, 1, 0), /* SCIFA3 */
64 [MSTP200] = MSTP(&sub_clk, SMSTPCR2, 0, 0), /* SCIFA4 */
65 [MSTP331] = MSTP(&sub_clk, SMSTPCR3, 31, 0), /* SCIFA6 */
66 [MSTP329] = MSTP(&r_clk, SMSTPCR3, 29, 0), /* CMT10 */
67};
68
69#define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk }
70
71static struct clk_lookup lookups[] = {
72 /* MSTP32 clocks */
73 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP219]), /* SCIFA7 */
74 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), /* SCIFA5 */
75 CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), /* SCIFB */
76 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), /* SCIFA0 */
77 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), /* SCIFA1 */
78 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP202]), /* SCIFA2 */
79 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP201]), /* SCIFA3 */
80 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]), /* SCIFA4 */
81 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP331]), /* SCIFA6 */
82 CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), /* CMT10 */
83};
84
85void __init sh73a0_clock_init(void)
86{
87 int k, ret = 0;
88
89 for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
90 ret = clk_register(main_clks[k]);
91
92 if (!ret)
93 ret = sh_clk_mstp32_register(mstp_clks, MSTP_NR);
94
95 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
96
97 if (!ret)
98 clk_init();
99 else
100 panic("failed to setup sh73a0 clocks\n");
101}