x86/efi: Enforce CONFIG_RELOCATABLE for EFI boot stub
[linux/fpc-iii.git] / arch / arm / mach-shmobile / board-armadillo800eva-reference.c
blob57d1a78367b6aa17accfddc013132b8328d9b5f5
1 /*
2 * armadillo 800 eva board support
4 * Copyright (C) 2012 Renesas Solutions Corp.
5 * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
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.
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.
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
22 #include <linux/clk.h>
23 #include <linux/err.h>
24 #include <linux/kernel.h>
25 #include <linux/gpio.h>
26 #include <linux/io.h>
27 #include <mach/common.h>
28 #include <mach/r8a7740.h>
29 #include <asm/mach/arch.h>
30 #include <asm/hardware/cache-l2x0.h>
33 * CON1 Camera Module
34 * CON2 Extension Bus
35 * CON3 HDMI Output
36 * CON4 Composite Video Output
37 * CON5 H-UDI JTAG
38 * CON6 ARM JTAG
39 * CON7 SD1
40 * CON8 SD2
41 * CON9 RTC BackUp
42 * CON10 Monaural Mic Input
43 * CON11 Stereo Headphone Output
44 * CON12 Audio Line Output(L)
45 * CON13 Audio Line Output(R)
46 * CON14 AWL13 Module
47 * CON15 Extension
48 * CON16 LCD1
49 * CON17 LCD2
50 * CON19 Power Input
51 * CON20 USB1
52 * CON21 USB2
53 * CON22 Serial
54 * CON23 LAN
55 * CON24 USB3
56 * LED1 Camera LED(Yellow)
57 * LED2 Power LED (Green)
58 * ED3-LED6 User LED(Yellow)
59 * LED7 LAN link LED(Green)
60 * LED8 LAN activity LED(Yellow)
64 * DipSwitch
66 * SW1
68 * -12345678-+---------------+----------------------------
69 * 1 | boot | hermit
70 * 0 | boot | OS auto boot
71 * -12345678-+---------------+----------------------------
72 * 00 | boot device | eMMC
73 * 10 | boot device | SDHI0 (CON7)
74 * 01 | boot device | -
75 * 11 | boot device | Extension Buss (CS0)
76 * -12345678-+---------------+----------------------------
77 * 0 | Extension Bus | D8-D15 disable, eMMC enable
78 * 1 | Extension Bus | D8-D15 enable, eMMC disable
79 * -12345678-+---------------+----------------------------
80 * 0 | SDHI1 | COM8 disable, COM14 enable
81 * 1 | SDHI1 | COM8 enable, COM14 disable
82 * -12345678-+---------------+----------------------------
83 * 0 | USB0 | COM20 enable, COM24 disable
84 * 1 | USB0 | COM20 disable, COM24 enable
85 * -12345678-+---------------+----------------------------
86 * 00 | JTAG | SH-X2
87 * 10 | JTAG | ARM
88 * 01 | JTAG | -
89 * 11 | JTAG | Boundary Scan
90 *-----------+---------------+----------------------------
94 * FSI-WM8978
96 * this command is required when playback.
98 * # amixer set "Headphone" 50
100 * this command is required when capture.
102 * # amixer set "Input PGA" 15
103 * # amixer set "Left Input Mixer MicP" on
104 * # amixer set "Left Input Mixer MicN" on
105 * # amixer set "Right Input Mixer MicN" on
106 * # amixer set "Right Input Mixer MicP" on
110 * USB function
112 * When you use USB Function,
113 * set SW1.6 ON, and connect cable to CN24.
115 * USBF needs workaround on R8A7740 chip.
116 * These are a little bit complex.
117 * see
118 * usbhsf_power_ctrl()
121 static void __init eva_clock_init(void)
123 struct clk *system = clk_get(NULL, "system_clk");
124 struct clk *xtal1 = clk_get(NULL, "extal1");
125 struct clk *usb24s = clk_get(NULL, "usb24s");
126 struct clk *fsibck = clk_get(NULL, "fsibck");
128 if (IS_ERR(system) ||
129 IS_ERR(xtal1) ||
130 IS_ERR(usb24s) ||
131 IS_ERR(fsibck)) {
132 pr_err("armadillo800eva board clock init failed\n");
133 goto clock_error;
136 /* armadillo 800 eva extal1 is 24MHz */
137 clk_set_rate(xtal1, 24000000);
139 /* usb24s use extal1 (= system) clock (= 24MHz) */
140 clk_set_parent(usb24s, system);
142 /* FSIBCK is 12.288MHz, and it is parent of FSI-B */
143 clk_set_rate(fsibck, 12288000);
145 clock_error:
146 if (!IS_ERR(system))
147 clk_put(system);
148 if (!IS_ERR(xtal1))
149 clk_put(xtal1);
150 if (!IS_ERR(usb24s))
151 clk_put(usb24s);
152 if (!IS_ERR(fsibck))
153 clk_put(fsibck);
157 * board init
159 static void __init eva_init(void)
161 r8a7740_clock_init(MD_CK0 | MD_CK2);
162 eva_clock_init();
164 r8a7740_meram_workaround();
166 #ifdef CONFIG_CACHE_L2X0
167 /* Early BRESP enable, Shared attribute override enable, 32K*8way */
168 l2x0_init(IOMEM(0xf0002000), 0x40440000, 0x82000fff);
169 #endif
171 r8a7740_add_standard_devices_dt();
173 r8a7740_pm_init();
176 #define RESCNT2 IOMEM(0xe6188020)
177 static void eva_restart(enum reboot_mode mode, const char *cmd)
179 /* Do soft power on reset */
180 writel(1 << 31, RESCNT2);
183 static const char *eva_boards_compat_dt[] __initdata = {
184 "renesas,armadillo800eva-reference",
185 NULL,
188 DT_MACHINE_START(ARMADILLO800EVA_DT, "armadillo800eva-reference")
189 .map_io = r8a7740_map_io,
190 .init_early = r8a7740_init_delay,
191 .init_irq = r8a7740_init_irq_of,
192 .init_machine = eva_init,
193 .init_late = shmobile_init_late,
194 .dt_compat = eva_boards_compat_dt,
195 .restart = eva_restart,
196 MACHINE_END