[U-Boot] [PATCH 0/4] 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(-)

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.
Signed-off-by: Masahiro Yamada yamada.m@jp.panasonic.com Cc: Michal Simek michal.simek@xilinx.com Cc: Simon Glass sjg@chromium.org ---
Makefile | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/Makefile b/Makefile index e82f616..83d1cc6 100644 --- a/Makefile +++ b/Makefile @@ -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

Hi Masahiro,
On 14 May 2014 06:55, Masahiro Yamada yamada.m@jp.panasonic.com wrote:
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.
Acked-by: Simon Glass sjg@chromium.org
FYI there is also a .lds file problem in some cases - see:
http://patchwork.ozlabs.org/patch/339609/ http://patchwork.ozlabs.org/patch/339603/
Signed-off-by: Masahiro Yamada yamada.m@jp.panasonic.com Cc: Michal Simek michal.simek@xilinx.com Cc: Simon Glass sjg@chromium.org
Makefile | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/Makefile b/Makefile index e82f616..83d1cc6 100644 --- a/Makefile +++ b/Makefile @@ -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
-- 1.8.3.2
Regards, Simon

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".
Signed-off-by: Masahiro Yamada yamada.m@jp.panasonic.com Cc: Michal Simek michal.simek@xilinx.com ---
include/configs/zynq-common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h index 731e69b..38e3d54 100644 --- a/include/configs/zynq-common.h +++ b/include/configs/zynq-common.h @@ -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. */

On 05/14/2014 02:55 PM, Masahiro Yamada wrote:
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".
Signed-off-by: Masahiro Yamada yamada.m@jp.panasonic.com Cc: Michal Simek michal.simek@xilinx.com
include/configs/zynq-common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h index 731e69b..38e3d54 100644 --- a/include/configs/zynq-common.h +++ b/include/configs/zynq-common.h @@ -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

Hi Michal,
diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h index 731e69b..38e3d54 100644 --- a/include/configs/zynq-common.h +++ b/include/configs/zynq-common.h @@ -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
Fixed in v2.
Best Regards Masahiro Yamada

Commit 9e0e37ac added OF RAM initialization support but memory nodes are missing in device tree.
Signed-off-by: Masahiro Yamada yamada.m@jp.panasonic.com Cc: Michal Simek michal.simek@xilinx.com ---
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(+)
diff --git a/arch/arm/dts/zynq-microzed.dts b/arch/arm/dts/zynq-microzed.dts index 6da71c1..842896f 100644 --- a/arch/arm/dts/zynq-microzed.dts +++ b/arch/arm/dts/zynq-microzed.dts @@ -11,4 +11,9 @@ / { model = "Zynq MicroZED Board"; compatible = "xlnx,zynq-microzed", "xlnx,zynq-7000"; + + memory { + device_type = "memory"; + reg = <0 0x40000000>; + }; }; diff --git a/arch/arm/dts/zynq-zc702.dts b/arch/arm/dts/zynq-zc702.dts index 667dc28..a94e331 100644 --- a/arch/arm/dts/zynq-zc702.dts +++ b/arch/arm/dts/zynq-zc702.dts @@ -11,4 +11,9 @@ / { model = "Zynq ZC702 Board"; compatible = "xlnx,zynq-zc702", "xlnx,zynq-7000"; + + memory { + device_type = "memory"; + reg = <0 0x40000000>; + }; }; diff --git a/arch/arm/dts/zynq-zc706.dts b/arch/arm/dts/zynq-zc706.dts index 526fc88..92de947 100644 --- a/arch/arm/dts/zynq-zc706.dts +++ b/arch/arm/dts/zynq-zc706.dts @@ -11,4 +11,9 @@ / { model = "Zynq ZC706 Board"; compatible = "xlnx,zynq-zc706", "xlnx,zynq-7000"; + + memory { + device_type = "memory"; + reg = <0 0x40000000>; + }; }; diff --git a/arch/arm/dts/zynq-zc770-xm010.dts b/arch/arm/dts/zynq-zc770-xm010.dts index 8b542a1..8d68208 100644 --- a/arch/arm/dts/zynq-zc770-xm010.dts +++ b/arch/arm/dts/zynq-zc770-xm010.dts @@ -11,4 +11,9 @@ / { model = "Zynq ZC770 XM010 Board"; compatible = "xlnx,zynq-zc770-xm010", "xlnx,zynq-7000"; + + memory { + device_type = "memory"; + reg = <0 0x40000000>; + }; }; diff --git a/arch/arm/dts/zynq-zc770-xm012.dts b/arch/arm/dts/zynq-zc770-xm012.dts index 0379a07..9ebbddf 100644 --- a/arch/arm/dts/zynq-zc770-xm012.dts +++ b/arch/arm/dts/zynq-zc770-xm012.dts @@ -11,4 +11,9 @@ / { model = "Zynq ZC770 XM012 Board"; compatible = "xlnx,zynq-zc770-xm012", "xlnx,zynq-7000"; + + memory { + device_type = "memory"; + reg = <0 0x40000000>; + }; }; diff --git a/arch/arm/dts/zynq-zc770-xm013.dts b/arch/arm/dts/zynq-zc770-xm013.dts index a4f9e05..b4f7fa2 100644 --- a/arch/arm/dts/zynq-zc770-xm013.dts +++ b/arch/arm/dts/zynq-zc770-xm013.dts @@ -11,4 +11,9 @@ / { model = "Zynq ZC770 XM013 Board"; compatible = "xlnx,zynq-zc770-xm013", "xlnx,zynq-7000"; + + memory { + device_type = "memory"; + reg = <0 0x40000000>; + }; }; diff --git a/arch/arm/dts/zynq-zed.dts b/arch/arm/dts/zynq-zed.dts index 91a5deb..3488a56 100644 --- a/arch/arm/dts/zynq-zed.dts +++ b/arch/arm/dts/zynq-zed.dts @@ -11,4 +11,9 @@ / { model = "Zynq ZED Board"; compatible = "xlnx,zynq-zed", "xlnx,zynq-7000"; + + memory { + device_type = "memory"; + reg = <0 0x20000000>; + }; };

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.
Signed-off-by: Masahiro Yamada yamada.m@jp.panasonic.com Cc: Michal Simek michal.simek@xilinx.com ---
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(+)
diff --git a/arch/arm/dts/zynq-7000.dtsi b/arch/arm/dts/zynq-7000.dtsi index f20b8bd..0766aaf 100644 --- a/arch/arm/dts/zynq-7000.dtsi +++ b/arch/arm/dts/zynq-7000.dtsi @@ -10,4 +10,22 @@
/ { compatible = "xlnx,zynq-7000"; + + amba { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + + uart0: uart@e0000000 { + compatible = "xlnx,xuartps"; + status = "disabled"; + reg = <0xE0000000 0x1000>; + }; + + uart1: uart@e0001000 { + compatible = "xlnx,xuartps"; + status = "disabled"; + reg = <0xE0001000 0x1000>; + }; + }; }; diff --git a/arch/arm/dts/zynq-microzed.dts b/arch/arm/dts/zynq-microzed.dts index 842896f..c373a2c 100644 --- a/arch/arm/dts/zynq-microzed.dts +++ b/arch/arm/dts/zynq-microzed.dts @@ -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>; diff --git a/arch/arm/dts/zynq-zc702.dts b/arch/arm/dts/zynq-zc702.dts index a94e331..4fa0b00 100644 --- a/arch/arm/dts/zynq-zc702.dts +++ b/arch/arm/dts/zynq-zc702.dts @@ -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>; diff --git a/arch/arm/dts/zynq-zc706.dts b/arch/arm/dts/zynq-zc706.dts index 92de947..2a80195 100644 --- a/arch/arm/dts/zynq-zc706.dts +++ b/arch/arm/dts/zynq-zc706.dts @@ -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>; diff --git a/arch/arm/dts/zynq-zc770-xm010.dts b/arch/arm/dts/zynq-zc770-xm010.dts index 8d68208..5e66174 100644 --- a/arch/arm/dts/zynq-zc770-xm010.dts +++ b/arch/arm/dts/zynq-zc770-xm010.dts @@ -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>; diff --git a/arch/arm/dts/zynq-zc770-xm012.dts b/arch/arm/dts/zynq-zc770-xm012.dts index 9ebbddf..127a661 100644 --- a/arch/arm/dts/zynq-zc770-xm012.dts +++ b/arch/arm/dts/zynq-zc770-xm012.dts @@ -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>; diff --git a/arch/arm/dts/zynq-zc770-xm013.dts b/arch/arm/dts/zynq-zc770-xm013.dts index b4f7fa2..c61c7e7 100644 --- a/arch/arm/dts/zynq-zc770-xm013.dts +++ b/arch/arm/dts/zynq-zc770-xm013.dts @@ -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>; diff --git a/arch/arm/dts/zynq-zed.dts b/arch/arm/dts/zynq-zed.dts index 3488a56..70cc8a6 100644 --- a/arch/arm/dts/zynq-zed.dts +++ b/arch/arm/dts/zynq-zed.dts @@ -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>;

Hi Masahiro.
On 05/14/2014 02:55 PM, Masahiro Yamada wrote:
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.
I have tested it on zc702 and it is working correctly.
Tested-by: Michal Simek monstr@monstr.eu
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

On Wed, 14 May 2014 16:14:55 +0200 Michal Simek monstr@monstr.eu wrote:
I have tested it on zc702 and it is working correctly.
Tested-by: Michal Simek monstr@monstr.eu
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
participants (3)
-
Masahiro Yamada
-
Michal Simek
-
Simon Glass