From patchwork Tue Jan 25 17:13:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 1584189 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=cGiK7Kd4; dkim-atps=neutral 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=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Jjtjp5MtGz9tB1 for ; Wed, 26 Jan 2022 04:13:50 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 062D083881; Tue, 25 Jan 2022 18:13:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="cGiK7Kd4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 410EF83019; Tue, 25 Jan 2022 18:13:26 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A873283102 for ; Tue, 25 Jan 2022 18:13:21 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 729D261307; Tue, 25 Jan 2022 17:13:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB67FC340E7; Tue, 25 Jan 2022 17:13:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643130799; bh=QdeBXDKws0tskC1J+PX3ClkC6vh5X76RyLS5hNEeypg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cGiK7Kd4ykRiZqgkH2N1tDYbVqkERPfMB+qnXOzP6Lk7Y/nDLJFmSkN702l2kdlLM di8JCj7MYlX8mYbdemdnMLjGMfPveMo06cvvl4gwHKvWWLgKJD1gTEHX+8N0SRxv+0 yiOHC+qbD2F1cbMIBCT7SVssW+QD7AaQwtaQXf7YxVpuQTV9ThKx7UqHet3fTFTmvG oocYSZ8maD0NZU0HLunU74CUaSofhAWr0leMecmATu/DbB/970ueuYxkr9297GF0Bq wnvSnJe/WJKxL5brsFG3ZQQb43Yz1YD+ZuGfUJ6q9SzUHqHBJJqmU0d2Lw08cSypF7 SG3Pn5zYo+NEg== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Stefan Roese Cc: u-boot@lists.denx.de, pali@kernel.org, =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH u-boot-marvell 01/14] tools: kwboot: Increase blk_rsp_timeo to 2s Date: Tue, 25 Jan 2022 18:13:00 +0100 Message-Id: <20220125171313.14498-2-kabel@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220125171313.14498-1-kabel@kernel.org> References: <20220125171313.14498-1-kabel@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.5 at phobos.denx.de X-Virus-Status: Clean From: Pali Rohár Fix xmodem retry mechanism if some bytes from xmodem packet were lost and BootROM is still waiting for completing previous xmodem packet. It is required to wait at least 1.312s on A385, otherwise BootROM does not accept next xmodem packet if previous one was not completely transferred. 2s should be enough timeout cause that BootROM will drop incomplete xmodem packet and expects new packet. Signed-off-by: Pali Rohár Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- tools/kwboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/kwboot.c b/tools/kwboot.c index c3d8ab6544..82cfd9a827 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c @@ -75,7 +75,7 @@ struct kwboot_block { uint8_t csum; } __packed; -#define KWBOOT_BLK_RSP_TIMEO 1000 /* ms */ +#define KWBOOT_BLK_RSP_TIMEO 2000 /* ms */ #define KWBOOT_HDR_RSP_TIMEO 10000 /* ms */ /* ARM code to change baudrate */ From patchwork Tue Jan 25 17:13:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 1584188 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=N+JQUcKq; dkim-atps=neutral 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=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Jjtjb5TXdz9t6g for ; Wed, 26 Jan 2022 04:13:39 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8839A8386D; Tue, 25 Jan 2022 18:13:31 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="N+JQUcKq"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F013883834; Tue, 25 Jan 2022 18:13:25 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0AD2783809 for ; Tue, 25 Jan 2022 18:13:23 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DCE0F60F9A; Tue, 25 Jan 2022 17:13:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51E00C340E0; Tue, 25 Jan 2022 17:13:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643130801; bh=El/f52FMBFJjVAr5vKIbvTKzvmtJ4Y+kL8p/jpMH8zk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N+JQUcKqPJ/dCPvQDXGEE5Kydd8Zoaa63K14KKGFkh57GaJxIV1lxrRtQv4H5tXQF icHnyBs/Ct/PJnjBd1QqK5WoB0YE75UXJrIQrf6ZiZPPmfyxYjDEZrz3Iz3mosXoXI 1xbMrNX2/JmADVjFg6Up2KbrPmFjiSLDJ6NMHdnwMOcxdZjo69hGDH1Z9WaWO4E/xd j7Tj3av6F7Q5sDWLyl4PFCyWySPqMigY+5DYfNcHoHg84kz6+9SeSXRw+4CF6woO9/ fNcGzipQAIAynnxH9QvN3mXinAMeONbkPs0GAtmZIGAEDGc4/R49+KSs3XsX2X5qq0 lawXFWkCrZm2w== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Stefan Roese Cc: u-boot@lists.denx.de, pali@kernel.org, =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH u-boot-marvell 02/14] tools: kwboot: Wait blk_rsp_timeo when flushing Date: Tue, 25 Jan 2022 18:13:01 +0100 Message-Id: <20220125171313.14498-3-kabel@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220125171313.14498-1-kabel@kernel.org> References: <20220125171313.14498-1-kabel@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.5 at phobos.denx.de X-Virus-Status: Clean From: Pali Rohár Use the blk_rsp_timeo variable when sleeping before flushing tty. Signed-off-by: Pali Rohár Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- tools/kwboot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/kwboot.c b/tools/kwboot.c index 82cfd9a827..1477c0f078 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c @@ -1081,8 +1081,8 @@ kwboot_xmodem(int tty, const void *_img, size_t size, int baudrate) */ hdrsz += (KWBOOT_XM_BLKSZ - hdrsz % KWBOOT_XM_BLKSZ) % KWBOOT_XM_BLKSZ; - kwboot_printv("Waiting 2s and flushing tty\n"); - sleep(2); /* flush isn't effective without it */ + kwboot_printv("Waiting %d ms and flushing tty\n", blk_rsp_timeo); + usleep(blk_rsp_timeo * 1000); tcflush(tty, TCIOFLUSH); pnum = 1; From patchwork Tue Jan 25 17:13:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 1584190 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=sh9nHsdA; dkim-atps=neutral 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=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Jjtjz4MD9z9t6g for ; Wed, 26 Jan 2022 04:13:59 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DCDF983806; Tue, 25 Jan 2022 18:13:36 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="sh9nHsdA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DB3D383809; Tue, 25 Jan 2022 18:13:29 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4D66583680 for ; Tue, 25 Jan 2022 18:13:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4BAB76130B; Tue, 25 Jan 2022 17:13:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9D1AC340EC; Tue, 25 Jan 2022 17:13:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643130802; bh=EXLWekh1eLLBLB1GvoKTANlFhKQZRFHJZMOSaG7ZQpA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sh9nHsdA51h6EZMEHvEXOMApVgQ7LPTBLwLEbqplhfEq0UkfgrPAcrrPVUYxCKIVM MOuVMpX7OAC9oItyIaMNYkGRuNLD4GE1DKUimk72VLOO2M22hyH361S/rnhOV/AO/V rmjx4xS6RE3MPHPCqgn7IzoJfk9sH4kkspb2CLYUggS5JcoLCC+WtHiFctaoFL8K6S I+XAx33OFUP7mgUM8EAgIyAehTTlpikHgJn3UMganr24du8Lp0KMwd+qqEKbCxdamA NfBpVP4b+PUrfNBX+fZzaAp1/2C9J44no935ne6qfqnU7h6cKK8OH3MVtQbdHheUm8 /APOQ8IB/AU2w== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Stefan Roese Cc: u-boot@lists.denx.de, pali@kernel.org, =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH u-boot-marvell 03/14] tools: kwboot: Improve retrying logic for incomplete xmodem packets Date: Tue, 25 Jan 2022 18:13:02 +0100 Message-Id: <20220125171313.14498-4-kabel@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220125171313.14498-1-kabel@kernel.org> References: <20220125171313.14498-1-kabel@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.5 at phobos.denx.de X-Virus-Status: Clean From: Pali Rohár Sometimes if the first byte of xmodem packet (SOH) is incorrectly transmitted, BootROM sends NAK for every non-SOH received byte, which makes BootROM and the host kwboot tool out of sync. BootROM automatically re-synchronizes after 2s pause by dropping its input queue. So when attempting retransmit for 9th time or later, ignore NAK reply from BootROM and either wait for valid ACK or let kwboot timeout, which implies re-synchronization. This fixes retransmission of xmodem packets and allows kwboot to work also without "Waiting ... and flushing tty" code which is at the beginning of kwboot xmodem transfer. Signed-off-by: Pali Rohár Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- tools/kwboot.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/kwboot.c b/tools/kwboot.c index 1477c0f078..be9a751406 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c @@ -880,6 +880,7 @@ kwboot_baud_magic_handle(int fd, char c, int baudrate) static int kwboot_xm_recv_reply(int fd, char *c, int nak_on_non_xm, + int ignore_nak_reply, int allow_non_xm, int *non_xm_print, int baudrate, int *baud_changed) { @@ -899,8 +900,14 @@ kwboot_xm_recv_reply(int fd, char *c, int nak_on_non_xm, } /* If received xmodem reply, end. */ - if (_is_xm_reply(*c)) + if (_is_xm_reply(*c)) { + if (*c == NAK && ignore_nak_reply) { + timeout = recv_until - _now(); + if (timeout >= 0) + continue; + } break; + } /* * If receiving/printing non-xmodem text output is allowed and @@ -968,6 +975,7 @@ kwboot_xm_sendblock(int fd, struct kwboot_block *block, int allow_non_xm, } rc = kwboot_xm_recv_reply(fd, &c, retries < 3, + retries > 8, allow_non_xm, &non_xm_print, baudrate, &baud_changed); if (rc) @@ -1011,6 +1019,7 @@ kwboot_xm_finish(int fd) return rc; rc = kwboot_xm_recv_reply(fd, &c, retries < 3, + retries > 8, 0, NULL, 0, NULL); if (rc) return rc; From patchwork Tue Jan 25 17:13:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 1584191 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=u5xM5hC8; dkim-atps=neutral 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=) 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)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JjtkB66SLz9t6g for ; Wed, 26 Jan 2022 04:14:10 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AB95D83877; Tue, 25 Jan 2022 18:13:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="u5xM5hC8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0212A837E7; Tue, 25 Jan 2022 18:13:30 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 608A48382C for ; Tue, 25 Jan 2022 18:13:25 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 557AB6130A; Tue, 25 Jan 2022 17:13:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D8B1C340E6; Tue, 25 Jan 2022 17:13:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643130804; bh=ODmoFZzx4kI+QWtJ/Hah8Y9n5qB9AJCWRwmBKC6Oc6Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u5xM5hC8+v7HFUzgbW5efsaloLdQK8CHxxvtE4Cw7tu9BFs0yZTPFhcN+YFFWZVg2 z6cVEVH5ge/V1evdX3Ga6W8Ibv7g9jG6elaVowrqmdIae4iaSWSUDvSWwQHFIpQQ23 lK5MdaSMqYvj+OHxGC86BrUNAc6WCRFxnFEVZf5yzam3j9EPV/54A5E0XQKqAwgsst Xfe9X6CA6mOATkSuQJ94S+pqbxlnQjtmZ9k3OqD6Jg5GZYFjxy4Nv2wJiBWClKSLZ2 ODigyNghRGIlR5XuIVIgE7kbcQyb9YREQnVObzm9oTNzV/YpEpXbhGuXUqc82bt4RH 0J5Ewq3Lr9XJg== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Stefan Roese Cc: u-boot@lists.denx.de, pali@kernel.org, =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH u-boot-marvell 04/14] tools: kwboot: Remove code for handling CAN byte Date: Tue, 25 Jan 2022 18:13:03 +0100 Message-Id: <20220125171313.14498-5-kabel@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220125171313.14498-1-kabel@kernel.org> References: <20220125171313.14498-1-kabel@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.5 at phobos.denx.de X-Virus-Status: Clean From: Pali Rohár It is unknown why handling of CAN byte was added into kwboot tool as Marvell BootROM does not support CAN byte. It never sends CAN byte to host and if host sends CAN byte BootROM handles it as an unknown byte. Remove code for handling and sending CAN bytes from the kwboot tool. Signed-off-by: Pali Rohár Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- tools/kwboot.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/tools/kwboot.c b/tools/kwboot.c index be9a751406..0b97990d09 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c @@ -63,7 +63,6 @@ static unsigned char kwboot_msg_debug[] = { #define EOT 4 /* sender end of block transfer */ #define ACK 6 /* target block ack */ #define NAK 21 /* target block negative ack */ -#define CAN 24 /* target/sender transfer cancellation */ #define KWBOOT_XM_BLKSZ 128 /* xmodem block size */ @@ -826,7 +825,7 @@ _now(void) static int _is_xm_reply(char c) { - return c == ACK || c == NAK || c == CAN; + return c == ACK || c == NAK; } static int @@ -841,9 +840,6 @@ _xm_reply_to_error(int c) case NAK: errno = EBADMSG; break; - case CAN: - errno = ECANCELED; - break; default: errno = EPROTO; break; @@ -966,7 +962,7 @@ kwboot_xm_sendblock(int fd, struct kwboot_block *block, int allow_non_xm, do { rc = kwboot_tty_send(fd, block, sizeof(*block), 1); if (rc) - return rc; + goto err; if (allow_non_xm && !*done_print) { kwboot_progress(100, '.'); @@ -979,7 +975,7 @@ kwboot_xm_sendblock(int fd, struct kwboot_block *block, int allow_non_xm, allow_non_xm, &non_xm_print, baudrate, &baud_changed); if (rc) - goto can; + goto err; if (!allow_non_xm && c != ACK) kwboot_progress(-1, '+'); @@ -990,15 +986,13 @@ kwboot_xm_sendblock(int fd, struct kwboot_block *block, int allow_non_xm, if (allow_non_xm && baudrate && !baud_changed) { fprintf(stderr, "Baudrate was not changed\n"); - rc = -1; errno = EPROTO; - goto can; + return -1; } return _xm_reply_to_error(c); -can: +err: err = errno; - kwboot_tty_send_char(fd, CAN); kwboot_printv("\n"); errno = err; return rc; From patchwork Tue Jan 25 17:13:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 1584193 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=SC1Wjdqf; dkim-atps=neutral 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=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4JjtkQ2YGbz9t6g for ; Wed, 26 Jan 2022 04:14:22 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 80B36837E7; Tue, 25 Jan 2022 18:13:52 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="SC1Wjdqf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B968383874; Tue, 25 Jan 2022 18:13:32 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 41EB283019 for ; Tue, 25 Jan 2022 18:13:27 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 27D166124C; Tue, 25 Jan 2022 17:13:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9551CC340E0; Tue, 25 Jan 2022 17:13:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643130805; bh=X9QfoCu0O4G7ie/d3B4WEx27zTjh0Tn9DcCGsF9QWjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SC1Wjdqfdvec1Z3uRe4lk6DPBE40vwPu0OqNRVBKMsCBZi2UuN9J/frz8f469yPba la9LL8FFh11l0rPxHEfcxtJWaVsD+3ZyxA5UbPlvy4mr+fMwU/H88olnIoexSuxkIn gAbMs+Sl8VbCnSVPOCtdXoDhfqRxOihydxynAMjXMTf6Yi/6PN7uHsJzaWzvbRzKxr Yuh/A55xPIaS00ccms+WfTYX0r7AWGINi00VNPdg3FuFMr6hA6X4PALefICjkI928o OBc2uCeJTGUAa+zu5GN02TbpEC0JghIbrBGs2dXzGrs5ajckavDSsdo1n4nGJ6CuO+ 85JNQ0dcJ/EOA== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Stefan Roese Cc: u-boot@lists.denx.de, pali@kernel.org, =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH u-boot-marvell 05/14] tools: kwboot: Do not change received character in kwboot_xm_recv_reply() Date: Tue, 25 Jan 2022 18:13:04 +0100 Message-Id: <20220125171313.14498-6-kabel@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220125171313.14498-1-kabel@kernel.org> References: <20220125171313.14498-1-kabel@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.5 at phobos.denx.de X-Virus-Status: Clean From: Pali Rohár Marvell BootROM expects retransmission of previous xmodem packet only in the case when it sends NAK response to the host. Do not change non-xmodem response (possibly UART transfer error) to NAK in kwboot_xm_recv_reply() function. Allow caller to receive original response from device. Change argument 'nak_on_non_xm' to 'stop_on_non_xm'. Instead of changing non-xmodem character to NAK, stop processing on invalid character and return it. Signed-off-by: Pali Rohár Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- tools/kwboot.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/kwboot.c b/tools/kwboot.c index 0b97990d09..a619a6c3c1 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c @@ -875,7 +875,7 @@ kwboot_baud_magic_handle(int fd, char c, int baudrate) } static int -kwboot_xm_recv_reply(int fd, char *c, int nak_on_non_xm, +kwboot_xm_recv_reply(int fd, char *c, int stop_on_non_xm, int ignore_nak_reply, int allow_non_xm, int *non_xm_print, int baudrate, int *baud_changed) @@ -931,10 +931,8 @@ kwboot_xm_recv_reply(int fd, char *c, int nak_on_non_xm, *non_xm_print = 1; } } else { - if (nak_on_non_xm) { - *c = NAK; + if (stop_on_non_xm) break; - } timeout = recv_until - _now(); if (timeout < 0) { errno = ETIMEDOUT; From patchwork Tue Jan 25 17:13:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 1584195 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=ARkCtiW4; dkim-atps=neutral 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=) 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)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Jjtkc2HJ0z9t6g for ; Wed, 26 Jan 2022 04:14:32 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 35D188384C; Tue, 25 Jan 2022 18:13:55 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="ARkCtiW4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A191383373; Tue, 25 Jan 2022 18:13:34 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A27CD830D0 for ; Tue, 25 Jan 2022 18:13:28 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 970DB60F9A; Tue, 25 Jan 2022 17:13:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09236C340E7; Tue, 25 Jan 2022 17:13:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643130807; bh=6fLTfW/cCqAZujZQOzYt07ZTgMaJYTyI4Ls0UKg6mG4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ARkCtiW40bndFzRRqbA41JpGK5TdF+U3X4fx8lyOfmykqMOZeOKeJAXmPuxWJjgEl BJ6jLWDCkBqwXOYuBJAnFAFlRIiHn0Uz1cHHPqN3MmrhMwOVoLaj8DwxMe8VhI15kf H+3iY+PukFvA9r/RaMJ3KVeAM53+DkH3oYLmspe9SSCOPgBEG5w57rGNxBLqIf6aN6 PQdXmN8zENePglQNiLTDLQ37OrBrtR2BfHlC2P8PQbwqTEAr1PFnJ6v+N1RejKzhGy zhDw2rgvOVu8PTe3NWI+hM2F+o08u4lib3FXfZhqEexzXYU3G+hcFbVs4daY8p+ACH EpItzEBFbsFQQ== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Stefan Roese Cc: u-boot@lists.denx.de, pali@kernel.org, =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH u-boot-marvell 06/14] tools: kwboot: Fix handling of repeated xmodem packets Date: Tue, 25 Jan 2022 18:13:05 +0100 Message-Id: <20220125171313.14498-7-kabel@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220125171313.14498-1-kabel@kernel.org> References: <20220125171313.14498-1-kabel@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.5 at phobos.denx.de X-Virus-Status: Clean From: Pali Rohár Unfortunately during some stages of xmodem transfer, A385 BootROM is not able to handle repeated xmodem packets. So if an error occurs during that stage, stop the transfer and return failure. Signed-off-by: Pali Rohár Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- tools/kwboot.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/tools/kwboot.c b/tools/kwboot.c index a619a6c3c1..dfac8aed7b 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c @@ -946,7 +946,7 @@ kwboot_xm_recv_reply(int fd, char *c, int stop_on_non_xm, static int kwboot_xm_sendblock(int fd, struct kwboot_block *block, int allow_non_xm, - int *done_print, int baudrate) + int *done_print, int baudrate, int allow_retries) { int non_xm_print, baud_changed; int rc, err, retries; @@ -977,7 +977,7 @@ kwboot_xm_sendblock(int fd, struct kwboot_block *block, int allow_non_xm, if (!allow_non_xm && c != ACK) kwboot_progress(-1, '+'); - } while (c == NAK && retries++ < 16); + } while (c == NAK && allow_retries && retries++ < 16); if (non_xm_print) kwboot_printv("\n"); @@ -1044,8 +1044,30 @@ kwboot_xmodem_one(int tty, int *pnum, int header, const uint8_t *data, last_block = (left <= blksz); + /* + * Handling of repeated xmodem packets is completely broken in + * Armada 385 BootROM - it completely ignores xmodem packet + * numbers, they are only used for checksum verification. + * BootROM can handle a retry of the xmodem packet only during + * the transmission of kwbimage header and only if BootROM + * itself sent NAK response to previous attempt (it does it on + * checksum failure). During the transmission of kwbimage data + * part, BootROM always expects next xmodem packet, even if it + * sent NAK to previous attempt - there is absolutely no way to + * repair incorrectly transmitted xmodem packet during kwbimage + * data part upload. Also, if kwboot receives non-ACK/NAK + * response (meaning that original BootROM response was damaged + * on UART) there is no way to detect if BootROM accepted xmodem + * packet or not and no way to check if kwboot could repeat the + * packet or not. + * + * Stop transfer and return failure if kwboot receives unknown + * reply if non-xmodem reply is not allowed (for all xmodem + * packets except the last header packet) or when non-ACK reply + * is received during data part transfer. + */ rc = kwboot_xm_sendblock(tty, &block, header && last_block, - &done_print, baudrate); + &done_print, baudrate, header); if (rc) goto out; From patchwork Tue Jan 25 17:13:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 1584196 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=Qb6jh7Ev; dkim-atps=neutral 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=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Jjtkp2k5Wz9t5H for ; Wed, 26 Jan 2022 04:14:42 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9E0C88387A; Tue, 25 Jan 2022 18:13:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="Qb6jh7Ev"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2684283874; Tue, 25 Jan 2022 18:13:35 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 21D2A83868 for ; Tue, 25 Jan 2022 18:13:30 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AD4D8B819A7; Tue, 25 Jan 2022 17:13:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 715C6C340E6; Tue, 25 Jan 2022 17:13:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643130808; bh=VMChcO88A/nheje1NE5z6VlS27/OwqFf65MlS5SQbaU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qb6jh7Eva2U2KWfQQRhmpVGJPPbrIcNjXvHqmBZLkzHVvBZLxoKQX9wCAXFXACZu1 XIZiDee0Tc0cMTrCEDBbbSuCgGrpIzwZrlDzhf+rtaZhlKm3j6h+cAuxtfzt65vNqz 7TLEzXjm097I7kWX7EYfcLyIQl3QUJup4R9kH47FWQH+PrLCCPn2cTS93NS8ExQ/bw M001/IuI+PFQY/CvMnUoYs+Tpv3V7dWm1kt7CR2N1JBess07no+1ucpjuLbkB/Y3wj 0p0TLX5FX7NN+WLoj045vlO0NNhftD5DzMAxXTV4QuAwaVXKzoAVtEaR9nly5Y9Fyc Y79l3r3R12CBg== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Stefan Roese Cc: u-boot@lists.denx.de, pali@kernel.org, =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH u-boot-marvell 07/14] tools: kwboot: Show 'E' in progress output when error occurs Date: Tue, 25 Jan 2022 18:13:06 +0100 Message-Id: <20220125171313.14498-8-kabel@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220125171313.14498-1-kabel@kernel.org> References: <20220125171313.14498-1-kabel@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.5 at phobos.denx.de X-Virus-Status: Clean From: Pali Rohár When kwboot is unable to resend current xmodem packet, show an 'E' in the progress output instead of a '+'. This allows to distinguish between the state when kwboot is retrying sending the packet and when retry is not possible. Signed-off-by: Pali Rohár Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- tools/kwboot.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/kwboot.c b/tools/kwboot.c index dfac8aed7b..1dcec1969a 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c @@ -975,8 +975,12 @@ kwboot_xm_sendblock(int fd, struct kwboot_block *block, int allow_non_xm, if (rc) goto err; - if (!allow_non_xm && c != ACK) - kwboot_progress(-1, '+'); + if (!allow_non_xm && c != ACK) { + if (c == NAK && allow_retries && retries + 1 < 16) + kwboot_progress(-1, '+'); + else + kwboot_progress(-1, 'E'); + } } while (c == NAK && allow_retries && retries++ < 16); if (non_xm_print) From patchwork Tue Jan 25 17:13:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 1584197 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=D4Qol9Fw; dkim-atps=neutral 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=) 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)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Jjtl01HvRz9t5H for ; Wed, 26 Jan 2022 04:14:52 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1FDCE83146; Tue, 25 Jan 2022 18:14:00 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="D4Qol9Fw"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1C35783866; Tue, 25 Jan 2022 18:13:37 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 811B18385B for ; Tue, 25 Jan 2022 18:13:31 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2D54EB819AA; Tue, 25 Jan 2022 17:13:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9BA7C340E9; Tue, 25 Jan 2022 17:13:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643130809; bh=6EbTtehY4nPaA4uorO7mNy7aTsffRhKno6V2pdcjsTk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D4Qol9FwhUe3Qfhc9ENur49HmR5sPi4N2/1WZ7YEuUaHv+Nhq/EV1rpzAC8aeGTmz zTAz+alTZK0XQuCmkckA9+nkV3uI2Ccdyx1Xk/E0ZqL3ux2HucHgRHWyukkxXQduxJ AFQA57k9iuoOrjeK+/5r9ZbhzW7PY1wvWrSE7KC1YUwGppiO2GN123zM7ojmVRSOnY 6sYDs1MbZOA4RIGkPRv6Z+JeswM1hKG0fn3FGzL/EL7nmzJHn4nxstZV+HHfXXzI8J SvXn+U0l5GO7Y7Gf5pKEDeKLBNI90BOgfg8gwyxnaAwBn6jXhUKRGRhKeH/Y53jXhg WnET2D4CXUx8w== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Stefan Roese Cc: u-boot@lists.denx.de, pali@kernel.org, =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH u-boot-marvell 08/14] tools: kwboot: Allow to use option -b without image path Date: Tue, 25 Jan 2022 18:13:07 +0100 Message-Id: <20220125171313.14498-9-kabel@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220125171313.14498-1-kabel@kernel.org> References: <20220125171313.14498-1-kabel@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.5 at phobos.denx.de X-Virus-Status: Clean From: Pali Rohár Allow option -b without image path parameter, to send boot pattern and wait for response but not send any image. This allows to use kwboot just for processing boot pattern and user can use any other xmodem tool for transferring the image itself (e.g. sx). Useful for debugging purposes. Signed-off-by: Pali Rohár Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- tools/kwboot.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/tools/kwboot.c b/tools/kwboot.c index 1dcec1969a..c413a8bf51 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c @@ -1699,6 +1699,8 @@ main(int argc, char **argv) size_t size; size_t after_img_rsv; int baudrate; + int prev_optind; + int c; rv = 1; tty = -1; @@ -1716,22 +1718,32 @@ main(int argc, char **argv) kwboot_verbose = isatty(STDOUT_FILENO); do { - int c = getopt(argc, argv, "hb:ptaB:dD:q:s:o:"); + prev_optind = optind; + c = getopt(argc, argv, "hbptaB:dD:q:s:o:"); if (c < 0) break; switch (c) { case 'b': + if (imgpath || bootmsg || debugmsg) + goto usage; bootmsg = kwboot_msg_boot; - imgpath = optarg; + if (prev_optind == optind) + goto usage; + if (argv[optind] && argv[optind][0] != '-') + imgpath = argv[optind++]; break; case 'D': + if (imgpath || bootmsg || debugmsg) + goto usage; bootmsg = NULL; imgpath = optarg; break; case 'd': + if (imgpath || bootmsg || debugmsg) + goto usage; debugmsg = kwboot_msg_debug; break; @@ -1774,11 +1786,11 @@ main(int argc, char **argv) if (!bootmsg && !term && !debugmsg) goto usage; - if (argc - optind < 1) - goto usage; - ttypath = argv[optind++]; + if (optind != argc) + goto usage; + tty = kwboot_open_tty(ttypath, imgpath ? 115200 : baudrate); if (tty < 0) { perror(ttypath); From patchwork Tue Jan 25 17:13:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 1584198 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=FT5g8TFb; dkim-atps=neutral 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=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4JjtlB2RT4z9t5H for ; Wed, 26 Jan 2022 04:15:02 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 86030838A8; Tue, 25 Jan 2022 18:14:03 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="FT5g8TFb"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EE4B48389A; Tue, 25 Jan 2022 18:13:38 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id EC84783877 for ; Tue, 25 Jan 2022 18:13:32 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DB32E61312; Tue, 25 Jan 2022 17:13:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5099CC340E8; Tue, 25 Jan 2022 17:13:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643130811; bh=eyKLcGefykjyy/fNZ13i12fKAicFE+d6PweCsRzYSdI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FT5g8TFbD20eFT+Bc3wW7OhWUSmdcjgFt0uT78XtPobCtvGbJz7ieHchfHmGDpYw6 POyyqc75yS8cQnYjAr/HnfValvgyco8nfqBmVwkzqMv89rNY1ocu6BedckwU0k/CUk +gyf2c3V1OXmHLH1XrIEw5yUsv72Sl4s0WFkq/gn3TZW95E3U3WEcc9S0vn8F36yxS 1B7A6tHoFqtZUZY+2bnrksdUxY623HUBTu/iUZ5w6m89twyj5c+4UZQIW1TygQJFK5 ANjxdri0M4teCYcflPVo/FGagJQYaCMTHq07r9yJJaHOIS7eUxoPXpByLYCys+2CYb vSD0WIKJjMSdQ== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Stefan Roese Cc: u-boot@lists.denx.de, pali@kernel.org, =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH u-boot-marvell 09/14] tools: kwboot: Force BootROM to flush input queue after boot pattern Date: Tue, 25 Jan 2022 18:13:08 +0100 Message-Id: <20220125171313.14498-10-kabel@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220125171313.14498-1-kabel@kernel.org> References: <20220125171313.14498-1-kabel@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.5 at phobos.denx.de X-Virus-Status: Clean From: Pali Rohár Force the BootROM to flush its input queue after sending boot pattern. This ensures that after function kwboot_bootmsg() finishes, BootROM is able to start receiving xmodem packets without any specific delay or setup. Signed-off-by: Pali Rohár Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- tools/kwboot.c | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/tools/kwboot.c b/tools/kwboot.c index c413a8bf51..824ae005b2 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c @@ -717,6 +717,7 @@ out: static int kwboot_bootmsg(int tty, void *msg) { + struct kwboot_block block; int rc; char c; int count; @@ -747,7 +748,40 @@ kwboot_bootmsg(int tty, void *msg) kwboot_printv("\n"); - return rc; + if (rc) + return rc; + + /* + * At this stage we have sent more boot message patterns and BootROM + * (at least on Armada XP and 385) started interpreting sent bytes as + * part of xmodem packets. If BootROM is expecting SOH byte as start of + * a xmodem packet and it receives byte 0xff, then it throws it away and + * sends a NAK reply to host. If BootROM does not receive any byte for + * 2s when expecting some continuation of the xmodem packet, it throws + * away the partially received xmodem data and sends NAK reply to host. + * + * Therefore for starting xmodem transfer we have two options: Either + * wait 2s or send 132 0xff bytes (which is the size of xmodem packet) + * to ensure that BootROM throws away any partially received data. + */ + + /* flush output queue with remaining boot message patterns */ + tcflush(tty, TCOFLUSH); + + /* send one xmodem packet with 0xff bytes to force BootROM to re-sync */ + memset(&block, 0xff, sizeof(block)); + kwboot_tty_send(tty, &block, sizeof(block), 0); + + /* + * Sending 132 bytes via 115200B/8-N-1 takes 11.45 ms, reading 132 bytes + * takes 11.45 ms, so waiting for 30 ms should be enough. + */ + usleep(30 * 1000); + + /* flush remaining NAK replies from input queue */ + tcflush(tty, TCIFLUSH); + + return 0; } static int From patchwork Tue Jan 25 17:13:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 1584200 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=si2QBcrG; dkim-atps=neutral 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=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Jjtlb5Vyzz9t5H for ; Wed, 26 Jan 2022 04:15:23 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C6B25838D3; Tue, 25 Jan 2022 18:14:07 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="si2QBcrG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 40DE783879; Tue, 25 Jan 2022 18:13:43 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 50F22837FC for ; Tue, 25 Jan 2022 18:13:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 06D1FB819A7; Tue, 25 Jan 2022 17:13:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9402C340E6; Tue, 25 Jan 2022 17:13:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643130812; bh=5qJH2Up2niqgeG0eQq/LvLe5BEYdXl7rYe5G/yFVgTE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=si2QBcrGrVR0yoGUXdyUfSOoRwtL9FG1rkHcl2nfbOr6lnewwwQuMfAX0bzEl3Vfw QOBTMJGRmPUkkCneSAXrNeuMh6aF2uVZHiVKW/r4s/2yytMA+sGaWYjx7wAFq0+JPk ynlp9EHh8h2fWtcpP0SvSj9uI3KJwaTtQgirVK3a8VQKneGQFqXtFpls6PDtkOaelP xuS5p/JjYl23+AmwtT/XyFEpQkKxEsL5YLGk1sKKMMR3KcLrhL8x1qbpmLIjsV1CZj FjK99c4ujrlDtQY42FvDAKhKIN5kaCiLAdW6rYzWYepGd88/An4LpGwKH8tYNaSmN1 ikphmhTUn0U1w== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Stefan Roese Cc: u-boot@lists.denx.de, pali@kernel.org, =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH u-boot-marvell 10/14] tools: kwboot: Remove 2s delay before sending first xmodem packet Date: Tue, 25 Jan 2022 18:13:09 +0100 Message-Id: <20220125171313.14498-11-kabel@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220125171313.14498-1-kabel@kernel.org> References: <20220125171313.14498-1-kabel@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.5 at phobos.denx.de X-Virus-Status: Clean From: Pali Rohár This delay is not needed anymore since kwboot already handles retrying logic for incomplete xmodem packets and also forces BootROM to flush its input queue. Removing it decreases total transfer time. Signed-off-by: Pali Rohár Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- tools/kwboot.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tools/kwboot.c b/tools/kwboot.c index 824ae005b2..de433c1b04 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c @@ -1142,10 +1142,6 @@ kwboot_xmodem(int tty, const void *_img, size_t size, int baudrate) */ hdrsz += (KWBOOT_XM_BLKSZ - hdrsz % KWBOOT_XM_BLKSZ) % KWBOOT_XM_BLKSZ; - kwboot_printv("Waiting %d ms and flushing tty\n", blk_rsp_timeo); - usleep(blk_rsp_timeo * 1000); - tcflush(tty, TCIOFLUSH); - pnum = 1; rc = kwboot_xmodem_one(tty, &pnum, 1, img, hdrsz, baudrate); From patchwork Tue Jan 25 17:13:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 1584201 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=L4XzudwI; dkim-atps=neutral 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=) 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)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Jjtln6CxVz9t5H for ; Wed, 26 Jan 2022 04:15:33 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1C7D5838EE; Tue, 25 Jan 2022 18:14:10 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="L4XzudwI"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3EA4C830D0; Tue, 25 Jan 2022 18:13:44 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C118D83373 for ; Tue, 25 Jan 2022 18:13:35 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B2B7D6091C; Tue, 25 Jan 2022 17:13:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CF02C36AE7; Tue, 25 Jan 2022 17:13:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643130814; bh=wmPSIK9YECmWl39FFphIt3GCpLrEFFuK01DxICm8RZc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L4XzudwIbm8dY0zghQDURdS1jpTrbEghOBn6TA/qVC/OwA3z89gPdqfP/n2vtbx+P wvLtxe9jJPrvMQ+hqGiUX3pLsksLpSwY8CNqaxQZhXktsOuRF1JiQymi7HnC3gAQgJ 9phKMLcrGwJEcGDkCoMT1Uz1+wLkw05/pzKE1j3VXg25qJUQTjaEQ+rRdQJTu2Jiwc yWfCdgf22/oZy1lQZlhLmTt1042OhzCcR3QsDZ0JlkNpgkQno8k3yTMqlawwow/Odl I0swNOfM4L4sgRE4KGmEKF7p7AgIkFpPb/YCtjTMtWfkag3XobZo67iEtQmBTPgXKw Bc4VMWhSYLDRg== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Stefan Roese Cc: u-boot@lists.denx.de, pali@kernel.org, =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH u-boot-marvell 11/14] tools: kwboot: Handle EINTR in kwboot_write() Date: Tue, 25 Jan 2022 18:13:10 +0100 Message-Id: <20220125171313.14498-12-kabel@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220125171313.14498-1-kabel@kernel.org> References: <20220125171313.14498-1-kabel@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.5 at phobos.denx.de X-Virus-Status: Clean From: Pali Rohár The write() syscall may be interrupted. Handle EINTR and retry it. Signed-off-by: Pali Rohár Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- tools/kwboot.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/kwboot.c b/tools/kwboot.c index de433c1b04..8b748f0fdd 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c @@ -292,13 +292,15 @@ static int blk_rsp_timeo = KWBOOT_BLK_RSP_TIMEO; static ssize_t kwboot_write(int fd, const char *buf, size_t len) { - size_t tot = 0; + ssize_t tot = 0; while (tot < len) { ssize_t wr = write(fd, buf + tot, len - tot); - if (wr < 0) - return -1; + if (wr < 0 && errno == EINTR) + continue; + else if (wr < 0) + return wr; tot += wr; } From patchwork Tue Jan 25 17:13:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 1584199 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=b4JFLNkd; dkim-atps=neutral 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=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4JjtlP4gYvz9t5H for ; Wed, 26 Jan 2022 04:15:13 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8C2F6838C8; Tue, 25 Jan 2022 18:14:05 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="b4JFLNkd"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 461A9830D0; Tue, 25 Jan 2022 18:13:43 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 37BCC838A6 for ; Tue, 25 Jan 2022 18:13:37 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DC9B4B819AB; Tue, 25 Jan 2022 17:13:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94A58C36AE9; Tue, 25 Jan 2022 17:13:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643130815; bh=7Ie8D2/vV7KRrpwUQBNGBacpIP9uIx69AdrsD6FD7a4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b4JFLNkd1s2Xit/FEHDNmmj3ZlbCOsrj8N72eggEkVPb9xKLTnHHzOyv/kRDBwnh7 5bVa7M7vW0e/3X7U2b+IxXf8vndwZL3NeWq+AHfOszPtCUv+U8Ikji3AUbL/c1RYuG uEmVxUyiHdtA3bhKSy4ZRykfr+V2ynK96A+29ygJ+L+FRF8rbS+bphCe7qPG/p9rfj vzzcY41tH7mmjzv5rmsgTwVCjiD//pGCHYzYVyA0bavkvYxW7YVGDBZaq8Xs4ELRIN tnv3PpogQjYFZCez6/3TPaTnNC4D+pUZJxHlLYK2mER/ZMqdMtFAkURt4GUiPaNp7C Wg4LLKn/Pexhw== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Stefan Roese Cc: u-boot@lists.denx.de, pali@kernel.org, =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH u-boot-marvell 12/14] tools: kwboot: Handle EINTR in kwboot_tty_recv() Date: Tue, 25 Jan 2022 18:13:11 +0100 Message-Id: <20220125171313.14498-13-kabel@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220125171313.14498-1-kabel@kernel.org> References: <20220125171313.14498-1-kabel@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.5 at phobos.denx.de X-Virus-Status: Clean From: Pali Rohár The select() and read() syscalls may be interrupted. Handle EINTR and retry them. Signed-off-by: Pali Rohár Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- tools/kwboot.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/kwboot.c b/tools/kwboot.c index 8b748f0fdd..fca1c73c55 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c @@ -409,15 +409,19 @@ kwboot_tty_recv(int fd, void *buf, size_t len, int timeo) do { nfds = select(fd + 1, &rfds, NULL, NULL, &tv); - if (nfds < 0) + if (nfds < 0 && errno == EINTR) + continue; + else if (nfds < 0) goto out; - if (!nfds) { + else if (!nfds) { errno = ETIMEDOUT; goto out; } n = read(fd, buf, len); - if (n <= 0) + if (n < 0 && errno == EINTR) + continue; + else if (n <= 0) goto out; buf = (char *)buf + n; From patchwork Tue Jan 25 17:13:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 1584202 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=bEbFBvLZ; dkim-atps=neutral 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=) 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)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Jjtlz50mQz9t5H for ; Wed, 26 Jan 2022 04:15:43 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EC0AF8390B; Tue, 25 Jan 2022 18:14:12 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="bEbFBvLZ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4265A830D0; Tue, 25 Jan 2022 18:13:46 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9E0DB83896 for ; Tue, 25 Jan 2022 18:13:38 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 943B861307; Tue, 25 Jan 2022 17:13:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08D82C36AE2; Tue, 25 Jan 2022 17:13:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643130817; bh=4gxerJ5LeBkMvipKOydMaiDE9/awk8eA1QoHUmkqNmQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bEbFBvLZF8xJ0v2N2PkG5FwJma8t156cD2WamdBOVAbbbE5j6wbNsmmWVBG0KN1e5 Hmk3YEOYnzNSiiX9WeN9OByfgekoBnu/Xc1CmFXPR+JJyZBkNwEzJhSNaEMmtJ1xFr oCGu8wtxo3mGBSHCqzI/jMSKg0AsOqTg4BTgFrh1jYflo5l5vwlZD0j+3twMGWc4f5 1DvbiJZDtrnx9+sqpGQecJaKge5kBxGve/nmDjwMDzT2y5pWB7YIbpfeQMOLdL5T04 CrBj02bgARWEMU5GH2GsdWGbiJoF0CrogEZNOaUzhBDQOmMrvIH48fexPN/9+//Xik K3JY0Ww2kKMjA== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Stefan Roese Cc: u-boot@lists.denx.de, pali@kernel.org, =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH u-boot-marvell 13/14] tools: kwboot: Fix usage of -D without -t Date: Tue, 25 Jan 2022 18:13:12 +0100 Message-Id: <20220125171313.14498-14-kabel@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220125171313.14498-1-kabel@kernel.org> References: <20220125171313.14498-1-kabel@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.5 at phobos.denx.de X-Virus-Status: Clean From: Pali Rohár When -D is specified then both bootmsg and debugmsg are not set, but imgpath is set. Fix this check for valid and required parameters. Signed-off-by: Pali Rohár Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- tools/kwboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/kwboot.c b/tools/kwboot.c index fca1c73c55..859559fb72 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c @@ -1819,7 +1819,7 @@ main(int argc, char **argv) } } while (1); - if (!bootmsg && !term && !debugmsg) + if (!bootmsg && !term && !debugmsg && !imgpath) goto usage; ttypath = argv[optind++]; From patchwork Tue Jan 25 17:13:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 1584204 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=Yyt4M1n2; dkim-atps=neutral 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=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Jjtm92n2Nz9t6g for ; Wed, 26 Jan 2022 04:15:53 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1D8B8839ED; Tue, 25 Jan 2022 18:14:15 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="Yyt4M1n2"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C0588830D0; Tue, 25 Jan 2022 18:13:47 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C085D83146 for ; Tue, 25 Jan 2022 18:13:39 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9B81D6091C; Tue, 25 Jan 2022 17:13:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71D8EC340E8; Tue, 25 Jan 2022 17:13:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643130818; bh=22oTUUQS7rMbT72ahhxD6ew0lEjfBGZegxJ4I9wwzMY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yyt4M1n2IGT9lXAjN+mdVMZu7RfXqEqDRPN4/iwbI0GFJTZDcBGtdqEztQ3zHHNGw ROi61FOCjAmpKIiyBgxdjnXHlCDVD5YVREN9ltN5n8zWsMmbtHYl438sDBzxXZnEa5 oUfEkP8ka7Rok8VfERxZRJdZu7nxYXuzgQj2VueIM7CRTrUj+R7ad2jrsjAFKynOEc hmQvdVDrSypSR3C5vb/Qsb/hg9RR4jCtNjhP0FHKkWSMi0YfWO9Ht4XiRReAPNcBKw GuWOtZMIdgVgkXfH86e9211f3fKskgJWYNAsKHUhR2lzPTqIMOpq2SS65TtCz1wQqv 9q/UDoZIOHqpQ== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Stefan Roese Cc: u-boot@lists.denx.de, pali@kernel.org, =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH u-boot-marvell 14/14] tools: kwboot: Set debug flag to 1 Date: Tue, 25 Jan 2022 18:13:13 +0100 Message-Id: <20220125171313.14498-15-kabel@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220125171313.14498-1-kabel@kernel.org> References: <20220125171313.14498-1-kabel@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.5 at phobos.denx.de X-Virus-Status: Clean From: Pali Rohár This should enable BootROM output on UART. (At least on A385 BootROM this is broken, BootROM ignores this debug flag and does not enable its output on UART if some valid image is available in SPI-NOR.) Signed-off-by: Pali Rohár Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- tools/kwboot.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/kwboot.c b/tools/kwboot.c index 859559fb72..2684f0e75a 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c @@ -1631,6 +1631,7 @@ kwboot_img_patch(void *img, size_t *size, int baudrate) * baudrate (which should be 115200) and do not touch * UART MPP configuration. */ + hdr->flags |= 0x1; hdr->options &= ~0x1F; hdr->options |= MAIN_HDR_V1_OPT_BAUD_DEFAULT; hdr->options |= 0 << 3;