[U-Boot] [PATCH v3 0/5] rockchip: Add Binman support

This is v3 set for Binman support in rockchip, [1] here is previous patchset.
This series add binman support for TPL-based targets, binman for SPL-alone boards add in future.
Changes for v3: - rebase on master - add binman for rk3288, rk3328, rk3368, rk3399 - added rst documentation for rockchip Changes for v2: - Add few clean target patches - update bl31.elf env handling code, with logging - support puma itb, via BL31 and PMUM0 env - enable BUILD_TARGET for ROCKCHIP_RK3399 - add patch to build rockchip dtbs based on SoC types - update binman patch
[1] http://patchwork.ozlabs.org/cover/1092198/
Any inputs? Jagan.
Jagan Teki (5): Makefile: Add rockchip image type Makefile: Rename idbloader.img with u-boot-spl-rockchip.bin arm: dts: rk3368: Add rk3368-u-boot.dtsi rockchip: Add Binman support doc: boards: Add rockchip documentation
Makefile | 23 ++++- arch/arm/Kconfig | 1 + arch/arm/dts/rk3288-u-boot.dtsi | 2 + arch/arm/dts/rk3328-u-boot.dtsi | 2 + arch/arm/dts/rk3368-geekbox-u-boot.dtsi | 2 + arch/arm/dts/rk3368-lion-u-boot.dtsi | 2 + arch/arm/dts/rk3368-px5-evb-u-boot.dtsi | 3 + arch/arm/dts/rk3368-sheep-u-boot.dtsi | 2 + arch/arm/dts/rk3368-u-boot.dtsi | 6 ++ arch/arm/dts/rk3399-u-boot.dtsi | 2 + arch/arm/dts/rockchip-u-boot.dtsi | 21 ++++ doc/board/rockchip/index.rst | 10 ++ doc/board/rockchip/rockchip.rst | 125 ++++++++++++++++++++++++ include/configs/rockchip-common.h | 2 + 14 files changed, 200 insertions(+), 3 deletions(-) create mode 100644 arch/arm/dts/rk3368-u-boot.dtsi create mode 100644 arch/arm/dts/rockchip-u-boot.dtsi create mode 100644 doc/board/rockchip/index.rst create mode 100644 doc/board/rockchip/rockchip.rst

Add rockchip image type support. right now the image type marked with rksd, So create image type variable with required image type like rksd or rkspi.
Cc: Kever Yang kever.yang@rock-chips.com Cc: Matwey V. Kornilov matwey.kornilov@gmail.com Signed-off-by: Jagan Teki jagan@amarulasolutions.com --- Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile index 6fda3268e7..ec55e0f6a4 100644 --- a/Makefile +++ b/Makefile @@ -1334,7 +1334,14 @@ u-boot-with-spl.bin: $(SPL_IMAGE) $(SPL_PAYLOAD) FORCE $(call if_changed,pad_cat)
ifeq ($(CONFIG_ARCH_ROCKCHIP),y) -MKIMAGEFLAGS_u-boot-tpl.img = -n $(CONFIG_SYS_SOC) -T rksd + +ifeq ($(CONFIG_SPI_FLASH_SUPPORT),y) +ROCKCHIP_IMG_TYPE := rkspi +else +ROCKCHIP_IMG_TYPE := rksd +endif + +MKIMAGEFLAGS_u-boot-tpl.img = -n $(CONFIG_SYS_SOC) -T $(ROCKCHIP_IMG_TYPE) tpl/u-boot-tpl.img: tpl/u-boot-tpl.bin FORCE $(call if_changed,mkimage) idbloader.img: tpl/u-boot-tpl.img spl/u-boot-spl.bin FORCE

On 2019/10/18 上午3:07, Jagan Teki wrote:
Add rockchip image type support. right now the image type marked with rksd, So create image type variable with required image type like rksd or rkspi.
Cc: Kever Yang kever.yang@rock-chips.com Cc: Matwey V. Kornilov matwey.kornilov@gmail.com Signed-off-by: Jagan Teki jagan@amarulasolutions.com
Reviewed-by: Kever Yang kever.yang@rock-chips.com
Thanks, - Kever
Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile index 6fda3268e7..ec55e0f6a4 100644 --- a/Makefile +++ b/Makefile @@ -1334,7 +1334,14 @@ u-boot-with-spl.bin: $(SPL_IMAGE) $(SPL_PAYLOAD) FORCE $(call if_changed,pad_cat)
ifeq ($(CONFIG_ARCH_ROCKCHIP),y) -MKIMAGEFLAGS_u-boot-tpl.img = -n $(CONFIG_SYS_SOC) -T rksd
+ifeq ($(CONFIG_SPI_FLASH_SUPPORT),y) +ROCKCHIP_IMG_TYPE := rkspi +else +ROCKCHIP_IMG_TYPE := rksd +endif
+MKIMAGEFLAGS_u-boot-tpl.img = -n $(CONFIG_SYS_SOC) -T $(ROCKCHIP_IMG_TYPE) tpl/u-boot-tpl.img: tpl/u-boot-tpl.bin FORCE $(call if_changed,mkimage) idbloader.img: tpl/u-boot-tpl.img spl/u-boot-spl.bin FORCE

idbloader.img name is specific to rockchip, where it usually created using rockchip tools. Since the image is created as per U-Boot generic builds like SPL, better to follow the generic U-Boot naming notation like other SoC's following.
Enable idbloader.img with u-boot-spl-rockchip.bin and create the same in spl directory since it is SPL file and Makefile.spl will clean it by default.
Cc: Kever Yang kever.yang@rock-chips.com Cc: Matwey V. Kornilov matwey.kornilov@gmail.com Signed-off-by: Jagan Teki jagan@amarulasolutions.com --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile index ec55e0f6a4..918b5d53e0 100644 --- a/Makefile +++ b/Makefile @@ -887,7 +887,7 @@ ALL-y += u-boot-with-dtb.bin endif
ifeq ($(CONFIG_ARCH_ROCKCHIP)$(CONFIG_SPL)$(CONFIG_TPL),yyy) -ALL-y += idbloader.img +ALL-y += spl/u-boot-spl-rockchip.bin endif
LDFLAGS_u-boot += $(LDFLAGS_FINAL) @@ -1344,7 +1344,7 @@ endif MKIMAGEFLAGS_u-boot-tpl.img = -n $(CONFIG_SYS_SOC) -T $(ROCKCHIP_IMG_TYPE) tpl/u-boot-tpl.img: tpl/u-boot-tpl.bin FORCE $(call if_changed,mkimage) -idbloader.img: tpl/u-boot-tpl.img spl/u-boot-spl.bin FORCE +spl/u-boot-spl-rockchip.bin: tpl/u-boot-tpl.img spl/u-boot-spl.bin FORCE $(call if_changed,cat) endif

Jagan,
On 2019/10/18 上午3:07, Jagan Teki wrote:
idbloader.img name is specific to rockchip,
This is specific for rockchip, like rksd, rkspi type in mkimage, since it's clear for what it stands for,
I think it can also used in U-Boot.
where it usually created using rockchip tools.
No, idbloader stands for the image with idb header packaged with two stage loader, eg. TPL+SPL
or ddr.bin+miniloader.bin, and maybe ddr.bin + SPL, TPL+miniloader.bin,
not related to rockchip tools, it can also be created with U-Boot mkimage tool.
Since the image is created as per U-Boot generic builds like SPL, better to follow the generic U-Boot naming notation like other SoC's following.
Enable idbloader.img with u-boot-spl-rockchip.bin and create the same in spl directory since it is SPL file and Makefile.spl will clean it by default.
Cc: Kever Yang kever.yang@rock-chips.com Cc: Matwey V. Kornilov matwey.kornilov@gmail.com Signed-off-by: Jagan Teki jagan@amarulasolutions.com
Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile index ec55e0f6a4..918b5d53e0 100644 --- a/Makefile +++ b/Makefile @@ -887,7 +887,7 @@ ALL-y += u-boot-with-dtb.bin endif
ifeq ($(CONFIG_ARCH_ROCKCHIP)$(CONFIG_SPL)$(CONFIG_TPL),yyy) -ALL-y += idbloader.img +ALL-y += spl/u-boot-spl-rockchip.bin
This idbloader including IDB header, TPL, and SPL, I don't think name it as spl and
put it in spl directory make any sense.
I though the origin output file use postfix '.bin' and those image after pack and can be
dd to storage directly better to use postfix '.img'.
About the clean, it will be better to be clean like other '.img' file in the Makefile.
Thanks,
- Kever
endif
LDFLAGS_u-boot += $(LDFLAGS_FINAL) @@ -1344,7 +1344,7 @@ endif MKIMAGEFLAGS_u-boot-tpl.img = -n $(CONFIG_SYS_SOC) -T $(ROCKCHIP_IMG_TYPE) tpl/u-boot-tpl.img: tpl/u-boot-tpl.bin FORCE $(call if_changed,mkimage) -idbloader.img: tpl/u-boot-tpl.img spl/u-boot-spl.bin FORCE +spl/u-boot-spl-rockchip.bin: tpl/u-boot-tpl.img spl/u-boot-spl.bin FORCE $(call if_changed,cat) endif

Hi Kever,
On Fri, Oct 18, 2019 at 4:26 PM Kever Yang kever.yang@rock-chips.com wrote:
Jagan,
On 2019/10/18 上午3:07, Jagan Teki wrote:
idbloader.img name is specific to rockchip,
This is specific for rockchip, like rksd, rkspi type in mkimage, since it's clear for what it stands for,
I think it can also used in U-Boot.
where it usually created using rockchip tools.
No, idbloader stands for the image with idb header packaged with two stage loader, eg. TPL+SPL
or ddr.bin+miniloader.bin, and maybe ddr.bin + SPL, TPL+miniloader.bin,
not related to rockchip tools, it can also be created with U-Boot mkimage tool.
I understand what idbloader contains, it is like rockchip SPL. but the main concern here is the naming convention used in U-Boot. It would be a standard way of using naming conventions where the final output naming conventions should have u-boot support stages(TPL, SPL, U-Boot) and platform specific name. This way it is less confused what exactly it contains.
Moreover most of the platform specific bin ended up using this type of conventions.
- u-boot-spl-mtk.bin - Mediatek SPL bin - u-boot-mtk.bin - Mediatek U-Boot bin (would be final image) - u-boot-sunxi-with-spl.bin - Allwinner U-Boot with SPL - u-boot-x86-start16-tpl.bin
Similar naming conventions used for tegra, x86 etc.
I'm completely aware of what you're trying to abbreviate idbloader.img, but having u-boot-spl-rockchip.bin is more readable and understand than idbloader.
Since the image is created as per U-Boot generic builds like SPL, better to follow the generic U-Boot naming notation like other SoC's following.
Enable idbloader.img with u-boot-spl-rockchip.bin and create the same in spl directory since it is SPL file and Makefile.spl will clean it by default.
Cc: Kever Yang kever.yang@rock-chips.com Cc: Matwey V. Kornilov matwey.kornilov@gmail.com Signed-off-by: Jagan Teki jagan@amarulasolutions.com
Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile index ec55e0f6a4..918b5d53e0 100644 --- a/Makefile +++ b/Makefile @@ -887,7 +887,7 @@ ALL-y += u-boot-with-dtb.bin endif
ifeq ($(CONFIG_ARCH_ROCKCHIP)$(CONFIG_SPL)$(CONFIG_TPL),yyy) -ALL-y += idbloader.img +ALL-y += spl/u-boot-spl-rockchip.bin
This idbloader including IDB header, TPL, and SPL, I don't think name it as spl and
put it in spl directory make any sense.
I though the origin output file use postfix '.bin' and those image after pack and can be
dd to storage directly better to use postfix '.img'.
About the clean, it will be better to be clean like other '.img' file in the Makefile.
This make sense, I have next version set where it used handle these so carefully.

From: Jagan Teki jagan@amarulasolutions.com Date: Mon, 21 Oct 2019 10:56:39 +0530
Hi Kever,
On Fri, Oct 18, 2019 at 4:26 PM Kever Yang kever.yang@rock-chips.com wrote:
Jagan,
On 2019/10/18 上午3:07, Jagan Teki wrote:
idbloader.img name is specific to rockchip,
This is specific for rockchip, like rksd, rkspi type in mkimage, since it's clear for what it stands for,
I think it can also used in U-Boot.
where it usually created using rockchip tools.
No, idbloader stands for the image with idb header packaged with two stage loader, eg. TPL+SPL
or ddr.bin+miniloader.bin, and maybe ddr.bin + SPL, TPL+miniloader.bin,
not related to rockchip tools, it can also be created with U-Boot mkimage tool.
I understand what idbloader contains, it is like rockchip SPL. but the main concern here is the naming convention used in U-Boot. It would be a standard way of using naming conventions where the final output naming conventions should have u-boot support stages(TPL, SPL, U-Boot) and platform specific name. This way it is less confused what exactly it contains.
Moreover most of the platform specific bin ended up using this type of conventions.
- u-boot-spl-mtk.bin - Mediatek SPL bin
- u-boot-mtk.bin - Mediatek U-Boot bin (would be final image)
- u-boot-sunxi-with-spl.bin - Allwinner U-Boot with SPL
- u-boot-x86-start16-tpl.bin
No real consistency there though...
Similar naming conventions used for tegra, x86 etc.
I'm completely aware of what you're trying to abbreviate idbloader.img, but having u-boot-spl-rockchip.bin is more readable and understand than idbloader.
As was discussed before, idbloader.img is the name used in external documentation.
Since the image is created as per U-Boot generic builds like SPL, better to follow the generic U-Boot naming notation like other SoC's following.
Enable idbloader.img with u-boot-spl-rockchip.bin and create the same in spl directory since it is SPL file and Makefile.spl will clean it by default.
Cc: Kever Yang kever.yang@rock-chips.com Cc: Matwey V. Kornilov matwey.kornilov@gmail.com Signed-off-by: Jagan Teki jagan@amarulasolutions.com
Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile index ec55e0f6a4..918b5d53e0 100644 --- a/Makefile +++ b/Makefile @@ -887,7 +887,7 @@ ALL-y += u-boot-with-dtb.bin endif
ifeq ($(CONFIG_ARCH_ROCKCHIP)$(CONFIG_SPL)$(CONFIG_TPL),yyy) -ALL-y += idbloader.img +ALL-y += spl/u-boot-spl-rockchip.bin
This idbloader including IDB header, TPL, and SPL, I don't think name it as spl and
put it in spl directory make any sense.
I though the origin output file use postfix '.bin' and those image after pack and can be
dd to storage directly better to use postfix '.img'.
About the clean, it will be better to be clean like other '.img' file in the Makefile.
This make sense, I have next version set where it used handle these so carefully. _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot

On Mon, Oct 21, 2019 at 1:43 PM Mark Kettenis mark.kettenis@xs4all.nl wrote:
From: Jagan Teki jagan@amarulasolutions.com Date: Mon, 21 Oct 2019 10:56:39 +0530
Hi Kever,
On Fri, Oct 18, 2019 at 4:26 PM Kever Yang kever.yang@rock-chips.com wrote:
Jagan,
On 2019/10/18 上午3:07, Jagan Teki wrote:
idbloader.img name is specific to rockchip,
This is specific for rockchip, like rksd, rkspi type in mkimage, since it's clear for what it stands for,
I think it can also used in U-Boot.
where it usually created using rockchip tools.
No, idbloader stands for the image with idb header packaged with two stage loader, eg. TPL+SPL
or ddr.bin+miniloader.bin, and maybe ddr.bin + SPL, TPL+miniloader.bin,
not related to rockchip tools, it can also be created with U-Boot mkimage tool.
I understand what idbloader contains, it is like rockchip SPL. but the main concern here is the naming convention used in U-Boot. It would be a standard way of using naming conventions where the final output naming conventions should have u-boot support stages(TPL, SPL, U-Boot) and platform specific name. This way it is less confused what exactly it contains.
Moreover most of the platform specific bin ended up using this type of conventions.
- u-boot-spl-mtk.bin - Mediatek SPL bin
- u-boot-mtk.bin - Mediatek U-Boot bin (would be final image)
- u-boot-sunxi-with-spl.bin - Allwinner U-Boot with SPL
- u-boot-x86-start16-tpl.bin
No real consistency there though...
Not sure what you pointed here, each bin listed above shows the platform and u-boot stage and prefix with u-boot- as well. of course all can't maintain the same but has mentioned details.
Similar naming conventions used for tegra, x86 etc.
I'm completely aware of what you're trying to abbreviate idbloader.img, but having u-boot-spl-rockchip.bin is more readable and understand than idbloader.
As was discussed before, idbloader.img is the name used in external documentation.
Yes, used in external documentation. when it comes to upstream it would follow as per existing platforms does atleast.

Hi Jagan,
On 2019/10/22 下午6:10, Jagan Teki wrote:
On Mon, Oct 21, 2019 at 1:43 PM Mark Kettenis mark.kettenis@xs4all.nl wrote:
From: Jagan Teki jagan@amarulasolutions.com Date: Mon, 21 Oct 2019 10:56:39 +0530
Hi Kever,
On Fri, Oct 18, 2019 at 4:26 PM Kever Yang kever.yang@rock-chips.com wrote:
Jagan,
On 2019/10/18 上午3:07, Jagan Teki wrote:
idbloader.img name is specific to rockchip,
This is specific for rockchip, like rksd, rkspi type in mkimage, since it's clear for what it stands for,
I think it can also used in U-Boot.
where it usually created using rockchip tools.
No, idbloader stands for the image with idb header packaged with two stage loader, eg. TPL+SPL
or ddr.bin+miniloader.bin, and maybe ddr.bin + SPL, TPL+miniloader.bin,
not related to rockchip tools, it can also be created with U-Boot mkimage tool.
I understand what idbloader contains, it is like rockchip SPL. but the main concern here is the naming convention used in U-Boot. It would be a standard way of using naming conventions where the final output naming conventions should have u-boot support stages(TPL, SPL, U-Boot) and platform specific name. This way it is less confused what exactly it contains.
Moreover most of the platform specific bin ended up using this type of conventions.
- u-boot-spl-mtk.bin - Mediatek SPL bin
- u-boot-mtk.bin - Mediatek U-Boot bin (would be final image)
- u-boot-sunxi-with-spl.bin - Allwinner U-Boot with SPL
- u-boot-x86-start16-tpl.bin
No real consistency there though...
Not sure what you pointed here, each bin listed above shows the platform and u-boot stage and prefix with u-boot- as well. of course all can't maintain the same but has mentioned details.
The image for Vendor's BootRom is always vendor specific, so I don't think invent a new name for idbloader.img make any sense. I know what's the u-boot.bin, u-boot.itb, u-boot-spl.bin, u-boot-tpl.bin, because all the boards use them in the same way, but I don't know what is u-boot-spl-mtk.bin or u-boot-sunxi-with-spl.bin, and also names like lpc32xx-***, because they always specific for the SoC vendor, people never know what it's before they work on this platform. For idbloader.img, it already used for a period of time, it's document in both Rockchip document and U-Boot document, developers know what it's when they see this name, I don't think add a new name for it and add a new document and discards the document with old name is a good idea, it only confuse developers. You can have a new name for binman output for that's new output, but I would like not to invent new name for idbloader until most of developers think that's really necessary.
Thanks, - Kever
Similar naming conventions used for tegra, x86 etc.
I'm completely aware of what you're trying to abbreviate idbloader.img, but having u-boot-spl-rockchip.bin is more readable and understand than idbloader.
As was discussed before, idbloader.img is the name used in external documentation.
Yes, used in external documentation. when it comes to upstream it would follow as per existing platforms does atleast.

Add U-Boot specific dtsi file for rk3368 SoC. This would help to add U-Boot specific dts nodes, properties which are common across rk3368.
Right now, the file is empty, will add required changes in future patches.
Signed-off-by: Jagan Teki jagan@amarulasolutions.com --- arch/arm/dts/rk3368-geekbox-u-boot.dtsi | 2 ++ arch/arm/dts/rk3368-lion-u-boot.dtsi | 2 ++ arch/arm/dts/rk3368-px5-evb-u-boot.dtsi | 3 +++ arch/arm/dts/rk3368-sheep-u-boot.dtsi | 2 ++ arch/arm/dts/rk3368-u-boot.dtsi | 4 ++++ 5 files changed, 13 insertions(+) create mode 100644 arch/arm/dts/rk3368-u-boot.dtsi
diff --git a/arch/arm/dts/rk3368-geekbox-u-boot.dtsi b/arch/arm/dts/rk3368-geekbox-u-boot.dtsi index 30ea9e433a..0b724fa45f 100644 --- a/arch/arm/dts/rk3368-geekbox-u-boot.dtsi +++ b/arch/arm/dts/rk3368-geekbox-u-boot.dtsi @@ -3,6 +3,8 @@ * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH */
+#include "rk3368-u-boot.dtsi" + &pinctrl { u-boot,dm-pre-reloc; }; diff --git a/arch/arm/dts/rk3368-lion-u-boot.dtsi b/arch/arm/dts/rk3368-lion-u-boot.dtsi index edc93e438f..5050d3dee8 100644 --- a/arch/arm/dts/rk3368-lion-u-boot.dtsi +++ b/arch/arm/dts/rk3368-lion-u-boot.dtsi @@ -3,6 +3,8 @@ * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH */
+#include "rk3368-u-boot.dtsi" + / { config { u-boot,spl-payload-offset = <0x40000>; /* @ 256KB */ diff --git a/arch/arm/dts/rk3368-px5-evb-u-boot.dtsi b/arch/arm/dts/rk3368-px5-evb-u-boot.dtsi index 002767a033..5fee02a65b 100644 --- a/arch/arm/dts/rk3368-px5-evb-u-boot.dtsi +++ b/arch/arm/dts/rk3368-px5-evb-u-boot.dtsi @@ -2,6 +2,9 @@ /* * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH */ + +#include "rk3368-u-boot.dtsi" + / { chosen { u-boot,spl-boot-order = &emmc; diff --git a/arch/arm/dts/rk3368-sheep-u-boot.dtsi b/arch/arm/dts/rk3368-sheep-u-boot.dtsi index 30ea9e433a..0b724fa45f 100644 --- a/arch/arm/dts/rk3368-sheep-u-boot.dtsi +++ b/arch/arm/dts/rk3368-sheep-u-boot.dtsi @@ -3,6 +3,8 @@ * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH */
+#include "rk3368-u-boot.dtsi" + &pinctrl { u-boot,dm-pre-reloc; }; diff --git a/arch/arm/dts/rk3368-u-boot.dtsi b/arch/arm/dts/rk3368-u-boot.dtsi new file mode 100644 index 0000000000..1e7d079315 --- /dev/null +++ b/arch/arm/dts/rk3368-u-boot.dtsi @@ -0,0 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2019 Jagan Teki jagan@amarulasolutions.com + */

TPL-based rockchip platform like rk3288, rk3328, rk3368 and rk3399 has three stage boot loaders like TPL, SPL and U-Boot proper. For each stage we need to burn the image on to flash with respective offsets.
This patch create a single image using binman, so that user can get rid of burning different stage boot images.
The new image called 'u-boot-rockchip-with-tpl-spl.bin' which can burn into flash like:
₹ sudo dd if=u-boot-rockchip-with-tpl-spl.bin of=/dev/sda seek=64
This would easily extend if other rockchip family SoC's would make use of single image creation.
Cc: Kever Yang kever.yang@rock-chips.com Cc: Matwey V. Kornilov matwey.kornilov@gmail.com Signed-off-by: Jagan Teki jagan@amarulasolutions.com --- Makefile | 10 ++++++++++ arch/arm/Kconfig | 1 + arch/arm/dts/rk3288-u-boot.dtsi | 2 ++ arch/arm/dts/rk3328-u-boot.dtsi | 2 ++ arch/arm/dts/rk3368-u-boot.dtsi | 2 ++ arch/arm/dts/rk3399-u-boot.dtsi | 2 ++ arch/arm/dts/rockchip-u-boot.dtsi | 21 +++++++++++++++++++++ include/configs/rockchip-common.h | 2 ++ 8 files changed, 42 insertions(+) create mode 100644 arch/arm/dts/rockchip-u-boot.dtsi
diff --git a/Makefile b/Makefile index 918b5d53e0..049781e0ba 100644 --- a/Makefile +++ b/Makefile @@ -888,6 +888,7 @@ endif
ifeq ($(CONFIG_ARCH_ROCKCHIP)$(CONFIG_SPL)$(CONFIG_TPL),yyy) ALL-y += spl/u-boot-spl-rockchip.bin +ALL-y += u-boot-rockchip-with-tpl-spl.bin endif
LDFLAGS_u-boot += $(LDFLAGS_FINAL) @@ -1346,6 +1347,15 @@ tpl/u-boot-tpl.img: tpl/u-boot-tpl.bin FORCE $(call if_changed,mkimage) spl/u-boot-spl-rockchip.bin: tpl/u-boot-tpl.img spl/u-boot-spl.bin FORCE $(call if_changed,cat) + +ifdef CONFIG_SPL_LOAD_FIT +ROCKCHIP_UBOOT_IMG := u-boot.itb +else +ROCKCHIP_UBOOT_IMG := u-boot.img +endif + +u-boot-rockchip-with-tpl-spl.bin: spl/u-boot-spl-rockchip.bin $(ROCKCHIP_UBOOT_IMG) FORCE + $(call if_changed,binman) endif
ifeq ($(CONFIG_ARCH_LPC32XX)$(CONFIG_SPL),yy) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 1df2aba3c2..87fa1f43f4 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1594,6 +1594,7 @@ config ARCH_STM32MP config ARCH_ROCKCHIP bool "Support Rockchip SoCs" select BLK + select BINMAN if TPL && SPL select DM select DM_GPIO select DM_I2C diff --git a/arch/arm/dts/rk3288-u-boot.dtsi b/arch/arm/dts/rk3288-u-boot.dtsi index 3f00a3b6d3..6d31735362 100644 --- a/arch/arm/dts/rk3288-u-boot.dtsi +++ b/arch/arm/dts/rk3288-u-boot.dtsi @@ -3,6 +3,8 @@ * Copyright (C) 2019 Rockchip Electronics Co., Ltd */
+#include "rockchip-u-boot.dtsi" + / { chosen { u-boot,spl-boot-order = \ diff --git a/arch/arm/dts/rk3328-u-boot.dtsi b/arch/arm/dts/rk3328-u-boot.dtsi index ffbd657e31..0c51a8dbfb 100644 --- a/arch/arm/dts/rk3328-u-boot.dtsi +++ b/arch/arm/dts/rk3328-u-boot.dtsi @@ -3,6 +3,8 @@ * (C) Copyright 2019 Rockchip Electronics Co., Ltd */
+#include "rockchip-u-boot.dtsi" + / { aliases { mmc0 = &emmc; diff --git a/arch/arm/dts/rk3368-u-boot.dtsi b/arch/arm/dts/rk3368-u-boot.dtsi index 1e7d079315..41ac054b81 100644 --- a/arch/arm/dts/rk3368-u-boot.dtsi +++ b/arch/arm/dts/rk3368-u-boot.dtsi @@ -2,3 +2,5 @@ /* * Copyright (C) 2019 Jagan Teki jagan@amarulasolutions.com */ + +#include "rockchip-u-boot.dtsi" diff --git a/arch/arm/dts/rk3399-u-boot.dtsi b/arch/arm/dts/rk3399-u-boot.dtsi index 2738a3889e..fe8a73d653 100644 --- a/arch/arm/dts/rk3399-u-boot.dtsi +++ b/arch/arm/dts/rk3399-u-boot.dtsi @@ -3,6 +3,8 @@ * Copyright (C) 2019 Jagan Teki jagan@amarulasolutions.com */
+#include "rockchip-u-boot.dtsi" + &pmu { u-boot,dm-pre-reloc; }; diff --git a/arch/arm/dts/rockchip-u-boot.dtsi b/arch/arm/dts/rockchip-u-boot.dtsi new file mode 100644 index 0000000000..c496107119 --- /dev/null +++ b/arch/arm/dts/rockchip-u-boot.dtsi @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2019 Jagan Teki jagan@amarulasolutions.com + */ + +#include <config.h> + +/ { + binman { + filename = "u-boot-rockchip-with-tpl-spl.bin"; + pad-byte = <0xff>; + + blob { + filename = "spl/u-boot-spl-rockchip.bin"; + }; + + u-boot-img { + offset = <CONFIG_SPL_PAD_TO>; + }; + }; +}; diff --git a/include/configs/rockchip-common.h b/include/configs/rockchip-common.h index 68e1105a4b..d7f5ca9fa4 100644 --- a/include/configs/rockchip-common.h +++ b/include/configs/rockchip-common.h @@ -9,6 +9,8 @@
#define CONFIG_SYS_NS16550_MEM32
+#define CONFIG_SPL_PAD_TO 8355840 + #ifndef CONFIG_SPL_BUILD
/* First try to boot from SD (index 0), then eMMC (index 1) */

Hi Simon,
On Fri, Oct 18, 2019 at 12:38 AM Jagan Teki jagan@amarulasolutions.com wrote:
TPL-based rockchip platform like rk3288, rk3328, rk3368 and rk3399 has three stage boot loaders like TPL, SPL and U-Boot proper. For each stage we need to burn the image on to flash with respective offsets.
This patch create a single image using binman, so that user can get rid of burning different stage boot images.
The new image called 'u-boot-rockchip-with-tpl-spl.bin' which can burn into flash like:
₹ sudo dd if=u-boot-rockchip-with-tpl-spl.bin of=/dev/sda seek=64
This would easily extend if other rockchip family SoC's would make use of single image creation.
Cc: Kever Yang kever.yang@rock-chips.com Cc: Matwey V. Kornilov matwey.kornilov@gmail.com Signed-off-by: Jagan Teki jagan@amarulasolutions.com
Makefile | 10 ++++++++++ arch/arm/Kconfig | 1 + arch/arm/dts/rk3288-u-boot.dtsi | 2 ++ arch/arm/dts/rk3328-u-boot.dtsi | 2 ++ arch/arm/dts/rk3368-u-boot.dtsi | 2 ++ arch/arm/dts/rk3399-u-boot.dtsi | 2 ++ arch/arm/dts/rockchip-u-boot.dtsi | 21 +++++++++++++++++++++ include/configs/rockchip-common.h | 2 ++ 8 files changed, 42 insertions(+) create mode 100644 arch/arm/dts/rockchip-u-boot.dtsi
diff --git a/Makefile b/Makefile index 918b5d53e0..049781e0ba 100644 --- a/Makefile +++ b/Makefile @@ -888,6 +888,7 @@ endif
ifeq ($(CONFIG_ARCH_ROCKCHIP)$(CONFIG_SPL)$(CONFIG_TPL),yyy) ALL-y += spl/u-boot-spl-rockchip.bin +ALL-y += u-boot-rockchip-with-tpl-spl.bin endif
LDFLAGS_u-boot += $(LDFLAGS_FINAL) @@ -1346,6 +1347,15 @@ tpl/u-boot-tpl.img: tpl/u-boot-tpl.bin FORCE $(call if_changed,mkimage) spl/u-boot-spl-rockchip.bin: tpl/u-boot-tpl.img spl/u-boot-spl.bin FORCE $(call if_changed,cat)
+ifdef CONFIG_SPL_LOAD_FIT +ROCKCHIP_UBOOT_IMG := u-boot.itb +else +ROCKCHIP_UBOOT_IMG := u-boot.img +endif
+u-boot-rockchip-with-tpl-spl.bin: spl/u-boot-spl-rockchip.bin $(ROCKCHIP_UBOOT_IMG) FORCE
$(call if_changed,binman)
endif
ifeq ($(CONFIG_ARCH_LPC32XX)$(CONFIG_SPL),yy) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 1df2aba3c2..87fa1f43f4 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1594,6 +1594,7 @@ config ARCH_STM32MP config ARCH_ROCKCHIP bool "Support Rockchip SoCs" select BLK
select BINMAN if TPL && SPL select DM select DM_GPIO select DM_I2C
diff --git a/arch/arm/dts/rk3288-u-boot.dtsi b/arch/arm/dts/rk3288-u-boot.dtsi index 3f00a3b6d3..6d31735362 100644 --- a/arch/arm/dts/rk3288-u-boot.dtsi +++ b/arch/arm/dts/rk3288-u-boot.dtsi @@ -3,6 +3,8 @@
- Copyright (C) 2019 Rockchip Electronics Co., Ltd
*/
+#include "rockchip-u-boot.dtsi"
/ { chosen { u-boot,spl-boot-order = \ diff --git a/arch/arm/dts/rk3328-u-boot.dtsi b/arch/arm/dts/rk3328-u-boot.dtsi index ffbd657e31..0c51a8dbfb 100644 --- a/arch/arm/dts/rk3328-u-boot.dtsi +++ b/arch/arm/dts/rk3328-u-boot.dtsi @@ -3,6 +3,8 @@
- (C) Copyright 2019 Rockchip Electronics Co., Ltd
*/
+#include "rockchip-u-boot.dtsi"
/ { aliases { mmc0 = &emmc; diff --git a/arch/arm/dts/rk3368-u-boot.dtsi b/arch/arm/dts/rk3368-u-boot.dtsi index 1e7d079315..41ac054b81 100644 --- a/arch/arm/dts/rk3368-u-boot.dtsi +++ b/arch/arm/dts/rk3368-u-boot.dtsi @@ -2,3 +2,5 @@ /*
- Copyright (C) 2019 Jagan Teki jagan@amarulasolutions.com
*/
+#include "rockchip-u-boot.dtsi" diff --git a/arch/arm/dts/rk3399-u-boot.dtsi b/arch/arm/dts/rk3399-u-boot.dtsi index 2738a3889e..fe8a73d653 100644 --- a/arch/arm/dts/rk3399-u-boot.dtsi +++ b/arch/arm/dts/rk3399-u-boot.dtsi @@ -3,6 +3,8 @@
- Copyright (C) 2019 Jagan Teki jagan@amarulasolutions.com
*/
+#include "rockchip-u-boot.dtsi"
&pmu { u-boot,dm-pre-reloc; }; diff --git a/arch/arm/dts/rockchip-u-boot.dtsi b/arch/arm/dts/rockchip-u-boot.dtsi new file mode 100644 index 0000000000..c496107119 --- /dev/null +++ b/arch/arm/dts/rockchip-u-boot.dtsi @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0+ +/*
- Copyright (C) 2019 Jagan Teki jagan@amarulasolutions.com
- */
+#include <config.h>
+/ {
binman {
filename = "u-boot-rockchip-with-tpl-spl.bin";
pad-byte = <0xff>;
blob {
filename = "spl/u-boot-spl-rockchip.bin";
};
u-boot-img {
offset = <CONFIG_SPL_PAD_TO>;
};
u-boot-img seems to be compatible or working with u-boot.itb but indeed Linux failed to boot with 'Starting kernel ...' does binman really know that this is itb? or some overlap on my image offset, not sure. any help?

Rockchip has documentation file, doc/README.rockchip but which is not so readable to add or understand the existing contents. Even the format that support is legacy readme in U-Boot.
Add rockchip specific documentation file using new rst format, which describes the information about Rockchip supported boards and it's usage steps.
Added minimal information about rk3288, rk3328, rk3368 and rk3399 boards and usage. This would indeed updated further based on the requirements and updates.
Cc: Kever Yang kever.yang@rock-chips.com Cc: Matwey V. Kornilov matwey.kornilov@gmail.com Signed-off-by: Jagan Teki jagan@amarulasolutions.com --- doc/board/rockchip/index.rst | 10 +++ doc/board/rockchip/rockchip.rst | 125 ++++++++++++++++++++++++++++++++ 2 files changed, 135 insertions(+) create mode 100644 doc/board/rockchip/index.rst create mode 100644 doc/board/rockchip/rockchip.rst
diff --git a/doc/board/rockchip/index.rst b/doc/board/rockchip/index.rst new file mode 100644 index 0000000000..0c377e9bbb --- /dev/null +++ b/doc/board/rockchip/index.rst @@ -0,0 +1,10 @@ +.. SPDX-License-Identifier: GPL-2.0+ +.. Copyright (C) 2019 Jagan Teki jagan@amarulasolutions.com + +Rockchip +======== + +.. toctree:: + :maxdepth: 2 + + rockchip diff --git a/doc/board/rockchip/rockchip.rst b/doc/board/rockchip/rockchip.rst new file mode 100644 index 0000000000..782a0f1c7a --- /dev/null +++ b/doc/board/rockchip/rockchip.rst @@ -0,0 +1,125 @@ +.. SPDX-License-Identifier: GPL-2.0+ +.. Copyright (C) 2019 Jagan Teki jagan@amarulasolutions.com + +ROCKCHIP +======== + +About this +---------- + +This document describes the information about Rockchip supported boards +and it's usage steps. + +Rockchip boards +--------------- + +Rockchip is SoC solutions provider for tablets & PCs, streaming media +TV boxes, AI audio & vision, IoT hardware. + +A wide range of Rockchip SoCs with associated boardsare supported in +mainline U-Boot. + +List of mainline supported rockchip boards: + +* rk3288 + - Evb-RK3288 + - Firefly-RK3288 + - mqmaker MiQi + - Phytec RK3288 PCM-947 + - PopMetal-RK3288 + - Radxa Rock 2 Square + - Tinker-RK3288 + - Google Jerry + - Google Mickey + - Google Minnie + - Google Speedy + - Amarula Vyasa-RK3288 +* rk3328 + - Rockchip RK3328 EVB + - Pine64 Rock64 +* rk3368 + - GeekBox + - PX5 EVB + - Rockchip sheep board + - Theobroma Systems RK3368-uQ7 SoM +* rk3399 + - 96boards RK3399 Ficus + - 96boards Rock960 + - Firefly-RK3399 Board + - Firefly ROC-RK3399-PC Board + - FriendlyElec NanoPC-T4 + - FriendlyElec NanoPi M4 + - FriendlyARM NanoPi NEO4 + - Google Bob + - Khadas Edge + - Khadas Edge-Captain + - Khadas Edge-V + - Orange Pi RK3399 Board + - Pine64 RockPro64 + - Radxa ROCK Pi 4 + - Rockchip RK3399 Evaluation Board + - Theobroma Systems RK3399-Q7 SoM + +Building +-------- + +TF-A +^^^^ + +TF-A would require to build for ARM64 Rockchip SoCs platforms. + +To build TF-A:: + + git clone https://github.com/ARM-software/arm-trusted-firmware.git + cd arm-trusted-firmware + make realclean + make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rk3399 + +Specify the PLAT= with desired rockchip platform to build TF-A for. + +U-Boot +^^^^^^ + +To build rk3328 boards:: + + export BL31=/path/to/arm-trusted-firmware/to/bl31.elf + make evb-rk3328_defconfig + make + +To build rk3288 boards:: + + make evb-rk3288_defconfig + make + +To build rk3368 boards:: + + export BL31=/path/to/arm-trusted-firmware/to/bl31.elf + make evb-px5_defconfig + make + +To build rk3399 boards:: + + export BL31=/path/to/arm-trusted-firmware/to/bl31.elf + make evb-rk3399_defconfig + make + +SD Card Flashing +---------------- + +To write an image that boots from an SD card (assumed to be /dev/sda): + +TPL + SPL:: + + sudo dd if=u-boot-rockchip-with-tpl-spl.bin of=/dev/sda seek=64 + sync + +TODO +---- + +- Add SPL-alone SD Card flashing steps +- Add rockchip idbloader image building +- Describe steps for eMMC flashing +- Add missing SoC's with it boards list + +.. Jagan Teki jagan@amarulasolutions.com +.. Thu Oct 17 22:36:14 IST 2019

On 17/10/2019 20:07, Jagan Teki wrote:
Rockchip has documentation file, doc/README.rockchip but which is not so readable to add or understand the existing contents. Even the format that support is legacy readme in U-Boot.
Add rockchip specific documentation file using new rst format, which describes the information about Rockchip supported boards and it's usage steps.
Added minimal information about rk3288, rk3328, rk3368 and rk3399 boards and usage. This would indeed updated further based on the requirements and updates.
Cc: Kever Yang kever.yang@rock-chips.com Cc: Matwey V. Kornilov matwey.kornilov@gmail.com Signed-off-by: Jagan Teki jagan@amarulasolutions.com
doc/board/rockchip/index.rst | 10 +++ doc/board/rockchip/rockchip.rst | 125 ++++++++++++++++++++++++++++++++ 2 files changed, 135 insertions(+) create mode 100644 doc/board/rockchip/index.rst create mode 100644 doc/board/rockchip/rockchip.rst
diff --git a/doc/board/rockchip/index.rst b/doc/board/rockchip/index.rst new file mode 100644 index 0000000000..0c377e9bbb --- /dev/null +++ b/doc/board/rockchip/index.rst @@ -0,0 +1,10 @@ +.. SPDX-License-Identifier: GPL-2.0+ +.. Copyright (C) 2019 Jagan Teki jagan@amarulasolutions.com
+Rockchip +========
+.. toctree::
- :maxdepth: 2
- rockchip
diff --git a/doc/board/rockchip/rockchip.rst b/doc/board/rockchip/rockchip.rst new file mode 100644 index 0000000000..782a0f1c7a --- /dev/null +++ b/doc/board/rockchip/rockchip.rst @@ -0,0 +1,125 @@ +.. SPDX-License-Identifier: GPL-2.0+ +.. Copyright (C) 2019 Jagan Teki jagan@amarulasolutions.com
+ROCKCHIP +========
+About this +----------
+This document describes the information about Rockchip supported boards +and it's usage steps.
+Rockchip boards +---------------
+Rockchip is SoC solutions provider for tablets & PCs, streaming media +TV boxes, AI audio & vision, IoT hardware.
+A wide range of Rockchip SoCs with associated boardsare supported in +mainline U-Boot.
+List of mainline supported rockchip boards:
+* rk3288
- Evb-RK3288
- Firefly-RK3288
- mqmaker MiQi
- Phytec RK3288 PCM-947
- PopMetal-RK3288
- Radxa Rock 2 Square
- Tinker-RK3288
- Google Jerry
- Google Mickey
- Google Minnie
- Google Speedy
- Amarula Vyasa-RK3288
+* rk3328
- Rockchip RK3328 EVB
- Pine64 Rock64
+* rk3368
- GeekBox
- PX5 EVB
- Rockchip sheep board
- Theobroma Systems RK3368-uQ7 SoM
+* rk3399
- 96boards RK3399 Ficus
- 96boards Rock960
- Firefly-RK3399 Board
- Firefly ROC-RK3399-PC Board
- FriendlyElec NanoPC-T4
- FriendlyElec NanoPi M4
- FriendlyARM NanoPi NEO4
- Google Bob
- Khadas Edge
- Khadas Edge-Captain
- Khadas Edge-V
- Orange Pi RK3399 Board
- Pine64 RockPro64
- Radxa ROCK Pi 4
- Rockchip RK3399 Evaluation Board
- Theobroma Systems RK3399-Q7 SoM
+Building +--------
+TF-A +^^^^
+TF-A would require to build for ARM64 Rockchip SoCs platforms.
+To build TF-A::
git clone https://github.com/ARM-software/arm-trusted-firmware.git
Nit: it's probably worth updating that to https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git
Robin.
cd arm-trusted-firmware
make realclean
make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rk3399
+Specify the PLAT= with desired rockchip platform to build TF-A for.
+U-Boot +^^^^^^
+To build rk3328 boards::
export BL31=/path/to/arm-trusted-firmware/to/bl31.elf
make evb-rk3328_defconfig
make
+To build rk3288 boards::
make evb-rk3288_defconfig
make
+To build rk3368 boards::
export BL31=/path/to/arm-trusted-firmware/to/bl31.elf
make evb-px5_defconfig
make
+To build rk3399 boards::
export BL31=/path/to/arm-trusted-firmware/to/bl31.elf
make evb-rk3399_defconfig
make
+SD Card Flashing +----------------
+To write an image that boots from an SD card (assumed to be /dev/sda):
+TPL + SPL::
sudo dd if=u-boot-rockchip-with-tpl-spl.bin of=/dev/sda seek=64
sync
+TODO +----
+- Add SPL-alone SD Card flashing steps +- Add rockchip idbloader image building +- Describe steps for eMMC flashing +- Add missing SoC's with it boards list
+.. Jagan Teki jagan@amarulasolutions.com +.. Thu Oct 17 22:36:14 IST 2019
participants (4)
-
Jagan Teki
-
Kever Yang
-
Mark Kettenis
-
Robin Murphy