aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-shmobile')
-rw-r--r--arch/arm/mach-shmobile/Kconfig14
-rw-r--r--arch/arm/mach-shmobile/Makefile1
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva-reference.c213
-rw-r--r--arch/arm/mach-shmobile/include/mach/r8a7740.h3
-rw-r--r--arch/arm/mach-shmobile/intc-r8a7740.c24
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7740.c54
6 files changed, 278 insertions, 31 deletions
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index 65e1547678b0..db27e8eef192 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -105,6 +105,20 @@ config MACH_ARMADILLO800EVA
105 select SND_SOC_WM8978 if SND_SIMPLE_CARD 105 select SND_SOC_WM8978 if SND_SIMPLE_CARD
106 select USE_OF 106 select USE_OF
107 107
108config MACH_ARMADILLO800EVA_REFERENCE
109 bool "Armadillo-800 EVA board - Reference Device Tree Implementation"
110 depends on ARCH_R8A7740
111 select ARCH_REQUIRE_GPIOLIB
112 select REGULATOR_FIXED_VOLTAGE if REGULATOR
113 select SND_SOC_WM8978 if SND_SIMPLE_CARD
114 select USE_OF
115 ---help---
116 Use reference implementation of Aramdillo800 EVA board support
117 which makes a greater use of device tree at the expense
118 of not supporting a number of devices.
119
120 This is intended to aid developers
121
108config MACH_BOCKW 122config MACH_BOCKW
109 bool "BOCK-W platform" 123 bool "BOCK-W platform"
110 depends on ARCH_R8A7778 124 depends on ARCH_R8A7778
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index 76f1639c5945..6165a517f580 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -44,6 +44,7 @@ obj-$(CONFIG_MACH_MARZEN) += board-marzen.o
44obj-$(CONFIG_MACH_MARZEN_REFERENCE) += board-marzen-reference.o 44obj-$(CONFIG_MACH_MARZEN_REFERENCE) += board-marzen-reference.o
45obj-$(CONFIG_MACH_LAGER) += board-lager.o 45obj-$(CONFIG_MACH_LAGER) += board-lager.o
46obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o 46obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o
47obj-$(CONFIG_MACH_ARMADILLO800EVA_REFERENCE) += board-armadillo800eva-reference.o
47obj-$(CONFIG_MACH_KZM9D) += board-kzm9d.o 48obj-$(CONFIG_MACH_KZM9D) += board-kzm9d.o
48obj-$(CONFIG_MACH_KZM9G) += board-kzm9g.o 49obj-$(CONFIG_MACH_KZM9G) += board-kzm9g.o
49obj-$(CONFIG_MACH_KZM9G_REFERENCE) += board-kzm9g-reference.o 50obj-$(CONFIG_MACH_KZM9G_REFERENCE) += board-kzm9g-reference.o
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva-reference.c b/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
new file mode 100644
index 000000000000..03b85fec2ddb
--- /dev/null
+++ b/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
@@ -0,0 +1,213 @@
1/*
2 * armadillo 800 eva board support
3 *
4 * Copyright (C) 2012 Renesas Solutions Corp.
5 * Copyright (C) 2012 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/clk.h>
23#include <linux/err.h>
24#include <linux/kernel.h>
25#include <linux/gpio.h>
26#include <linux/io.h>
27#include <linux/pinctrl/machine.h>
28#include <mach/common.h>
29#include <mach/r8a7740.h>
30#include <asm/mach/arch.h>
31#include <asm/hardware/cache-l2x0.h>
32
33/*
34 * CON1 Camera Module
35 * CON2 Extension Bus
36 * CON3 HDMI Output
37 * CON4 Composite Video Output
38 * CON5 H-UDI JTAG
39 * CON6 ARM JTAG
40 * CON7 SD1
41 * CON8 SD2
42 * CON9 RTC BackUp
43 * CON10 Monaural Mic Input
44 * CON11 Stereo Headphone Output
45 * CON12 Audio Line Output(L)
46 * CON13 Audio Line Output(R)
47 * CON14 AWL13 Module
48 * CON15 Extension
49 * CON16 LCD1
50 * CON17 LCD2
51 * CON19 Power Input
52 * CON20 USB1
53 * CON21 USB2
54 * CON22 Serial
55 * CON23 LAN
56 * CON24 USB3
57 * LED1 Camera LED(Yellow)
58 * LED2 Power LED (Green)
59 * ED3-LED6 User LED(Yellow)
60 * LED7 LAN link LED(Green)
61 * LED8 LAN activity LED(Yellow)
62 */
63
64/*
65 * DipSwitch
66 *
67 * SW1
68 *
69 * -12345678-+---------------+----------------------------
70 * 1 | boot | hermit
71 * 0 | boot | OS auto boot
72 * -12345678-+---------------+----------------------------
73 * 00 | boot device | eMMC
74 * 10 | boot device | SDHI0 (CON7)
75 * 01 | boot device | -
76 * 11 | boot device | Extension Buss (CS0)
77 * -12345678-+---------------+----------------------------
78 * 0 | Extension Bus | D8-D15 disable, eMMC enable
79 * 1 | Extension Bus | D8-D15 enable, eMMC disable
80 * -12345678-+---------------+----------------------------
81 * 0 | SDHI1 | COM8 disable, COM14 enable
82 * 1 | SDHI1 | COM8 enable, COM14 disable
83 * -12345678-+---------------+----------------------------
84 * 0 | USB0 | COM20 enable, COM24 disable
85 * 1 | USB0 | COM20 disable, COM24 enable
86 * -12345678-+---------------+----------------------------
87 * 00 | JTAG | SH-X2
88 * 10 | JTAG | ARM
89 * 01 | JTAG | -
90 * 11 | JTAG | Boundary Scan
91 *-----------+---------------+----------------------------
92 */
93
94/*
95 * FSI-WM8978
96 *
97 * this command is required when playback.
98 *
99 * # amixer set "Headphone" 50
100 *
101 * this command is required when capture.
102 *
103 * # amixer set "Input PGA" 15
104 * # amixer set "Left Input Mixer MicP" on
105 * # amixer set "Left Input Mixer MicN" on
106 * # amixer set "Right Input Mixer MicN" on
107 * # amixer set "Right Input Mixer MicP" on
108 */
109
110/*
111 * USB function
112 *
113 * When you use USB Function,
114 * set SW1.6 ON, and connect cable to CN24.
115 *
116 * USBF needs workaround on R8A7740 chip.
117 * These are a little bit complex.
118 * see
119 * usbhsf_power_ctrl()
120 */
121
122static const struct pinctrl_map eva_pinctrl_map[] = {
123 /* SCIFA1 */
124 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.1", "pfc-r8a7740",
125 "scifa1_data", "scifa1"),
126};
127
128static void __init eva_clock_init(void)
129{
130 struct clk *system = clk_get(NULL, "system_clk");
131 struct clk *xtal1 = clk_get(NULL, "extal1");
132 struct clk *usb24s = clk_get(NULL, "usb24s");
133 struct clk *fsibck = clk_get(NULL, "fsibck");
134
135 if (IS_ERR(system) ||
136 IS_ERR(xtal1) ||
137 IS_ERR(usb24s) ||
138 IS_ERR(fsibck)) {
139 pr_err("armadillo800eva board clock init failed\n");
140 goto clock_error;
141 }
142
143 /* armadillo 800 eva extal1 is 24MHz */
144 clk_set_rate(xtal1, 24000000);
145
146 /* usb24s use extal1 (= system) clock (= 24MHz) */
147 clk_set_parent(usb24s, system);
148
149 /* FSIBCK is 12.288MHz, and it is parent of FSI-B */
150 clk_set_rate(fsibck, 12288000);
151
152clock_error:
153 if (!IS_ERR(system))
154 clk_put(system);
155 if (!IS_ERR(xtal1))
156 clk_put(xtal1);
157 if (!IS_ERR(usb24s))
158 clk_put(usb24s);
159 if (!IS_ERR(fsibck))
160 clk_put(fsibck);
161}
162
163/*
164 * board init
165 */
166static void __init eva_init(void)
167{
168
169 r8a7740_clock_init(MD_CK0 | MD_CK2);
170 eva_clock_init();
171
172 pinctrl_register_mappings(eva_pinctrl_map, ARRAY_SIZE(eva_pinctrl_map));
173 r8a7740_pinmux_init();
174
175 r8a7740_meram_workaround();
176
177 /*
178 * Touchscreen
179 * TODO: Move reset GPIO over to .dts when we can reference it
180 */
181 gpio_request_one(166, GPIOF_OUT_INIT_HIGH, NULL); /* TP_RST_B */
182
183#ifdef CONFIG_CACHE_L2X0
184 /* Early BRESP enable, Shared attribute override enable, 32K*8way */
185 l2x0_init(IOMEM(0xf0002000), 0x40440000, 0x82000fff);
186#endif
187
188 r8a7740_add_standard_devices_dt();
189 r8a7740_pm_init();
190}
191
192#define RESCNT2 IOMEM(0xe6188020)
193static void eva_restart(char mode, const char *cmd)
194{
195 /* Do soft power on reset */
196 writel((1 << 31), RESCNT2);
197}
198
199static const char *eva_boards_compat_dt[] __initdata = {
200 "renesas,armadillo800eva-reference",
201 NULL,
202};
203
204DT_MACHINE_START(ARMADILLO800EVA_DT, "armadillo800eva-reference")
205 .map_io = r8a7740_map_io,
206 .init_early = r8a7740_init_delay,
207 .init_irq = r8a7740_init_irq_of,
208 .init_machine = eva_init,
209 .init_time = shmobile_timer_init,
210 .init_late = shmobile_init_late,
211 .dt_compat = eva_boards_compat_dt,
212 .restart = eva_restart,
213MACHINE_END
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7740.h b/arch/arm/mach-shmobile/include/mach/r8a7740.h
index 9c9a66ccaf6f..b34d19b5ca5c 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7740.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a7740.h
@@ -45,10 +45,13 @@ enum {
45}; 45};
46 46
47extern void r8a7740_meram_workaround(void); 47extern void r8a7740_meram_workaround(void);
48extern void r8a7740_init_delay(void);
48extern void r8a7740_init_irq(void); 49extern void r8a7740_init_irq(void);
50extern void r8a7740_init_irq_of(void);
49extern void r8a7740_map_io(void); 51extern void r8a7740_map_io(void);
50extern void r8a7740_add_early_devices(void); 52extern void r8a7740_add_early_devices(void);
51extern void r8a7740_add_standard_devices(void); 53extern void r8a7740_add_standard_devices(void);
54extern void r8a7740_add_standard_devices_dt(void);
52extern void r8a7740_clock_init(u8 md_ck); 55extern void r8a7740_clock_init(u8 md_ck);
53extern void r8a7740_pinmux_init(void); 56extern void r8a7740_pinmux_init(void);
54extern void r8a7740_pm_init(void); 57extern void r8a7740_pm_init(void);
diff --git a/arch/arm/mach-shmobile/intc-r8a7740.c b/arch/arm/mach-shmobile/intc-r8a7740.c
index b741c8409a5a..8871f7717dc8 100644
--- a/arch/arm/mach-shmobile/intc-r8a7740.c
+++ b/arch/arm/mach-shmobile/intc-r8a7740.c
@@ -20,19 +20,15 @@
20 20
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/irqchip.h>
23#include <linux/irqchip/arm-gic.h> 24#include <linux/irqchip/arm-gic.h>
24 25
25void __init r8a7740_init_irq(void) 26static void __init r8a7740_init_irq_common(void)
26{ 27{
27 void __iomem *gic_dist_base = ioremap_nocache(0xc2800000, 0x1000);
28 void __iomem *gic_cpu_base = ioremap_nocache(0xc2000000, 0x1000);
29 void __iomem *intc_prio_base = ioremap_nocache(0xe6900010, 0x10); 28 void __iomem *intc_prio_base = ioremap_nocache(0xe6900010, 0x10);
30 void __iomem *intc_msk_base = ioremap_nocache(0xe6900040, 0x10); 29 void __iomem *intc_msk_base = ioremap_nocache(0xe6900040, 0x10);
31 void __iomem *pfc_inta_ctrl = ioremap_nocache(0xe605807c, 0x4); 30 void __iomem *pfc_inta_ctrl = ioremap_nocache(0xe605807c, 0x4);
32 31
33 /* initialize the Generic Interrupt Controller PL390 r0p0 */
34 gic_init(0, 29, gic_dist_base, gic_cpu_base);
35
36 /* route signals to GIC */ 32 /* route signals to GIC */
37 iowrite32(0x0, pfc_inta_ctrl); 33 iowrite32(0x0, pfc_inta_ctrl);
38 34
@@ -54,3 +50,19 @@ void __init r8a7740_init_irq(void)
54 iounmap(intc_msk_base); 50 iounmap(intc_msk_base);
55 iounmap(pfc_inta_ctrl); 51 iounmap(pfc_inta_ctrl);
56} 52}
53
54void __init r8a7740_init_irq_of(void)
55{
56 irqchip_init();
57 r8a7740_init_irq_common();
58}
59
60void __init r8a7740_init_irq(void)
61{
62 void __iomem *gic_dist_base = ioremap_nocache(0xc2800000, 0x1000);
63 void __iomem *gic_cpu_base = ioremap_nocache(0xc2000000, 0x1000);
64
65 /* initialize the Generic Interrupt Controller PL390 r0p0 */
66 gic_init(0, 29, gic_dist_base, gic_cpu_base);
67 r8a7740_init_irq_common();
68}
diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
index 3a6b6fe7b6c0..00c5a707238b 100644
--- a/arch/arm/mach-shmobile/setup-r8a7740.c
+++ b/arch/arm/mach-shmobile/setup-r8a7740.c
@@ -517,11 +517,7 @@ static struct platform_device ipmmu_device = {
517 .num_resources = ARRAY_SIZE(ipmmu_resources), 517 .num_resources = ARRAY_SIZE(ipmmu_resources),
518}; 518};
519 519
520static struct platform_device *r8a7740_early_devices[] __initdata = { 520static struct platform_device *r8a7740_devices_dt[] __initdata = {
521 &irqpin0_device,
522 &irqpin1_device,
523 &irqpin2_device,
524 &irqpin3_device,
525 &scif0_device, 521 &scif0_device,
526 &scif1_device, 522 &scif1_device,
527 &scif2_device, 523 &scif2_device,
@@ -532,6 +528,13 @@ static struct platform_device *r8a7740_early_devices[] __initdata = {
532 &scif7_device, 528 &scif7_device,
533 &scifb_device, 529 &scifb_device,
534 &cmt10_device, 530 &cmt10_device,
531};
532
533static struct platform_device *r8a7740_early_devices[] __initdata = {
534 &irqpin0_device,
535 &irqpin1_device,
536 &irqpin2_device,
537 &irqpin3_device,
535 &tmu00_device, 538 &tmu00_device,
536 &tmu01_device, 539 &tmu01_device,
537 &tmu02_device, 540 &tmu02_device,
@@ -951,6 +954,8 @@ void __init r8a7740_add_standard_devices(void)
951 /* add devices */ 954 /* add devices */
952 platform_add_devices(r8a7740_early_devices, 955 platform_add_devices(r8a7740_early_devices,
953 ARRAY_SIZE(r8a7740_early_devices)); 956 ARRAY_SIZE(r8a7740_early_devices));
957 platform_add_devices(r8a7740_devices_dt,
958 ARRAY_SIZE(r8a7740_devices_dt));
954 platform_add_devices(r8a7740_late_devices, 959 platform_add_devices(r8a7740_late_devices,
955 ARRAY_SIZE(r8a7740_late_devices)); 960 ARRAY_SIZE(r8a7740_late_devices));
956 961
@@ -972,6 +977,8 @@ void __init r8a7740_add_early_devices(void)
972{ 977{
973 early_platform_add_devices(r8a7740_early_devices, 978 early_platform_add_devices(r8a7740_early_devices,
974 ARRAY_SIZE(r8a7740_early_devices)); 979 ARRAY_SIZE(r8a7740_early_devices));
980 early_platform_add_devices(r8a7740_devices_dt,
981 ARRAY_SIZE(r8a7740_devices_dt));
975 982
976 /* setup early console here as well */ 983 /* setup early console here as well */
977 shmobile_setup_console(); 984 shmobile_setup_console();
@@ -979,33 +986,29 @@ void __init r8a7740_add_early_devices(void)
979 986
980#ifdef CONFIG_USE_OF 987#ifdef CONFIG_USE_OF
981 988
982void __init r8a7740_add_early_devices_dt(void)
983{
984 shmobile_setup_delay(800, 1, 3); /* Cortex-A9 @ 800MHz */
985
986 early_platform_add_devices(r8a7740_early_devices,
987 ARRAY_SIZE(r8a7740_early_devices));
988
989 /* setup early console here as well */
990 shmobile_setup_console();
991}
992
993static const struct of_dev_auxdata r8a7740_auxdata_lookup[] __initconst = { 989static const struct of_dev_auxdata r8a7740_auxdata_lookup[] __initconst = {
994 { } 990 { }
995}; 991};
996 992
997void __init r8a7740_add_standard_devices_dt(void) 993void __init r8a7740_add_standard_devices_dt(void)
998{ 994{
999 /* clocks are setup late during boot in the case of DT */ 995 platform_add_devices(r8a7740_devices_dt,
1000 r8a7740_clock_init(0); 996 ARRAY_SIZE(r8a7740_devices_dt));
1001
1002 platform_add_devices(r8a7740_early_devices,
1003 ARRAY_SIZE(r8a7740_early_devices));
1004
1005 of_platform_populate(NULL, of_default_bus_match_table, 997 of_platform_populate(NULL, of_default_bus_match_table,
1006 r8a7740_auxdata_lookup, NULL); 998 r8a7740_auxdata_lookup, NULL);
1007} 999}
1008 1000
1001void __init r8a7740_init_delay(void)
1002{
1003 shmobile_setup_delay(800, 1, 3); /* Cortex-A9 @ 800MHz */
1004};
1005
1006static void __init r8a7740_generic_init(void)
1007{
1008 r8a7740_clock_init(0);
1009 r8a7740_add_standard_devices_dt();
1010}
1011
1009static const char *r8a7740_boards_compat_dt[] __initdata = { 1012static const char *r8a7740_boards_compat_dt[] __initdata = {
1010 "renesas,r8a7740", 1013 "renesas,r8a7740",
1011 NULL, 1014 NULL,
@@ -1013,9 +1016,10 @@ static const char *r8a7740_boards_compat_dt[] __initdata = {
1013 1016
1014DT_MACHINE_START(R8A7740_DT, "Generic R8A7740 (Flattened Device Tree)") 1017DT_MACHINE_START(R8A7740_DT, "Generic R8A7740 (Flattened Device Tree)")
1015 .map_io = r8a7740_map_io, 1018 .map_io = r8a7740_map_io,
1016 .init_early = r8a7740_add_early_devices_dt, 1019 .init_early = r8a7740_init_delay,
1017 .init_irq = r8a7740_init_irq, 1020 .init_irq = r8a7740_init_irq_of,
1018 .init_machine = r8a7740_add_standard_devices_dt, 1021 .init_machine = r8a7740_generic_init,
1022 .init_time = shmobile_timer_init,
1019 .dt_compat = r8a7740_boards_compat_dt, 1023 .dt_compat = r8a7740_boards_compat_dt,
1020MACHINE_END 1024MACHINE_END
1021 1025