From patchwork Mon Jul 29 07:47: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: 823 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 714AA3F0E1 for ; Mon, 29 Jul 2019 09:48:19 +0200 (CEST) Received: by mail-pl1-f200.google.com with SMTP id r7sf32659258plo.6 for ; Mon, 29 Jul 2019 00:48:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1564386498; cv=pass; d=google.com; s=arc-20160816; b=n5EDPz+37Zr34//ssFKZWScbGg7zhEbHCzjKG/5y9Qy8W7CVvfp4qPOHsrU5KkMfpX YQubcobKciNgTmu8EneUGkSKHsoq3hKkCN8NdQ+AfKIRRzJr0tMdcnREioDXbeDYCCjT /javhoK/ATccd4q5B80zOrQvTdKmFhTzA0MR5YK6iWL41m4nWS7xYo9IWwq/p4UZri8O t+P9Afoc05jrXRM9DHMfBnQl5rQfhW93+1b62m+yHR8LpUcBW8ytxYy0+jf3n9flrF11 /s0yB2IMm+cbSZScmeOgvymJuYSLctYMoWLbY5JbKP1FM3lIsPSG1V8t8DReBt24gkk4 1M2Q== 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=+ZadM60sxkawubraZfcXXU8u6j0S+pF2bmfVUWmW7Nk=; b=emBRd4p5AstPDmeM3WsiFI7+CgcH23ReYVJsyIcAAjvG189SrAst1YCxabf1Rk2Z9C ObaDdAtWfjRKblOaJFIaYN3pwUVmepOiFArAvXThthq3IPZhT1j6cW6fmBPdFvSw5ziS yxCGK+cMCGkegbflCJbsPiHgCdn9tFwrOibzoNqLuHhXh9POF5Jdqucu0irC/NusOKVC t0mv0vn7K+diLhCP5jHA/g3lfoLdjZajMNKiZUPQ00nLDfmunpr4Fr+gTuDB3r3wljGr ZlesA6nnXSGrEBA5Y7z+tjMWj7qaAayXenpYpRpe9paose9lfMjsZL0ERbFazj5WBTyM WI2w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=c7WwARmC; 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=+ZadM60sxkawubraZfcXXU8u6j0S+pF2bmfVUWmW7Nk=; b=qL0y017hVV37BGveKJOyFshNA8BEd9Iynw4SwLaVFDkv9dnkCusKeN2ihwmvGnysNl cxHlBiI29UhCRFutXMyvDqcm9DUyMCYWPssnVGsKofaQ+eEjf9gVA1e7aS0xCNrOhm2D vnEC5QzoUpJPIU+qsvJuLhPg7kBrRc0MHEfe0= 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=+ZadM60sxkawubraZfcXXU8u6j0S+pF2bmfVUWmW7Nk=; b=ebx+dqTJDoSEtdgD/gEpByPzI0K11bxCRYfEmjUtZiOIcNEcZWRLQi6ezy9QKswzP4 /6NNE0+flAWTnI8V3USw2gxHuCSqLmTrNvPMP+NztI5R5e1fp9jFYOc4ZoG7pQqN2dij qbnkVnBwNu6BQKaImyE3WxRybQ1WLHOOdRZXE32MkysM3fuaBulbjLhk7QOLUosH49yW 7t2MuLJN+ZVqu9+Ub7rnzphiBs/rUWD0KUCinjoHxKJjW14V24rn/wKKLcihQFNmB1vh aZYt5z1Kaa66ZagBc0Hx2BL6OOq6UHLri5RSr4ulOy4qGzENN10+nWy2mrQbZTzeKx48 HekQ== X-Gm-Message-State: APjAAAX8nYvuTqJ+Hjm7BXGTK5vF1raijuKU7bxCpkTfr7CNzyzWpWcR CKLO7/3p1QXY3Rw88q+QSR/ebhjK X-Google-Smtp-Source: APXvYqzRIFvsl/ac8n6KcIeYe89iaKPPKmvnORof++Z4CWUZLy7KZNkyFjS7o5OeMtAf+/D9uB831Q== X-Received: by 2002:a17:902:b789:: with SMTP id e9mr105886187pls.294.1564386498283; Mon, 29 Jul 2019 00:48:18 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:32d:: with SMTP id 42ls16913651pld.11.gmail; Mon, 29 Jul 2019 00:48:18 -0700 (PDT) X-Received: by 2002:a17:90a:9f4a:: with SMTP id q10mr110331641pjv.95.1564386497917; Mon, 29 Jul 2019 00:48:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564386497; cv=none; d=google.com; s=arc-20160816; b=LTtiPiHpiAlalap3obOMnBX1q6PtbCt6b/esqtjjQvD9vaW+5kS+8gv+PmAvDUeIO2 /TE1V8if+sxAfNqIfV0wTvrW7K9JYtCnirFl4gyWfSP5Xd5U5hFDIHDni6LiGY1pc8H3 9AMvdF7OCgPUVE7c6f1lmVemQoyW6El7a7FCihTMsVJKlmwjda8ikQkZ6R6DzeRz0u/Z 4U1p6MTmQeA23J++62dDDJe4d2edjRptff+avOUU3FZ9PCW6xP25iDlrUtnbSoMsXFlg ll1988MIc8Ik+0am0x/WEfmA4x2spuqghpNe7xAXtcT0ibhkXL+xU/zsHXj8PEYRh3pT 4Kjg== 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=u7szBjNEXUp4OiSeFnl8aPhRsuIeh4Tl0P1JrlmGS+4=; b=em4kFPhSnQD2HzPN04GLhNEzH1PHZm6Zhos96fD65KHG0iByR0U9L+AuEEIRvtu6Oy L1lTDcCmyX5m3nAf98adX5ff1GW4DzTQ2jI4NcvN0ikfZuyQaZuCJApRH9JdbhtesbTe KiEGPYV781WOwBFJ1oHAwAbTMm/uCGkbTOILzmHM8u3DydxdKKpbZntCvahXbJ6KXGpd DEINRnPZ9/2lQW7UZYwtdJ2YT32x+Kx2T8xlGALLb/5iPd/fjVOC04CTFs0ewa+ljIVw hxIS+3QTVY5mUMaZVvLmzH8dUPB2y6yu9qebLQOe8kThYlOzRgsIxDHgbHqgvdZcK7Yv Vm/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=c7WwARmC; 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 q8sor32574344pgn.1.2019.07.29.00.48.17 for (Google Transport Security); Mon, 29 Jul 2019 00:48:17 -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:a65:5a44:: with SMTP id z4mr103285588pgs.41.1564386497542; Mon, 29 Jul 2019 00:48:17 -0700 (PDT) Received: from localhost.localdomain ([49.206.203.41]) by smtp.gmail.com with ESMTPSA id h14sm75723348pfq.22.2019.07.29.00.48.14 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 00:48:17 -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 14/15] rockchip: rk3399: Add bootcount support Date: Mon, 29 Jul 2019 13:17:10 +0530 Message-Id: <20190729074711.16988-15-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190729074711.16988-1-jagan@amarulasolutions.com> References: <20190729074711.16988-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=c7WwARmC; 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 17f31e89f3..dd5055ed69 100644 --- a/arch/arm/mach-rockchip/Kconfig +++ b/arch/arm/mach-rockchip/Kconfig @@ -184,6 +184,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 67b48e03ba..ace82928d1 100644 --- a/include/configs/rk3399_common.h +++ b/include/configs/rk3399_common.h @@ -70,7 +70,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