diff options
Diffstat (limited to 'common')
| -rw-r--r-- | common/Makefile | 1 | ||||
| -rw-r--r-- | common/cmd_bootm.c | 16 | ||||
| -rw-r--r-- | common/cmd_dfu.c | 14 | ||||
| -rw-r--r-- | common/cmd_fpgad.c | 84 | ||||
| -rw-r--r-- | common/cmd_load.c | 24 | ||||
| -rw-r--r-- | common/cmd_sf.c | 30 | ||||
| -rw-r--r-- | common/env_sf.c | 2 | ||||
| -rw-r--r-- | common/image-fit.c | 11 | ||||
| -rw-r--r-- | common/lcd.c | 1 | ||||
| -rw-r--r-- | common/spl/spl.c | 5 | ||||
| -rw-r--r-- | common/stdio.c | 3 | ||||
| -rw-r--r-- | common/usb_hub.c | 4 | 
12 files changed, 164 insertions, 31 deletions
| diff --git a/common/Makefile b/common/Makefile index 87ba82e20..288690bca 100644 --- a/common/Makefile +++ b/common/Makefile @@ -92,6 +92,7 @@ COBJS-$(CONFIG_CMD_FLASH) += cmd_flash.o  ifdef CONFIG_FPGA  COBJS-$(CONFIG_CMD_FPGA) += cmd_fpga.o  endif +COBJS-$(CONFIG_CMD_FPGAD) += cmd_fpgad.o  COBJS-$(CONFIG_CMD_FS_GENERIC) += cmd_fs.o  COBJS-$(CONFIG_CMD_FUSE) += cmd_fuse.o  COBJS-$(CONFIG_CMD_GETTIME) += cmd_gettime.o diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 046e22ff4..1685c14a5 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -636,7 +636,7 @@ static int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc,  			goto err;  		else if (ret == BOOTM_ERR_OVERLAP)  			ret = 0; -#ifdef CONFIG_SILENT_CONSOLE +#if defined(CONFIG_SILENT_CONSOLE) && !defined(CONFIG_SILENT_U_BOOT_ONLY)  		if (images->os.os == IH_OS_LINUX)  			fixup_silent_linux();  #endif @@ -1384,9 +1384,19 @@ static void fixup_silent_linux(void)  	char *buf;  	const char *env_val;  	char *cmdline = getenv("bootargs"); +	int want_silent; -	/* Only fix cmdline when requested */ -	if (!(gd->flags & GD_FLG_SILENT)) +	/* +	 * Only fix cmdline when requested. The environment variable can be: +	 * +	 *	no - we never fixup +	 *	yes - we always fixup +	 *	unset - we rely on the console silent flag +	 */ +	want_silent = getenv_yesno("silent_linux"); +	if (want_silent == 0) +		return; +	else if (want_silent == -1 && !(gd->flags & GD_FLG_SILENT))  		return;  	debug("before silent fix-up: %s\n", cmdline); diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c index db066acc3..793c42212 100644 --- a/common/cmd_dfu.c +++ b/common/cmd_dfu.c @@ -19,8 +19,8 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])  {  	const char *str_env;  	char *s = "dfu"; +	int ret, i = 0;  	char *env_bkp; -	int ret;  	if (argc < 3)  		return CMD_RET_USAGE; @@ -49,6 +49,15 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])  	g_dnl_register(s);  	while (1) { +		if (dfu_reset()) +			/* +			 * This extra number of usb_gadget_handle_interrupts() +			 * calls is necessary to assure correct transmission +			 * completion with dfu-util +			 */ +			if (++i == 10) +				goto exit; +  		if (ctrlc())  			goto exit; @@ -60,6 +69,9 @@ done:  	dfu_free_entities();  	free(env_bkp); +	if (dfu_reset()) +		run_command("reset", 0); +  	return CMD_RET_SUCCESS;  } diff --git a/common/cmd_fpgad.c b/common/cmd_fpgad.c new file mode 100644 index 000000000..1b25ed874 --- /dev/null +++ b/common/cmd_fpgad.c @@ -0,0 +1,84 @@ +/* + * (C) Copyright 2013 + * Dirk Eibach,  Guntermann & Drunck GmbH, dirk.eibach@gdsys.cc + * + * based on cmd_mem.c + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * SPDX-License-Identifier:	GPL-2.0+ + */ + +#include <common.h> +#include <command.h> + +#include <gdsys_fpga.h> + +static uint	dp_last_fpga; +static uint	dp_last_addr; +static uint	dp_last_length = 0x40; + +/* + * FPGA Memory Display + * + * Syntax: + *	fpgad {fpga} {addr} {len} + */ +#define DISP_LINE_LEN	16 +int do_fpga_md(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{ +	unsigned int k; +	unsigned int fpga; +	ulong	addr, length; +	int rc = 0; +	u16	linebuf[DISP_LINE_LEN/sizeof(u16)]; + +	/* +	 * We use the last specified parameters, unless new ones are +	 * entered. +	 */ +	fpga = dp_last_fpga; +	addr = dp_last_addr; +	length = dp_last_length; + +	if (argc < 3) +		return CMD_RET_USAGE; + +	if ((flag & CMD_FLAG_REPEAT) == 0) { +		/* +		 * FPGA is specified since argc > 2 +		 */ +		fpga = simple_strtoul(argv[1], NULL, 16); + +		/* +		 * Address is specified since argc > 2 +		 */ +		addr = simple_strtoul(argv[2], NULL, 16); + +		/* +		 * If another parameter, it is the length to display. +		 * Length is the number of objects, not number of bytes. +		 */ +		if (argc > 3) +			length = simple_strtoul(argv[3], NULL, 16); +	} + +	/* Print the lines. */ +	for (k = 0; k < DISP_LINE_LEN / sizeof(u16); ++k) +		fpga_get_reg(fpga, (u16 *)fpga_ptr[fpga] + k, k * sizeof(u16), +			     &linebuf[k]); +	print_buffer(addr, (void *)linebuf, sizeof(u16), +		     length, DISP_LINE_LEN / sizeof(u16)); +	addr += sizeof(u16)*length; + +	dp_last_fpga = fpga; +	dp_last_addr = addr; +	dp_last_length = length; +	return rc; +} + +U_BOOT_CMD( +	fpgad,	4,	1,	do_fpga_md, +	"fpga register display", +	"fpga address [# of objects]" +); diff --git a/common/cmd_load.c b/common/cmd_load.c index 0ce949683..f6e522cbb 100644 --- a/common/cmd_load.c +++ b/common/cmd_load.c @@ -18,7 +18,7 @@  DECLARE_GLOBAL_DATA_PTR;  #if defined(CONFIG_CMD_LOADB) -static ulong load_serial_ymodem(ulong offset); +static ulong load_serial_ymodem(ulong offset, int mode);  #endif  #if defined(CONFIG_CMD_LOADS) @@ -462,7 +462,15 @@ static int do_load_serial_bin(cmd_tbl_t *cmdtp, int flag, int argc,  			offset,  			load_baudrate); -		addr = load_serial_ymodem(offset); +		addr = load_serial_ymodem(offset, xyzModem_ymodem); + +	} else if (strcmp(argv[0],"loadx")==0) { +		printf("## Ready for binary (xmodem) download " +			"to 0x%08lX at %d bps...\n", +			offset, +			load_baudrate); + +		addr = load_serial_ymodem(offset, xyzModem_xmodem);  	} else { @@ -942,7 +950,7 @@ static int getcxmodem(void) {  		return (getc());  	return -1;  } -static ulong load_serial_ymodem(ulong offset) +static ulong load_serial_ymodem(ulong offset, int mode)  {  	int size;  	int err; @@ -953,7 +961,7 @@ static ulong load_serial_ymodem(ulong offset)  	ulong addr = 0;  	size = 0; -	info.mode = xyzModem_ymodem; +	info.mode = mode;  	res = xyzModem_stream_open(&info, &err);  	if (!res) { @@ -1056,6 +1064,14 @@ U_BOOT_CMD(  );  U_BOOT_CMD( +	loadx, 3, 0,	do_load_serial_bin, +	"load binary file over serial line (xmodem mode)", +	"[ off ] [ baud ]\n" +	"    - load binary file over serial line" +	" with offset 'off' and baudrate 'baud'" +); + +U_BOOT_CMD(  	loady, 3, 0,	do_load_serial_bin,  	"load binary file over serial line (ymodem mode)",  	"[ off ] [ baud ]\n" diff --git a/common/cmd_sf.c b/common/cmd_sf.c index 19b0dc9f4..4af0f0af2 100644 --- a/common/cmd_sf.c +++ b/common/cmd_sf.c @@ -151,16 +151,17 @@ static const char *spi_flash_update_block(struct spi_flash *flash, u32 offset,  		size_t len, const char *buf, char *cmp_buf, size_t *skipped)  {  	debug("offset=%#x, sector_size=%#x, len=%#zx\n", -		offset, flash->sector_size, len); +	      offset, flash->sector_size, len);  	if (spi_flash_read(flash, offset, len, cmp_buf))  		return "read";  	if (memcmp(cmp_buf, buf, len) == 0) {  		debug("Skip region %x size %zx: no change\n", -			offset, len); +		      offset, len);  		*skipped += len;  		return NULL;  	} -	if (spi_flash_erase(flash, offset, len)) +	/* Erase the entire sector */ +	if (spi_flash_erase(flash, offset, flash->sector_size))  		return "erase";  	if (spi_flash_write(flash, offset, len, buf))  		return "write"; @@ -200,7 +201,7 @@ static int spi_flash_update(struct spi_flash *flash, u32 offset,  			todo = min(end - buf, flash->sector_size);  			if (get_timer(last_update) > 100) {  				printf("   \rUpdating, %zu%% %lu B/s", -					100 - (end - buf) / scale, +				       100 - (end - buf) / scale,  					bytes_per_second(buf - start_buf,  							 start_time));  				last_update = get_timer(0); @@ -220,9 +221,9 @@ static int spi_flash_update(struct spi_flash *flash, u32 offset,  	delta = get_timer(start_time);  	printf("%zu bytes written, %zu bytes skipped", len - skipped, -		skipped); +	       skipped);  	printf(" in %ld.%lds, speed %ld B/s\n", -		delta / 1000, delta % 1000, bytes_per_second(len, start_time)); +	       delta / 1000, delta % 1000, bytes_per_second(len, start_time));  	return 0;  } @@ -252,7 +253,7 @@ static int do_spi_flash_read_write(int argc, char * const argv[])  	/* Consistency checking */  	if (offset + len > flash->size) {  		printf("ERROR: attempting %s past flash size (%#x)\n", -			argv[0], flash->size); +		       argv[0], flash->size);  		return 1;  	} @@ -262,9 +263,9 @@ static int do_spi_flash_read_write(int argc, char * const argv[])  		return 1;  	} -	if (strcmp(argv[0], "update") == 0) +	if (strcmp(argv[0], "update") == 0) {  		ret = spi_flash_update(flash, offset, len, buf); -	else if (strncmp(argv[0], "read", 4) == 0 || +	} else if (strncmp(argv[0], "read", 4) == 0 ||  			strncmp(argv[0], "write", 5) == 0) {  		int read; @@ -275,7 +276,7 @@ static int do_spi_flash_read_write(int argc, char * const argv[])  			ret = spi_flash_write(flash, offset, len, buf);  		printf("SF: %zu bytes @ %#x %s: %s\n", (size_t)len, (u32)offset, -			read ? "Read" : "Written", ret ? "ERROR" : "OK"); +		       read ? "Read" : "Written", ret ? "ERROR" : "OK");  	}  	unmap_physmem(buf, len); @@ -304,13 +305,13 @@ static int do_spi_flash_erase(int argc, char * const argv[])  	/* Consistency checking */  	if (offset + len > flash->size) {  		printf("ERROR: attempting %s past flash size (%#x)\n", -			argv[0], flash->size); +		       argv[0], flash->size);  		return 1;  	}  	ret = spi_flash_erase(flash, offset, len);  	printf("SF: %zu bytes @ %#x Erased: %s\n", (size_t)len, (u32)offset, -			ret ? "ERROR" : "OK"); +	       ret ? "ERROR" : "OK");  	return ret == 0 ? 0 : 1;  } @@ -470,7 +471,8 @@ static int do_spi_flash_test(int argc, char * const argv[])  }  #endif /* CONFIG_CMD_SF_TEST */ -static int do_spi_flash(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +static int do_spi_flash(cmd_tbl_t *cmdtp, int flag, int argc, +			char * const argv[])  {  	const char *cmd;  	int ret; @@ -526,7 +528,7 @@ U_BOOT_CMD(  	"SPI flash sub-system",  	"probe [[bus:]cs] [hz] [mode]	- init flash device on given SPI bus\n"  	"				  and chip select\n" -	"sf read addr offset len 	- read `len' bytes starting at\n" +	"sf read addr offset len	- read `len' bytes starting at\n"  	"				  `offset' to memory at `addr'\n"  	"sf write addr offset len	- write `len' bytes from memory\n"  	"				  at `addr' to flash at `offset'\n" diff --git a/common/env_sf.c b/common/env_sf.c index e3e1897cc..9f806fb09 100644 --- a/common/env_sf.c +++ b/common/env_sf.c @@ -7,7 +7,7 @@   *   * (C) Copyright 2008 Atmel Corporation   * - * SPDX-License-Identifier:	GPL-2.0+  + * SPDX-License-Identifier:	GPL-2.0+   */  #include <common.h>  #include <environment.h> diff --git a/common/image-fit.c b/common/image-fit.c index 683c1a511..199b4ed16 100644 --- a/common/image-fit.c +++ b/common/image-fit.c @@ -343,6 +343,17 @@ void fit_image_print(const void *fit, int image_noffset, const char *p)  	else  		printf("%s\n", desc); +	if (IMAGE_ENABLE_TIMESTAMP) { +		time_t timestamp; + +		ret = fit_get_timestamp(fit, 0, ×tamp); +		printf("%s  Created:      ", p); +		if (ret) +			printf("unavailable\n"); +		else +			genimg_print_time(timestamp); +	} +  	fit_image_get_type(fit, image_noffset, &type);  	printf("%s  Type:         %s\n", p, genimg_get_type_name(type)); diff --git a/common/lcd.c b/common/lcd.c index 8d5c63c29..990650c7e 100644 --- a/common/lcd.c +++ b/common/lcd.c @@ -51,7 +51,6 @@  /* ** FONT DATA								*/  /************************************************************************/  #include <video_font.h>		/* Get font data, width and height	*/ -#include <video_font_data.h>  /************************************************************************/  /* ** LOGO DATA								*/ diff --git a/common/spl/spl.c b/common/spl/spl.c index d6b0e0107..da31457d5 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -85,8 +85,9 @@ void spl_parse_image_header(const struct image_header *header)  		}  		spl_image.os = image_get_os(header);  		spl_image.name = image_get_name(header); -		debug("spl: payload image: %s load addr: 0x%x size: %d\n", -			spl_image.name, spl_image.load_addr, spl_image.size); +		debug("spl: payload image: %.*s load addr: 0x%x size: %d\n", +			sizeof(spl_image.name), spl_image.name, +			spl_image.load_addr, spl_image.size);  	} else {  		/* Signature not found - assume u-boot.bin */  		debug("mkimage signature not found - ih_magic = %x\n", diff --git a/common/stdio.c b/common/stdio.c index 721e9a144..844f98c18 100644 --- a/common/stdio.c +++ b/common/stdio.c @@ -196,9 +196,6 @@ int stdio_init (void)  	/* Initialize the list */  	INIT_LIST_HEAD(&(devs.list)); -#ifdef CONFIG_ARM_DCC -	drv_arm_dcc_init (); -#endif  #ifdef CONFIG_SYS_I2C  	i2c_init_all();  #else diff --git a/common/usb_hub.c b/common/usb_hub.c index 754d436ad..a11b401e6 100644 --- a/common/usb_hub.c +++ b/common/usb_hub.c @@ -110,7 +110,7 @@ static void usb_hub_power_on(struct usb_hub_device *hub)  		ret = usb_get_port_status(dev, i + 1, portsts);  		if (ret < 0) {  			debug("port %d: get_port_status failed\n", i + 1); -			return; +			continue;  		}  		/* @@ -125,7 +125,7 @@ static void usb_hub_power_on(struct usb_hub_device *hub)  		portstatus = le16_to_cpu(portsts->wPortStatus);  		if (portstatus & (USB_PORT_STAT_POWER << 1)) {  			debug("port %d: Port power change failed\n", i + 1); -			return; +			continue;  		}  	} |