From patchwork Wed Oct 23 19:56:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 878 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 8B96F3F08B for ; Wed, 23 Oct 2019 21:57:32 +0200 (CEST) Received: by mail-pf1-f199.google.com with SMTP id t65sf16990762pfd.14 for ; Wed, 23 Oct 2019 12:57:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1571860651; cv=pass; d=google.com; s=arc-20160816; b=pA6H4JkhharoQcIWFlb8hqEYElgopbk47HjCx3w7uu2BRK9NV1eBLNNeFT+8cV8Tdm QnltGZoj5AGSUzesADZy5oajbvy8Cmi4AhvwfCyqqQ+q2806rnlhZn+dKIrtpb8iBUil J4X6z40koOm5PzUVqZbYFearJuu6HuyVaseu4Tq3ch31HfCOkuTi+Gcyi3Ndl8IeWDFD qGa8Gm5EFY1MaaBnQKSsjlsMPba47V04cF6USwGG4DbZ2fJFUkWXvm5Hd0fOX4ZS1oDU z7qbaYZYl7eeE55Z4A92GFAztngRoZbPytY4zmQN/4sMCZTt+UHeV/3qn7unjEj645PI dtDw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tMx8HZpjOSg19OwX2xSoNTV5r8rRhV/9eKD7nWIeyM8=; b=qtksrMADX49q0t7/ItNbvdPfD7gYb1icHrH22hr1UEvdeACUfOhe9xobm06nD2MUDV xZQ5/cqpZaN7n5KOKX3yquBJz+m/x68I6o+g9l7gVQmiXaDFuO+QQEamoPwdvXQiDYgx 5fcra5vH4NgTtZ/BHvpAjLSsbZd3ywkzYyz88rpxERNy0+qSX7K5oRtsXOp4hog3srBa WIuM5l8gLy02eKoiLnlUo5c7kEweZMcXwSBj7PduB6cAS31Y9EcsJZQBMy2V0sjND7TO fUq0Q65fTHJsabJ/SKDDIeMuBtRSszP9ujwIPV/ooK1XvkKGGTgsWtecSunGJ401HF/m 8pxA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=CiLzTeAv; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=tMx8HZpjOSg19OwX2xSoNTV5r8rRhV/9eKD7nWIeyM8=; b=noPLBkIFNUMjmSa+LPfLceSJlTF04HgntWt/vkSFgpMY5R6SV3gx9BZox+hPC4kPsa EnZ6+oYIVs1GlVCif+JXkZoC1DF8zM3P5MiIQ2qyDAUYN4s2H6PqBOLzTz+SxFd8CW9N /EoNn1FaE9uHKpqe+tvlxfdpehnyMwJ/uEe20= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=tMx8HZpjOSg19OwX2xSoNTV5r8rRhV/9eKD7nWIeyM8=; b=M0xoMTjg2LPgpFANYTKFiWcglNTVNlKCytA12wadjEz6HsWsUdn4Uz0nadiPkQaK+c vt8QBH3wc6uddX2Hl0Ry9/lxcj3Zmc6hZpW1sLbD9AXNSH6yxxEbke11UG3rYxvvVck7 cJkcqooyBNLeJmr/OLqS+9J2c24G/CDxEx3XjVugIKeoaw/VtlJuOGd5Z7n8YmEHtppv gjVjKw9ySCtFzXxfPU0f+2KpXl/yf2zyCFKkPwJ91miFqhmaw9pH0F1ONA+iCrvUS93M 0i3dygxoDKxeQRl7yu4o6DFw90mNoo5Aq/kD0+ShAQBj05LlmbF/IxfieGR+2NcTCvFt FfSw== X-Gm-Message-State: APjAAAWI3TMBKwSwlUAYEjH5/ddEZVgtldYFDOq08hz4JVABGqLn/pDK k3XfmEX7WofpuiuweQj21n6byPdr X-Google-Smtp-Source: APXvYqyFjx7gW8Yk6eqC1jc/wc+ov9IaP5+o55gg+q99vKgn+pABTEF84yLJz+DoYB9WWbL66YDvJA== X-Received: by 2002:a63:d0f:: with SMTP id c15mr11080046pgl.313.1571860651155; Wed, 23 Oct 2019 12:57:31 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:aa91:: with SMTP id d17ls996049plr.2.gmail; Wed, 23 Oct 2019 12:57:30 -0700 (PDT) X-Received: by 2002:a17:902:7207:: with SMTP id ba7mr11756433plb.172.1571860650577; Wed, 23 Oct 2019 12:57:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571860650; cv=none; d=google.com; s=arc-20160816; b=Aziqw6Zg81xGJkoo9GH0tJj561HfA0w2lbYtHCnBR8FXu/cAsxG9O1nbqM5e9pvNpH EjhGbl3QTqdNqL9l6pQEoSY/tvJcHfEcdkr4GW210FTWMMdnMyfFal5Sply7CnPRHC65 f14UslzzFrrfSpL6Etg3zoYS6rZulk3syUZ+hpeYPee9DA91SR6akgFTP4AHQTRpWvaJ vxuyqyEAW/JcDz+hydYOM+u7TMBSnPwFRH5bdlixM+uhYt06Afzs9loKBk9QbPnOxRgh yS4Q5ydS/ScbrUb8jNC+ZklkbFsC/K23UbP7FVszqrn/jRJaStQkLWc3zGMPzPktI3Ok a2tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=xYatTQidUvcBY8oQodNSYrAF9VaBOnitFhHzBSyX2+E=; b=x9e2omhXHKoCGIl2MIv+eD16FZVSx7QTwYCkfBPNGxLkqWvbmw2aOJScBozeUv5V4P iEidn7lkkMYrVP6TAcuinFRkUa3eMoaySnaZdgQ8biq91YlkhfPa1wuVVMD9p7lEwkIm P/qax5L+O0iRgNV9FPtQSWruY9hPv2TlFCfoCsMw8hEcX1LAOWLLn3fYnZijwKTz6L/6 z2hmPCOQmjWx7b8R3B3tJcE/LdMuaLf0N7uGwXlkHAs8AIYX34LhHWrYRMAp0R4u3Lg1 VMwITZFnUfCYlg3cS5lf+8zp+aUmWsE/XM6aETl+7o091y0I/8PbCCTMNY42GhmMdLVn L/wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=CiLzTeAv; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id a14sor20452872pgh.66.2019.10.23.12.57.29 for (Google Transport Security); Wed, 23 Oct 2019 12:57:30 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a63:540c:: with SMTP id i12mr9273758pgb.322.1571860648304; Wed, 23 Oct 2019 12:57:28 -0700 (PDT) Received: from localhost.localdomain ([115.97.180.31]) by smtp.gmail.com with ESMTPSA id o185sm31499280pfg.136.2019.10.23.12.57.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 12:57:27 -0700 (PDT) From: Jagan Teki To: Kever Yang , Simon Glass , Philipp Tomsich Cc: u-boot@lists.denx.de, linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, Jagan Teki , "Matwey V . Kornilov" Subject: [PATCH v4 6/7] rockchip: Add Single boot image (with binman, pad_cat) Date: Thu, 24 Oct 2019 01:26:51 +0530 Message-Id: <20191023195652.7158-7-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20191023195652.7158-1-jagan@amarulasolutions.com> References: <20191023195652.7158-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=CiLzTeAv; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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: Kever Yang Cc: Matwey V. Kornilov Signed-off-by: Jagan Teki Reviewed-by: Kever Yang --- Makefile | 18 ++++++++++++++---- arch/arm/Kconfig | 1 + arch/arm/dts/rk3036-u-boot.dtsi | 2 ++ arch/arm/dts/rk3288-u-boot.dtsi | 2 ++ arch/arm/dts/rockchip-u-boot.dtsi | 21 +++++++++++++++++++++ include/configs/rockchip-common.h | 2 ++ 6 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 arch/arm/dts/rockchip-u-boot.dtsi diff --git a/Makefile b/Makefile index a4278170d4..6c70106c6e 100644 --- a/Makefile +++ b/Makefile @@ -887,7 +887,7 @@ ALL-y += u-boot-with-dtb.bin endif ifeq ($(CONFIG_ARCH_ROCKCHIP)$(CONFIG_SPL),yy) -ALL-y += u-boot-spl-rockchip.bin +ALL-y += u-boot-rockchip.bin endif LDFLAGS_u-boot += $(LDFLAGS_FINAL) @@ -1347,15 +1347,25 @@ 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) -u-boot-spl-rockchip.bin: tpl/u-boot-tpl-rockchip.bin spl/u-boot-spl.bin FORCE +spl/u-boot-spl-rockchip.bin: tpl/u-boot-tpl-rockchip.bin spl/u-boot-spl.bin FORCE $(call if_changed,cat) else MKIMAGEFLAGS_u-boot-spl-rockchip.bin = -n $(CONFIG_SYS_SOC) -T $(ROCKCHIP_IMG_TYPE) -u-boot-spl-rockchip.bin: spl/u-boot-spl.bin FORCE +spl/u-boot-spl-rockchip.bin: spl/u-boot-spl.bin FORCE $(call if_changed,mkimage) endif -endif +ifeq ($(CONFIG_ARM64),) +u-boot-rockchip.bin: spl/u-boot-spl-rockchip.bin 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: spl/u-boot-spl-rockchip.bin 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) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 1df2aba3c2..8107414626 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 !ARM64 select DM select DM_GPIO select DM_I2C diff --git a/arch/arm/dts/rk3036-u-boot.dtsi b/arch/arm/dts/rk3036-u-boot.dtsi index 1e7d079315..41ac054b81 100644 --- a/arch/arm/dts/rk3036-u-boot.dtsi +++ b/arch/arm/dts/rk3036-u-boot.dtsi @@ -2,3 +2,5 @@ /* * Copyright (C) 2019 Jagan Teki */ + +#include "rockchip-u-boot.dtsi" 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/rockchip-u-boot.dtsi b/arch/arm/dts/rockchip-u-boot.dtsi new file mode 100644 index 0000000000..bc0b1412a2 --- /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 + */ + +#include + +/ { + binman { + filename = "u-boot-rockchip.bin"; + pad-byte = <0xff>; + + blob { + filename = "spl/u-boot-spl-rockchip.bin"; + }; + + u-boot-img { + offset = ; + }; + }; +}; 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) */