From patchwork Fri Apr 17 15:38:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Johnson X-Patchwork-Id: 1272291 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=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=lixil.net Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 493gJD5FVmz9s71 for ; Sat, 18 Apr 2020 01:39:40 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0DCB881CA5; Fri, 17 Apr 2020 17:38:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=lixil.net Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 3914981CA6; Fri, 17 Apr 2020 17:38:24 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from crane.lixil.net (crane.lixil.net [71.19.154.81]) by phobos.denx.de (Postfix) with ESMTP id 816CF81A30 for ; Fri, 17 Apr 2020 17:38:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=lixil.net Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mrjoel@lixil.net Received: from dark.lixil.net (unknown [IPv6:2601:8c3:4200:423:22a:268e:22c9:cc81]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mrjoel@lixil.net) by crane.lixil.net (Postfix) with ESMTPSA id 780B4351009; Fri, 17 Apr 2020 09:38:14 -0600 (MDT) From: Joel Johnson To: Stefan Roese Cc: Baruch Siach , Josua Mayer , Joel Johnson , Joe Hershberger , Simon Glass , u-boot@lists.denx.de Subject: [PATCH v6 1/5] cmd: mvebu: bubt: add A38x support Date: Fri, 17 Apr 2020 09:38:04 -0600 Message-Id: <20200417153808.2468508-1-mrjoel@lixil.net> X-Mailer: git-send-email 2.26.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean Add support for Armada 38x devices in bubt flashing utility. This is based on (and streamlined from) the support in the SolidRun master-a38x vendor fork. Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v2 changes - none v3 changes - none v4 changes - none v5 changes - none v6 changes - none --- cmd/mvebu/bubt.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index 2041a7a29a..d399fb6da4 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -85,7 +85,29 @@ struct mvebu_image_info { u32 encrypt_start_offset; u32 encrypt_size; }; -#endif /* CONFIG_ARMADA_XXX */ +#elif defined(CONFIG_ARMADA_38X) /* A38X */ + +/* Structure of the main header, version 1 (Armada 370/38x/XP) */ +struct a38x_main_hdr_v1 { + u8 blockid; /* 0x0 */ + u8 flags; /* 0x1 */ + u16 reserved2; /* 0x2-0x3 */ + u32 blocksize; /* 0x4-0x7 */ + u8 version; /* 0x8 */ + u8 headersz_msb; /* 0x9 */ + u16 headersz_lsb; /* 0xA-0xB */ + u32 srcaddr; /* 0xC-0xF */ + u32 destaddr; /* 0x10-0x13 */ + u32 execaddr; /* 0x14-0x17 */ + u8 options; /* 0x18 */ + u8 nandblocksize; /* 0x19 */ + u8 nandbadblklocation; /* 0x1A */ + u8 reserved4; /* 0x1B */ + u16 reserved5; /* 0x1C-0x1D */ + u8 ext; /* 0x1E */ + u8 checksum; /* 0x1F */ +}; +#endif struct bubt_dev { char name[8]; @@ -621,7 +643,52 @@ static int check_image_header(void) return 0; } +#elif defined(CONFIG_ARMADA_38X) +static size_t a38x_header_size(const struct a38x_main_hdr_v1 *h) +{ + if (h->version == 1) + return (h->headersz_msb << 16) | le16_to_cpu(h->headersz_lsb); + + printf("Error: Invalid A38x image (header version 0x%x unknown)!\n", + h->version); + return 0; +} + +static uint8_t image_checksum8(const void *start, size_t len) +{ + u8 csum = 0; + const u8 *p = start; + + while (len) { + csum += *p; + ++p; + --len; + } + + return csum; +} +static int check_image_header(void) +{ + u8 checksum; + const struct a38x_main_hdr_v1 *hdr = + (struct a38x_main_hdr_v1 *)get_load_addr(); + const size_t image_size = a38x_header_size(hdr); + + if (!image_size) + return -ENOEXEC; + + checksum = image_checksum8(hdr, image_size); + checksum -= hdr->checksum; + if (checksum != hdr->checksum) { + printf("Error: Bad A38x image checksum. 0x%x != 0x%x\n", + checksum, hdr->checksum); + return -ENOEXEC; + } + + printf("Image checksum...OK!\n"); + return 0; +} #else /* Not ARMADA? */ static int check_image_header(void) { From patchwork Fri Apr 17 15:38:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Johnson X-Patchwork-Id: 1272292 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=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=lixil.net Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 493gJY67RHz9sSM for ; Sat, 18 Apr 2020 01:39:57 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 11C4D81CAE; Fri, 17 Apr 2020 17:39:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=lixil.net Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 65D5881CA0; Fri, 17 Apr 2020 17:38:25 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from crane.lixil.net (crane.lixil.net [71.19.154.81]) by phobos.denx.de (Postfix) with ESMTP id B0DE881CA5 for ; Fri, 17 Apr 2020 17:38:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=lixil.net Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mrjoel@lixil.net Received: from dark.lixil.net (unknown [IPv6:2601:8c3:4200:423:22a:268e:22c9:cc81]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mrjoel@lixil.net) by crane.lixil.net (Postfix) with ESMTPSA id 138D135100E; Fri, 17 Apr 2020 09:38:15 -0600 (MDT) From: Joel Johnson To: Stefan Roese Cc: Baruch Siach , Josua Mayer , Joel Johnson , Joe Hershberger , Simon Glass , u-boot@lists.denx.de Subject: [PATCH v6 2/5] cmd: mvebu: bubt: correct U-Boot spelling Date: Fri, 17 Apr 2020 09:38:05 -0600 Message-Id: <20200417153808.2468508-2-mrjoel@lixil.net> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200417153808.2468508-1-mrjoel@lixil.net> References: <20200417153808.2468508-1-mrjoel@lixil.net> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean Replace "U-BOOT" text with correct spelling Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v2 changes: - none v3 changes: - none v4 changes: - none v5 changes: - none v6 changes: - none --- cmd/mvebu/bubt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index d399fb6da4..b80b81c82a 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -346,7 +346,7 @@ static int nand_burn_image(size_t image_size) /* Align U-Boot size to currently used blocksize */ image_size = ((image_size + (block_size - 1)) & (~(block_size - 1))); - /* Erase the U-BOOT image space */ + /* Erase the U-Boot image space */ printf("Erasing 0x%x - 0x%x:...", 0, (int)image_size); ret = nand_erase(mtd, 0, image_size); if (ret) { @@ -734,7 +734,7 @@ static int bubt_read_file(struct bubt_dev *src) static int bubt_is_dev_active(struct bubt_dev *dev) { if (!dev->active) { - printf("Device \"%s\" not supported by U-BOOT image\n", + printf("Device \"%s\" not supported by U-Boot image\n", dev->name); return 0; } @@ -822,7 +822,7 @@ int do_bubt_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (!bubt_is_dev_active(src)) return -ENODEV; - printf("Burning U-BOOT image \"%s\" from \"%s\" to \"%s\"\n", + printf("Burning U-Boot image \"%s\" from \"%s\" to \"%s\"\n", net_boot_file_name, src->name, dst->name); image_size = bubt_read_file(src); From patchwork Fri Apr 17 15:38:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Johnson X-Patchwork-Id: 1272295 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=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=lixil.net Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 493gKG4tP4z9s71 for ; Sat, 18 Apr 2020 01:40:34 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7856981CB6; Fri, 17 Apr 2020 17:39:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=lixil.net Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 5F75881CA4; Fri, 17 Apr 2020 17:39:10 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from crane.lixil.net (crane.lixil.net [IPv6:2605:2700:1:1045:0:6c:6978:696c]) by phobos.denx.de (Postfix) with ESMTP id 9606081C94 for ; Fri, 17 Apr 2020 17:38:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=lixil.net Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mrjoel@lixil.net Received: from dark.lixil.net (unknown [IPv6:2601:8c3:4200:423:22a:268e:22c9:cc81]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mrjoel@lixil.net) by crane.lixil.net (Postfix) with ESMTPSA id A0751351011; Fri, 17 Apr 2020 09:38:15 -0600 (MDT) From: Joel Johnson To: Stefan Roese Cc: Baruch Siach , Josua Mayer , Joel Johnson , Joe Hershberger , Simon Glass , u-boot@lists.denx.de Subject: [PATCH v6 3/5] cmd: mvebu: bubt: verify A38x target device type Date: Fri, 17 Apr 2020 09:38:06 -0600 Message-Id: <20200417153808.2468508-3-mrjoel@lixil.net> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200417153808.2468508-1-mrjoel@lixil.net> References: <20200417153808.2468508-1-mrjoel@lixil.net> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean Ensure that the device to which an image is being written includes header information indicating boot support for the destination device. This is derived from the support in the SolidRun master-a38x vendor fork. Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v2 changes: - none v3 changes: - use ARRAY_SIZE instead of #define size v4 changes: - none v5 changes: - use if(IS_ENABLED()) for inline check instead of ifdef v6 changes: - reduce #ifdef usages at the tradeoff of otherwise unneccessarily exposing A38x internal structs to more than A38x builds. - since state is exposed anyway, rename a38x_check_boot_mode to bubt_check_boot_mode with provision for per-target customization This fixes building across all mvebu targets. Exposing the needed a38x_* structs isn't something I'm hugely excited about, but it does get the build working and avoids inline #ifdefs as requested. In cases where the target being built (all but A38x) doesn't support checking the boot mode, rely on the compiler to [mostly] optimize the function usage away. Local tests show an increase of only 4 bytes of rodata in such cases. --- cmd/mvebu/bubt.c | 52 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index b80b81c82a..be6c5869a9 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -85,7 +85,7 @@ struct mvebu_image_info { u32 encrypt_start_offset; u32 encrypt_size; }; -#elif defined(CONFIG_ARMADA_38X) /* A38X */ +#endif /* Structure of the main header, version 1 (Armada 370/38x/XP) */ struct a38x_main_hdr_v1 { @@ -107,7 +107,23 @@ struct a38x_main_hdr_v1 { u8 ext; /* 0x1E */ u8 checksum; /* 0x1F */ }; -#endif + +struct a38x_boot_mode { + unsigned int id; + const char *name; +}; + +/* The blockid header field values used to indicate boot device of image */ +struct a38x_boot_mode a38x_boot_modes[] = { + { 0x4D, "i2c" }, + { 0x5A, "spi" }, + { 0x69, "uart" }, + { 0x78, "sata" }, + { 0x8B, "nand" }, + { 0x9C, "pex" }, + { 0xAE, "mmc" }, + {}, +}; struct bubt_dev { char name[8]; @@ -697,7 +713,29 @@ static int check_image_header(void) } #endif -static int bubt_verify(size_t image_size) +static int bubt_check_boot_mode(const struct bubt_dev *dst) +{ + if (IS_ENABLED(CONFIG_ARMADA_38X)) { + int mode; + const struct a38x_main_hdr_v1 *hdr = + (struct a38x_main_hdr_v1 *)get_load_addr(); + + for (mode = 0; mode < ARRAY_SIZE(a38x_boot_modes); mode++) { + if (strcmp(a38x_boot_modes[mode].name, dst->name) == 0) + break; + } + + if (a38x_boot_modes[mode].id == hdr->blockid) + return 0; + + puts("Error: A38x image not built for destination device!\n"); + return -ENOEXEC; + } else { + return 0; + } +} + +static int bubt_verify(const struct bubt_dev *dst) { int err; @@ -708,6 +746,12 @@ static int bubt_verify(size_t image_size) return err; } + err = bubt_check_boot_mode(dst); + if (err) { + printf("Error: Image boot mode verification failed\n"); + return err; + } + return 0; } @@ -829,7 +873,7 @@ int do_bubt_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (!image_size) return -EIO; - err = bubt_verify(image_size); + err = bubt_verify(dst); if (err) return err; From patchwork Fri Apr 17 15:38:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Johnson X-Patchwork-Id: 1272293 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=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=lixil.net Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 493gJv41z0z9s71 for ; Sat, 18 Apr 2020 01:40:15 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6028981CAA; Fri, 17 Apr 2020 17:39:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=lixil.net Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 4C34E81CA7; Fri, 17 Apr 2020 17:39:10 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from crane.lixil.net (crane.lixil.net [IPv6:2605:2700:1:1045:0:6c:6978:696c]) by phobos.denx.de (Postfix) with ESMTP id 4E2A981CA1 for ; Fri, 17 Apr 2020 17:38:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=lixil.net Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mrjoel@lixil.net Received: from dark.lixil.net (unknown [IPv6:2601:8c3:4200:423:22a:268e:22c9:cc81]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mrjoel@lixil.net) by crane.lixil.net (Postfix) with ESMTPSA id 37330351016; Fri, 17 Apr 2020 09:38:16 -0600 (MDT) From: Joel Johnson To: Stefan Roese Cc: Baruch Siach , Josua Mayer , Joel Johnson , Tom Rini , u-boot@lists.denx.de Subject: [PATCH v6 4/5] arm: mvebu: clearfog: enable bubt command Date: Fri, 17 Apr 2020 09:38:07 -0600 Message-Id: <20200417153808.2468508-4-mrjoel@lixil.net> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200417153808.2468508-1-mrjoel@lixil.net> References: <20200417153808.2468508-1-mrjoel@lixil.net> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean With support added for Armada 38x, include the bubt command in ClearFog defconfig. Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v2 changes: - none v3 changes: - none v4 changes: - none v5 changes: - none v6 changes: - none --- configs/clearfog_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/clearfog_defconfig b/configs/clearfog_defconfig index 6db8b8acf6..0f2ae1ccec 100644 --- a/configs/clearfog_defconfig +++ b/configs/clearfog_defconfig @@ -33,6 +33,7 @@ CONFIG_SPL_CMD_TLV_EEPROM=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y +CONFIG_CMD_MVEBU_BUBT=y CONFIG_CMD_PCI=y CONFIG_CMD_SPI=y CONFIG_CMD_USB=y From patchwork Fri Apr 17 15:38:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Johnson X-Patchwork-Id: 1272294 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=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=lixil.net Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 493gK51FzVz9s71 for ; Sat, 18 Apr 2020 01:40:25 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1BFD181CAC; Fri, 17 Apr 2020 17:39:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=lixil.net Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id C8D0781CA0; Fri, 17 Apr 2020 17:38:42 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from crane.lixil.net (crane.lixil.net [71.19.154.81]) by phobos.denx.de (Postfix) with ESMTP id 1E0E081C9B for ; Fri, 17 Apr 2020 17:38:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=lixil.net Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mrjoel@lixil.net Received: from dark.lixil.net (unknown [IPv6:2601:8c3:4200:423:22a:268e:22c9:cc81]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mrjoel@lixil.net) by crane.lixil.net (Postfix) with ESMTPSA id B9FD635101E; Fri, 17 Apr 2020 09:38:16 -0600 (MDT) From: Joel Johnson To: Stefan Roese Cc: Baruch Siach , Josua Mayer , Joel Johnson , Joe Hershberger , Simon Glass , u-boot@lists.denx.de Subject: [PATCH v6 5/5] cmd: mvebu: bubt: show image boot device Date: Fri, 17 Apr 2020 09:38:08 -0600 Message-Id: <20200417153808.2468508-5-mrjoel@lixil.net> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200417153808.2468508-1-mrjoel@lixil.net> References: <20200417153808.2468508-1-mrjoel@lixil.net> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean When a mismatch is found trying to write an image for one boot method to a different boot device, print an error message including the image header marked target boot device type. Signed-off-by: Joel Johnson Reviewed-by: Stefan Roese --- v2 changes: - newly added in v2 series v3 changes: - none v4 changes: - adjust to ARRAY_SIZE usage v5 changes: - remove double space (one each line) in error message v6 changes: - rebased on different location/naming from patch 3 of the bubt_check_boot_mode function --- cmd/mvebu/bubt.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index be6c5869a9..dc0ce01c35 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -728,7 +728,17 @@ static int bubt_check_boot_mode(const struct bubt_dev *dst) if (a38x_boot_modes[mode].id == hdr->blockid) return 0; - puts("Error: A38x image not built for destination device!\n"); + for (int i = 0; i < ARRAY_SIZE(a38x_boot_modes); i++) { + if (a38x_boot_modes[i].id == hdr->blockid) { + printf("Error: A38x image meant to be " + "booted from \"%s\", not \"%s\"!\n", + a38x_boot_modes[i].name, dst->name); + return -ENOEXEC; + } + } + + printf("Error: unknown boot device in A38x image header: " + "0x%x\n", hdr->blockid); return -ENOEXEC; } else { return 0;