Skip to contentSkip to conversation

rockchip: Add Binman support

PATCH New Jagan Teki 3 participants 9 messages Jan 9, 2020 – Jan 17, 2020 2 messages not in the archive

Subsystems (3)
lore
Share & tools
lore

Jagan Teki

author
#0 lore raw

v7 cover rockchip: Add Binman support

This is v7 set for Binman support in rockchip, [1] here is previous patchset.

This series add single boot image with binman for arm32 and pad_cat for arm64 rockchip platforms both TPL + SPL and SPL-alone targets.

Changes for v7:
- fix rock board
- fix phycore-rk3288 size blow issue
Changes for v6:
- drop idbloader.img filename change patch
- update rockchip.rst to include, rockchip TPL, SPI boot as TODO Changes for v5:
- collect kever review tag
- drop idbloader.img from clean target
Changes for v4:
- support all rockchip platforms
- add new patches for dtsi changes
- update documentation
- format proper commit message
- rebase on master
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

[1] https://patchwork.ozlabs.org/cover/1217529/

Any inputs?
Jagan.

Jagan Teki (7):
Makefile: Add rockchip image type
Makefile: rockchip: Suffix platform type with tpl name
Makefile: rockchip: Support SPL-alone mkimage
arm: dts: rk3036: Add rk3036-u-boot.dtsi
arm: dts: rk3188: Add rk3188-u-boot.dtsi
rockchip: Add Single boot image (with binman, pad_cat)
doc: boards: Add rockchip documentation

 Makefile                                  |  36 +++++-
 arch/arm/Kconfig                          |   1 +
 arch/arm/dts/rk3036-sdk-u-boot.dtsi       |   2 +
 arch/arm/dts/rk3036-u-boot.dtsi           |   6 +
 arch/arm/dts/rk3188-radxarock-u-boot.dtsi |   2 +
 arch/arm/dts/rk3188-u-boot.dtsi           |   6 +
 arch/arm/dts/rk3288-u-boot.dtsi           |   2 +
 arch/arm/dts/rockchip-u-boot.dtsi         |  21 ++++
 configs/phycore-rk3288_defconfig          |   2 -
 doc/board/rockchip/index.rst              |  10 ++
 doc/board/rockchip/rockchip.rst           | 130 ++++++++++++++++++++++
 include/configs/rockchip-common.h         |   3 +
 12 files changed, 214 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/dts/rk3036-u-boot.dtsi
 create mode 100644 arch/arm/dts/rk3188-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
Signature · 1 line
2.18.0.321.gffc6fa0e3

A message that is not in the archive (sent off-list or not yet received): 20200109184622.3098-1-jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org

author
#2 lore raw

PATCH v7 1/7 Makefile: Add rockchip image type

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.

---
 Makefile | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
Makefile +9 -1
index e20a206239..e264b2a49a 100644
@@ -1374,7 +1374,15 @@ 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
+
+# rockchip image type
+ifeq ($(CONFIG_SPL_SPI_LOAD),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
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#3 lore raw

PATCH v7 2/7 Makefile: rockchip: Suffix platform type with tpl name

In reply to a message not in the archive

Most of the platforms uses the platform type on their boot stage image naming conventions in makefile like,

u-boot-x86-start16-tpl.bin - x86 start16 TPL bin
u-boot-spl-mtk.bin - Mediatek SPL bin

This would help to understand the users to what that particular image belongs to? and less confused.

On that note, suffix platform type rockchip for existing u-boot-tpl.img so now it become u-boot-tpl-rockchip.bin

Also, bin is more conventional way to include it on tools like binman, pad_cat etc in future patches.

Note: usage of platform type doesn't follow consistent order as of now.

---
 Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Makefile +3 -3
index e264b2a49a..50ac12fe9b 100644
@@ -1382,10 +1382,10 @@ 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
+MKIMAGEFLAGS_u-boot-tpl-rockchip.bin = -n $(CONFIG_SYS_SOC) -T $(ROCKCHIP_IMG_TYPE)
+tpl/u-boot-tpl-rockchip.bin: 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: tpl/u-boot-tpl-rockchip.bin spl/u-boot-spl.bin FORCE
 	$(call if_changed,cat)
 endif
 
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#4 lore raw

PATCH v7 3/7 Makefile: rockchip: Support SPL-alone mkimage

In reply to a message not in the archive

Add SPL-alone mkimage tooling support via Makefile for few platforms or boards used in rockchip family.

With this users would get rid of explicitly creating mkimage tool for rockchip rksd or rkspi boot modes.

---
 Makefile | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
Makefile +9 -1
index 50ac12fe9b..5361524f77 100644
@@ -908,7 +908,7 @@ ifeq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy)
 ALL-y += u-boot-with-dtb.bin
 endif
 
-ifeq ($(CONFIG_ARCH_ROCKCHIP)$(CONFIG_SPL)$(CONFIG_TPL),yyy)
+ifeq ($(CONFIG_ARCH_ROCKCHIP)$(CONFIG_SPL),yy)
 ALL-y += idbloader.img
 endif
 
@@ -1382,11 +1382,19 @@ else
 ROCKCHIP_IMG_TYPE := rksd
 endif
 
+# TPL + SPL
+ifeq ($(CONFIG_SPL)$(CONFIG_TPL),yy)
 MKIMAGEFLAGS_u-boot-tpl-rockchip.bin = -n $(CONFIG_SYS_SOC) -T $(ROCKCHIP_IMG_TYPE)
 tpl/u-boot-tpl-rockchip.bin: tpl/u-boot-tpl.bin FORCE
 	$(call if_changed,mkimage)
 idbloader.img: tpl/u-boot-tpl-rockchip.bin spl/u-boot-spl.bin FORCE
 	$(call if_changed,cat)
+else
+MKIMAGEFLAGS_idbloader.img = -n $(CONFIG_SYS_SOC) -T $(ROCKCHIP_IMG_TYPE)
+idbloader.img: spl/u-boot-spl.bin FORCE
+	$(call if_changed,mkimage)
+endif
+
 endif
 
 ifeq ($(CONFIG_ARCH_LPC32XX)$(CONFIG_SPL),yy)
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#5 lore raw

PATCH v7 4/7 arm: dts: rk3036: Add rk3036-u-boot.dtsi

In reply to a message not in the archive

Add U-Boot specific dtsi file for rk3036 SoC. This would help to add U-Boot specific dts nodes, properties which are common across rk3036.

Right now, the file is empty, will add required changes in future patches.

---
 arch/arm/dts/rk3036-sdk-u-boot.dtsi | 2 ++
 arch/arm/dts/rk3036-u-boot.dtsi     | 4 ++++
 2 files changed, 6 insertions(+)
 create mode 100644 arch/arm/dts/rk3036-u-boot.dtsi
arch/arm/dts/rk3036-sdk-u-boot.dtsi +2 -0
index 6f15f4a8ec..754800c6e6 100644
@@ -1,3 +1,5 @@
+#include "rk3036-u-boot.dtsi"
+
 &uart2 {
 	u-boot,dm-pre-reloc;
 };
arch/arm/dts/rk3036-u-boot.dtsi new file +4 -0
new file mode 100644
index 0000000000..1e7d079315
@@ -0,0 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Jagan Teki <jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>
+ */
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#6 lore raw

PATCH v7 7/7 doc: boards: Add rockchip documentation

In reply to a message not in the archive

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.

---
 doc/board/rockchip/index.rst    |  10 +++
 doc/board/rockchip/rockchip.rst | 130 ++++++++++++++++++++++++++++++++
 2 files changed, 140 insertions(+)
 create mode 100644 doc/board/rockchip/index.rst
 create mode 100644 doc/board/rockchip/rockchip.rst
doc/board/rockchip/index.rst new file +10 -0
new file mode 100644
index 0000000000..0c377e9bbb
@@ -0,0 +1,10 @@
+.. SPDX-License-Identifier: GPL-2.0+
+.. Copyright (C) 2019 Jagan Teki <jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>
+
+Rockchip
+========
+
+.. toctree::
+   :maxdepth: 2
+
+   rockchip
doc/board/rockchip/rockchip.rst new file +130 -0

130 lines not on this page · raw message

Signature · 1 line
2.18.0.321.gffc6fa0e3
#7 lore raw

PATCH v7 5/7 arm: dts: rk3188: Add rk3188-u-boot.dtsi

In reply to Jagan Teki

Add U-Boot specific dtsi file for rk3188 SoC. This would help to add U-Boot specific dts nodes, properties which are common across rk3188.

Right now, the file is empty, will add required changes in future patches.

---
 arch/arm/dts/rk3188-radxarock-u-boot.dtsi | 2 ++
 arch/arm/dts/rk3188-u-boot.dtsi           | 4 ++++
 2 files changed, 6 insertions(+)
 create mode 100644 arch/arm/dts/rk3188-u-boot.dtsi
arch/arm/dts/rk3188-radxarock-u-boot.dtsi +2 -0
index 1bb5408592..204bb3a90e 100644
@@ -3,6 +3,8 @@
  * Copyright (c) 2018 Fuzhou Rockchip Electronics Co., Ltd.
  */
 
+#include "rk3188-u-boot.dtsi"
+
 &cru {
 	u-boot,dm-spl;
 };
arch/arm/dts/rk3188-u-boot.dtsi new file +4 -0
new file mode 100644
index 0000000000..1e7d079315
@@ -0,0 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Jagan Teki <[email protected]>
+ */
Signature · 1 line
2.18.0.321.gffc6fa0e3

A message that is not in the archive (sent off-list or not yet received): 20200109184622.3098-6-jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org

Reviewed-by
#9 lore raw

Re: [PATCH v7 5/7] arm: dts: rk3188: Add rk3188-u-boot.dtsi

Quoted 8 lines · Jagan Teki

Add U-Boot specific dtsi file for rk3188 SoC. This would help to add U-Boot specific dts nodes, properties which are common across rk3188.

Right now, the file is empty, will add required changes in future patches.

Thanks,
- Kever

Quoted 25 lines
---
  arch/arm/dts/rk3188-radxarock-u-boot.dtsi | 2 ++
  arch/arm/dts/rk3188-u-boot.dtsi           | 4 ++++
  2 files changed, 6 insertions(+)

create mode 100644 arch/arm/dts/rk3188-u-boot.dtsi

arch/arm/dts/rk3188-radxarock-u-boot.dtsi +2 -0
index 1bb5408592..204bb3a90e 100644
@@ -3,6 +3,8 @@
   * Copyright (c) 2018 Fuzhou Rockchip Electronics Co., Ltd.
   */
 
+#include "rk3188-u-boot.dtsi"
+
  &cru {
  	u-boot,dm-spl;
  };
arch/arm/dts/rk3188-u-boot.dtsi new file +0 -0
new file mode 100644
index 0000000000..1e7d079315

arch/arm/dts/rk3188-u-boot.dtsi line 4

Quoted 4 lines
arch/arm/dts/rk3188-u-boot.dtsi new file +4 -0
@@ -0,0 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Jagan Teki <[email protected]>
+ */

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

#10 lore raw

PATCH v7 6/7 rockchip: Add Single boot image (with binman, pad_cat)

In reply to Jagan Teki

All rockchip platforms support TPL or SPL-based bootloader in mainline with U-Boot proper as final stage. For each stage we need to burn the image on to flash with respective offsets.

This patch creates a single boot image component using
- binman, for arm32 rockchip platforms
- pad_cat, for arm64 rockchip platforms.

This would help users to get rid of burning different boot stage images.

The new image called 'u-boot-rockchip.bin'
which can burn into flash like:

₹ sudo dd if=u-boot-rockchip.bin of=/dev/sda seek=64

This would support all rockchip platforms, except rk3128 since it doesn't support for SPL yet.

Cc Matwey V. Kornilov <[email protected]>
Cc Wadim Egorov <[email protected]>
---
 Makefile                          | 14 ++++++++++++--
 arch/arm/Kconfig                  |  1 +
 arch/arm/dts/rk3036-u-boot.dtsi   |  2 ++
 arch/arm/dts/rk3188-u-boot.dtsi   |  2 ++
 arch/arm/dts/rk3288-u-boot.dtsi   |  2 ++
 arch/arm/dts/rockchip-u-boot.dtsi | 21 +++++++++++++++++++++
 configs/phycore-rk3288_defconfig  |  2 --
 include/configs/rockchip-common.h |  3 +++
 8 files changed, 43 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/dts/rockchip-u-boot.dtsi
Makefile +12 -2
index 5361524f77..1d71a77cbb 100644
@@ -909,7 +909,7 @@ ALL-y += u-boot-with-dtb.bin
 endif
 
 ifeq ($(CONFIG_ARCH_ROCKCHIP)$(CONFIG_SPL),yy)
-ALL-y += idbloader.img
+ALL-y += u-boot-rockchip.bin
 endif
 
 LDFLAGS_u-boot += $(LDFLAGS_FINAL)
@@ -1395,7 +1395,17 @@ idbloader.img: spl/u-boot-spl.bin FORCE
 	$(call if_changed,mkimage)
 endif
 
-endif
+ifeq ($(CONFIG_ARM64),)
+u-boot-rockchip.bin: idbloader.img u-boot.img FORCE
+	$(call if_changed,binman)
+else
+OBJCOPYFLAGS_u-boot-rockchip.bin = -I binary -O binary \
+	--pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff
+u-boot-rockchip.bin: idbloader.img u-boot.itb FORCE
+	$(call if_changed,pad_cat)
+endif # CONFIG_ARM64
+
+endif # CONFIG_ARCH_ROCKCHIP
 
 ifeq ($(CONFIG_ARCH_LPC32XX)$(CONFIG_SPL),yy)
 MKIMAGEFLAGS_lpc32xx-spl.img = -T lpc32xximage -a $(CONFIG_SPL_TEXT_BASE)
arch/arm/Kconfig +1 -0
index f9dab073ea..7bd99ba3bb 100644
@@ -1590,6 +1590,7 @@ config ARCH_STM32MP
 config ARCH_ROCKCHIP
 	bool "Support Rockchip SoCs"
 	select BLK
+	select BINMAN if !ARM64
 	select DM
 	select DM_GPIO
 	select DM_I2C
arch/arm/dts/rk3036-u-boot.dtsi +2 -0
index 1e7d079315..41ac054b81 100644
@@ -2,3 +2,5 @@
 /*
  * Copyright (C) 2019 Jagan Teki <[email protected]>
  */
+
+#include "rockchip-u-boot.dtsi"
arch/arm/dts/rk3188-u-boot.dtsi +2 -0
index 1e7d079315..41ac054b81 100644
@@ -2,3 +2,5 @@
 /*
  * Copyright (C) 2019 Jagan Teki <[email protected]>
  */
+
+#include "rockchip-u-boot.dtsi"
arch/arm/dts/rk3288-u-boot.dtsi +2 -0
index 3f00a3b6d3..6d31735362 100644
@@ -3,6 +3,8 @@
  * Copyright (C) 2019 Rockchip Electronics Co., Ltd
  */
 
+#include "rockchip-u-boot.dtsi"
+
 / {
 	chosen {
 		u-boot,spl-boot-order = \
arch/arm/dts/rockchip-u-boot.dtsi new file +21 -0
new file mode 100644
index 0000000000..a2559e2db0
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Jagan Teki <[email protected]>
+ */
+
+#include <config.h>
+
+/ {
+	binman {
+		filename = "u-boot-rockchip.bin";
+		pad-byte = <0xff>;
+
+		blob {
+			filename = "idbloader.img";
+		};
+
+		u-boot-img {
+			offset = <CONFIG_SPL_PAD_TO>;
+		};
+	};
+};
configs/phycore-rk3288_defconfig +0 -2
index 2f10c7a3b3..ee164a9083 100644
@@ -19,8 +19,6 @@ CONFIG_DEFAULT_FDT_FILE="rk3288-phycore-rdk.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
-CONFIG_SPL_I2C_SUPPORT=y
-CONFIG_SPL_POWER_SUPPORT=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
include/configs/rockchip-common.h +3 -0
index 68e1105a4b..b55e09a9ca 100644
@@ -9,6 +9,9 @@
 
 #define CONFIG_SYS_NS16550_MEM32
 
+/* ((CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR - 64) * 512) */
+#define CONFIG_SPL_PAD_TO		8355840
+
 #ifndef CONFIG_SPL_BUILD
 
 /* First try to boot from SD (index 0), then eMMC (index 1) */
Signature · 1 line
2.18.0.321.gffc6fa0e3