public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Jagan Teki <jagan@amarulasolutions.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 4/5] rockchip: Add Binman support
Date: Fri, 18 Oct 2019 00:37:09 +0530	[thread overview]
Message-ID: <20191017190710.29985-5-jagan@amarulasolutions.com> (raw)
In-Reply-To: <20191017190710.29985-1-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) */
-- 
2.18.0.321.gffc6fa0e3

  parent reply	other threads:[~2019-10-17 19:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-17 19:07 [U-Boot] [PATCH v3 0/5] rockchip: Add Binman support Jagan Teki
2019-10-17 19:07 ` [U-Boot] [PATCH v3 1/5] Makefile: Add rockchip image type Jagan Teki
2019-11-10 14:16   ` Kever Yang
2019-10-17 19:07 ` [U-Boot] [PATCH v3 2/5] Makefile: Rename idbloader.img with u-boot-spl-rockchip.bin Jagan Teki
2019-10-18 10:56   ` Kever Yang
2019-10-21  5:26     ` Jagan Teki
2019-10-21  8:13       ` Mark Kettenis
2019-10-22 10:10         ` Jagan Teki
2019-11-15  6:34           ` Kever Yang
2019-10-17 19:07 ` [U-Boot] [PATCH v3 3/5] arm: dts: rk3368: Add rk3368-u-boot.dtsi Jagan Teki
2019-10-17 19:07 ` Jagan Teki [this message]
2019-10-21  8:16   ` [U-Boot] [PATCH v3 4/5] rockchip: Add Binman support Jagan Teki
2019-10-17 19:07 ` [U-Boot] [PATCH v3 5/5] doc: boards: Add rockchip documentation Jagan Teki
2019-10-18 12:20   ` Robin Murphy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191017190710.29985-5-jagan@amarulasolutions.com \
    --to=jagan@amarulasolutions.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox