From patchwork Sun Dec 29 19:07:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 963 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 DC8E53F030 for ; Sun, 29 Dec 2019 20:07:57 +0100 (CET) Received: by mail-pf1-f199.google.com with SMTP id e62sf23298343pfh.14 for ; Sun, 29 Dec 2019 11:07:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1577646476; cv=pass; d=google.com; s=arc-20160816; b=QfdqAGVcid7pkSW29/9GIN3ejgsooo/7AI+H0d4tHlpXU/EzFs9Mbc3H/3bHsnaZuO fcht9tCoGWogW60GIZbXd3tALED3EBtpnAIO++pHc8LhudKdJiAVvXupfOwSg/V0n2bH XzFnGYkjRLTZuErQkMT7lQ9fmt+dQOvX+hMw4/nnVjjPAedbDniIqurzXSqxm/HqCug3 UsK+J2jrZx6sZuI1Q0NO0ax1aHSl2BjNSfP8clMEuTy4VeeaSZB3FV8bcnhNIKwrgFqn 5tmWRgNermqPhvjjKeJnoWs6FUZBIiUSJXCDUC81f1CTniT79Sj2YSHh2PbbaBH0H3cY 7krg== 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=cW53brLJPGnYWQO4quREeUsyTqjO7o8UWq3ox3IMLbE=; b=ClbA4oektNZy5gvl2KJ4GuADC7Jks5v3EhqnwQbBGWb/uA36VndR0b1UbFAyO6fZQf jYkleV4yvKTCl0FCBYFvoCCOPSF9jeAwDipFrpWb2Giqh4lP2SKZc9uy6WK+vGQBrXKk qBcTGYE1V+LzoZBd/AyujZLBOPs+gCXEpb6o6IK7M5cf2JBI0QD3hxvvsboiO6gRATm+ Bbp+8Jdc0O9dq6lpfKCsTZX2z2eJXz2cnog8nlHeMWpD9x9u4qXjWWBesf8rVskn5yEM zNLtVKtHCwk7NlhmF/v1TxEEDX8YtdpAqvBb2uX7mK0lbP9Niz+TuCUCd7GqjXVgTTuA dNpQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=L+5VnKGd; 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=cW53brLJPGnYWQO4quREeUsyTqjO7o8UWq3ox3IMLbE=; b=c/WtPbZrJd5C7RORNcBB8q9CvZKJ+wp0DwQ0fVEDtxsb0PQwxR2fHEcPGxZNLbPsh+ 4DFkJ+flvTyoKV8nsPIvosZ7ba4tSpAh9MKuNEWUWjlNV+kLDrgroNERB+lRBTYo5RkR zcBza0aeMwU0A5iLCWRVoh/lIcTDcuMQBc7iI= 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=cW53brLJPGnYWQO4quREeUsyTqjO7o8UWq3ox3IMLbE=; b=lt8FfbbMsAZkdpOlttwi9Z9lb2U+Yzd+f5tOvs+vcYsJ6BUnM9r0ZSxLb8Wn92PlQO HJUYBgx+opBsTN1ID7nzMSHAjAFqTBKluUliiJGOnsMvesbn/de/wWuvrvQJsgR4NyRz qxQ1DBrDK9ICEhFtyhF1e6K2uBNEf7zKpN2vw9BJud3gA+4ucnvZYtL39tKPcIDVoxEb IqCfX0WdaMyeUSnNGMDZJ/T1pyFQvcvgATMtCmEqaTYZ/k4mJG2tCGz1mkp5DXWzDJon 06syaAbTUG0ruFoS7QpxVGdw8Xo6WbVrVYP9g9wMMfhm04ah2f+T5YkWese9F30XJNGd +0fA== X-Gm-Message-State: APjAAAVap8X5NamDH59th7U/KwWF+PIZQdlInvbdLF31QWQzYt9TmOOD w0lGQQgMxjYUbdpo+XuR0SYIFkal X-Google-Smtp-Source: APXvYqyiFGct3ADpSY4q7jra+ZljqLczxZlgKzNWb7azEwvanOERbzOcds4Ojja2SnD5CTLsfMO9QA== X-Received: by 2002:a17:902:aa48:: with SMTP id c8mr63886302plr.243.1577646476644; Sun, 29 Dec 2019 11:07:56 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a65:4608:: with SMTP id v8ls8834422pgq.8.gmail; Sun, 29 Dec 2019 11:07:56 -0800 (PST) X-Received: by 2002:a65:6088:: with SMTP id t8mr68264551pgu.329.1577646476079; Sun, 29 Dec 2019 11:07:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577646476; cv=none; d=google.com; s=arc-20160816; b=nhPWB47Ed3VtEOaMI8s/wzYmfOHe6Qfi4d5NWITSJlx5E2iI/SzvMsNwic3HArX6Nh Fe1H9Mxi8fNfLLFwBtuC9C4LCfL3vs506ExsBKv9w9VMpElg0/bwB20BWu8ZOW0Pu9yr rYJRxLzB6+Oa3Jcry/LsuGZZCLdr3NiG054/WdqEGQqB+qZ3fH11G0xJYntWAW2jadCs F9+/Fw6TWR/KVsXZnkZYTFsGf7ubLeSy7FGkJz1u5D2tmZrfcg/qdifka/2ZwL1dREEd DSBSMKT1v2aLnlHsQufFZ9682j4TRSNborwogAzkfUYgravup26v2b5sCRlwciVxGfgG B7zQ== 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=OclQb8nXU/5Z2kX6g2jXsNVbgd5mlQqGTFLV3uaUurg=; b=bBFnjrdUQ/imxNyPS7HoTyTm8xMtHSFuKpjehuyzqdetXP77XqMJN24+xmic0d/N1J /8Dw1ajNY+DtfZF4ynI/vC6P5DekcCcy85oPV+qyaGiV8pMazp1FrTUCZ3eXJCabj7vq RuIu6GEOmaJJ9g1R9DyQcUVe/Dsu6Byyt9o7kK1sJ4Ma8vl1tuqn0Tp/MGkuCCB1n+8Q gGM9HhsrwCSpf/5fbNBz7IgynG7NLtl6UQgasIU1CG+k1GEmc6T+U5iiogJLsDzILbEb KLgNCumt4HrRmgvgCUaQJwNqjrl/nQ7XxVzgqJPoiCggPTv09LYTt9+6hIJBOOV1o3mL /MFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=L+5VnKGd; 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 x9sor43609344pgi.32.2019.12.29.11.07.56 for (Google Transport Security); Sun, 29 Dec 2019 11:07:56 -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:a65:4381:: with SMTP id m1mr68859912pgp.68.1577646475724; Sun, 29 Dec 2019 11:07:55 -0800 (PST) Received: from localhost.localdomain ([2405:201:c809:c7d5:f590:ce0e:1ce1:c326]) by smtp.gmail.com with ESMTPSA id u10sm44879700pgg.41.2019.12.29.11.07.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Dec 2019 11:07:55 -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 Subject: [PATCH v3 5/5] rockchip: rk3399: Add bootcount support Date: Mon, 30 Dec 2019 00:37:26 +0530 Message-Id: <20191229190726.29266-6-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20191229190726.29266-1-jagan@amarulasolutions.com> References: <20191229190726.29266-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=L+5VnKGd; 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 Reviewed-by: Kever Yang --- 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