aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSimon Horman <horms+renesas@verge.net.au>2012-11-21 10:34:25 -0500
committerSimon Horman <horms+renesas@verge.net.au>2013-03-18 08:27:02 -0400
commitb8b82b2983e5b7bccca3a037c886e2aad86aaeea (patch)
tree4aac50e56a7c8bdf4c1fb281464eec37b9189c79 /arch
parent73d6a69e3b3ae168fcb8d797e427c1b5fe132a40 (diff)
ARM: shmobile: kzm9g: Reference DT implementation
Provide alternate board code for the kzm9g to demonstrate how DT may be used given the current state of driver device tree support. This is intended to act as a reference for mach-shmobile developers. Some notes: * Brings up the GIC interrupt handler using device tree * Brings up the following device using device tree: - MMCIF (MMC) * Does not bring up the INTC interrupt controller at all, thus external devices may not be used. In particular, the SMSC ethernet device may not be used and thus NFS root may not be used. * Uses existing C code and not device tree to initialise the following, which are needed for a working board: - SCIF (Serial) - CMT (Clock) - PFC (GPIO) To use this alternate board code instead of the normal board code, CONFIG_MACH_KZM9G_REFERENCE should be selected in the kernel config. And the sh73a0-kzm9g-reference.dtb flattened device tree blob should be used. Includes fix by Thierry Reding to no longer use gic_handle_irq() Includes fixes by Guennadi Liakhovetski for recent pinmux changes. Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Cc: Thierry Reding <thierry.reding@avionic-design.de> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/boot/dts/Makefile1
-rw-r--r--arch/arm/boot/dts/sh73a0-kzm9g-reference.dts41
-rw-r--r--arch/arm/mach-shmobile/Kconfig10
-rw-r--r--arch/arm/mach-shmobile/Makefile1
-rw-r--r--arch/arm/mach-shmobile/board-kzm9g-reference.c87
5 files changed, 140 insertions, 0 deletions
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 7965b9ad99d9..ee9fbe4d9912 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -138,6 +138,7 @@ dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \
138 r8a7740-armadillo800eva.dtb \ 138 r8a7740-armadillo800eva.dtb \
139 r8a7779-marzen-reference.dtb \ 139 r8a7779-marzen-reference.dtb \
140 sh73a0-kzm9g.dtb \ 140 sh73a0-kzm9g.dtb \
141 sh73a0-kzm9g-reference.dtb \
141 sh7372-mackerel.dtb 142 sh7372-mackerel.dtb
142dtb-$(CONFIG_ARCH_SOCFPGA) += socfpga_cyclone5.dtb \ 143dtb-$(CONFIG_ARCH_SOCFPGA) += socfpga_cyclone5.dtb \
143 socfpga_vt.dtb 144 socfpga_vt.dtb
diff --git a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
new file mode 100644
index 000000000000..06f52f98f90d
--- /dev/null
+++ b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
@@ -0,0 +1,41 @@
1/*
2 * Device Tree Source for the KZM-A9-GT board
3 *
4 * Copyright (C) 2012 Horms Solutions Ltd.
5 *
6 * Based on sh73a0-kzm9g.dts
7 * Copyright (C) 2012 Renesas Solutions Corp.
8 *
9 * This file is licensed under the terms of the GNU General Public License
10 * version 2. This program is licensed "as is" without any warranty of any
11 * kind, whether express or implied.
12 */
13
14/dts-v1/;
15/include/ "sh73a0-reference.dtsi"
16
17/ {
18 model = "KZM-A9-GT";
19 compatible = "renesas,kzm9g-reference", "renesas,sh73a0";
20
21 chosen {
22 bootargs = "console=tty0 console=ttySC4,115200 root=/dev/nfs ip=dhcp ignore_loglevel earlyprintk=sh-sci.4,115200";
23 };
24
25 memory {
26 device_type = "memory";
27 reg = <0x41000000 0x1e800000>;
28 };
29
30 fixedregulator1v8: fixedregulator@0 {
31 compatible = "regulator-fixed";
32 regulator-name = "fixed-1.8V";
33 regulator-min-microvolt = <1800000>;
34 regulator-max-microvolt = <1800000>;
35 };
36};
37
38&mmcif {
39 vmmc-supply = <&fixedregulator1v8>;
40 vqmmc-supply = <&fixedregulator1v8>;
41};
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index b15d4ffcd9a2..0c48af9b1a0f 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -129,6 +129,16 @@ config MACH_KZM9G
129 select SND_SOC_AK4642 if SND_SIMPLE_CARD 129 select SND_SOC_AK4642 if SND_SIMPLE_CARD
130 select USE_OF 130 select USE_OF
131 131
132config MACH_KZM9G_REFERENCE
133 bool "KZM-A9-GT board - Reference Device Tree Implementation"
134 depends on MACH_KZM9G
135 ---help---
136 Use reference implementation of KZM-A9-GT board support
137 which makes as greater use of device tree at the expense
138 of not supporting a number of devices.
139
140 This is intended to aid developers
141
132comment "SH-Mobile System Configuration" 142comment "SH-Mobile System Configuration"
133 143
134config CPU_HAS_INTEVT 144config CPU_HAS_INTEVT
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index 3705d4f7096b..c621edfa6ead 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -42,6 +42,7 @@ obj-$(CONFIG_MACH_MARZEN_REFERENCE) += board-marzen-reference.o
42obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o 42obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o
43obj-$(CONFIG_MACH_KZM9D) += board-kzm9d.o 43obj-$(CONFIG_MACH_KZM9D) += board-kzm9d.o
44obj-$(CONFIG_MACH_KZM9G) += board-kzm9g.o 44obj-$(CONFIG_MACH_KZM9G) += board-kzm9g.o
45obj-$(CONFIG_MACH_KZM9G_REFERENCE) += board-kzm9g-reference.o
45 46
46# Framework support 47# Framework support
47obj-$(CONFIG_SMP) += $(smp-y) 48obj-$(CONFIG_SMP) += $(smp-y)
diff --git a/arch/arm/mach-shmobile/board-kzm9g-reference.c b/arch/arm/mach-shmobile/board-kzm9g-reference.c
new file mode 100644
index 000000000000..caba1bb62f84
--- /dev/null
+++ b/arch/arm/mach-shmobile/board-kzm9g-reference.c
@@ -0,0 +1,87 @@
1/*
2 * KZM-A9-GT board support - Reference Device Tree Implementation
3 *
4 * Copyright (C) 2012 Horms Solutions Ltd.
5 *
6 * Based on board-kzm9g.c
7 * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 2 of the License.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#include <linux/delay.h>
24#include <linux/gpio.h>
25#include <linux/io.h>
26#include <linux/irq.h>
27#include <linux/irqchip.h>
28#include <linux/input.h>
29#include <linux/of_platform.h>
30#include <linux/pinctrl/machine.h>
31#include <mach/sh73a0.h>
32#include <mach/common.h>
33#include <asm/hardware/cache-l2x0.h>
34#include <asm/mach-types.h>
35#include <asm/mach/arch.h>
36
37static const struct pinctrl_map kzm_pinctrl_map[] = {
38 PIN_MAP_MUX_GROUP_DEFAULT("i2c-sh_mobile.3", "pfc-sh73a0",
39 "i2c3_1", "i2c3"),
40 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0",
41 "scifa4_data", "scifa4"),
42 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0",
43 "scifa4_ctrl", "scifa4"),
44};
45
46static void __init kzm_init(void)
47{
48 sh73a0_add_standard_devices_dt();
49 pinctrl_register_mappings(kzm_pinctrl_map, ARRAY_SIZE(kzm_pinctrl_map));
50
51#ifdef CONFIG_CACHE_L2X0
52 /* Early BRESP enable, Shared attribute override enable, 64K*8way */
53 l2x0_init(IOMEM(0xf0100000), 0x40460000, 0x82000fff);
54#endif
55}
56
57static void kzm9g_restart(char mode, const char *cmd)
58{
59#define RESCNT2 IOMEM(0xe6188020)
60 /* Do soft power on reset */
61 writel((1 << 31), RESCNT2);
62}
63
64static const char *kzm9g_boards_compat_dt[] __initdata = {
65 "renesas,kzm9g-reference",
66 NULL,
67};
68
69/* Please note that the clock initialisation shcheme used in
70 * sh73a0_add_early_devices_dt() and sh73a0_add_standard_devices_dt()
71 * does not work with SMP as there is a yet to be resolved lock-up in
72 * workqueue initialisation.
73 *
74 * CONFIG_SMP should be disabled when using this code.
75 */
76DT_MACHINE_START(KZM9G_DT, "kzm9g-reference")
77 .smp = smp_ops(sh73a0_smp_ops),
78 .map_io = sh73a0_map_io,
79 .init_early = sh73a0_init_delay,
80 .nr_irqs = NR_IRQS_LEGACY,
81 .init_irq = irqchip_init,
82 .init_machine = kzm_init,
83 .init_late = shmobile_init_late,
84 .init_time = shmobile_timer_init,
85 .restart = kzm9g_restart,
86 .dt_compat = kzm9g_boards_compat_dt,
87MACHINE_END