From patchwork Thu Jan 9 08:52:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1022 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 65A733F042 for ; Thu, 9 Jan 2020 09:52:57 +0100 (CET) Received: by mail-pf1-f200.google.com with SMTP id c72sf3616261pfc.0 for ; Thu, 09 Jan 2020 00:52:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1578559976; cv=pass; d=google.com; s=arc-20160816; b=M9nXFBuOOgvy7FKuSjOFOfUEz1ccg6OTFv6unda0CaGV9IIkGQ0MiyUEm9Fm7jDDC+ NdGvT47Qm/4QekWUu1YzItk0LxX543MoGb0MIeJi7xDLuzAbg8kKKYkFCVjW8E3yWjR3 gsmil1f+kPgrtQ4EOQSs5RzmrbbRXv9CJHx1grGUqreFhNdrE2qHfTBomJJ64A/oC7dE NeqqtdKoIiH/NY/tvODfzhNnpTWLOvc2xfnOZVhTJnxql6++pRKlkbu+F/I/1Kk42m3B yexF5BY/OfQydJIqxld3fNhf+VbIycHqqdqaLNW+qnZVN60NZSQftSsXp3TWLdk+apBd oPOA== 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:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=fd5LfJDaC4ojsM2uAN9WxL2hk0xpgTt7jhr8zv8j+pY=; b=h4tM1rb1MfdHXGI/aQ8pjsm+7txvePUPblNBI10K9XZ+IMH8qDAbrL9wY3KnP6VDuJ VpZ2aydx0B4xW7lzVwejz4RnPR7M/OBBXnlLZaiHYye4qWj3aFwwB3PaGRkmqrmxAVG0 w86otUQ4oavf7haNc8LVTK8UDt4JzgmHeqPujPb6aTBxIHl67rxwAGM+gaTWk/zmMAt/ yeAshkpQeuYUV8MaG3P3Jw89XID8/W+/Fa1sD36+/xZbBHzVozG0JEiO8284LNp4/fko MX6Vyzwg903Xuf3PC6hYaLJMaZyIwlRtAhv5Lz6d7BFqYtI5Y58zuNPmxNxxYCVe7yTM DGeg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=iywMJA+Q; 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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=fd5LfJDaC4ojsM2uAN9WxL2hk0xpgTt7jhr8zv8j+pY=; b=HXoGRQZtwJ+wzRJdLpKslS7Y1Wx10MvfHEyBC8wPAiW8r73QPzqcKKRaI/awXgk++w 8m5f/s9OPkvG9ueZII4VhTFgpdJKQEiGrP8cx7MHJ7kflZuJeNX5zLGGyA6px4gfUXg4 M4rXve4YGtGnQ7jrL4vrL001h49E9wF5fv6ok= 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: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=fd5LfJDaC4ojsM2uAN9WxL2hk0xpgTt7jhr8zv8j+pY=; b=Ot8Rz+f8ckn4gwzzHYf3IUA9sAorOtDcF1F3Bg0Hp28ZEeZt8ENsm+FbCgW5ZOB9N/ NW1vxghwXyFxw/9jUssYWCWu6wsptApoNMmcZU/qp/xk+QJIl5KqcPixcfvCUwBwzcl0 /S2JK5pfnWy3/E+kyk8vF7TgOm7zlXQ7QetlVVqnR/4ayB9JedjJaXQj4H+l3jKZhrm9 BaC2P2e9QmYcPZ5oBV3fTu1cJhdk6N6cXZQkJqjUddCWLz+iq78VZ3w2kYxIwxBiu/PH n91M58s0zlfphqQyVFjfyqlCp3FMW6ef6hDrUTFwH8GENPKwLbqSN/4rbes/g/AgzXSE 2B+w== X-Gm-Message-State: APjAAAVl3f4Di2ZuX1WsAN4m5L4asCifvVxLBeKNSM9P09FX/s36DnKp ShWVb6KISnyS2FwVqYdJ3/UnrkNq X-Google-Smtp-Source: APXvYqyWatp+T3zQIvmd4kKH7AGvc9r+yblYQ4cPxOuNpbqz/5zGM14Wzbh2744Q/2JQxaxUh/2QEQ== X-Received: by 2002:a17:90a:c385:: with SMTP id h5mr3974354pjt.122.1578559976143; Thu, 09 Jan 2020 00:52:56 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a62:6483:: with SMTP id y125ls391833pfb.9.gmail; Thu, 09 Jan 2020 00:52:55 -0800 (PST) X-Received: by 2002:a63:364f:: with SMTP id d76mr10260612pga.215.1578559975666; Thu, 09 Jan 2020 00:52:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578559975; cv=none; d=google.com; s=arc-20160816; b=Y+ZGVj7+LQHtlvDjYxsNZ46qqcNBCZw0ty7jrYbue/P6Pz4vvrKJGl5Hd7yEYX9WNw /wnYZJiK563W8Lej5hh/QD72qWGjleD8X3824fDHtGQTvGB8+wVh/Ug/xepRToNW6mGE ovDxHghVuOtAlEluNpYhWh++CdZCnJDxB64SjXLhamC2LVKKPm2Mv3ZvtsuSeZ9bbWpq C1O/spDYifT1zRb3gh5bfW2Nd7zHTSLqLuyhl4r2l3VRYFCErJdHUVfOqn5sSTvoFlE2 6QS6B9R2zu8olbE6imW+2GYZqEpo71FxX0pFbJx5Ugn60Zi/7RPjXFq61FrebZcgDGdM svgA== 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=oRKgs2PetZDvzDu1FBC+Mjjc1xHu28pIwI8pYrZq3es=; b=Tf0sS0DS6QioIj/jnInMOTphzn0kuyGMe4UZGmRLooiu+Z3Rai5vUfHiWO+uprvhcl EomnD8A0TSsWEmHTy4D80DaipjQ0ECcleVbWaPhxpsO65p+FfHFBsqj4qs98J2TyjZd3 MNaHS2x/JJgWMnDZIZpucq1MTn3soDHdBbEUif2cXO5cLL6C1C7z9Q72RPGXtEeXJLrH snpnVtfqvWIEF6VMWR7/2El1KpYIoz9/nA0/2+EY9+MtJvkeEeXCvzMy2JWoeLLzxkYR PuXIDsJcJ/kMKubqEQe4YkJ0dNW86YCJNC/lKjWH/2lSqjYfGRsKeYq3ozD5R+pRESPd g6cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=iywMJA+Q; 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 g22sor6612802pgl.73.2020.01.09.00.52.55 for (Google Transport Security); Thu, 09 Jan 2020 00:52:55 -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:2949:: with SMTP id p70mr10177435pgp.191.1578559975335; Thu, 09 Jan 2020 00:52:55 -0800 (PST) Received: from localhost.localdomain ([2405:201:c809:c7d5:d888:9871:544a:b516]) by smtp.gmail.com with ESMTPSA id o17sm2139121pjq.1.2020.01.09.00.52.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jan 2020 00:52:54 -0800 (PST) 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 Subject: [PATCH v4 5/8] rockchip: rk3399: Add bootcount support Date: Thu, 9 Jan 2020 14:22:19 +0530 Message-Id: <20200109085222.22670-6-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20200109085222.22670-1-jagan@amarulasolutions.com> References: <20200109085222.22670-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=iywMJA+Q; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" 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: , Add bootcount support for Rockchip rk3399. The bootcount value is preserved in PMU_SYS_REG0 register, this would help to support redundent boot. Once the redundant boot triggers, the altboot command will look for extlinux-rollback.conf on particular bootable partition which supposed to be a recovery partition where redundant boot required. Reviewed-by: Kever Yang Signed-off-by: Jagan Teki --- arch/arm/mach-rockchip/Kconfig | 2 ++ arch/arm/mach-rockchip/rk3399/Kconfig | 10 ++++++++++ include/configs/rk3399_common.h | 5 ++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig index d8d68ba447..9a3c65ec58 100644 --- a/arch/arm/mach-rockchip/Kconfig +++ b/arch/arm/mach-rockchip/Kconfig @@ -244,6 +244,8 @@ config ROCKCHIP_RK3399 imply TPL_CLK imply TPL_TINY_MEMSET imply TPL_ROCKCHIP_COMMON_BOARD + imply SYS_BOOTCOUNT_SINGLEWORD if BOOTCOUNT_LIMIT + imply CMD_BOOTCOUNT if BOOTCOUNT_LIMIT help The Rockchip RK3399 is a ARM-based SoC with a dual-core Cortex-A72 and quad-core Cortex-A53. diff --git a/arch/arm/mach-rockchip/rk3399/Kconfig b/arch/arm/mach-rockchip/rk3399/Kconfig index 868e85fc2a..f994152803 100644 --- a/arch/arm/mach-rockchip/rk3399/Kconfig +++ b/arch/arm/mach-rockchip/rk3399/Kconfig @@ -113,6 +113,16 @@ config TPL_TEXT_BASE config SPL_STACK_R_ADDR default 0x04000000 +if BOOTCOUNT_LIMIT + +config BOOTCOUNT_BOOTLIMIT + default 3 + +config SYS_BOOTCOUNT_ADDR + default 0xff3100f0 # PMU_SYS_REG0 + +endif # BOOTCOUNT_LIMIT + source "board/rockchip/evb_rk3399/Kconfig" source "board/theobroma-systems/puma_rk3399/Kconfig" source "board/vamrs/rock960_rk3399/Kconfig" diff --git a/include/configs/rk3399_common.h b/include/configs/rk3399_common.h index 127ca1f09c..89a8a44bbe 100644 --- a/include/configs/rk3399_common.h +++ b/include/configs/rk3399_common.h @@ -63,7 +63,10 @@ "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \ "partitions=" PARTS_DEFAULT \ ROCKCHIP_DEVICE_SETTINGS \ - BOOTENV + BOOTENV \ + "altbootcmd=" \ + "setenv boot_syslinux_conf extlinux/extlinux-rollback.conf;" \ + "run distro_bootcmd\0" #endif