[PATCH u-boot-marvell 04/14] tools: kwboot: Remove code for handling CAN byte
Stefan Roese
sr at denx.de
Wed Jan 26 16:35:28 CET 2022
On 1/25/22 18:13, Marek Behún wrote:
> From: Pali Rohár <pali at kernel.org>
>
> 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 <pali at kernel.org>
> Signed-off-by: Marek Behún <marek.behun at nic.cz>
Reviewed-by: Stefan Roese <sr at denx.de>
Thanks,
Stefan
> ---
> 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;
Viele Grüße,
Stefan Roese
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
More information about the U-Boot
mailing list