From patchwork Mon Aug 26 18:21:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 840 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-oi1-f199.google.com (mail-oi1-f199.google.com [209.85.167.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 7E4E23F0E1 for ; Mon, 26 Aug 2019 20:21:39 +0200 (CEST) Received: by mail-oi1-f199.google.com with SMTP id s3sf5950121oia.19 for ; Mon, 26 Aug 2019 11:21:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1566843698; cv=pass; d=google.com; s=arc-20160816; b=COblyJaiJ5b+ssXAtUQVnjduIMIzqaLCiMNRKdWEzyGXfTmQ5UzwHbOrgDi/vhob3V Zcd+NLMRZOFG6KJziJS+HXupLU36nOCtKfKMvV/aA3lSFuLBU3f2LK4ihAPCjcZfBU0Z 8YXdsLFPtzOMwHdPBMVF0AfEZAzK+K0d4e4yOeoBe8d8EdeuQLWYt+7VcclmrPDeR1/f QwsbgZdaWLGnw9m1vk+yxpH7VpPkqd0DQs5D/gp+1DXZNdRFc93pJAQuX4ar1BeG5dJ5 16sZFS6j2rNtKW2jLFdTZwBZMadfpdrLpW7Hr+4DZA1MdyoN5xWy1cLJJ4hx//zPjF85 jeTA== 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=ZQ4Oqo0DZo+9+vsMEeI6lXz3rp00qUNXSJiJsnDz3GA=; b=THIGGd1LVyZpT45eTqW12TIGgIi7ejtO7/y2Tr3BzIjdxJctFZX5nUQYKA1Kc8bJXY whG5yCGHuSGOTGnYUAsKyri93g641uiThv0OvDwOpJpdNcP4J9GVjf9uGiZCUdBJyZdN c5U/d4ERhx3tgory8La8FYacF89T/2es3pKuyYABZKBvjocHIeioQlxRC+1hoDJSL2mt An5GbOXusdRmQ1uvrLWXja40BTiRzLH+R5TujeMFycAT+Ywm51mWfqGniDNIOCktCY8Q YD+ZRKGl1ZwBY1KuzLJUK6GaT8PIZ3Mvsl9fRFb2WVlrWedyOQo7Q0sEQwhLGlVpFJVX VT9w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=MOXXMFw6; 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=ZQ4Oqo0DZo+9+vsMEeI6lXz3rp00qUNXSJiJsnDz3GA=; b=dCwlxaxmHU/BTpCAsn0y2UxCXXVpd5OJ9WhVlMbRNMlDex6Vnl2j8Ulfst6ZBztUcu JCB895v0ekHtymwBLAGeyyuDNjkDyHRwqfdT9nIrSB+2GvZy3Y53utuiy7Kn3dGVQbtm ikb4mLhYHqXm2I6Q5flOeg1bBjtPoarTSttlc= 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=ZQ4Oqo0DZo+9+vsMEeI6lXz3rp00qUNXSJiJsnDz3GA=; b=KDRmzHIC0LfkTxxbJP26y5dTqioY+v+KW5mJhYo9AiW1KbJM0tNdWfG2ZZ6RdA0s2V APa36hVgYiOrTV0wntgP8YaqswZcgoZ/EZBMkfNa+eBFoHrMFkJ2vgwgFyuCjE9I+U3q QMu2/ckA/BXRN6pYmaz5319ZBLqIXMv84Vlsdb6dyZrhHWvLpSPmItlzPhvSGDWi2K62 2yDzaKaN1UjYmZ9YQ5ATnf7jG6beF5wlIn1YP180RPx8fZmCloGskdlw4WeC6Bh1ZA7s PtlTbLvaKtxLCAlrIwCY3qyiD80+brsFRwqqa1PgMkLAzI6ov6ArKQno0w8/5Y4cqRhf ZqVw== X-Gm-Message-State: APjAAAXs4AGWklNZoX+r2Pe6OL3wG4KKcHpQOEMHhd4tosmXNicvPq0O 6VxGJJvHPlUb+ev+P8MQpUM5RQAI X-Google-Smtp-Source: APXvYqy7M2QYDVj5USZnaV1lAzDnHymd5vMgPYgKuLyoa3rIDiSZQnXHOREip01i3CjpHJ0koMi9Bw== X-Received: by 2002:a9d:1b01:: with SMTP id l1mr13865651otl.249.1566843698483; Mon, 26 Aug 2019 11:21:38 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a9d:6395:: with SMTP id w21ls508653otk.10.gmail; Mon, 26 Aug 2019 11:21:38 -0700 (PDT) X-Received: by 2002:a9d:5f0b:: with SMTP id f11mr6534431oti.211.1566843698001; Mon, 26 Aug 2019 11:21:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566843697; cv=none; d=google.com; s=arc-20160816; b=EXX76z2yF4M3pN0DaEy0NU1kXKUCTYMxABulZwjrnmzxi1qIVQ6q6KCWcIurVyN5u5 aQ82uPNPxmpCHFg/n7hbK8ymZRZ+ldlxV2pabltW05cu0Oay/ASyZQK5xZBgE6/5yxH9 Ek1WzENsgxllfnWlcj3ykPKC8gra328p8ZIg6KeeVG8gibLuca4VZuSJFnYXQTqyZLeO LKWa92fkROLopCbEfqInftOHp0srK8vuz6O7oEI3e2020z74Gz7GmTN2ehraSyIytegE Gi0ixkbIog58zPeapiuRsRSJqIWeqBVa2Y/zvVsRk2YZLjC0l4BbwSpteskrk33LJD2I pxKg== 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=E/qBc6mh0Js+GUAR+QXICXFI1nahJkV/JF00fmFnkqo=; b=H3/irHlf2W3SqgCGGaj60Fzoqk7I2cL1hGNuBavQ+JdtDkOYowZjwRfAVQVjoGcAVi J3trHTKK/kYz/pL4GNxGXg/vWn83AjzcGWNIYHYpaela1jbjj0r6rsuh0D+mc2h9XK1s +syPBGZ/sEGlVDyCCN7H6y0bMusc+yaWExd49FeSDDYjTQ6ruXFC3Na/n88TVaHyc+bR CeTtpKgBoT6m00wO8DQGMALlO2Lpso2Wmjy5FE8+ZqxBmxkKdGJzdiIBe9b4fN/8KQgt epD/7dv5Phz+ShImtA56mbt9B3lbEampsgqi8sQcGSEqhnhjUkWO0Cqia0OHZHTBXWhP vVvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=MOXXMFw6; 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 16sor5349746oin.143.2019.08.26.11.21.37 for (Google Transport Security); Mon, 26 Aug 2019 11:21:37 -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:aca:1104:: with SMTP id 4mr8967503oir.65.1566843697673; Mon, 26 Aug 2019 11:21:37 -0700 (PDT) Received: from jagan-XPS-13-9350.attlocal.net ([2600:1700:7430:38e0:d5b0:4823:33c8:5e46]) by smtp.gmail.com with ESMTPSA id c11sm4401461otr.54.2019.08.26.11.21.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2019 11:21:37 -0700 (PDT) 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 Subject: [PATCH v2 15/16] rockchip: rk3399: Add bootcount support Date: Mon, 26 Aug 2019 23:51:10 +0530 Message-Id: <20190826182111.30999-16-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190826182111.30999-1-jagan@amarulasolutions.com> References: <20190826182111.30999-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=MOXXMFw6; 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. 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 f5a80b4f0c..f3e4d72203 100644 --- a/arch/arm/mach-rockchip/Kconfig +++ b/arch/arm/mach-rockchip/Kconfig @@ -197,6 +197,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 6660d05349..68ac913bcb 100644 --- a/arch/arm/mach-rockchip/rk3399/Kconfig +++ b/arch/arm/mach-rockchip/rk3399/Kconfig @@ -91,6 +91,16 @@ config TPL_STACK config TPL_TEXT_BASE default 0xff8c2000 +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 a5e69b26ad..724ea4cbfc 100644 --- a/include/configs/rk3399_common.h +++ b/include/configs/rk3399_common.h @@ -64,7 +64,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