]> Pileus Git - ~andy/linux/commitdiff
ARM: shmobile: ape6evm: add DT reference
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Mon, 8 Jul 2013 16:04:57 +0000 (18:04 +0200)
committerSimon Horman <horms+renesas@verge.net.au>
Wed, 17 Jul 2013 05:28:31 +0000 (14:28 +0900)
This patch adds a sample DT-based APE6EVM "reference" implementation. The
use of platform-specific C-code should be avoided with this configuration
as much as possible.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
Acked-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
arch/arm/boot/dts/Makefile
arch/arm/boot/dts/r8a73a4-ape6evm-reference.dts [new file with mode: 0644]
arch/arm/mach-shmobile/Kconfig
arch/arm/mach-shmobile/Makefile
arch/arm/mach-shmobile/Makefile.boot
arch/arm/mach-shmobile/board-ape6evm-reference.c [new file with mode: 0644]
arch/arm/mach-shmobile/include/mach/r8a73a4.h
arch/arm/mach-shmobile/setup-r8a73a4.c

index af19e38f8e97a8b3b6f0524c1280eb0eb03c796c..6d79bde792b7a98ade8bfa5897ac9ededf3bc50e 100644 (file)
@@ -192,6 +192,7 @@ dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \
        sh73a0-kzm9g.dtb \
        sh73a0-kzm9g-reference.dtb \
        r8a73a4-ape6evm.dtb \
+       r8a73a4-ape6evm-reference.dtb \
        sh7372-mackerel.dtb
 dtb-$(CONFIG_ARCH_SOCFPGA) += socfpga_cyclone5.dtb \
        socfpga_vt.dtb
diff --git a/arch/arm/boot/dts/r8a73a4-ape6evm-reference.dts b/arch/arm/boot/dts/r8a73a4-ape6evm-reference.dts
new file mode 100644 (file)
index 0000000..3251f05
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Device Tree Source for the APE6EVM board
+ *
+ * Copyright (C) 2013 Renesas Solutions Corp.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+/dts-v1/;
+/include/ "r8a73a4.dtsi"
+
+/ {
+       model = "APE6EVM";
+       compatible = "renesas,ape6evm-reference", "renesas,r8a73a4";
+
+       chosen {
+               bootargs = "console=ttySC0,115200 ignore_loglevel";
+       };
+
+       memory@40000000 {
+               device_type = "memory";
+               reg = <0 0x40000000 0 0x40000000>;
+       };
+
+       lbsc {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges = <0 0 0 0x80000000>;
+       };
+};
index dd80f215feeb9461a60a19885d467ce01815c794..ad28f91b5796199f24e91a9ac13e8d2edcd5c51a 100644 (file)
@@ -83,6 +83,17 @@ config MACH_APE6EVM
        depends on ARCH_R8A73A4
        select USE_OF
 
+config MACH_APE6EVM_REFERENCE
+       bool "APE6EVM board - Reference Device Tree Implementation"
+       depends on ARCH_R8A73A4
+       select USE_OF
+       ---help---
+          Use reference implementation of APE6EVM board support
+          which makes a greater use of device tree at the expense
+          of not supporting a number of devices.
+
+          This is intended to aid developers
+
 config MACH_MACKEREL
        bool "mackerel board"
        depends on ARCH_SH7372
index e8d0a2c904a01d4c19246d372bf7b249f1d39f56..26a578420796f3a0ff98f2624bbc7273c2d7ccde 100644 (file)
@@ -37,6 +37,7 @@ obj-$(CONFIG_ARCH_SH73A0)     += pm-sh73a0.o
 # Board objects
 obj-$(CONFIG_MACH_AG5EVM)      += board-ag5evm.o
 obj-$(CONFIG_MACH_APE6EVM)     += board-ape6evm.o
+obj-$(CONFIG_MACH_APE6EVM_REFERENCE)   += board-ape6evm-reference.o
 obj-$(CONFIG_MACH_MACKEREL)    += board-mackerel.o
 obj-$(CONFIG_MACH_KOTA2)       += board-kota2.o
 obj-$(CONFIG_MACH_BOCKW)       += board-bockw.o
index 7785c52b5cfdfd0f509375c6491a50d501057930..c938b58f64079918d86afd87cb2ae05bcda3a0de 100644 (file)
@@ -2,6 +2,7 @@
 loadaddr-y     :=
 loadaddr-$(CONFIG_MACH_AG5EVM) += 0x40008000
 loadaddr-$(CONFIG_MACH_APE6EVM) += 0x40008000
+loadaddr-$(CONFIG_MACH_APE6EVM_REFERENCE) += 0x40008000
 loadaddr-$(CONFIG_MACH_ARMADILLO800EVA) += 0x40008000
 loadaddr-$(CONFIG_MACH_ARMADILLO800EVA_REFERENCE) += 0x40008000
 loadaddr-$(CONFIG_MACH_BOCKW) += 0x60008000
diff --git a/arch/arm/mach-shmobile/board-ape6evm-reference.c b/arch/arm/mach-shmobile/board-ape6evm-reference.c
new file mode 100644 (file)
index 0000000..c828874
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * APE6EVM board support
+ *
+ * Copyright (C) 2013  Renesas Solutions Corp.
+ * Copyright (C) 2013  Magnus Damm
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include <linux/gpio.h>
+#include <linux/kernel.h>
+#include <linux/of_platform.h>
+#include <linux/pinctrl/machine.h>
+#include <linux/sh_clk.h>
+#include <mach/common.h>
+#include <mach/r8a73a4.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+
+static const struct pinctrl_map ape6evm_pinctrl_map[] = {
+       /* SCIFA0 console */
+       PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.0", "pfc-r8a73a4",
+                                 "scifa0_data", "scifa0"),
+};
+
+static void __init ape6evm_add_standard_devices(void)
+{
+
+       struct clk *parent;
+       struct clk *mp;
+
+       r8a73a4_clock_init();
+
+       /* MP clock parent = extal2 */
+       parent      = clk_get(NULL, "extal2");
+       mp          = clk_get(NULL, "mp");
+       BUG_ON(IS_ERR(parent) || IS_ERR(mp));
+
+       clk_set_parent(mp, parent);
+       clk_put(parent);
+       clk_put(mp);
+
+       pinctrl_register_mappings(ape6evm_pinctrl_map,
+                                 ARRAY_SIZE(ape6evm_pinctrl_map));
+       r8a73a4_pinmux_init();
+       r8a73a4_add_dt_devices();
+       of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+}
+
+static const char *ape6evm_boards_compat_dt[] __initdata = {
+       "renesas,ape6evm-reference",
+       NULL,
+};
+
+DT_MACHINE_START(APE6EVM_DT, "ape6evm")
+       .init_early     = r8a73a4_init_delay,
+       .init_time      = shmobile_timer_init,
+       .init_machine   = ape6evm_add_standard_devices,
+       .dt_compat      = ape6evm_boards_compat_dt,
+MACHINE_END
index 144a85e29245dabcc12ef5f0ae89f755c0f26f1a..f3a9b702da56f326055029c8ffb81275b619d2ec 100644 (file)
@@ -2,6 +2,7 @@
 #define __ASM_R8A73A4_H__
 
 void r8a73a4_add_standard_devices(void);
+void r8a73a4_add_dt_devices(void);
 void r8a73a4_clock_init(void);
 void r8a73a4_pinmux_init(void);
 void r8a73a4_init_delay(void);
index d533bd23865c70e408c74374946ee5d355a41289..630ea4eb5472fcdeee87001467113d0666c293cb 100644 (file)
@@ -188,7 +188,7 @@ static struct resource cmt10_resources[] = {
                                          &cmt##idx##_platform_data,    \
                                          sizeof(struct sh_timer_config))
 
-void __init r8a73a4_add_standard_devices(void)
+void __init r8a73a4_add_dt_devices(void)
 {
        r8a73a4_register_scif(SCIFA0);
        r8a73a4_register_scif(SCIFA1);
@@ -196,10 +196,15 @@ void __init r8a73a4_add_standard_devices(void)
        r8a73a4_register_scif(SCIFB1);
        r8a73a4_register_scif(SCIFB2);
        r8a73a4_register_scif(SCIFB3);
+       r8a7790_register_cmt(10);
+}
+
+void __init r8a73a4_add_standard_devices(void)
+{
+       r8a73a4_add_dt_devices();
        r8a73a4_register_irqc(0);
        r8a73a4_register_irqc(1);
        r8a73a4_register_thermal();
-       r8a7790_register_cmt(10);
 }
 
 void __init r8a73a4_init_delay(void)