From patchwork Wed Mar 14 17:24:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 885965 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 401dtJ6Scsz9sVV for ; Thu, 15 Mar 2018 04:26:16 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 98BACC21E38; Wed, 14 Mar 2018 17:25:31 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL 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 5D480C21E0B; Wed, 14 Mar 2018 17:25:12 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 631FFC21D4A; Wed, 14 Mar 2018 17:25:10 +0000 (UTC) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.10]) by lists.denx.de (Postfix) with ESMTPS id 182F5C21D4A for ; Wed, 14 Mar 2018 17:25:10 +0000 (UTC) Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 401ds02q8gz1qxgR; Wed, 14 Mar 2018 18:25:08 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 401ds01Jr6z1qwkj; Wed, 14 Mar 2018 18:25:08 +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 alzKIISDtP_M; Wed, 14 Mar 2018 18:25:06 +0100 (CET) X-Auth-Info: kEPXoKSipHcXLtXA2riAoVtJ/zxN0+D6ZFV6A3QXMJY= 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:06 +0100 (CET) From: Lukasz Majewski To: u-boot@lists.denx.de Date: Wed, 14 Mar 2018 18:24:43 +0100 Message-Id: <20180314172450.8385-2-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 , Faiz Abbas , Stefan Roese Subject: [U-Boot] [PATCH v2 1/7] bootcount: spl: Enable bootcount support in SPL 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" New, SPL related config option - CONFIG_SPL_BOOTCOUNT_LIMIT has been added to allow drivers/bootcount code re-usage in SPL. This code is necessary to use and setup bootcount in SPL in the case of falcon boot mode. Signed-off-by: Lukasz Majewski Reviewed-by: Stefan Roese --- Changes in v2: None common/spl/Kconfig | 9 +++++++++ drivers/Makefile | 1 + 2 files changed, 10 insertions(+) diff --git a/common/spl/Kconfig b/common/spl/Kconfig index 9609fceea5..af6573af8f 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -54,6 +54,15 @@ config SPL_BOOTROM_SUPPORT BOOT_DEVICE_BOOTROM (or fall-through to the next boot device in the boot device list, if not implemented for a given board) +config SPL_BOOTCOUNT_LIMIT + bool "Support bootcount in SPL" + depends on SPL_ENV_SUPPORT + help + On some boards, which use 'falcon' mode, it is necessary to check + and increment the number of boot attempts. Such boards do not + use proper U-Boot for normal boot flow and hence needs those + adjustments to be done in the SPL. + config SPL_RAW_IMAGE_SUPPORT bool "Support SPL loading and booting of RAW images" default n if (ARCH_MX6 && (SPL_MMC_SUPPORT || SPL_SATA_SUPPORT)) diff --git a/drivers/Makefile b/drivers/Makefile index 2673428cb6..a194039e91 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -20,6 +20,7 @@ obj-$(CONFIG_$(SPL_TPL_)TIMER) += timer/ ifndef CONFIG_TPL_BUILD ifdef CONFIG_SPL_BUILD +obj-$(CONFIG_SPL_BOOTCOUNT_LIMIT) += bootcount/ obj-$(CONFIG_SPL_CPU_SUPPORT) += cpu/ obj-$(CONFIG_SPL_CRYPTO_SUPPORT) += crypto/ obj-$(CONFIG_SPL_GPIO_SUPPORT) += gpio/ From patchwork Wed Mar 14 17:24:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 885958 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 401dsL4VDTz9sTD for ; Thu, 15 Mar 2018 04:25:26 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 41E69C21E52; Wed, 14 Mar 2018 17:25:14 +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 A4DABC21BE5; Wed, 14 Mar 2018 17:25:11 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 52B78C21DA6; Wed, 14 Mar 2018 17:25:10 +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 0B9F4C21BE5 for ; Wed, 14 Mar 2018 17:25:10 +0000 (UTC) Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 401ds15nLTz1r2RB; Wed, 14 Mar 2018 18:25:09 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 401ds153XQz1qwl8; Wed, 14 Mar 2018 18:25:09 +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 wvTnz3FzGoUt; Wed, 14 Mar 2018 18:25:08 +0100 (CET) X-Auth-Info: N0uybRThj8aUezyG/ywda6MfQTdfLJQzf8uj6lIXxyQ= 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:08 +0100 (CET) From: Lukasz Majewski To: u-boot@lists.denx.de Date: Wed, 14 Mar 2018 18:24:44 +0100 Message-Id: <20180314172450.8385-3-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 2/7] bootcount: Add include guards into bootcount.h file 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" Signed-off-by: Lukasz Majewski Reviewed-by: Stefan Roese --- Changes in v2: - New patch include/bootcount.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/bootcount.h b/include/bootcount.h index 06fb4d3578..e3b3f7028e 100644 --- a/include/bootcount.h +++ b/include/bootcount.h @@ -4,6 +4,8 @@ * * SPDX-License-Identifier: GPL-2.0+ */ +#ifndef _BOOTCOUNT_H__ +#define _BOOTCOUNT_H__ #include #include @@ -38,3 +40,4 @@ static inline u32 raw_bootcount_load(volatile u32 *addr) return in_be32(addr); } #endif +#endif /* _BOOTCOUNT_H__ */ From patchwork Wed Mar 14 17:24:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 885967 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 401dvW2s5Rz9sTD for ; Thu, 15 Mar 2018 04:27:19 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 005BCC21E0F; Wed, 14 Mar 2018 17:26:05 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL 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 3B031C21E3E; Wed, 14 Mar 2018 17:25:14 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 9B1ACC21D83; Wed, 14 Mar 2018 17:25:11 +0000 (UTC) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.10]) by lists.denx.de (Postfix) with ESMTPS id 54B53C21BE5 for ; Wed, 14 Mar 2018 17:25:11 +0000 (UTC) Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 401ds3168lz1qxpM; Wed, 14 Mar 2018 18:25:11 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 401ds30pVsz1qwkj; Wed, 14 Mar 2018 18:25:11 +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 smn1K43dePMK; Wed, 14 Mar 2018 18:25:10 +0100 (CET) X-Auth-Info: a6xCHNEPHL+WBQVd9mliDSLS3cors3zPcd1Q1G9KKTk= 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:10 +0100 (CET) From: Lukasz Majewski To: u-boot@lists.denx.de Date: Wed, 14 Mar 2018 18:24:45 +0100 Message-Id: <20180314172450.8385-4-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 3/7] bootcount: Add function wrappers to handle bootcount increment and error checking 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" Those two functions can be used to provide easy bootcount management. Signed-off-by: Lukasz Majewski --- Changes in v2: - None include/bootcount.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/include/bootcount.h b/include/bootcount.h index e3b3f7028e..0ec9af6e2b 100644 --- a/include/bootcount.h +++ b/include/bootcount.h @@ -40,4 +40,29 @@ static inline u32 raw_bootcount_load(volatile u32 *addr) return in_be32(addr); } #endif + +#ifdef CONFIG_SPL_BOOTCOUNT_LIMIT +static inline bool bootcount_error(void) +{ + unsigned long bootcount = bootcount_load(); + unsigned long bootlimit = env_get_ulong("bootlimit", 10, 0); + + if (bootlimit && (bootcount > bootlimit)) { + printf("Warning: Bootlimit (%lu) exceeded.\n", bootlimit); + return true; + } + + return false; +} + +static inline void bootcount_inc(void) +{ + unsigned long bootcount = bootcount_load(); + + bootcount_store(++bootcount); +} +#else +static inline bool bootcount_error(void) { return false; } +static inline void bootcount_inc(void) {} +#endif /* CONFIG_SPL_BOOTCOUNT_LIMIT */ #endif /* _BOOTCOUNT_H__ */ From patchwork Wed Mar 14 17:24:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 885968 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 401dwd3n0Kz9sVK for ; Thu, 15 Mar 2018 04:28:17 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 35E50C21E38; Wed, 14 Mar 2018 17:26:22 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL 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 558E4C21E6C; Wed, 14 Mar 2018 17:25:19 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id EEC10C21D4A; Wed, 14 Mar 2018 17:25:17 +0000 (UTC) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.10]) by lists.denx.de (Postfix) with ESMTPS id 05456C21E2F for ; Wed, 14 Mar 2018 17:25:13 +0000 (UTC) Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 401ds45q4Gz1qxpM; Wed, 14 Mar 2018 18:25:12 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 401ds43ztkz1qwkj; Wed, 14 Mar 2018 18:25:12 +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 jYdisRLDmbK1; Wed, 14 Mar 2018 18:25:11 +0100 (CET) X-Auth-Info: D/8ARMxzGxS9f8rR1ht4Ip/EhKGxB65VYiS/7JvgTbI= 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:11 +0100 (CET) From: Lukasz Majewski To: u-boot@lists.denx.de Date: Wed, 14 Mar 2018 18:24:46 +0100 Message-Id: <20180314172450.8385-5-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 , Martin Etnestad , Stefan Roese Subject: [U-Boot] [PATCH v2 4/7] bootcount: u-boot: Do not increment bootcount if already done in SPL 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" If the CONFIG_SPL_BOOTCOUNT_LIMIT is defined, the bootcount variable is already incremented after each boot attempt. For that reason we shall not increment it again in u-boot. Signed-off-by: Lukasz Majewski --- Changes in v2: - None common/autoboot.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/autoboot.c b/common/autoboot.c index 2eef7a04cc..87fca2ea92 100644 --- a/common/autoboot.c +++ b/common/autoboot.c @@ -298,7 +298,9 @@ const char *bootdelay_process(void) #ifdef CONFIG_BOOTCOUNT_LIMIT bootcount = bootcount_load(); +#ifndef CONFIG_SPL_BOOTCOUNT_LIMIT bootcount++; +#endif bootcount_store(bootcount); env_set_ulong("bootcount", bootcount); bootlimit = env_get_ulong("bootlimit", 10, 0); 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; From patchwork Wed Mar 14 17:24:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 885970 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 401dxq2JyYz9sTV for ; Thu, 15 Mar 2018 04:29:19 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 06C61C21DF9; Wed, 14 Mar 2018 17:26:39 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL 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 5C343C21E70; Wed, 14 Mar 2018 17:25:32 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C6BB6C21DAF; Wed, 14 Mar 2018 17:25:19 +0000 (UTC) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.10]) by lists.denx.de (Postfix) with ESMTPS id 33F7BC21E29 for ; Wed, 14 Mar 2018 17:25:16 +0000 (UTC) Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 401ds80C22z1qyB8; Wed, 14 Mar 2018 18:25:16 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 401ds76l1Nz1qwkj; Wed, 14 Mar 2018 18:25:15 +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 qt5doMcyMWn2; Wed, 14 Mar 2018 18:25:14 +0100 (CET) X-Auth-Info: sMCBYBwngge6ewtatlfke5aqCJIABq+qTruhtk8zWlU= 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:14 +0100 (CET) From: Lukasz Majewski To: u-boot@lists.denx.de Date: Wed, 14 Mar 2018 18:24:48 +0100 Message-Id: <20180314172450.8385-7-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 6/7] bootcount: display5: spl: Extend DISPLAY5 board SPL to support bootcount checking 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 is necessary for providing basic bootcount checking in the case of using "falcon" boot mode in that board. It forces u-boot proper boot, when we exceed the number of errors. Signed-off-by: Lukasz Majewski Reviewed-by: Stefan Roese --- Changes in v2: - Remove bootcount_init() from SPL specific board code board/liebherr/display5/spl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/board/liebherr/display5/spl.c b/board/liebherr/display5/spl.c index 437963e225..7712e5bc3f 100644 --- a/board/liebherr/display5/spl.c +++ b/board/liebherr/display5/spl.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "common.h" DECLARE_GLOBAL_DATA_PTR; @@ -214,7 +215,7 @@ void board_boot_order(u32 *spl_boot_list) env_load(); s = env_get("BOOT_FROM"); - if (s && strcmp(s, "ACTIVE") == 0) { + if (s && !bootcount_error() && strcmp(s, "ACTIVE") == 0) { spl_boot_list[0] = BOOT_DEVICE_MMC1; spl_boot_list[1] = spl_boot_device(); } From patchwork Wed Mar 14 17:24:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 885969 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 401dwx0bCfz9sTD for ; Thu, 15 Mar 2018 04:28:32 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 89340C21E0B; Wed, 14 Mar 2018 17:27:13 +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 86477C21E0B; Wed, 14 Mar 2018 17:25:43 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E6632C21DAF; Wed, 14 Mar 2018 17:25:21 +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 72F2EC21E5B for ; Wed, 14 Mar 2018 17:25:17 +0000 (UTC) Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 401ds924N0z1r2cD; Wed, 14 Mar 2018 18:25:17 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 401ds91qz0z1qwl2; Wed, 14 Mar 2018 18:25:17 +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 y13aUHbMDFKF; Wed, 14 Mar 2018 18:25:16 +0100 (CET) X-Auth-Info: 87LLm7d/DJT/57DWsFXMFg9f4S8CVoVo5KlhSzH9qGM= 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:16 +0100 (CET) From: Lukasz Majewski To: u-boot@lists.denx.de Date: Wed, 14 Mar 2018 18:24:49 +0100 Message-Id: <20180314172450.8385-8-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 7/7] bootcount: display5: config: Enable boot count feature in the display5 board 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" The boot count is enabled in both SPL and proper u-boot. Signed-off-by: Lukasz Majewski Reviewed-by: Stefan Roese --- Changes in v2: - None configs/display5_defconfig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/configs/display5_defconfig b/configs/display5_defconfig index 4d67700f4d..893794804c 100644 --- a/configs/display5_defconfig +++ b/configs/display5_defconfig @@ -16,6 +16,7 @@ CONFIG_OF_BOARD_SETUP=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg,MX6Q" CONFIG_SUPPORT_RAW_INITRD=y CONFIG_SPL=y +CONFIG_SPL_BOOTCOUNT_LIMIT=y # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set CONFIG_SPL_DMA_SUPPORT=y CONFIG_SPL_ENV_SUPPORT=y @@ -51,6 +52,9 @@ CONFIG_EFI_PARTITION=y # CONFIG_SPL_EFI_PARTITION is not set CONFIG_OF_CONTROL=y CONFIG_ENV_IS_IN_SPI_FLASH=y +CONFIG_BOOTCOUNT_LIMIT=y +CONFIG_SYS_BOOTCOUNT_SINGLEWORD=y +CONFIG_SYS_BOOTCOUNT_ADDR=0x020CC068 CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_BAR=y CONFIG_SPI_FLASH_SPANSION=y