diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2011-11-10 21:46:45 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2011-11-11 02:56:25 -0500 |
commit | d55c9a97f80a7ad64f7c7eab5fb447a8d9a1532a (patch) | |
tree | 7a5dd9b45b6527af850772ddcec1c6e6b29a08d7 /arch/arm/mach-shmobile/board-bonito.c | |
parent | 215d6cc9230c2a42a643c4cd296680040eeb1f49 (diff) |
ARM: mach-shmobile: add bonito board support.
This adds basic bonito board (R-Mobile A1) support
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/arm/mach-shmobile/board-bonito.c')
-rw-r--r-- | arch/arm/mach-shmobile/board-bonito.c | 187 |
1 files changed, 187 insertions, 0 deletions
diff --git a/arch/arm/mach-shmobile/board-bonito.c b/arch/arm/mach-shmobile/board-bonito.c new file mode 100644 index 000000000000..901d7457973a --- /dev/null +++ b/arch/arm/mach-shmobile/board-bonito.c | |||
@@ -0,0 +1,187 @@ | |||
1 | /* | ||
2 | * bonito board support | ||
3 | * | ||
4 | * Copyright (C) 2011 Renesas Solutions Corp. | ||
5 | * Copyright (C) 2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | ||
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 as published by | ||
9 | * the Free Software Foundation; version 2 of the License. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
19 | * | ||
20 | */ | ||
21 | |||
22 | #include <linux/kernel.h> | ||
23 | #include <linux/init.h> | ||
24 | #include <linux/interrupt.h> | ||
25 | #include <linux/irq.h> | ||
26 | #include <linux/platform_device.h> | ||
27 | #include <linux/gpio.h> | ||
28 | #include <mach/common.h> | ||
29 | #include <asm/mach-types.h> | ||
30 | #include <asm/mach/arch.h> | ||
31 | #include <asm/mach/map.h> | ||
32 | #include <asm/mach/time.h> | ||
33 | #include <asm/hardware/cache-l2x0.h> | ||
34 | #include <mach/r8a7740.h> | ||
35 | |||
36 | /* | ||
37 | * CS Address device note | ||
38 | *---------------------------------------------------------------- | ||
39 | * 0 0x0000_0000 NOR Flash (64MB) SW12 : bit3 = OFF | ||
40 | * 2 0x0800_0000 ExtNOR (64MB) SW12 : bit3 = OFF | ||
41 | * 4 - | ||
42 | * 5A - | ||
43 | * 5B 0x1600_0000 SRAM (8MB) | ||
44 | * 6 0x1800_0000 FPGA (64K) | ||
45 | * 0x1801_0000 Ether (4KB) | ||
46 | * 0x1801_1000 USB (4KB) | ||
47 | */ | ||
48 | |||
49 | /* | ||
50 | * SW12 | ||
51 | * | ||
52 | * bit1 bit2 bit3 | ||
53 | *---------------------------------------------------------------------------- | ||
54 | * ON NOR WriteProtect NAND WriteProtect CS0 ExtNOR / CS2 NOR | ||
55 | * OFF NOR Not WriteProtect NAND Not WriteProtect CS0 NOR / CS2 ExtNOR | ||
56 | */ | ||
57 | |||
58 | /* | ||
59 | * FPGA | ||
60 | */ | ||
61 | #define A1MDSR 0x10E0 | ||
62 | #define BVERR 0x1100 | ||
63 | static u16 bonito_fpga_read(u32 offset) | ||
64 | { | ||
65 | return __raw_readw(0xf0003000 + offset); | ||
66 | } | ||
67 | |||
68 | static void bonito_fpga_write(u32 offset, u16 val) | ||
69 | { | ||
70 | __raw_writew(val, 0xf0003000 + offset); | ||
71 | } | ||
72 | |||
73 | /* | ||
74 | * devices | ||
75 | */ | ||
76 | static struct platform_device *bonito_devices[] __initdata = { | ||
77 | }; | ||
78 | |||
79 | /* | ||
80 | * map I/O | ||
81 | */ | ||
82 | static struct map_desc bonito_io_desc[] __initdata = { | ||
83 | /* | ||
84 | * for CPGA/INTC/PFC | ||
85 | * 0xe6000000-0xefffffff -> 0xe6000000-0xefffffff | ||
86 | */ | ||
87 | { | ||
88 | .virtual = 0xe6000000, | ||
89 | .pfn = __phys_to_pfn(0xe6000000), | ||
90 | .length = 160 << 20, | ||
91 | .type = MT_DEVICE_NONSHARED | ||
92 | }, | ||
93 | #ifdef CONFIG_CACHE_L2X0 | ||
94 | /* | ||
95 | * for l2x0_init() | ||
96 | * 0xf0100000-0xf0101000 -> 0xf0002000-0xf0003000 | ||
97 | */ | ||
98 | { | ||
99 | .virtual = 0xf0002000, | ||
100 | .pfn = __phys_to_pfn(0xf0100000), | ||
101 | .length = PAGE_SIZE, | ||
102 | .type = MT_DEVICE_NONSHARED | ||
103 | }, | ||
104 | #endif | ||
105 | /* | ||
106 | * for FPGA (0x1800000-0x19ffffff) | ||
107 | * 0x18000000-0x18002000 -> 0xf0003000-0xf0005000 | ||
108 | */ | ||
109 | { | ||
110 | .virtual = 0xf0003000, | ||
111 | .pfn = __phys_to_pfn(0x18000000), | ||
112 | .length = PAGE_SIZE * 2, | ||
113 | .type = MT_DEVICE_NONSHARED | ||
114 | } | ||
115 | }; | ||
116 | |||
117 | static void __init bonito_map_io(void) | ||
118 | { | ||
119 | iotable_init(bonito_io_desc, ARRAY_SIZE(bonito_io_desc)); | ||
120 | |||
121 | /* setup early devices and console here as well */ | ||
122 | r8a7740_add_early_devices(); | ||
123 | shmobile_setup_console(); | ||
124 | } | ||
125 | |||
126 | /* | ||
127 | * board init | ||
128 | */ | ||
129 | static void __init bonito_init(void) | ||
130 | { | ||
131 | u16 val; | ||
132 | |||
133 | r8a7740_pinmux_init(); | ||
134 | |||
135 | /* FPGA */ | ||
136 | gpio_request(GPIO_FN_CS5B, NULL); | ||
137 | gpio_request(GPIO_FN_CS6A, NULL); | ||
138 | gpio_request(GPIO_FN_CS5A_PORT105, NULL); | ||
139 | gpio_request(GPIO_FN_IRQ10, NULL); | ||
140 | |||
141 | val = bonito_fpga_read(BVERR); | ||
142 | pr_info("bonito version: cpu %02x, base %02x\n", | ||
143 | ((val >> 8) & 0xFF), | ||
144 | ((val >> 0) & 0xFF)); | ||
145 | |||
146 | /* SCIFA5 */ | ||
147 | gpio_request(GPIO_FN_SCIFA5_TXD_PORT91, NULL); | ||
148 | gpio_request(GPIO_FN_SCIFA5_RXD_PORT92, NULL); | ||
149 | |||
150 | #ifdef CONFIG_CACHE_L2X0 | ||
151 | /* Early BRESP enable, Shared attribute override enable, 32K*8way */ | ||
152 | l2x0_init(__io(0xf0002000), 0x40440000, 0x82000fff); | ||
153 | #endif | ||
154 | |||
155 | r8a7740_add_standard_devices(); | ||
156 | platform_add_devices(bonito_devices, ARRAY_SIZE(bonito_devices)); | ||
157 | } | ||
158 | |||
159 | static void __init bonito_timer_init(void) | ||
160 | { | ||
161 | u16 val; | ||
162 | u8 md_ck = 0; | ||
163 | |||
164 | /* read MD_CK value */ | ||
165 | val = bonito_fpga_read(A1MDSR); | ||
166 | if (val & (1 << 10)) | ||
167 | md_ck |= MD_CK2; | ||
168 | if (val & (1 << 9)) | ||
169 | md_ck |= MD_CK1; | ||
170 | if (val & (1 << 8)) | ||
171 | md_ck |= MD_CK0; | ||
172 | |||
173 | r8a7740_clock_init(md_ck); | ||
174 | shmobile_timer.init(); | ||
175 | } | ||
176 | |||
177 | struct sys_timer bonito_timer = { | ||
178 | .init = bonito_timer_init, | ||
179 | }; | ||
180 | |||
181 | MACHINE_START(BONITO, "bonito") | ||
182 | .map_io = bonito_map_io, | ||
183 | .init_irq = r8a7740_init_irq, | ||
184 | .handle_irq = shmobile_handle_irq_intc, | ||
185 | .init_machine = bonito_init, | ||
186 | .timer = &bonito_timer, | ||
187 | MACHINE_END | ||