From patchwork Mon Dec 30 08:28:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 970 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id ECEC03F076 for ; Mon, 30 Dec 2019 09:28:47 +0100 (CET) Received: by mail-pj1-f72.google.com with SMTP id s19sf11614916pjp.9 for ; Mon, 30 Dec 2019 00:28:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1577694526; cv=pass; d=google.com; s=arc-20160816; b=lI4uT4OVUpNbyxQPGFBUyZaE6woQMD2A74Vt3eUtMrcjIagCTZQt2exvzTzoA2XrfV RrqR3lQQ2OPQ2c2aAGC6YN9xPEGqACCKymavoP/EEB5hea3RYqIXlbLhEacRCeRJjsTH 97PhE5t+K4GA6A4xHMH5NVNqqtVNhZHUqixa3mCtCgMwsKQMNxCBdeZfG81Nc+W8v47I lVfR+fwmNYPUQq66bp1Jp+rzj8NNy9CBOXXWJP5QMbLpscyKrh7MOn6KffWxVExVZ6Ug m8D4wXzZwCK0IlZQLwCpXzPMcZO4Ao3BzTZrVg/y2snuVetKioDmro6KgMJS1CXx41XA wNBA== 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=pfQvKb/f+pxUm4Orq8rh+a3di3WnVvKBIUXCaDmQePM=; b=V2WxVV8tI0MCMfOrxqAhhqX8FFXB5bahQcu4NjnfCN6NxMYgcYTdDgVRehdLbml/2B mwRqksT6xC9ksQ04nvDy0N/nixz7F3Lk39zcUVbxytQxk+EhJMu+idUi38I2rl2m+52T R+T8xrw1jNACHqZqHIrzTd8dWk4y3h7DTipRXWiQcUHhXrd7lAC5hk8HeUEmgTsXttmc 7tewxISPbYFKxxbe5btXGVEmZm3XDydaKHSRj95uk5QrKgVKxI1YqVZVF4tl8kyNjrOs /yki+WsvqAMZImwz0azhT4vuWVPSsZquktELH3mLZPa+kxng2hDbm1ASPip/AAO1II9J NynQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YoHWYDgB; 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=pfQvKb/f+pxUm4Orq8rh+a3di3WnVvKBIUXCaDmQePM=; b=MqJG0BivRWR3RQB4FJK8pkGSH/iIQSJ3dOGh6XWsrLXWg3H/YDYp7EqKwO81TscpKv 6GPRNuIEvsYYowgkGHWhyNmGVa27KRa8v8FLkglIDQIhFJpk+FK282hlQcjU7DNJz6n9 ioaqMXowh6J12QCMxAXyhPwzCgh4EdpceE8oM= 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=pfQvKb/f+pxUm4Orq8rh+a3di3WnVvKBIUXCaDmQePM=; b=ev68Kc9hZ2n/JFcplGyG6JNwfKV+YX/Fr/phJPVOXx0w+lZHQjthP2sjTbc6R7QFoj QCib4yPBB6A1ma5iyHmnC2QreuNkjwuuIeX2HDVxMYNqpvrCC0d+fZmnVxpbWMSU6Lhi 1LnWT9hHMoanE+PTRNb3yQsSbMEytucbMEg7bHc5kg8rf0WrIzWjNeDE3n78Pz8BVGtD x2+HBKGg6uI1ux9IVNZxJVvzGXSjPa41pVNr0quHw2Yij7vZvEY0YbSLgw+nKVGSlh3K Sr42Ifj4fqSwSiVtZ67+m5A+KgiHVrbmTBzy14RfJk2PzMSWCK1di0o0pOnj0U0AKIFx h6uA== X-Gm-Message-State: APjAAAUWK79awXiw4GYtKybnTXQXHJZBLtEvlwDIbGfCYihPDTtINQ4C kiI3hVmadhAXyHLiQOqUPTKeyCSw X-Google-Smtp-Source: APXvYqxYoOL2iabNGgRVb3cmjaJ2Gl++0PZQrpFJYSW9g9pmIJz/FWk09kAkznf8uzWi4AFDqAU3kA== X-Received: by 2002:a63:4d4c:: with SMTP id n12mr72137092pgl.212.1577694526722; Mon, 30 Dec 2019 00:28:46 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:9f95:: with SMTP id g21ls5898971plq.5.gmail; Mon, 30 Dec 2019 00:28:46 -0800 (PST) X-Received: by 2002:a17:90a:cf07:: with SMTP id h7mr43982470pju.66.1577694526224; Mon, 30 Dec 2019 00:28:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577694526; cv=none; d=google.com; s=arc-20160816; b=qOKqlYcZP4im3c/m6KQ59qMdiD4hoG6G8g0ZO3C9qL1VL45rpXTqVFit2PfuRZAFFr jOZ+iaQ5xEHCYSI9R2FiLqfUxf9oT/egfkbmDWHYc1c51USuYVCtfs8DcZhkyymwkGWD LUbZ6xPYSpN7RpLey0bmxTos7pZdtQeZsCbEyelDDpnITIMfVRcd1vBgpNR74RrxF0yo gociM0URqZfhz5KH1AFDaLFFzNrILCdAAyyNIDDEWR541XxwT3SIHBQ4hqe7Yot/Ldv9 aelDgzfhw6q0fReNP24XQXx2hCTkwizch9iQTLmI+4vMOslyMY0f+tN0SFLDn8q8AQ6L foEw== 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=t68vP3zUnxKiomoAY67bH1HGMmANs3QjoEQpZMhCEPQ=; b=Aaf6ChF8papmyvjnvLUC6cCvGXzVJ1wf0WujKHG/i+usgdfUoXYQN0U8YTzaBETGc4 hXc5c1c+yrwIhJjeP8XuN/DS6riG35bpdZ0Oea4gFN4FQjDW53NIvB9AG4Ou+47Uezlv iZ6s6AzIzCdDKqigN/wrAv5CHRhhAsbVvv9v9x5ZFpTllBP/wZAlQwDJes3BFNaE3Fb2 fQx3oN5OoEgH+4QdHn1XGIctqRUxvscfXf2TAWdVin4ocgZP+lT7FsJIKfNdV6ZfBO9F /1astYuKVfnzSi7PHBwya7Cdo0Nh6J35TMcBcF6z282vHTI2D5crZwI2aY8ckgHmtSdL OB6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YoHWYDgB; 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 p7sor45268947pgg.48.2019.12.30.00.28.46 for (Google Transport Security); Mon, 30 Dec 2019 00:28:46 -0800 (PST) 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:447:: with SMTP id 68mr72595709pge.364.1577694525840; Mon, 30 Dec 2019 00:28:45 -0800 (PST) Received: from localhost.localdomain ([49.206.202.131]) by smtp.gmail.com with ESMTPSA id s1sm46240652pgv.87.2019.12.30.00.28.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Dec 2019 00:28:45 -0800 (PST) From: Jagan Teki To: Kever Yang , Simon Glass , Philipp Tomsich Cc: Akash Gajjar , u-boot@lists.denx.de, linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, Jagan Teki , "Matwey V . Kornilov" Subject: [PATCH v5 6/7] rockchip: Add Single boot image (with binman, pad_cat) Date: Mon, 30 Dec 2019 13:58:18 +0530 Message-Id: <20191230082819.30191-7-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20191230082819.30191-1-jagan@amarulasolutions.com> References: <20191230082819.30191-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=YoHWYDgB; 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 b48693e560..d5b6c45c89 100644 --- a/Makefile +++ b/Makefile @@ -909,7 +909,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) @@ -1387,15 +1387,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 f9dab073ea..7bd99ba3bb 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -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 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) */