[PATCH V6 5/5] ARM: Xilinx: adding device tree support

John Linn john.linn at xilinx.com
Tue Apr 5 14:28:06 EDT 2011


This commit is dependent on the device tree for ARM
work that Grant Likely has been doing. Minimal changes
are needed to support device tree.

Signed-off-by: John Linn <john.linn at xilinx.com>
---

This is new patch in the series starting at V6. It is an optional 
patch for those not using device tree yet.

 Documentation/devicetree/bindings/arm/xilinx.txt |    7 +++
 arch/arm/boot/dts/zynq-ep107.dts                 |   52 ++++++++++++++++++++++
 arch/arm/mach-zynq/board_ep107.c                 |    8 +++-
 arch/arm/mach-zynq/common.c                      |   12 +++++
 4 files changed, 78 insertions(+), 1 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/xilinx.txt
 create mode 100755 arch/arm/boot/dts/zynq-ep107.dts

diff --git a/Documentation/devicetree/bindings/arm/xilinx.txt b/Documentation/devicetree/bindings/arm/xilinx.txt
new file mode 100644
index 0000000..6f1ed83
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/xilinx.txt
@@ -0,0 +1,7 @@
+Xilinx Zynq EP107 Emulation Platform board
+
+This board is an emulation platform for the Zynq product which is
+based on an ARM Cortex A9 processor.
+
+Required root node properties:
+    - compatible = "xlnx,zynq-ep107";
diff --git a/arch/arm/boot/dts/zynq-ep107.dts b/arch/arm/boot/dts/zynq-ep107.dts
new file mode 100755
index 0000000..fe2c0cc
--- /dev/null
+++ b/arch/arm/boot/dts/zynq-ep107.dts
@@ -0,0 +1,52 @@
+/*
+ *  Copyright (C) 2011 Xilinx
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+/dts-v1/;
+/ {
+	model = "Xilinx Zynq EP107";
+	compatible = "xlnx,zynq-ep107";
+	#address-cells = <1>;
+	#size-cells = <1>;
+	interrupt-parent = <&intc>;
+
+	memory {
+		device_type = "memory";
+		reg = <0x0 0x10000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyDF0,9600 root=/dev/ram rw initrd=0x800000,8M earlyprintk";
+		linux,stdout-path = &uart0;
+	};
+
+	amba: amba at 0 {
+		compatible = "simple-bus";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
+		intc: intc at F8F01000 {
+			interrupt-controller;
+			compatible = "arm,gic";
+			reg = <0xF8F01000 0x1000>;
+			#interrupt-cells = <2>;
+		};
+
+		uart0: uart at E0000000 {
+			compatible = "xlnx,xuartpss";
+			reg = <0xE0000000 0x1000>;
+			interrupts = <59 0>;
+			clock = <50000000>;
+		};
+	};
+};
diff --git a/arch/arm/mach-zynq/board_ep107.c b/arch/arm/mach-zynq/board_ep107.c
index 3d576d0..5284dcc 100644
--- a/arch/arm/mach-zynq/board_ep107.c
+++ b/arch/arm/mach-zynq/board_ep107.c
@@ -76,10 +76,16 @@ static void __init board_ep107_init(void)
 	platform_add_devices(&xilinx_pdevices[0], ARRAY_SIZE(xilinx_pdevices));
 }
 
-MACHINE_START(XILINX_EP107, "Xilinx EP107")
+static const char *xilinx_ep107_board_compat[] = {
+	"xlnx,zynq-ep107",
+	NULL
+};
+
+MACHINE_START(XILINX_EP107, "Xilinx Zynq EP107")
 	.boot_params    = PLAT_PHYS_OFFSET + 0x00000100,
 	.map_io         = xilinx_map_io,
 	.init_irq       = xilinx_irq_init,
 	.init_machine   = board_ep107_init,
 	.timer          = &xttcpss_sys_timer,
+	.dt_compat	= xilinx_ep107_board_compat,
 MACHINE_END
diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c
index 9a626ba..4dd909b 100644
--- a/arch/arm/mach-zynq/common.c
+++ b/arch/arm/mach-zynq/common.c
@@ -20,6 +20,7 @@
 #include <linux/cpumask.h>
 #include <linux/platform_device.h>
 #include <linux/clk.h>
+#include <linux/of_platform.h>
 
 #include <asm/mach/map.h>
 #include <asm/page.h>
@@ -30,6 +31,13 @@
 #include <mach/clkdev.h>
 #include "common.h"
 
+#ifdef CONFIG_OF
+static struct of_device_id zynq_of_bus_ids[] __initdata = {
+	{ .compatible = "simple-bus", },
+	{}
+};
+#endif
+
 /*
  * Clock function infrastructure.
  */
@@ -60,6 +68,10 @@ void __init xilinx_system_init(void)
 	 */
 	l2x0_init(PL310_L2CC_BASE, 0x02060000, 0xF0F0FFFF);
 #endif
+
+#ifdef CONFIG_OF
+	of_platform_bus_probe(NULL, zynq_of_bus_ids, NULL);
+#endif
 }
 
 /**
-- 
1.5.4.7



This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.





More information about the linux-arm-kernel mailing list