From patchwork Wed Mar 14 17:24:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 885971 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 401dyV3ddyz9sTV for ; Thu, 15 Mar 2018 04:29:54 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id E47A2C21DDC; Wed, 14 Mar 2018 17:26:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 40F46C21E0D; Wed, 14 Mar 2018 17:25:42 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 9B702C21DAF; Wed, 14 Mar 2018 17:25:18 +0000 (UTC) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) by lists.denx.de (Postfix) with ESMTPS id CE212C21E52 for ; Wed, 14 Mar 2018 17:25:14 +0000 (UTC) Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 401ds64c4Nz1r2cC; Wed, 14 Mar 2018 18:25:14 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 401ds63KDpz1qwl7; Wed, 14 Mar 2018 18:25:14 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id niK3gW3jpvVV; Wed, 14 Mar 2018 18:25:12 +0100 (CET) X-Auth-Info: la7Q8YS+75YguvqO7w7FY7wHF6aID9TfD2ZsQPNQxLc= Received: from localhost.localdomain (89-64-1-240.dynamic.chello.pl [89.64.1.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Wed, 14 Mar 2018 18:25:12 +0100 (CET) From: Lukasz Majewski To: u-boot@lists.denx.de Date: Wed, 14 Mar 2018 18:24:47 +0100 Message-Id: <20180314172450.8385-6-lukma@denx.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180314172450.8385-1-lukma@denx.de> References: <20180314172450.8385-1-lukma@denx.de> Cc: Marek Vasut , Tom Rini , Stefan Roese Subject: [U-Boot] [PATCH v2 5/7] bootcount: spl: Extend SPL to support bootcount incrementation X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This patch adds support for incrementation of the bootcount in SPL. Such feature is necessary when we do want to use this feature with 'falcon' boot mode (which loads OS directly in SPL). Signed-off-by: Lukasz Majewski --- Changes in v2: - New patch - as suggested by Stefan Roese - bootcount_inc() is called in common SPL code (./common/spl/spl.c), so other boards can also reuse it without modification common/spl/spl.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/spl/spl.c b/common/spl/spl.c index b1ce56d0d0..01e7989869 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -20,6 +20,9 @@ #include #include #include +#ifdef CONFIG_SPL_BOOTCOUNT_LIMIT +#include +#endif DECLARE_GLOBAL_DATA_PTR; @@ -411,6 +414,10 @@ void board_init_r(gd_t *dummy1, ulong dummy2) spl_board_init(); #endif +#ifdef CONFIG_SPL_BOOTCOUNT_LIMIT + bootcount_inc(); +#endif + memset(&spl_image, '\0', sizeof(spl_image)); #ifdef CONFIG_SYS_SPL_ARGS_ADDR spl_image.arg = (void *)CONFIG_SYS_SPL_ARGS_ADDR;