Skip to contentSkip to conversation

zynq: fix OF control of Zynq

PATCH Superseded Masahiro Yamada 3 participants 10 messages May 14, 2014 – May 15, 2014

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover zynq: fix OF control of Zynq

Zynq SoCs define CONFIG_OF_CONTROL and CONFIG_OF_SEPARATE, but it is not working.

One possible workaround was to edit include/configs/zynq-common.h to disable
CONFIG_OF_CONTROL
CONFIG_OF_SEPARATE
CONFIG_DISPLAY_BOARDINFO_LATE
CONFIG_FIT_SIGNATURE
CONFIG_RSA

I am not satisfied with this temporal workaround.

My motivation is to run U-boot mainline on Zynq boards with OF control.

To achieve this, SPL must load u-boot-dtb.bin.

1/4 adds support u-boot-dtb.img (= uImage header + u-boot-dtb.bin)

2/4 switches to load u-boot-dtb.img.

3/4 and 4/4 add missing some nodes to device tree.

This series was tested on my ZC706 board.

Masahiro Yamada (4):
build: support a new image u-boot-dtb.img
zynq: load u-boot-dtb.img for SD boot
zynq: add memory nodes to device tree to initialize DRAM with OF
zynq: add UART nodes to device tree to initialize UART with OF

 Makefile                          |  8 ++++++++
 arch/arm/dts/zynq-7000.dtsi       | 18 ++++++++++++++++++
 arch/arm/dts/zynq-microzed.dts    |  9 +++++++++
 arch/arm/dts/zynq-zc702.dts       |  9 +++++++++
 arch/arm/dts/zynq-zc706.dts       |  9 +++++++++
 arch/arm/dts/zynq-zc770-xm010.dts |  9 +++++++++
 arch/arm/dts/zynq-zc770-xm012.dts |  9 +++++++++
 arch/arm/dts/zynq-zc770-xm013.dts |  9 +++++++++
 arch/arm/dts/zynq-zed.dts         |  9 +++++++++
 include/configs/zynq-common.h     |  2 +-
 10 files changed, 90 insertions(+), 1 deletion(-)
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH 1/4 build: support a new image u-boot-dtb.img

In SPL framework, SPL uses u-boot.img to load u-boot.bin. Here,
u-boot.img = uImage header + u-boot.bin

To use OF control with a separate devicetree, u-boot.dtb must be placed right after u-boot.bin. In this case, u-boot-dtb.bin is generally used. Here,
u-boot-dtb.bin = u-boot.bin + u-boot.dtb

We need u-boot-dtb.img to use both SPL framework and separate OF control at the same time.
u-boot-dtb.img = uImage header + u-boot-dtb.bin

For example, Zynq boards already define all of
- CONFIG_SPL
- CONFIG_OF_CONTROL
- CONFIG_OF_SEPARATE

So, the support of u-boot-dtb.img is urgent.

Cc Michal Simek <[email protected]>
Cc Simon Glass <[email protected]>

---

 Makefile | 8 ++++++++
 1 file changed, 8 insertions(+)
Makefile +8 -0
index e82f616..83d1cc6 100644
@@ -752,6 +752,9 @@ ALL-$(CONFIG_SPL) += spl/u-boot-spl.bin
 ALL-$(CONFIG_SPL_FRAMEWORK) += u-boot.img
 ALL-$(CONFIG_TPL) += tpl/u-boot-tpl.bin
 ALL-$(CONFIG_OF_SEPARATE) += u-boot.dtb u-boot-dtb.bin
+ifeq ($(CONFIG_SPL_FRAMEWORK),y)
+ALL-$(CONFIG_OF_SEPARATE) += u-boot-dtb.img
+endif
 ALL-$(CONFIG_OF_HOSTFILE) += u-boot.dtb
 ifneq ($(CONFIG_SPL_TARGET),)
 ALL-$(CONFIG_SPL) += $(CONFIG_SPL_TARGET:"%"=%)
@@ -854,6 +857,11 @@ MKIMAGEFLAGS_u-boot.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \
 u-boot.img u-boot.kwb u-boot.pbl: u-boot.bin FORCE
 	$(call if_changed,mkimage)
 
+MKIMAGEFLAGS_u-boot-dtb.img = $(MKIMAGEFLAGS_u-boot.img)
+
+u-boot-dtb.img: u-boot-dtb.bin FORCE
+	$(call if_changed,mkimage)
+
 u-boot.sha1:	u-boot.bin
 		tools/ubsha1 u-boot.bin
 
Signature · 1 line
1.8.3.2
#2 lore raw

PATCH 1/4 build: support a new image u-boot-dtb.img

Hi Masahiro,

Quoted 14 lines · Masahiro Yamada

In SPL framework, SPL uses u-boot.img to load u-boot.bin. Here,
u-boot.img = uImage header + u-boot.bin

To use OF control with a separate devicetree, u-boot.dtb must be placed right after u-boot.bin. In this case, u-boot-dtb.bin is generally used. Here,
u-boot-dtb.bin = u-boot.bin + u-boot.dtb

We need u-boot-dtb.img to use both SPL framework and separate OF control at the same time.
u-boot-dtb.img = uImage header + u-boot-dtb.bin

Quoted 6 lines

For example, Zynq boards already define all of
- CONFIG_SPL
- CONFIG_OF_CONTROL
- CONFIG_OF_SEPARATE

So, the support of u-boot-dtb.img is urgent.

FYI there is also a .lds file problem in some cases - see:

http://patchwork.ozlabs.org/patch/339609/
http://patchwork.ozlabs.org/patch/339603/

Quoted 36 lines
Cc Michal Simek <[email protected]>
Cc Simon Glass <[email protected]>

---

 Makefile | 8 ++++++++
 1 file changed, 8 insertions(+)
Makefile +8 -1
index e82f616..83d1cc6 100644
@@ -752,6 +752,9 @@ ALL-$(CONFIG_SPL) += spl/u-boot-spl.bin
 ALL-$(CONFIG_SPL_FRAMEWORK) += u-boot.img
 ALL-$(CONFIG_TPL) += tpl/u-boot-tpl.bin
 ALL-$(CONFIG_OF_SEPARATE) += u-boot.dtb u-boot-dtb.bin
+ifeq ($(CONFIG_SPL_FRAMEWORK),y)
+ALL-$(CONFIG_OF_SEPARATE) += u-boot-dtb.img
+endif
 ALL-$(CONFIG_OF_HOSTFILE) += u-boot.dtb
 ifneq ($(CONFIG_SPL_TARGET),)
 ALL-$(CONFIG_SPL) += $(CONFIG_SPL_TARGET:"%"=%)
@@ -854,6 +857,11 @@ MKIMAGEFLAGS_u-boot.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \
 u-boot.img u-boot.kwb u-boot.pbl: u-boot.bin FORCE
        $(call if_changed,mkimage)
 
+MKIMAGEFLAGS_u-boot-dtb.img = $(MKIMAGEFLAGS_u-boot.img)
+
+u-boot-dtb.img: u-boot-dtb.bin FORCE
+       $(call if_changed,mkimage)
+
 u-boot.sha1:   u-boot.bin
                tools/ubsha1 u-boot.bin
 
--
Quoted 2 lines

1.8.3.2

Regards,
Simon

#3 lore raw

PATCH 2/4 zynq: load u-boot-dtb.img for SD boot

In reply to Masahiro Yamada

Because Zynq enables CONFIG_OF_CONTROL and CONFIG_OF_SEPARATE by default, CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME should be "u-boot-dtb.img", not "u-boot.img".

---

 include/configs/zynq-common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/configs/zynq-common.h +1 -1
index 731e69b..38e3d54 100644
@@ -253,7 +253,7 @@
 #define CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION    1
 #define CONFIG_SPL_LIBDISK_SUPPORT
 #define CONFIG_SPL_FAT_SUPPORT
-#define CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME     "u-boot.img"
+#define CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME     "u-boot-dtb.img"
 #endif
 
 /* Address in RAM where the parameters must be copied by SPL. */
Signature · 1 line
1.8.3.2
#4 lore raw

PATCH 2/4 zynq: load u-boot-dtb.img for SD boot

Quoted 16 lines · Masahiro Yamada

Because Zynq enables CONFIG_OF_CONTROL and CONFIG_OF_SEPARATE by default, CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME should be "u-boot-dtb.img", not "u-boot.img".

---

 include/configs/zynq-common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/configs/zynq-common.h +0 -0
index 731e69b..38e3d54 100644

include/configs/zynq-common.h line 256

Quoted 5 lines
include/configs/zynq-common.h +1 -1
@@ -253,7 +253,7 @@
 #define CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION    1
 #define CONFIG_SPL_LIBDISK_SUPPORT
 #define CONFIG_SPL_FAT_SUPPORT
-#define CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME     "u-boot.img"
+#define CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME     "u-boot-dtb.img"

Here should be just for sure.
#if defined(CONFIG_OF_CONTROL) && defined(CONFIG_OF_SEPARATE)

# define CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME     "u-boot-dtb.img"
#else
# define CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME     "u-boot.img"
#endif

Thanks,
Michal

Signature · 14 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140514/ab9e25f6/attachment.pgp>
#5 lore raw

PATCH 2/4 zynq: load u-boot-dtb.img for SD boot

Hi Michal,

Quoted 13 lines

include/configs/zynq-common.h line 256

Quoted 10 lines
include/configs/zynq-common.h +1 -1
index 731e69b..38e3d54 100644
@@ -253,7 +253,7 @@
 #define CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION    1
 #define CONFIG_SPL_LIBDISK_SUPPORT
 #define CONFIG_SPL_FAT_SUPPORT
-#define CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME     "u-boot.img"
+#define CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME     "u-boot-dtb.img"

Here should be just for sure.
#if defined(CONFIG_OF_CONTROL) && defined(CONFIG_OF_SEPARATE)

Quoted 4 lines
# define CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME     "u-boot-dtb.img"
#else
# define CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME     "u-boot.img"
#endif

Fixed in v2.

Best Regards
Masahiro Yamada

#6 lore raw

PATCH 3/4 zynq: add memory nodes to device tree to initialize DRAM with OF

In reply to Masahiro Yamada

Commit 9e0e37ac added OF RAM initialization support but memory nodes are missing in device tree.

---

 arch/arm/dts/zynq-microzed.dts    | 5 +++++
 arch/arm/dts/zynq-zc702.dts       | 5 +++++
 arch/arm/dts/zynq-zc706.dts       | 5 +++++
 arch/arm/dts/zynq-zc770-xm010.dts | 5 +++++
 arch/arm/dts/zynq-zc770-xm012.dts | 5 +++++
 arch/arm/dts/zynq-zc770-xm013.dts | 5 +++++
 arch/arm/dts/zynq-zed.dts         | 5 +++++
 7 files changed, 35 insertions(+)
arch/arm/dts/zynq-microzed.dts +5 -0
index 6da71c1..842896f 100644
@@ -11,4 +11,9 @@
 / {
 	model = "Zynq MicroZED Board";
 	compatible = "xlnx,zynq-microzed", "xlnx,zynq-7000";
+
+	memory {
+		device_type = "memory";
+		reg = <0 0x40000000>;
+	};
 };
arch/arm/dts/zynq-zc702.dts +5 -0
index 667dc28..a94e331 100644
@@ -11,4 +11,9 @@
 / {
 	model = "Zynq ZC702 Board";
 	compatible = "xlnx,zynq-zc702", "xlnx,zynq-7000";
+
+	memory {
+		device_type = "memory";
+		reg = <0 0x40000000>;
+	};
 };
arch/arm/dts/zynq-zc706.dts +5 -0
index 526fc88..92de947 100644
@@ -11,4 +11,9 @@
 / {
 	model = "Zynq ZC706 Board";
 	compatible = "xlnx,zynq-zc706", "xlnx,zynq-7000";
+
+	memory {
+		device_type = "memory";
+		reg = <0 0x40000000>;
+	};
 };
arch/arm/dts/zynq-zc770-xm010.dts +5 -0
index 8b542a1..8d68208 100644
@@ -11,4 +11,9 @@
 / {
 	model = "Zynq ZC770 XM010 Board";
 	compatible = "xlnx,zynq-zc770-xm010", "xlnx,zynq-7000";
+
+	memory {
+		device_type = "memory";
+		reg = <0 0x40000000>;
+	};
 };
arch/arm/dts/zynq-zc770-xm012.dts +5 -0
index 0379a07..9ebbddf 100644
@@ -11,4 +11,9 @@
 / {
 	model = "Zynq ZC770 XM012 Board";
 	compatible = "xlnx,zynq-zc770-xm012", "xlnx,zynq-7000";
+
+	memory {
+		device_type = "memory";
+		reg = <0 0x40000000>;
+	};
 };
arch/arm/dts/zynq-zc770-xm013.dts +5 -0
index a4f9e05..b4f7fa2 100644
@@ -11,4 +11,9 @@
 / {
 	model = "Zynq ZC770 XM013 Board";
 	compatible = "xlnx,zynq-zc770-xm013", "xlnx,zynq-7000";
+
+	memory {
+		device_type = "memory";
+		reg = <0 0x40000000>;
+	};
 };
arch/arm/dts/zynq-zed.dts +5 -0
index 91a5deb..3488a56 100644
@@ -11,4 +11,9 @@
 / {
 	model = "Zynq ZED Board";
 	compatible = "xlnx,zynq-zed", "xlnx,zynq-7000";
+
+	memory {
+		device_type = "memory";
+		reg = <0 0x20000000>;
+	};
 };
Signature · 1 line
1.8.3.2
#7 lore raw

PATCH 4/4 zynq: add UART nodes to device tree to initialize UART with OF

In reply to Masahiro Yamada

Commit c9416b92 added OF UART initialization support but uart and aliases nodes are missing in device tree.

The nodes uart0 and uart1 have been copied from arch/arm/boot/dts/zynq-7000.dtsi, Linux Kernel v3.15-rc5 tag.

---

 arch/arm/dts/zynq-7000.dtsi       | 18 ++++++++++++++++++
 arch/arm/dts/zynq-microzed.dts    |  4 ++++
 arch/arm/dts/zynq-zc702.dts       |  4 ++++
 arch/arm/dts/zynq-zc706.dts       |  4 ++++
 arch/arm/dts/zynq-zc770-xm010.dts |  4 ++++
 arch/arm/dts/zynq-zc770-xm012.dts |  4 ++++
 arch/arm/dts/zynq-zc770-xm013.dts |  4 ++++
 arch/arm/dts/zynq-zed.dts         |  4 ++++
 8 files changed, 46 insertions(+)
arch/arm/dts/zynq-7000.dtsi +18 -0
index f20b8bd..0766aaf 100644
@@ -10,4 +10,22 @@
 
 / {
 	compatible = "xlnx,zynq-7000";
+
+	amba {
+		compatible = "simple-bus";
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		uart0: uart at e0000000 {
+			compatible = "xlnx,xuartps";
+			status = "disabled";
+			reg = <0xE0000000 0x1000>;
+		};
+
+		uart1: uart at e0001000 {
+			compatible = "xlnx,xuartps";
+			status = "disabled";
+			reg = <0xE0001000 0x1000>;
+		};
+	};
 };
arch/arm/dts/zynq-microzed.dts +4 -0
index 842896f..c373a2c 100644
@@ -12,6 +12,10 @@
 	model = "Zynq MicroZED Board";
 	compatible = "xlnx,zynq-microzed", "xlnx,zynq-7000";
 
+	aliases {
+		serial0 = &uart1;
+	};
+
 	memory {
 		device_type = "memory";
 		reg = <0 0x40000000>;
arch/arm/dts/zynq-zc702.dts +4 -0
index a94e331..4fa0b00 100644
@@ -12,6 +12,10 @@
 	model = "Zynq ZC702 Board";
 	compatible = "xlnx,zynq-zc702", "xlnx,zynq-7000";
 
+	aliases {
+		serial0 = &uart1;
+	};
+
 	memory {
 		device_type = "memory";
 		reg = <0 0x40000000>;
arch/arm/dts/zynq-zc706.dts +4 -0
index 92de947..2a80195 100644
@@ -12,6 +12,10 @@
 	model = "Zynq ZC706 Board";
 	compatible = "xlnx,zynq-zc706", "xlnx,zynq-7000";
 
+	aliases {
+		serial0 = &uart1;
+	};
+
 	memory {
 		device_type = "memory";
 		reg = <0 0x40000000>;
arch/arm/dts/zynq-zc770-xm010.dts +4 -0
index 8d68208..5e66174 100644
@@ -12,6 +12,10 @@
 	model = "Zynq ZC770 XM010 Board";
 	compatible = "xlnx,zynq-zc770-xm010", "xlnx,zynq-7000";
 
+	aliases {
+		serial0 = &uart1;
+	};
+
 	memory {
 		device_type = "memory";
 		reg = <0 0x40000000>;
arch/arm/dts/zynq-zc770-xm012.dts +4 -0
index 9ebbddf..127a661 100644
@@ -12,6 +12,10 @@
 	model = "Zynq ZC770 XM012 Board";
 	compatible = "xlnx,zynq-zc770-xm012", "xlnx,zynq-7000";
 
+	aliases {
+		serial0 = &uart1;
+	};
+
 	memory {
 		device_type = "memory";
 		reg = <0 0x40000000>;
arch/arm/dts/zynq-zc770-xm013.dts +4 -0
index b4f7fa2..c61c7e7 100644
@@ -12,6 +12,10 @@
 	model = "Zynq ZC770 XM013 Board";
 	compatible = "xlnx,zynq-zc770-xm013", "xlnx,zynq-7000";
 
+	aliases {
+		serial0 = &uart0;
+	};
+
 	memory {
 		device_type = "memory";
 		reg = <0 0x40000000>;
arch/arm/dts/zynq-zed.dts +4 -0
index 3488a56..70cc8a6 100644
@@ -12,6 +12,10 @@
 	model = "Zynq ZED Board";
 	compatible = "xlnx,zynq-zed", "xlnx,zynq-7000";
 
+	aliases {
+		serial0 = &uart1;
+	};
+
 	memory {
 		device_type = "memory";
 		reg = <0 0x20000000>;
Signature · 1 line
1.8.3.2
#8 lore raw

cover zynq: fix OF control of Zynq

In reply to Masahiro Yamada

Hi Masahiro.

Quoted 18 lines · Masahiro Yamada

Zynq SoCs define CONFIG_OF_CONTROL and CONFIG_OF_SEPARATE, but it is not working.

One possible workaround was to edit include/configs/zynq-common.h to disable
CONFIG_OF_CONTROL
CONFIG_OF_SEPARATE
CONFIG_DISPLAY_BOARDINFO_LATE
CONFIG_FIT_SIGNATURE
CONFIG_RSA

I am not satisfied with this temporal workaround.

My motivation is to run U-boot mainline on Zynq boards with OF control.

To achieve this, SPL must load u-boot-dtb.bin.

Quoted 7 lines

1/4 adds support u-boot-dtb.img (= uImage header + u-boot-dtb.bin)

2/4 switches to load u-boot-dtb.img.

3/4 and 4/4 add missing some nodes to device tree.

This series was tested on my ZC706 board.

I have tested it on zc702 and it is working correctly.

Regarding patches 3/4 and 4/4 maybe will be just easier to add full DTS because you will want to use OF configuration for ethernet, mmc, usb, etc. Taken it from mainline kernel make sense.

Thanks,
Michal

Signature · 14 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140514/62c4f5b2/attachment.pgp>
#9 lore raw

cover zynq: fix OF control of Zynq

Quoted 8 lines · On Wed, 14 May 2014 16:14:55 +0200 Michal Simek <[email protected]> wrote:

I have tested it on zc702 and it is working correctly.

Regarding patches 3/4 and 4/4 maybe will be just easier to add full DTS because you will want to use OF configuration for ethernet, mmc, usb, etc. Taken it from mainline kernel make sense.

Thanks for your review and test!

I imported and adjusted zynq-7000.dtsi in v2.

Best Regards
Masahiro Yamada