public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Luka Perkov <luka@openwrt.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v1 22/25] tools/kwboot: Sync with latest barebox version to support Armada XP
Date: Fri, 27 Jun 2014 21:06:41 +0200	[thread overview]
Message-ID: <20140627190641.GA24739@w500.lan> (raw)
In-Reply-To: <1403862911-6138-23-git-send-email-sr@denx.de>

Hi Stefan,

It's great to see you working on adding support for Marvell's new SoCs :)

Since now kwboot is going to support more SoCs except kirkwood it makes
sense to rename it to mvboot. I've sent this patch long ago, dunno if it
still applies:

http://patchwork.ozlabs.org/patch/219741/

Also, I'd like to test this series on some boards I have - do you have
patches on some git tree that can be pulled easily?

Luka

On Fri, Jun 27, 2014 at 11:55:08AM +0200, Stefan Roese wrote:
> The barebox version of the kwboot tool has evolved a bit. To support
> Armada XP and Dove. Additionally a few minor fixes have been applied.
> So lets sync with the latest barebox version.
> 
> Please note that the main difference between both versions now is, that
> the U-Boot version still supports the -p option, to dynamically patch
> an image for UART boot mode. I didn't test it now though.
> 
> Signed-off-by: Stefan Roese <sr@denx.de>
> ---
> 
>  tools/kwboot.c | 97 +++++++++++++++++++++++++++++++++++++++++++++++++---------
>  1 file changed, 83 insertions(+), 14 deletions(-)
> 
> diff --git a/tools/kwboot.c b/tools/kwboot.c
> index e773f01..c47970e 100644
> --- a/tools/kwboot.c
> +++ b/tools/kwboot.c
> @@ -1,5 +1,6 @@
>  /*
> - * Boot a Marvell Kirkwood SoC, with Xmodem over UART0.
> + * Boot a Marvell SoC, with Xmodem over UART0.
> + *  supports Kirkwood, Dove, Armada 370, Armada XP
>   *
>   * (c) 2012 Daniel Stodden <daniel.stodden@gmail.com>
>   *
> @@ -37,8 +38,12 @@ static unsigned char kwboot_msg_boot[] = {
>  	0xBB, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77
>  };
>  
> -#define KWBOOT_MSG_REQ_DELAY	10 /* ms */
> -#define KWBOOT_MSG_RSP_TIMEO	50 /* ms */
> +static unsigned char kwboot_msg_debug[] = {
> +	0xDD, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77
> +};
> +
> +#define KWBOOT_MSG_REQ_DELAY	1000 /* ms */
> +#define KWBOOT_MSG_RSP_TIMEO	1000 /* ms */
>  
>  /*
>   * Xmodem Transfers
> @@ -184,6 +189,9 @@ kwboot_tty_send(int fd, const void *buf, size_t len)
>  	int rc;
>  	ssize_t n;
>  
> +	if (!buf)
> +		return 0;
> +
>  	rc = -1;
>  
>  	do {
> @@ -268,7 +276,10 @@ kwboot_bootmsg(int tty, void *msg)
>  	int rc;
>  	char c;
>  
> -	kwboot_printv("Sending boot message. Please reboot the target...");
> +	if (msg == NULL)
> +		kwboot_printv("Please reboot the target into UART boot mode...");
> +	else
> +		kwboot_printv("Sending boot message. Please reboot the target...");
>  
>  	do {
>  		rc = tcflush(tty, TCIOFLUSH);
> @@ -293,6 +304,37 @@ kwboot_bootmsg(int tty, void *msg)
>  }
>  
>  static int
> +kwboot_debugmsg(int tty, void *msg)
> +{
> +	int rc;
> +
> +	kwboot_printv("Sending debug message. Please reboot the target...");
> +
> +	do {
> +		char buf[16];
> +
> +		rc = tcflush(tty, TCIOFLUSH);
> +		if (rc)
> +			break;
> +
> +		rc = kwboot_tty_send(tty, msg, 8);
> +		if (rc) {
> +			usleep(KWBOOT_MSG_REQ_DELAY * 1000);
> +			continue;
> +		}
> +
> +		rc = kwboot_tty_recv(tty, buf, 16, KWBOOT_MSG_RSP_TIMEO);
> +
> +		kwboot_spinner();
> +
> +	} while (rc);
> +
> +	kwboot_printv("\n");
> +
> +	return rc;
> +}
> +
> +static int
>  kwboot_xm_makeblock(struct kwboot_block *block, const void *data,
>  		    size_t size, int pnum)
>  {
> @@ -300,6 +342,7 @@ kwboot_xm_makeblock(struct kwboot_block *block, const void *data,
>  	size_t n;
>  	int i;
>  
> +	block->soh = SOH;
>  	block->pnum = pnum;
>  	block->_pnum = ~block->pnum;
>  
> @@ -326,9 +369,15 @@ kwboot_xm_sendblock(int fd, struct kwboot_block *block)
>  		if (rc)
>  			break;
>  
> -		rc = kwboot_tty_recv(fd, &c, 1, KWBOOT_BLK_RSP_TIMEO);
> -		if (rc)
> -			break;
> +		do {
> +			rc = kwboot_tty_recv(fd, &c, 1, KWBOOT_BLK_RSP_TIMEO);
> +			if (rc)
> +				break;
> +
> +			if (c != ACK && c != NAK && c != CAN)
> +				printf("%c", c);
> +
> +		} while (c != ACK && c != NAK && c != CAN);
>  
>  		if (c != ACK)
>  			kwboot_progress(-1, '+');
> @@ -511,7 +560,6 @@ kwboot_mmap_image(const char *path, size_t *size, int prot)
>  	void *img;
>  
>  	rc = -1;
> -	fd = -1;
>  	img = NULL;
>  
>  	fd = open(path, O_RDONLY);
> @@ -601,11 +649,15 @@ static void
>  kwboot_usage(FILE *stream, char *progname)
>  {
>  	fprintf(stream,
> -		"Usage: %s -b <image> [ -p ] [ -t ] "
> -		"[-B <baud> ] <TTY>\n", progname);
> +		"Usage: %s [-d | -b <image> | -D <image> ] [ -t ] [-B <baud> ] <TTY>\n",
> +		progname);
>  	fprintf(stream, "\n");
> -	fprintf(stream, "  -b <image>: boot <image>\n");
> +	fprintf(stream,
> +		"  -b <image>: boot <image> with preamble (Kirkwood, Armada 370/XP)\n");
>  	fprintf(stream, "  -p: patch <image> to type 0x69 (uart boot)\n");
> +	fprintf(stream,
> +		"  -D <image>: boot <image> without preamble (Dove)\n");
> +	fprintf(stream, "  -d: enter debug mode\n");
>  	fprintf(stream, "\n");
>  	fprintf(stream, "  -t: mini terminal\n");
>  	fprintf(stream, "\n");
> @@ -619,6 +671,7 @@ main(int argc, char **argv)
>  	const char *ttypath, *imgpath;
>  	int rv, rc, tty, term, prot, patch;
>  	void *bootmsg;
> +	void *debugmsg;
>  	void *img;
>  	size_t size;
>  	speed_t speed;
> @@ -626,6 +679,7 @@ main(int argc, char **argv)
>  	rv = 1;
>  	tty = -1;
>  	bootmsg = NULL;
> +	debugmsg = NULL;
>  	imgpath = NULL;
>  	img = NULL;
>  	term = 0;
> @@ -636,7 +690,7 @@ main(int argc, char **argv)
>  	kwboot_verbose = isatty(STDOUT_FILENO);
>  
>  	do {
> -		int c = getopt(argc, argv, "hb:ptB:");
> +		int c = getopt(argc, argv, "hb:ptB:dD:");
>  		if (c < 0)
>  			break;
>  
> @@ -646,6 +700,15 @@ main(int argc, char **argv)
>  			imgpath = optarg;
>  			break;
>  
> +		case 'D':
> +			bootmsg = NULL;
> +			imgpath = optarg;
> +			break;
> +
> +		case 'd':
> +			debugmsg = kwboot_msg_debug;
> +			break;
> +
>  		case 'p':
>  			patch = 1;
>  			break;
> @@ -667,7 +730,7 @@ main(int argc, char **argv)
>  		}
>  	} while (1);
>  
> -	if (!bootmsg && !term)
> +	if (!bootmsg && !term && !debugmsg)
>  		goto usage;
>  
>  	if (patch && !imgpath)
> @@ -702,7 +765,13 @@ main(int argc, char **argv)
>  		}
>  	}
>  
> -	if (bootmsg) {
> +	if (debugmsg) {
> +		rc = kwboot_debugmsg(tty, debugmsg);
> +		if (rc) {
> +			perror("debugmsg");
> +			goto out;
> +		}
> +	} else {
>  		rc = kwboot_bootmsg(tty, bootmsg);
>  		if (rc) {
>  			perror("bootmsg");
> -- 
> 2.0.1
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

  reply	other threads:[~2014-06-27 19:06 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-27  9:54 [U-Boot] [PATCH v1 0/25] Add Marvell Armada XP MV78460 SoC support Stefan Roese
2014-06-27  9:54 ` [U-Boot] [PATCH v1 01/25] sf: Add M25PX64 SPI NOR flash ID Stefan Roese
2014-07-03 20:14   ` Jagan Teki
2014-07-13 16:20     ` Jagan Teki
2014-06-27  9:54 ` [U-Boot] [PATCH v1 02/25] arm: kirkwood: spi.h: Add some missing parenthesis Stefan Roese
2014-07-03 20:15   ` Jagan Teki
2014-06-27  9:54 ` [U-Boot] [PATCH v1 03/25] spi: kirkwood_spi.c: Some fixes and cleanup Stefan Roese
2014-07-03 20:16   ` Jagan Teki
2014-06-27  9:54 ` [U-Boot] [PATCH v1 04/25] spi: kirkwood_spi.c: Make global variable static Stefan Roese
2014-07-03 20:18   ` Jagan Teki
2014-06-27  9:54 ` [U-Boot] [PATCH v1 05/25] spi: kirkwood_spi.c: cosmetic: Fix minor coding style issues Stefan Roese
2014-07-03 20:18   ` Jagan Teki
2014-06-27  9:54 ` [U-Boot] [PATCH v1 06/25] arm: kirkwood: Move some SoC files into new arch/arm/mvebu-common Stefan Roese
2014-06-27  9:54 ` [U-Boot] [PATCH v1 07/25] arm: marvell: Move arch/kirkwood.h to arch/soc.h Stefan Roese
2014-06-27  9:54 ` [U-Boot] [PATCH v1 08/25] arm: marvell: Move arch-kirkwood/spi.h to arch-mvebu/spi.h Stefan Roese
2014-07-13 16:16   ` Jagan Teki
2014-06-27  9:54 ` [U-Boot] [PATCH v1 09/25] arm: marvell: Rework timer.c to make it usable for other MVEBU platforms Stefan Roese
2014-06-27  9:54 ` [U-Boot] [PATCH v1 10/25] arm: mvebu: Add common mbus functions to use on Marvell SoCs Stefan Roese
2014-06-27  9:54 ` [U-Boot] [PATCH v1 11/25] spi: kirkwood_spi.c: Compile MPP (pin-mux) only for kirkwood SoC's Stefan Roese
2014-07-13 16:18   ` Jagan Teki
2014-06-27  9:54 ` [U-Boot] [PATCH v1 12/25] arm: marvell: Extract kirkwood gpio functions into new common file gpio.c Stefan Roese
2014-06-27  9:54 ` [U-Boot] [PATCH v1 13/25] spi: kirkwood_spi.c: Change KW_SPI_BASE to MVEBU_SPI_BASE Stefan Roese
2014-07-13 16:18   ` Jagan Teki
2014-06-27  9:55 ` [U-Boot] [PATCH v1 14/25] arm: kirkwood: Change naming of dram functions from km_foo() to mvebu_foo() Stefan Roese
2014-06-27  9:55 ` [U-Boot] [PATCH v1 15/25] net: mvneta.c: Add support for the ethernet controller of the Marvell Armada XP SoC Stefan Roese
2014-06-27  9:55 ` [U-Boot] [PATCH v1 16/25] net: phy.h: Make PHY autonegotiation timeout configurable Stefan Roese
2014-06-27  9:55 ` [U-Boot] [PATCH v1 17/25] i2c: mvtwsi: Add support for Marvell Armada XP Stefan Roese
2014-07-01  5:48   ` Heiko Schocher
2014-06-27  9:55 ` [U-Boot] [PATCH v1 18/25] arm: armada-xp: Add basic support for Marvell Armada XP SoC Stefan Roese
2014-06-27  9:55 ` [U-Boot] [PATCH v1 19/25] arm: armada-xp: Add basic support for the Marvell DB-78460-BP board Stefan Roese
2014-06-27  9:55 ` [U-Boot] [PATCH v1 20/25] arm: kirkwood: Remove some dead code from cpu.c Stefan Roese
2014-07-01 23:45   ` Luka Perkov
2014-06-27  9:55 ` [U-Boot] [PATCH v1 21/25] arm: kirkwood: Use mvebu new common mbus API Stefan Roese
2014-06-27  9:55 ` [U-Boot] [PATCH v1 22/25] tools/kwboot: Sync with latest barebox version to support Armada XP Stefan Roese
2014-06-27 19:06   ` Luka Perkov [this message]
2014-06-28  1:25     ` Daniel Stodden
2014-06-28  7:43     ` Stefan Roese
2014-07-03 22:02   ` Luka Perkov
2014-07-28  6:47     ` Stefan Roese
2014-07-29 23:16       ` Luka Perkov
2014-07-30  8:53         ` Stefan Roese
2014-07-28  8:12   ` Wolfgang Denk
2014-06-27  9:55 ` [U-Boot] [PATCH v1 23/25] tools: Compile kwboot for Marvell Armada XP as those SoCs are now supported Stefan Roese
2014-07-03 22:03   ` Luka Perkov
2014-06-27  9:55 ` [U-Boot] [PATCH v1 24/25] tools: kwbimage: Add image version 1 support for Armada XP / 370 Stefan Roese
2014-07-03 22:03   ` Luka Perkov
2014-06-27  9:55 ` [U-Boot] [PATCH v1 25/25] Makefile: Add CONFIG_BUILD_TARGET to automatically build an special image Stefan Roese
2014-06-27 10:18 ` [U-Boot] [PATCH v1 0/25] Add Marvell Armada XP MV78460 SoC support Prafulla Wadaskar
2014-07-13 16:15   ` Jagan Teki
2014-07-14 14:51     ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140627190641.GA24739@w500.lan \
    --to=luka@openwrt.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox