diff options
134 files changed, 1718 insertions, 3999 deletions
| @@ -18,6 +18,7 @@ usage()  	  -c CPU,    --cpu CPU         Build all boards with cpu CPU  	  -v VENDOR, --vendor VENDOR   Build all boards with vendor VENDOR  	  -s SOC,    --soc SOC         Build all boards with soc SOC +	  -b BOARD,  --board BOARD     Build all boards with board name BOARD  	  -l,        --list            List all targets to be built  	  -m,        --maintainers     List all targets and maintainer email  	  -M,        --mails           List all targets and all affilated emails @@ -59,8 +60,8 @@ usage()  	exit ${ret}  } -SHORT_OPTS="ha:c:v:s:lmMCnr" -LONG_OPTS="help,arch:,cpu:,vendor:,soc:,list,maintainers,mails,check,continue,rebuild-errors" +SHORT_OPTS="ha:c:v:s:b:lmMCnr" +LONG_OPTS="help,arch:,cpu:,vendor:,soc:,board:,list,maintainers,mails,check,continue,rebuild-errors"  # Option processing based on util-linux-2.13/getopt-parse.bash @@ -121,6 +122,17 @@ while true ; do  		fi  		SELECTED='y'  		shift 2 ;; +	-b|--board) +		# echo "Option BOARD: argument \`$2'" +		if [ "$opt_b" ] ; then +			opt_b="${opt_b%)} || \$6 == \"$2\" || \$7 == \"$2\")" +		else +			# We need to check the 7th field too +			# for boards whose 6th field is "-" +			opt_b="(\$6 == \"$2\" || \$7 == \"$2\")" +		fi +		SELECTED='y' +		shift 2 ;;  	-C|--check)  		CHECK='C=1'  		shift ;; @@ -158,6 +170,7 @@ FILTER="\$1 !~ /^#/"  [ "$opt_c" ] && FILTER="${FILTER} && $opt_c"  [ "$opt_s" ] && FILTER="${FILTER} && $opt_s"  [ "$opt_v" ] && FILTER="${FILTER} && $opt_v" +[ "$opt_b" ] && FILTER="${FILTER} && $opt_b"  if [ "$SELECTED" ] ; then  	SELECTED=$(awk '('"$FILTER"') { print $7 }' boards.cfg) @@ -5,10 +5,10 @@  # SPDX-License-Identifier:	GPL-2.0+  # -VERSION = 2013 -PATCHLEVEL = 10 +VERSION = 2014 +PATCHLEVEL = 01  SUBLEVEL = -EXTRAVERSION = +EXTRAVERSION = -rc1  ifneq "$(SUBLEVEL)" ""  U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)  else @@ -136,7 +136,6 @@ unexport CDPATH  # The "examples" conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC  # is "yes"), so compile examples after U-Boot is compiled.  SUBDIR_TOOLS = tools -SUBDIR_EXAMPLES = examples/standalone examples/api  SUBDIRS = $(SUBDIR_TOOLS)  .PHONY : $(SUBDIRS) $(VERSION_FILE) $(TIMESTAMP_FILE) @@ -150,8 +149,10 @@ all:  sinclude $(obj)include/autoconf.mk.dep  sinclude $(obj)include/autoconf.mk +SUBDIR_EXAMPLES-y := examples/standalone +SUBDIR_EXAMPLES-$(CONFIG_API) += examples/api  ifndef CONFIG_SANDBOX -SUBDIRS += $(SUBDIR_EXAMPLES) +SUBDIRS += $(SUBDIR_EXAMPLES-y)  endif  # load ARCH, BOARD, and CPU configuration @@ -230,11 +231,6 @@ OBJS := $(addprefix $(obj),$(OBJS))  HAVE_VENDOR_COMMON_LIB = $(if $(wildcard board/$(VENDOR)/common/Makefile),y,n)  LIBS-y += lib/ -LIBS-$(CONFIG_RSA) += lib/rsa/ -LIBS-$(CONFIG_LZMA) += lib/lzma/ -LIBS-$(CONFIG_LZO) += lib/lzo/ -LIBS-$(CONFIG_ZLIB) += lib/zlib/ -LIBS-$(CONFIG_TIZEN) += lib/tizen/  LIBS-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/  LIBS-y += $(CPUDIR)/  ifdef SOC @@ -278,7 +274,7 @@ LIBS-y += drivers/usb/phy/  LIBS-y += drivers/usb/ulpi/  LIBS-y += common/  LIBS-y += lib/libfdt/ -LIBS-y += api/ +LIBS-$(CONFIG_API) += api/  LIBS-y += post/  LIBS-y += test/ @@ -363,7 +359,7 @@ endif  build := -f $(TOPDIR)/scripts/Makefile.build -C -all:		$(ALL-y) $(SUBDIR_EXAMPLES) +all:		$(ALL-y) $(SUBDIR_EXAMPLES-y)  $(obj)u-boot.dtb:	checkdtc $(obj)u-boot  		$(MAKE) $(build) dts binary @@ -551,7 +547,7 @@ $(LIBS):	depend $(SUBDIR_TOOLS)  $(SUBDIRS):	depend  		$(MAKE) -C $@ all -$(SUBDIR_EXAMPLES): $(obj)u-boot +$(SUBDIR_EXAMPLES-y): $(obj)u-boot  $(LDSCRIPT):	depend  		$(MAKE) -C $(dir $@) $(notdir $@) @@ -571,9 +567,6 @@ $(obj)spl/u-boot-spl.bin:	$(SUBDIR_TOOLS) depend  $(obj)tpl/u-boot-tpl.bin:	$(SUBDIR_TOOLS) depend  		$(MAKE) -C spl all CONFIG_TPL_BUILD=y -updater: -		$(MAKE) -C tools/updater all -  # Explicitly make _depend in subdirs containing multiple targets to prevent  # parallel sub-makes creating .depend files simultaneously.  depend dep:	$(TIMESTAMP_FILE) $(VERSION_FILE) \ @@ -716,7 +709,7 @@ else	# !config.mk  all $(obj)u-boot.hex $(obj)u-boot.srec $(obj)u-boot.bin \  $(obj)u-boot.img $(obj)u-boot.dis $(obj)u-boot \  $(filter-out tools,$(SUBDIRS)) \ -updater depend dep tags ctags etags cscope $(obj)System.map: +depend dep tags ctags etags cscope $(obj)System.map:  	@echo "System not configured - see README" >&2  	@ exit 1 @@ -1997,6 +1997,21 @@ CBFS (Coreboot Filesystem) support  		kernel). Defining CONFIG_STATUS_LED enables this  		feature in U-Boot. +		Additional options: + +		CONFIG_GPIO_LED +		The status LED can be connected to a GPIO pin. +		In such cases, the gpio_led driver can be used as a +		status LED backend implementation. Define CONFIG_GPIO_LED +		to include the gpio_led driver in the U-Boot binary. + +		CONFIG_GPIO_LED_INVERTED_TABLE +		Some GPIO connected LEDs may have inverted polarity in which +		case the GPIO high value corresponds to LED off state and +		GPIO low value corresponds to LED on state. +		In such cases CONFIG_GPIO_LED_INVERTED_TABLE may be defined +		with a list of GPIO LEDs that have inverted polarity. +  - CAN Support:	CONFIG_CAN_DRIVER  		Defining CONFIG_CAN_DRIVER enables CAN driver support diff --git a/api/Makefile b/api/Makefile index fb130ffe8..3c095eedb 100644 --- a/api/Makefile +++ b/api/Makefile @@ -4,5 +4,6 @@  # SPDX-License-Identifier:	GPL-2.0+  # -obj-$(CONFIG_API) += api.o api_display.o api_net.o api_storage.o \ -		       api_platform-$(ARCH).o +obj-y += api.o api_display.o api_net.o api_storage.o +obj-$(CONFIG_ARM) += api_platform-arm.o +obj-$(CONFIG_PPC) += api_platform-powerpc.o diff --git a/arch/arm/cpu/armv7/am33xx/Makefile b/arch/arm/cpu/armv7/am33xx/Makefile index 966fcab71..5566310d9 100644 --- a/arch/arm/cpu/armv7/am33xx/Makefile +++ b/arch/arm/cpu/armv7/am33xx/Makefile @@ -19,4 +19,3 @@ obj-y	+= ddr.o  obj-y	+= emif4.o  obj-y	+= board.o  obj-y	+= mux.o -obj-$(CONFIG_NAND_OMAP_GPMC)	+= elm.o diff --git a/arch/arm/cpu/armv7/am33xx/mem.c b/arch/arm/cpu/armv7/am33xx/mem.c index b6eb46678..56c9e7dbc 100644 --- a/arch/arm/cpu/armv7/am33xx/mem.c +++ b/arch/arm/cpu/armv7/am33xx/mem.c @@ -22,17 +22,6 @@  struct gpmc *gpmc_cfg; -#if defined(CONFIG_CMD_NAND) -static const u32 gpmc_m_nand[GPMC_MAX_REG] = { -	M_NAND_GPMC_CONFIG1, -	M_NAND_GPMC_CONFIG2, -	M_NAND_GPMC_CONFIG3, -	M_NAND_GPMC_CONFIG4, -	M_NAND_GPMC_CONFIG5, -	M_NAND_GPMC_CONFIG6, 0 -}; -#endif -  void enable_gpmc_cs_config(const u32 *gpmc_config, struct gpmc_cs *cs, u32 base,  			u32 size) @@ -61,11 +50,34 @@ void gpmc_init(void)  {  	/* putting a blanket check on GPMC based on ZeBu for now */  	gpmc_cfg = (struct gpmc *)GPMC_BASE; - -#ifdef CONFIG_CMD_NAND -	const u32 *gpmc_config = NULL; -	u32 base = 0; +#if defined(CONFIG_NOR) +/* configure GPMC for NOR */ +	const u32 gpmc_regs[GPMC_MAX_REG] = {	STNOR_GPMC_CONFIG1, +						STNOR_GPMC_CONFIG2, +						STNOR_GPMC_CONFIG3, +						STNOR_GPMC_CONFIG4, +						STNOR_GPMC_CONFIG5, +						STNOR_GPMC_CONFIG6, +						STNOR_GPMC_CONFIG7 +						}; +	u32 size = GPMC_SIZE_16M; +	u32 base = CONFIG_SYS_FLASH_BASE; +#elif defined(CONFIG_NAND) +/* configure GPMC for NAND */ +	const u32  gpmc_regs[GPMC_MAX_REG] = {	M_NAND_GPMC_CONFIG1, +						M_NAND_GPMC_CONFIG2, +						M_NAND_GPMC_CONFIG3, +						M_NAND_GPMC_CONFIG4, +						M_NAND_GPMC_CONFIG5, +						M_NAND_GPMC_CONFIG6, +						0 +						}; +	u32 size = GPMC_SIZE_256M; +	u32 base = CONFIG_SYS_NAND_BASE; +#else +	const u32 gpmc_regs[GPMC_MAX_REG] = { 0, 0, 0, 0, 0, 0, 0 };  	u32 size = 0; +	u32 base = 0;  #endif  	/* global settings */  	writel(0x00000008, &gpmc_cfg->sysconfig); @@ -81,12 +93,6 @@ void gpmc_init(void)  	 */  	writel(0, &gpmc_cfg->cs[0].config7);  	sdelay(1000); - -#ifdef CONFIG_CMD_NAND -	gpmc_config = gpmc_m_nand; - -	base = PISMO1_NAND_BASE; -	size = PISMO1_NAND_SIZE; -	enable_gpmc_cs_config(gpmc_config, &gpmc_cfg->cs[0], base, size); -#endif +	/* enable chip-select specific configurations */ +	enable_gpmc_cs_config(gpmc_regs, &gpmc_cfg->cs[0], base, size);  } diff --git a/arch/arm/include/asm/arch-am33xx/mem.h b/arch/arm/include/asm/arch-am33xx/mem.h index 983ea28dc..e7e8c58b0 100644 --- a/arch/arm/include/asm/arch-am33xx/mem.h +++ b/arch/arm/include/asm/arch-am33xx/mem.h @@ -68,9 +68,4 @@  #define PISMO2_NAND_CS0		7  #define PISMO2_NAND_CS1		8 -/* make it readable for the gpmc_init */ -#define PISMO1_NOR_BASE	FLASH_BASE -#define PISMO1_NAND_BASE	CONFIG_SYS_NAND_BASE -#define PISMO1_NAND_SIZE	GPMC_SIZE_256M -  #endif /* endif _MEM_H_ */ diff --git a/arch/arm/include/asm/arch-am33xx/elm.h b/arch/arm/include/asm/omap_elm.h index 45454eaf0..45454eaf0 100644 --- a/arch/arm/include/asm/arch-am33xx/elm.h +++ b/arch/arm/include/asm/omap_elm.h diff --git a/arch/arm/include/asm/omap_gpmc.h b/arch/arm/include/asm/omap_gpmc.h index dd40cb6c1..d4143ecd8 100644 --- a/arch/arm/include/asm/omap_gpmc.h +++ b/arch/arm/include/asm/omap_gpmc.h @@ -68,4 +68,20 @@  }  #endif +enum omap_ecc { +	/* 1-bit  ECC calculation by Software, Error detection by Software */ +	OMAP_ECC_HAM1_CODE_SW = 1, /* avoid un-initialized int can be 0x0 */ +	/* 1-bit  ECC calculation by GPMC, Error detection by Software */ +	/* ECC layout compatible to legacy ROMCODE. */ +	OMAP_ECC_HAM1_CODE_HW, +	/* 4-bit  ECC calculation by GPMC, Error detection by Software */ +	OMAP_ECC_BCH4_CODE_HW_DETECTION_SW, +	/* 4-bit  ECC calculation by GPMC, Error detection by ELM */ +	OMAP_ECC_BCH4_CODE_HW, +	/* 8-bit  ECC calculation by GPMC, Error detection by Software */ +	OMAP_ECC_BCH8_CODE_HW_DETECTION_SW, +	/* 8-bit  ECC calculation by GPMC, Error detection by ELM */ +	OMAP_ECC_BCH8_CODE_HW, +}; +  #endif /* __ASM_OMAP_GPMC_H */ diff --git a/arch/blackfin/cpu/os_log.c b/arch/blackfin/cpu/os_log.c index e1c8e2948..2092d9e3b 100644 --- a/arch/blackfin/cpu/os_log.c +++ b/arch/blackfin/cpu/os_log.c @@ -12,12 +12,12 @@  #define OS_LOG_MAGIC_ADDR  ((unsigned long *)0x4f0)  #define OS_LOG_PTR_ADDR    ((char **)0x4f4) -bool bfin_os_log_check(void) +int bfin_os_log_check(void)  {  	if (*OS_LOG_MAGIC_ADDR != OS_LOG_MAGIC) -		return false; +		return 0;  	*OS_LOG_MAGIC_ADDR = 0; -	return true; +	return 1;  }  void bfin_os_log_dump(void) diff --git a/arch/blackfin/include/asm/blackfin_local.h b/arch/blackfin/include/asm/blackfin_local.h index ab31dcb81..8ea8cde69 100644 --- a/arch/blackfin/include/asm/blackfin_local.h +++ b/arch/blackfin/include/asm/blackfin_local.h @@ -51,7 +51,7 @@ extern u_long get_dclk(void);  # define bfin_revid() (bfin_read_CHIPID() >> 28) -extern bool bfin_os_log_check(void); +extern int bfin_os_log_check(void);  extern void bfin_os_log_dump(void);  extern void blackfin_icache_flush_range(const void *, const void *); diff --git a/arch/sandbox/cpu/Makefile b/arch/sandbox/cpu/Makefile index 404ff6793..58c253776 100644 --- a/arch/sandbox/cpu/Makefile +++ b/arch/sandbox/cpu/Makefile @@ -10,5 +10,7 @@  obj-y	:= cpu.o os.o start.o state.o  # os.c is build in the system environment, so needs standard includes -$(obj)os.o: ALL_CFLAGS := $(filter-out -nostdinc,$(ALL_CFLAGS)) -$(obj).depend.os: CPPFLAGS := $(filter-out -nostdinc,$(CPPFLAGS)) +$(obj)os.o: ALL_CFLAGS := $(BASE_CPPFLAGS) \ +	$(patsubst %, -idirafter %, $(BASE_INCLUDE_DIRS)) +$(obj).depend.os: CPPFLAGS := $(BASE_CPPFLAGS) \ +	$(patsubst %, -idirafter %, $(BASE_INCLUDE_DIRS)) diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index c2e5f5719..db66fd31f 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -8,6 +8,7 @@  #include <fcntl.h>  #include <getopt.h>  #include <stdio.h> +#include <stdint.h>  #include <stdlib.h>  #include <string.h>  #include <termios.h> @@ -136,7 +137,7 @@ void os_usleep(unsigned long usec)  	usleep(usec);  } -u64 __attribute__((no_instrument_function)) os_get_nsec(void) +uint64_t __attribute__((no_instrument_function)) os_get_nsec(void)  {  #if defined(CLOCK_MONOTONIC) && defined(_POSIX_MONOTONIC_CLOCK)  	struct timespec tp; diff --git a/arch/sandbox/include/asm/io.h b/arch/sandbox/include/asm/io.h index 9ac6a5f00..795604117 100644 --- a/arch/sandbox/include/asm/io.h +++ b/arch/sandbox/include/asm/io.h @@ -38,6 +38,6 @@ static inline void unmap_sysmem(const void *vaddr)  }  /* Map from a pointer to our RAM buffer */ -phys_addr_t map_to_sysmem(void *ptr); +phys_addr_t map_to_sysmem(const void *ptr);  #endif diff --git a/arch/sandbox/include/asm/types.h b/arch/sandbox/include/asm/types.h index 88c84bae7..6d3eb1f3d 100644 --- a/arch/sandbox/include/asm/types.h +++ b/arch/sandbox/include/asm/types.h @@ -48,8 +48,8 @@ typedef unsigned long long u64;  #define BITS_PER_LONG	CONFIG_SANDBOX_BITS_PER_LONG  typedef unsigned long dma_addr_t; -typedef unsigned long phys_addr_t; -typedef unsigned long phys_size_t; +typedef u32 phys_addr_t; +typedef u32 phys_size_t;  #endif /* __KERNEL__ */ diff --git a/arch/sparc/cpu/leon3/start.S b/arch/sparc/cpu/leon3/start.S index bbc1b3476..cf897f687 100644 --- a/arch/sparc/cpu/leon3/start.S +++ b/arch/sparc/cpu/leon3/start.S @@ -1,33 +1,41 @@ -#include <config.h> - -TRAP ta 0; nop; nop; nop; - -/* Software trap. Treat as BAD_TRAP for the time being... */ -#define SOFT_TRAP TRAP(_hwerr) - -#define PSR_INIT   0x1FC0	/* Disable traps, set s and ps */ -#define WIM_INIT   2 - -/* All traps low-level code here must end with this macro. */ -#define RESTORE_ALL b ret_trap_entry; clr %l6; +/* This is where the SPARC/LEON3 starts + * Copyright (C) 2007, + * Daniel Hellstrom, daniel@gaisler.com + * + * See file CREDITS for list of people who contributed to this + * project. + * + * SPDX-License-Identifier:	GPL-2.0+ + */ -#define WRITE_PAUSE nop;nop;nop +#include <asm-offsets.h> +#include <config.h> +#include <asm/asmmacro.h> +#include <asm/winmacro.h> +#include <asm/psr.h> +#include <asm/stack.h> +#include <asm/leon.h> +#include <version.h> -WINDOWSIZE = (16 * 4) -ARGPUSHSIZE = (6 * 4) -ARGPUSH = (WINDOWSIZE + 4) -MINFRAME = (WINDOWSIZE + ARGPUSHSIZE + 4) +/* Entry for traps which jump to a programmer-specified trap handler.  */ +#define TRAPR(H)  \ +	wr	%g0, 0xfe0, %psr; \ +	mov	%g0, %tbr; \ +	ba	(H); \ +	mov	%g0, %wim; -/* Number of register windows */ -#ifndef CONFIG_SYS_SPARC_NWINDOWS -#error Must define number of SPARC register windows, default is 8 -#endif +#define TRAP(H) \ +	mov	%psr, %l0; \ +	ba	(H); \ +	nop; nop; -#define STACK_ALIGN	8 -#define SA(X)	(((X)+(STACK_ALIGN-1)) & ~(STACK_ALIGN-1)) +#define TRAPI(ilevel) \ +	mov	ilevel, %l7; \ +	mov	%psr, %l0; \ +	b	_irq_entry; \ +	mov	%wim, %l3 -	.section ".start", "ax" -	.globl	_starttate */ +/* Unexcpected trap will halt the processor by forcing it to error state */  #undef BAD_TRAP  #define BAD_TRAP ta 0; nop; nop; nop; diff --git a/board/atmel/sama5d3xek/sama5d3xek.c b/board/atmel/sama5d3xek/sama5d3xek.c index b0965ef21..83fd63f54 100644 --- a/board/atmel/sama5d3xek/sama5d3xek.c +++ b/board/atmel/sama5d3xek/sama5d3xek.c @@ -131,7 +131,8 @@ static void sama5d3xek_lcd_hw_init(void)  void lcd_show_board_info(void)  { -	ulong dram_size, nand_size; +	ulong dram_size; +	uint64_t nand_size;  	int i;  	char temp[32]; @@ -150,7 +151,7 @@ void lcd_show_board_info(void)  	for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++)  		nand_size += nand_info[i].size;  #endif -	lcd_printf("%ld MB SDRAM, %ld MB NAND\n", +	lcd_printf("%ld MB SDRAM, %lld MB NAND\n",  		   dram_size >> 20, nand_size >> 20);  }  #endif /* CONFIG_LCD_INFO */ diff --git a/board/h2200/Makefile b/board/h2200/Makefile index b654a96e0..d4fa15344 100644 --- a/board/h2200/Makefile +++ b/board/h2200/Makefile @@ -10,8 +10,5 @@ obj-y	:= h2200.o  extra-y := h2200-header.bin -$(obj)h2200-header.o: h2200-header.S -	$(CC) $(CFLAGS) -c -o $@ $< -  $(obj)h2200-header.bin: $(obj)h2200-header.o  	$(OBJCOPY) -O binary $< $@ diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c index 8edd21b11..db225ce1d 100644 --- a/board/ti/am335x/board.c +++ b/board/ti/am335x/board.c @@ -481,26 +481,14 @@ void sdram_init(void)   */  int board_init(void)  { -#ifdef CONFIG_NOR -	const u32 gpmc_nor[GPMC_MAX_REG] = { STNOR_GPMC_CONFIG1, -		STNOR_GPMC_CONFIG2, STNOR_GPMC_CONFIG3, STNOR_GPMC_CONFIG4, -		STNOR_GPMC_CONFIG5, STNOR_GPMC_CONFIG6, STNOR_GPMC_CONFIG7 }; -#endif -  #if defined(CONFIG_HW_WATCHDOG)  	hw_watchdog_init();  #endif  	gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; - +#if defined(CONFIG_NOR) || defined(CONFIG_NAND)  	gpmc_init(); - -#ifdef CONFIG_NOR -	/* Reconfigure CS0 for NOR instead of NAND. */ -	enable_gpmc_cs_config(gpmc_nor, &gpmc_cfg->cs[0], -			      CONFIG_SYS_FLASH_BASE, GPMC_SIZE_16M);  #endif -  	return 0;  } diff --git a/board/tqc/tqm5200/Makefile b/board/tqc/tqm5200/Makefile index 757f4729a..80c1eba87 100644 --- a/board/tqc/tqm5200/Makefile +++ b/board/tqc/tqm5200/Makefile @@ -6,6 +6,3 @@  #  obj-y	:= tqm5200.o cmd_stk52xx.o cmd_tb5200.o cam5200_flash.o - -$(obj)cam5200_flash.o:	cam5200_flash.c -	$(CC) $(CFLAGS) -c -o $@ $< diff --git a/common/Makefile b/common/Makefile index 32acbf935..74404beb3 100644 --- a/common/Makefile +++ b/common/Makefile @@ -232,14 +232,11 @@ obj-y += stdio.o  CPPFLAGS += -I.. -$(obj)env_embedded.o: $(src)env_embedded.c $(obj)../tools/envcrc +$(obj)env_embedded.o: $(src)env_embedded.c  	$(CC) $(AFLAGS) -Wa,--no-warn \  		-DENV_CRC=$(shell $(obj)../tools/envcrc) \  		-c -o $@ $(src)env_embedded.c -$(obj)../tools/envcrc: -	$(MAKE) -C ../tools -  # SEE README.arm-unaligned-accesses  $(obj)hush.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)  $(obj)fdt_support.o: CFLAGS += $(PLATFORM_NO_UNALIGNED) diff --git a/common/cmd_mdio.c b/common/cmd_mdio.c index 65a1f10a9..fb13d0507 100644 --- a/common/cmd_mdio.c +++ b/common/cmd_mdio.c @@ -41,9 +41,11 @@ static int extract_range(char *input, int *plo, int *phi)  	return 0;  } -static int mdio_write_ranges(struct mii_dev *bus, int addrlo, +static int mdio_write_ranges(struct phy_device *phydev, struct mii_dev *bus, +			     int addrlo,  			     int addrhi, int devadlo, int devadhi, -			     int reglo, int reghi, unsigned short data) +			     int reglo, int reghi, unsigned short data, +			     int extended)  {  	int addr, devad, reg;  	int err = 0; @@ -51,7 +53,12 @@ static int mdio_write_ranges(struct mii_dev *bus, int addrlo,  	for (addr = addrlo; addr <= addrhi; addr++) {  		for (devad = devadlo; devad <= devadhi; devad++) {  			for (reg = reglo; reg <= reghi; reg++) { -				err = bus->write(bus, addr, devad, reg, data); +				if (!extended) +					err = bus->write(bus, addr, devad, +							 reg, data); +				else +					err = phydev->drv->writeext(phydev, +							addr, devad, reg, data);  				if (err)  					goto err_out; @@ -63,9 +70,10 @@ err_out:  	return err;  } -static int mdio_read_ranges(struct mii_dev *bus, int addrlo, +static int mdio_read_ranges(struct phy_device *phydev, struct mii_dev *bus, +			    int addrlo,  			    int addrhi, int devadlo, int devadhi, -			    int reglo, int reghi) +			    int reglo, int reghi, int extended)  {  	int addr, devad, reg; @@ -77,7 +85,12 @@ static int mdio_read_ranges(struct mii_dev *bus, int addrlo,  			for (reg = reglo; reg <= reghi; reg++) {  				int val; -				val = bus->read(bus, addr, devad, reg); +				if (!extended) +					val = bus->read(bus, addr, devad, reg); +				else +					val = phydev->drv->readext(phydev, addr, +						devad, reg); +  				if (val < 0) {  					printf("Error\n"); @@ -126,9 +139,10 @@ static int extract_reg_range(char *input, int *devadlo, int *devadhi,  }  static int extract_phy_range(char *const argv[], int argc, struct mii_dev **bus, +			     struct phy_device **phydev,  			     int *addrlo, int *addrhi)  { -	struct phy_device *phydev; +	struct phy_device *dev = *phydev;  	if ((argc < 1) || (argc > 2))  		return -1; @@ -154,11 +168,11 @@ static int extract_phy_range(char *const argv[], int argc, struct mii_dev **bus,  	 * device by the given name.  If none are found, we call  	 * extract_range() on the string, and see if it's an address range.  	 */ -	phydev = mdio_phydev_for_ethname(argv[0]); +	dev = mdio_phydev_for_ethname(argv[0]); -	if (phydev) { -		*addrlo = *addrhi = phydev->addr; -		*bus = phydev->bus; +	if (dev) { +		*addrlo = *addrhi = dev->addr; +		*bus = dev->bus;  		return 0;  	} @@ -175,6 +189,8 @@ static int do_mdio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])  	unsigned short	data;  	int pos = argc - 1;  	struct mii_dev *bus; +	struct phy_device *phydev = NULL; +	int extended = 0;  	if (argc < 2)  		return CMD_RET_USAGE; @@ -197,6 +213,29 @@ static int do_mdio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])  	if (flag & CMD_FLAG_REPEAT)  		op[0] = last_op[0]; +	if (strlen(argv[1]) > 1) { +		op[1] = argv[1][1]; +		if (op[1] == 'x') { +			phydev = mdio_phydev_for_ethname(argv[2]); + +			if (phydev) { +				addrlo = phydev->addr; +				addrhi = addrlo; +				bus = phydev->bus; +				extended = 1; +			} else { +				return -1; +			} + +			if (!phydev->drv || +			    (!phydev->drv->writeext && (op[0] == 'w')) || +			    (!phydev->drv->readext && (op[0] == 'r'))) { +				puts("PHY does not have extended functions\n"); +				return -1; +			} +		} +	} +  	switch (op[0]) {  	case 'w':  		if (pos > 1) @@ -210,7 +249,7 @@ static int do_mdio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])  	default:  		if (pos > 1)  			if (extract_phy_range(&(argv[2]), pos - 1, &bus, -					&addrlo, &addrhi)) +					&phydev, &addrlo, &addrhi))  				return -1;  		break; @@ -227,13 +266,13 @@ static int do_mdio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])  	switch (op[0]) {  	case 'w': -		mdio_write_ranges(bus, addrlo, addrhi, devadlo, devadhi, -				reglo, reghi, data); +		mdio_write_ranges(phydev, bus, addrlo, addrhi, devadlo, devadhi, +				  reglo, reghi, data, extended);  		break;  	case 'r': -		mdio_read_ranges(bus, addrlo, addrhi, devadlo, devadhi, -				reglo, reghi); +		mdio_read_ranges(phydev, bus, addrlo, addrhi, devadlo, devadhi, +				 reglo, reghi, extended);  		break;  	} @@ -262,6 +301,10 @@ U_BOOT_CMD(  		"read PHY's register at <devad>.<reg>\n"  	"mdio write <phydev> [<devad>.]<reg> <data> - "  		"write PHY's register at <devad>.<reg>\n" +	"mdio rx <phydev> [<devad>.]<reg> - " +		"read PHY's extended register at <devad>.<reg>\n" +	"mdio wx <phydev> [<devad>.]<reg> <data> - " +		"write PHY's extended register at <devad>.<reg>\n"  	"<phydev> may be:\n"  	"   <busname>  <addr>\n"  	"   <addr>\n" diff --git a/common/cmd_mii.c b/common/cmd_mii.c index d3dd6b1c9..b82a7ce61 100644 --- a/common/cmd_mii.c +++ b/common/cmd_mii.c @@ -78,9 +78,9 @@ static const MII_field_desc_t reg_3_desc_tbl[] = {  static const MII_field_desc_t reg_4_desc_tbl[] = {  	{ 15, 15, 0x01, "next page able"               }, -	{ 14, 14, 0x01, "reserved"                     }, +	{ 14, 14, 0x01, "(reserved)"                   },  	{ 13, 13, 0x01, "remote fault"                 }, -	{ 12, 12, 0x01, "reserved"                     }, +	{ 12, 12, 0x01, "(reserved)"                   },  	{ 11, 11, 0x01, "asymmetric pause"             },  	{ 10, 10, 0x01, "pause enable"                 },  	{  9,  9, 0x01, "100BASE-T4 able"              }, diff --git a/common/hash.c b/common/hash.c index 722c40b3f..872cd8542 100644 --- a/common/hash.c +++ b/common/hash.c @@ -325,8 +325,8 @@ int hash_command(const char *algo_name, int flags, cmd_tbl_t *cmdtp, int flag,  		printf("CRC32 for %08lx ... %08lx ==> %08lx\n",  				addr, addr + len - 1, crc); -		if (argc > 3) { -			ptr = (ulong *)simple_strtoul(argv[3], NULL, 16); +		if (argc >= 3) { +			ptr = (ulong *)simple_strtoul(argv[0], NULL, 16);  			*ptr = crc;  		}  	} @@ -250,11 +250,16 @@ Please undefined CONFIG_SYS_GENERIC_BOARD in your board config file)  endif  endif +# Sandbox needs the base flags and includes, so keep them around +BASE_CPPFLAGS := $(CPPFLAGS) +  ifneq ($(OBJTREE),$(SRCTREE)) -CPPFLAGS += -I$(OBJTREE)/include +BASE_INCLUDE_DIRS := $(OBJTREE)/include  endif -CPPFLAGS += -I$(TOPDIR)/include -I$(SRCTREE)/arch/$(ARCH)/include +BASE_INCLUDE_DIRS += $(TOPDIR)/include $(SRCTREE)/arch/$(ARCH)/include + +CPPFLAGS += $(patsubst %, -I%, $(BASE_INCLUDE_DIRS))  CPPFLAGS += -fno-builtin -ffreestanding -nostdinc	\  	-isystem $(gccincdir) -pipe $(PLATFORM_CPPFLAGS) diff --git a/doc/README.nand b/doc/README.nand index 913e9b50b..b91f1985d 100644 --- a/doc/README.nand +++ b/doc/README.nand @@ -104,6 +104,16 @@ Configuration Options:     CONFIG_SYS_MAX_NAND_DEVICE        The maximum number of NAND devices you want to support. +   CONFIG_SYS_NAND_MAX_ECCPOS +      If specified, overrides the maximum number of ECC bytes +      supported.  Useful for reducing image size, especially with SPL. +      This must be at least 48 if nand_base.c is used. + +   CONFIG_SYS_NAND_MAX_OOBFREE +      If specified, overrides the maximum number of free OOB regions +      supported.  Useful for reducing image size, especially with SPL. +      This must be at least 2 if nand_base.c is used. +     CONFIG_SYS_NAND_MAX_CHIPS        The maximum number of NAND chips per device to be supported. @@ -169,6 +179,59 @@ Configuration Options:        Please convert your driver even if you don't need the extra        flexibility, so that one day we can eliminate the old mechanism. + +   CONFIG_SYS_NAND_ONFI_DETECTION +	Enables detection of ONFI compliant devices during probe. +	And fetching device parameters flashed on device, by parsing +	ONFI parameter page. + +   CONFIG_BCH +	Enables software based BCH ECC algorithm present in lib/bch.c +	This is used by SoC platforms which do not have built-in ELM +	hardware engine required for BCH ECC correction. + + +Platform specific options +========================= +   CONFIG_NAND_OMAP_GPMC +	Enables omap_gpmc.c driver for OMAPx and AMxxxx platforms. +	GPMC controller is used for parallel NAND flash devices, and can +	do ECC calculation (not ECC error detection) for HAM1, BCH4, BCH8 +	and BCH16 ECC algorithms. + +   CONFIG_NAND_OMAP_ELM +	Enables omap_elm.c driver for OMAPx and AMxxxx platforms. +	ELM controller is used for ECC error detection (not ECC calculation) +	of BCH4, BCH8 and BCH16 ECC algorithms. +	Some legacy platforms like OMAP3xx do not have in-built ELM h/w engine, +	thus such SoC platforms need to depend on software library for ECC error +	detection. However ECC calculation on such plaforms would still be +	done by GPMC controller. + +   CONFIG_NAND_OMAP_ECCSCHEME +	On OMAP platforms, this CONFIG specifies NAND ECC scheme. +	It can take following values: +	OMAP_ECC_HAM1_CODE_SW +		1-bit Hamming code using software lib. +		(for legacy devices only) +	OMAP_ECC_HAM1_CODE_HW +		1-bit Hamming code using GPMC hardware. +		(for legacy devices only) +	OMAP_ECC_BCH4_CODE_HW_DETECTION_SW +		4-bit BCH code (unsupported) +	OMAP_ECC_BCH4_CODE_HW +		4-bit BCH code (unsupported) +	OMAP_ECC_BCH8_CODE_HW_DETECTION_SW +		8-bit BCH code with +		- ecc calculation using GPMC hardware engine, +		- error detection using software library. +		- requires CONFIG_BCH to enable software BCH library +		(For legacy device which do not have ELM h/w engine) +	OMAP_ECC_BCH8_CODE_HW +		8-bit BCH code with +		- ecc calculation using GPMC hardware engine, +		- error detection using ELM hardware engine. +  NOTE:  ===== diff --git a/doc/README.omap3 b/doc/README.omap3 index 1fbe79db3..a62c35740 100644 --- a/doc/README.omap3 +++ b/doc/README.omap3 @@ -161,8 +161,7 @@ BCH8  To enable hardware assisted BCH8 (8-bit BCH [Bose, Chaudhuri, Hocquenghem]) on  OMAP3 devices we can use the BCH library in lib/bch.c. To do so add CONFIG_BCH -to enable the library and CONFIG_NAND_OMAP_BCH8 to to enable hardware assisted -syndrom generation to your board config. +and set CONFIG_NAND_OMAP_ECCSCHEME=5 (refer README.nand) for selecting BCH8_SW.  The NAND OOB layout is the same as in linux kernel, if the linux kernel BCH8  implementation for OMAP3 works for you so the u-boot version should also.  When you require the SPL to read with BCH8 there are two more configs to diff --git a/drivers/bios_emulator/Makefile b/drivers/bios_emulator/Makefile index 6f74fdc23..52a2ceb47 100644 --- a/drivers/bios_emulator/Makefile +++ b/drivers/bios_emulator/Makefile @@ -8,9 +8,8 @@ obj-y = atibios.o biosemu.o besys.o bios.o \  	$(X86DIR)/sys.o \  	$(X86DIR)/debug.o -EXTRA_CFLAGS += -I. -I./include -I$(TOPDIR)/include \ +EXTRA_CFLAGS += -I. -I./include \  	-D__PPC__  -D__BIG_ENDIAN__  CFLAGS += $(EXTRA_CFLAGS) -HOSTCFLAGS += $(EXTRA_CFLAGS)  CPPFLAGS += $(EXTRA_CFLAGS) diff --git a/drivers/misc/fsl_ifc.c b/drivers/misc/fsl_ifc.c index 507c4de52..be6197366 100644 --- a/drivers/misc/fsl_ifc.c +++ b/drivers/misc/fsl_ifc.c @@ -34,6 +34,9 @@ void init_early_memctl_regs(void)  #ifdef CONFIG_SYS_CSPR0_EXT  	set_ifc_cspr_ext(IFC_CS0, CONFIG_SYS_CSPR0_EXT);  #endif +#ifdef CONFIG_SYS_CSOR0_EXT +	set_ifc_csor_ext(IFC_CS0, CONFIG_SYS_CSOR0_EXT); +#endif  	set_ifc_cspr(IFC_CS0, CONFIG_SYS_CSPR0);  	set_ifc_amask(IFC_CS0, CONFIG_SYS_AMASK0);  	set_ifc_csor(IFC_CS0, CONFIG_SYS_CSOR0); @@ -43,6 +46,9 @@ void init_early_memctl_regs(void)  #ifdef CONFIG_SYS_CSPR1_EXT  	set_ifc_cspr_ext(IFC_CS1, CONFIG_SYS_CSPR1_EXT);  #endif +#ifdef CONFIG_SYS_CSOR1_EXT +	set_ifc_csor_ext(IFC_CS1, CONFIG_SYS_CSOR1_EXT); +#endif  #if defined(CONFIG_SYS_CSPR1) && defined(CONFIG_SYS_CSOR1)  	set_ifc_ftim(IFC_CS1, IFC_FTIM0, CONFIG_SYS_CS1_FTIM0);  	set_ifc_ftim(IFC_CS1, IFC_FTIM1, CONFIG_SYS_CS1_FTIM1); @@ -57,6 +63,9 @@ void init_early_memctl_regs(void)  #ifdef CONFIG_SYS_CSPR2_EXT  	set_ifc_cspr_ext(IFC_CS2, CONFIG_SYS_CSPR2_EXT);  #endif +#ifdef CONFIG_SYS_CSOR2_EXT +	set_ifc_csor_ext(IFC_CS2, CONFIG_SYS_CSOR2_EXT); +#endif  #if defined(CONFIG_SYS_CSPR2) && defined(CONFIG_SYS_CSOR2)  	set_ifc_ftim(IFC_CS2, IFC_FTIM0, CONFIG_SYS_CS2_FTIM0);  	set_ifc_ftim(IFC_CS2, IFC_FTIM1, CONFIG_SYS_CS2_FTIM1); @@ -71,6 +80,9 @@ void init_early_memctl_regs(void)  #ifdef CONFIG_SYS_CSPR3_EXT  	set_ifc_cspr_ext(IFC_CS3, CONFIG_SYS_CSPR3_EXT);  #endif +#ifdef CONFIG_SYS_CSOR3_EXT +	set_ifc_csor_ext(IFC_CS3, CONFIG_SYS_CSOR3_EXT); +#endif  #if defined(CONFIG_SYS_CSPR3) && defined(CONFIG_SYS_CSOR3)  	set_ifc_ftim(IFC_CS3, IFC_FTIM0, CONFIG_SYS_CS3_FTIM0);  	set_ifc_ftim(IFC_CS3, IFC_FTIM1, CONFIG_SYS_CS3_FTIM1); @@ -85,6 +97,9 @@ void init_early_memctl_regs(void)  #ifdef CONFIG_SYS_CSPR4_EXT  	set_ifc_cspr_ext(IFC_CS4, CONFIG_SYS_CSPR4_EXT);  #endif +#ifdef CONFIG_SYS_CSOR4_EXT +	set_ifc_csor_ext(IFC_CS4, CONFIG_SYS_CSOR4_EXT); +#endif  #if defined(CONFIG_SYS_CSPR4) && defined(CONFIG_SYS_CSOR4)  	set_ifc_ftim(IFC_CS4, IFC_FTIM0, CONFIG_SYS_CS4_FTIM0);  	set_ifc_ftim(IFC_CS4, IFC_FTIM1, CONFIG_SYS_CS4_FTIM1); @@ -99,6 +114,9 @@ void init_early_memctl_regs(void)  #ifdef CONFIG_SYS_CSPR5_EXT  	set_ifc_cspr_ext(IFC_CS5, CONFIG_SYS_CSPR5_EXT);  #endif +#ifdef CONFIG_SYS_CSOR5_EXT +	set_ifc_csor_ext(IFC_CS5, CONFIG_SYS_CSOR5_EXT); +#endif  #if defined(CONFIG_SYS_CSPR5) && defined(CONFIG_SYS_CSOR5)  	set_ifc_ftim(IFC_CS5, IFC_FTIM0, CONFIG_SYS_CS5_FTIM0);  	set_ifc_ftim(IFC_CS5, IFC_FTIM1, CONFIG_SYS_CS5_FTIM1); @@ -113,6 +131,9 @@ void init_early_memctl_regs(void)  #ifdef CONFIG_SYS_CSPR6_EXT  	set_ifc_cspr_ext(IFC_CS6, CONFIG_SYS_CSPR6_EXT);  #endif +#ifdef CONFIG_SYS_CSOR6_EXT +	set_ifc_csor_ext(IFC_CS6, CONFIG_SYS_CSOR6_EXT); +#endif  #if defined(CONFIG_SYS_CSPR6) && defined(CONFIG_SYS_CSOR6)  	set_ifc_ftim(IFC_CS6, IFC_FTIM0, CONFIG_SYS_CS6_FTIM0);  	set_ifc_ftim(IFC_CS6, IFC_FTIM1, CONFIG_SYS_CS6_FTIM1); @@ -127,6 +148,9 @@ void init_early_memctl_regs(void)  #ifdef CONFIG_SYS_CSPR7_EXT  	set_ifc_cspr_ext(IFC_CS7, CONFIG_SYS_CSPR7_EXT);  #endif +#ifdef CONFIG_SYS_CSOR7_EXT +	set_ifc_csor_ext(IFC_CS7, CONFIG_SYS_CSOR7_EXT); +#endif  #if defined(CONFIG_SYS_CSPR7) && defined(CONFIG_SYS_CSOR7)  	set_ifc_ftim(IFC_CS7, IFC_FTIM0, CONFIG_SYS_CS7_FTIM0);  	set_ifc_ftim(IFC_CS7, IFC_FTIM1, CONFIG_SYS_CS7_FTIM1); diff --git a/drivers/misc/gpio_led.c b/drivers/misc/gpio_led.c index 3fedddc8b..3e95727d7 100644 --- a/drivers/misc/gpio_led.c +++ b/drivers/misc/gpio_led.c @@ -9,15 +9,42 @@  #include <status_led.h>  #include <asm/gpio.h> +#ifndef CONFIG_GPIO_LED_INVERTED_TABLE +#define CONFIG_GPIO_LED_INVERTED_TABLE {} +#endif + +static led_id_t gpio_led_inv[] = CONFIG_GPIO_LED_INVERTED_TABLE; + +static int gpio_led_gpio_value(led_id_t mask, int state) +{ +	int i, gpio_value = (state == STATUS_LED_ON); + +	for (i = 0; i < ARRAY_SIZE(gpio_led_inv); i++) { +		if (gpio_led_inv[i] == mask) +			gpio_value = !gpio_value; +	} + +	return gpio_value; +} +  void __led_init(led_id_t mask, int state)  { -	gpio_request(mask, "gpio_led"); -	gpio_direction_output(mask, state == STATUS_LED_ON); +	int gpio_value; + +	if (gpio_request(mask, "gpio_led") != 0) { +		printf("%s: failed requesting GPIO%lu!\n", __func__, mask); +		return; +	} + +	gpio_value = gpio_led_gpio_value(mask, state); +	gpio_direction_output(mask, gpio_value);  }  void __led_set(led_id_t mask, int state)  { -	gpio_set_value(mask, state == STATUS_LED_ON); +	int gpio_value = gpio_led_gpio_value(mask, state); + +	gpio_set_value(mask, gpio_value);  }  void __led_toggle(led_id_t mask) diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile index eb1eafaf0..e145cd184 100644 --- a/drivers/mtd/nand/Makefile +++ b/drivers/mtd/nand/Makefile @@ -58,6 +58,7 @@ obj-$(CONFIG_NAND_S3C2410) += s3c2410_nand.o  obj-$(CONFIG_NAND_SPEAR) += spr_nand.o  obj-$(CONFIG_TEGRA_NAND) += tegra_nand.o  obj-$(CONFIG_NAND_OMAP_GPMC) += omap_gpmc.o +obj-$(CONFIG_NAND_OMAP_ELM) += omap_elm.o  obj-$(CONFIG_NAND_PLAT) += nand_plat.o  obj-$(CONFIG_NAND_DOCG4) += docg4.o diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c index da83f06e4..16b7df0f7 100644 --- a/drivers/mtd/nand/atmel_nand.c +++ b/drivers/mtd/nand/atmel_nand.c @@ -412,7 +412,7 @@ static int pmecc_err_location(struct mtd_info *mtd)  	}  	if (!timeout) { -		printk(KERN_ERR "atmel_nand : Timeout to calculate PMECC error location\n"); +		dev_err(host->dev, "atmel_nand : Timeout to calculate PMECC error location\n");  		return -1;  	} @@ -452,7 +452,7 @@ static void pmecc_correct_data(struct mtd_info *mtd, uint8_t *buf, uint8_t *ecc,  			*(buf + byte_pos) ^= (1 << bit_pos);  			pos = sector_num * host->pmecc_sector_size + byte_pos; -			printk(KERN_INFO "Bit flip in data area, byte_pos: %d, bit_pos: %d, 0x%02x -> 0x%02x\n", +			dev_dbg(host->dev, "Bit flip in data area, byte_pos: %d, bit_pos: %d, 0x%02x -> 0x%02x\n",  				pos, bit_pos, err_byte, *(buf + byte_pos));  		} else {  			/* Bit flip in OOB area */ @@ -462,7 +462,7 @@ static void pmecc_correct_data(struct mtd_info *mtd, uint8_t *buf, uint8_t *ecc,  			ecc[tmp] ^= (1 << bit_pos);  			pos = tmp + nand_chip->ecc.layout->eccpos[0]; -			printk(KERN_INFO "Bit flip in OOB, oob_byte_pos: %d, bit_pos: %d, 0x%02x -> 0x%02x\n", +			dev_dbg(host->dev, "Bit flip in OOB, oob_byte_pos: %d, bit_pos: %d, 0x%02x -> 0x%02x\n",  				pos, bit_pos, err_byte, ecc[tmp]);  		} @@ -500,7 +500,7 @@ normal_check:  			err_nbr = pmecc_err_location(mtd);  			if (err_nbr == -1) { -				printk(KERN_ERR "PMECC: Too many errors\n"); +				dev_err(host->dev, "PMECC: Too many errors\n");  				mtd->ecc_stats.failed++;  				return -EIO;  			} else { @@ -544,7 +544,7 @@ static int atmel_nand_pmecc_read_page(struct mtd_info *mtd,  	}  	if (!timeout) { -		printk(KERN_ERR "atmel_nand : Timeout to read PMECC page\n"); +		dev_err(host->dev, "atmel_nand : Timeout to read PMECC page\n");  		return -1;  	} @@ -584,7 +584,7 @@ static int atmel_nand_pmecc_write_page(struct mtd_info *mtd,  	}  	if (!timeout) { -		printk(KERN_ERR "atmel_nand : Timeout to read PMECC status, fail to write PMECC in oob\n"); +		dev_err(host->dev, "atmel_nand : Timeout to read PMECC status, fail to write PMECC in oob\n");  		goto out;  	} @@ -827,6 +827,7 @@ static int atmel_pmecc_nand_init_params(struct nand_chip *nand,  	switch (mtd->writesize) {  	case 2048:  	case 4096: +	case 8192:  		host->pmecc_degree = (sector_size == 512) ?  			PMECC_GF_DIMENSION_13 : PMECC_GF_DIMENSION_14;  		host->pmecc_cw_len = (1 << host->pmecc_degree) - 1; @@ -840,8 +841,15 @@ static int atmel_pmecc_nand_init_params(struct nand_chip *nand,  		nand->ecc.steps = 1;  		nand->ecc.bytes = host->pmecc_bytes_per_sector *  				       host->pmecc_sector_number; + +		if (nand->ecc.bytes > MTD_MAX_ECCPOS_ENTRIES_LARGE) { +			dev_err(host->dev, "too large eccpos entries. max support ecc.bytes is %d\n", +					MTD_MAX_ECCPOS_ENTRIES_LARGE); +			return -EINVAL; +		} +  		if (nand->ecc.bytes > mtd->oobsize - 2) { -			printk(KERN_ERR "No room for ECC bytes\n"); +			dev_err(host->dev, "No room for ECC bytes\n");  			return -EINVAL;  		}  		pmecc_config_ecc_layout(&atmel_pmecc_oobinfo, @@ -852,7 +860,7 @@ static int atmel_pmecc_nand_init_params(struct nand_chip *nand,  	case 512:  	case 1024:  		/* TODO */ -		printk(KERN_ERR "Unsupported page size for PMECC, use Software ECC\n"); +		dev_err(host->dev, "Unsupported page size for PMECC, use Software ECC\n");  	default:  		/* page size not handled by HW ECC */  		/* switching back to soft ECC */ @@ -1035,7 +1043,7 @@ static int atmel_nand_correct(struct mtd_info *mtd, u_char *dat,  		/* it doesn't seems to be a freshly  		 * erased block.  		 * We can't correct so many errors */ -		printk(KERN_WARNING "atmel_nand : multiple errors detected." +		dev_warn(host->dev, "atmel_nand : multiple errors detected."  				" Unable to correct.\n");  		return -EIO;  	} @@ -1045,12 +1053,12 @@ static int atmel_nand_correct(struct mtd_info *mtd, u_char *dat,  		/* there's nothing much to do here.  		 * the bit error is on the ECC itself.  		 */ -		printk(KERN_WARNING "atmel_nand : one bit error on ECC code." +		dev_warn(host->dev, "atmel_nand : one bit error on ECC code."  				" Nothing to correct\n");  		return 0;  	} -	printk(KERN_WARNING "atmel_nand : one bit error on data." +	dev_warn(host->dev, "atmel_nand : one bit error on data."  			" (word offset in the page :"  			" 0x%x bit offset : 0x%x)\n",  			ecc_word, ecc_bit); @@ -1062,7 +1070,7 @@ static int atmel_nand_correct(struct mtd_info *mtd, u_char *dat,  		/* 8 bits words */  		dat[ecc_word] ^= (1 << ecc_bit);  	} -	printk(KERN_WARNING "atmel_nand : error corrected\n"); +	dev_warn(host->dev, "atmel_nand : error corrected\n");  	return 1;  } @@ -1178,7 +1186,11 @@ int atmel_nand_chip_init(int devnum, ulong base_addr)  	mtd->priv = nand;  	nand->IO_ADDR_R = nand->IO_ADDR_W = (void  __iomem *)base_addr; +#ifdef CONFIG_NAND_ECC_BCH +	nand->ecc.mode = NAND_ECC_SOFT_BCH; +#else  	nand->ecc.mode = NAND_ECC_SOFT; +#endif  #ifdef CONFIG_SYS_NAND_DBW_16  	nand->options = NAND_BUSWIDTH_16;  #endif @@ -1186,7 +1198,7 @@ int atmel_nand_chip_init(int devnum, ulong base_addr)  #ifdef CONFIG_SYS_NAND_READY_PIN  	nand->dev_ready = at91_nand_ready;  #endif -	nand->chip_delay = 20; +	nand->chip_delay = 75;  	ret = nand_scan_ident(mtd, CONFIG_SYS_NAND_MAX_CHIPS, NULL);  	if (ret) @@ -1214,6 +1226,6 @@ void board_nand_init(void)  	int i;  	for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++)  		if (atmel_nand_chip_init(i, base_addr[i])) -			printk(KERN_ERR "atmel_nand: Fail to initialize #%d chip", +			dev_err(host->dev, "atmel_nand: Fail to initialize #%d chip",  				i);  } diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_nand.c index 3b845b9d6..1808a7ffb 100644 --- a/drivers/mtd/nand/fsl_ifc_nand.c +++ b/drivers/mtd/nand/fsl_ifc_nand.c @@ -125,6 +125,69 @@ static struct nand_ecclayout oob_4096_ecc8 = {  	.oobfree = { {2, 6}, {136, 82} },  }; +/* 8192-byte page size with 4-bit ECC */ +static struct nand_ecclayout oob_8192_ecc4 = { +	.eccbytes = 128, +	.eccpos = { +		8, 9, 10, 11, 12, 13, 14, 15, +		16, 17, 18, 19, 20, 21, 22, 23, +		24, 25, 26, 27, 28, 29, 30, 31, +		32, 33, 34, 35, 36, 37, 38, 39, +		40, 41, 42, 43, 44, 45, 46, 47, +		48, 49, 50, 51, 52, 53, 54, 55, +		56, 57, 58, 59, 60, 61, 62, 63, +		64, 65, 66, 67, 68, 69, 70, 71, +		72, 73, 74, 75, 76, 77, 78, 79, +		80, 81, 82, 83, 84, 85, 86, 87, +		88, 89, 90, 91, 92, 93, 94, 95, +		96, 97, 98, 99, 100, 101, 102, 103, +		104, 105, 106, 107, 108, 109, 110, 111, +		112, 113, 114, 115, 116, 117, 118, 119, +		120, 121, 122, 123, 124, 125, 126, 127, +		128, 129, 130, 131, 132, 133, 134, 135, +	}, +	.oobfree = { {2, 6}, {136, 208} }, +}; + +/* 8192-byte page size with 8-bit ECC -- requires 218-byte OOB */ +static struct nand_ecclayout oob_8192_ecc8 = { +	.eccbytes = 256, +	.eccpos = { +		8, 9, 10, 11, 12, 13, 14, 15, +		16, 17, 18, 19, 20, 21, 22, 23, +		24, 25, 26, 27, 28, 29, 30, 31, +		32, 33, 34, 35, 36, 37, 38, 39, +		40, 41, 42, 43, 44, 45, 46, 47, +		48, 49, 50, 51, 52, 53, 54, 55, +		56, 57, 58, 59, 60, 61, 62, 63, +		64, 65, 66, 67, 68, 69, 70, 71, +		72, 73, 74, 75, 76, 77, 78, 79, +		80, 81, 82, 83, 84, 85, 86, 87, +		88, 89, 90, 91, 92, 93, 94, 95, +		96, 97, 98, 99, 100, 101, 102, 103, +		104, 105, 106, 107, 108, 109, 110, 111, +		112, 113, 114, 115, 116, 117, 118, 119, +		120, 121, 122, 123, 124, 125, 126, 127, +		128, 129, 130, 131, 132, 133, 134, 135, +		136, 137, 138, 139, 140, 141, 142, 143, +		144, 145, 146, 147, 148, 149, 150, 151, +		152, 153, 154, 155, 156, 157, 158, 159, +		160, 161, 162, 163, 164, 165, 166, 167, +		168, 169, 170, 171, 172, 173, 174, 175, +		176, 177, 178, 179, 180, 181, 182, 183, +		184, 185, 186, 187, 188, 189, 190, 191, +		192, 193, 194, 195, 196, 197, 198, 199, +		200, 201, 202, 203, 204, 205, 206, 207, +		208, 209, 210, 211, 212, 213, 214, 215, +		216, 217, 218, 219, 220, 221, 222, 223, +		224, 225, 226, 227, 228, 229, 230, 231, +		232, 233, 234, 235, 236, 237, 238, 239, +		240, 241, 242, 243, 244, 245, 246, 247, +		248, 249, 250, 251, 252, 253, 254, 255, +		256, 257, 258, 259, 260, 261, 262, 263, +	}, +	.oobfree = { {2, 6}, {264, 80} }, +};  /*   * Generic flash bbt descriptors @@ -428,20 +491,27 @@ static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command,  		if (mtd->writesize > 512) {  			nand_fcr0 =  				(NAND_CMD_SEQIN << IFC_NAND_FCR0_CMD0_SHIFT) | -				(NAND_CMD_PAGEPROG << IFC_NAND_FCR0_CMD1_SHIFT); +				(NAND_CMD_STATUS << IFC_NAND_FCR0_CMD1_SHIFT) | +				(NAND_CMD_PAGEPROG << IFC_NAND_FCR0_CMD2_SHIFT);  			out_be32(&ifc->ifc_nand.nand_fir0,  				 (IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) |  				 (IFC_FIR_OP_CA0 << IFC_NAND_FIR0_OP1_SHIFT) |  				 (IFC_FIR_OP_RA0 << IFC_NAND_FIR0_OP2_SHIFT) |  				 (IFC_FIR_OP_WBCD  << IFC_NAND_FIR0_OP3_SHIFT) | -				 (IFC_FIR_OP_CW1 << IFC_NAND_FIR0_OP4_SHIFT)); -			out_be32(&ifc->ifc_nand.nand_fir1, 0); +				 (IFC_FIR_OP_CMD2 << IFC_NAND_FIR0_OP4_SHIFT)); +			out_be32(&ifc->ifc_nand.nand_fir1, +				 (IFC_FIR_OP_CW1 << IFC_NAND_FIR1_OP5_SHIFT) | +				 (IFC_FIR_OP_RDSTAT << +					IFC_NAND_FIR1_OP6_SHIFT) | +				 (IFC_FIR_OP_NOP << IFC_NAND_FIR1_OP7_SHIFT));  		} else {  			nand_fcr0 = ((NAND_CMD_PAGEPROG <<  					IFC_NAND_FCR0_CMD1_SHIFT) |  				    (NAND_CMD_SEQIN << -					IFC_NAND_FCR0_CMD2_SHIFT)); +					IFC_NAND_FCR0_CMD2_SHIFT) | +				    (NAND_CMD_STATUS << +					IFC_NAND_FCR0_CMD3_SHIFT));  			out_be32(&ifc->ifc_nand.nand_fir0,  				 (IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) | @@ -450,7 +520,11 @@ static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command,  				 (IFC_FIR_OP_RA0 << IFC_NAND_FIR0_OP3_SHIFT) |  				 (IFC_FIR_OP_WBCD << IFC_NAND_FIR0_OP4_SHIFT));  			out_be32(&ifc->ifc_nand.nand_fir1, -				 (IFC_FIR_OP_CW1 << IFC_NAND_FIR1_OP5_SHIFT)); +				 (IFC_FIR_OP_CMD1 << IFC_NAND_FIR1_OP5_SHIFT) | +				 (IFC_FIR_OP_CW3 << IFC_NAND_FIR1_OP6_SHIFT) | +				 (IFC_FIR_OP_RDSTAT << +					IFC_NAND_FIR1_OP7_SHIFT) | +				 (IFC_FIR_OP_NOP << IFC_NAND_FIR1_OP8_SHIFT));  			if (column >= mtd->writesize)  				nand_fcr0 |= @@ -902,6 +976,21 @@ static int fsl_ifc_chip_init(int devnum, u8 *addr)  		priv->bufnum_mask = 1;  		break; +	case CSOR_NAND_PGS_8K: +		if ((csor & CSOR_NAND_ECC_MODE_MASK) == +		    CSOR_NAND_ECC_MODE_4) { +			layout = &oob_8192_ecc4; +			nand->ecc.strength = 4; +		} else { +			layout = &oob_8192_ecc8; +			nand->ecc.strength = 8; +			nand->ecc.bytes = 16; +		} + +		priv->bufnum_mask = 0; +		break; + +  	default:  		printf("ifc nand: bad csor %#x: bad page size\n", csor);  		return -ENODEV; diff --git a/drivers/mtd/nand/fsl_ifc_spl.c b/drivers/mtd/nand/fsl_ifc_spl.c index 3c8278daf..9de327ba4 100644 --- a/drivers/mtd/nand/fsl_ifc_spl.c +++ b/drivers/mtd/nand/fsl_ifc_spl.c @@ -112,10 +112,13 @@ static void nand_load(unsigned int offs, int uboot_size, uchar *dst)  	port_size = (cspr & CSPR_PORT_SIZE_16) ? 16 : 8; -	if (csor & CSOR_NAND_PGS_4K) { +	if ((csor & CSOR_NAND_PGS_MASK) == CSOR_NAND_PGS_8K) { +		page_size = 8192; +		bufnum_mask = 0x0; +	} else if ((csor & CSOR_NAND_PGS_MASK) == CSOR_NAND_PGS_4K) {  		page_size = 4096;  		bufnum_mask = 0x1; -	} else if (csor & CSOR_NAND_PGS_2K) { +	} else if ((csor & CSOR_NAND_PGS_MASK) == CSOR_NAND_PGS_2K) {  		page_size = 2048;  		bufnum_mask = 0x3;  	} else { diff --git a/arch/arm/cpu/armv7/am33xx/elm.c b/drivers/mtd/nand/omap_elm.c index 8f1d6afdd..2aa7807f3 100644 --- a/arch/arm/cpu/armv7/am33xx/elm.c +++ b/drivers/mtd/nand/omap_elm.c @@ -18,7 +18,7 @@  #include <asm/errno.h>  #include <asm/arch/cpu.h>  #include <asm/omap_gpmc.h> -#include <asm/arch/elm.h> +#include <asm/omap_elm.h>  #define ELM_DEFAULT_POLY (0) @@ -127,7 +127,7 @@ int elm_check_error(u8 *syndrome, u32 nibbles, u32 *error_count,  	for (i = 0; i < *error_count; i++) {  		error_locations[i] = -			readl(&elm_cfg->error_location[poly].error_location_x[i]); +		     readl(&elm_cfg->error_location[poly].error_location_x[i]);  	}  	return 0; @@ -175,7 +175,7 @@ void elm_reset(void)  {  	/* initiate reset */  	writel((readl(&elm_cfg->sysconfig) | ELM_SYSCONFIG_SOFTRESET), -				&elm_cfg->sysconfig); +			&elm_cfg->sysconfig);  	/* wait for reset complete and normal operation */  	while ((readl(&elm_cfg->sysstatus) & ELM_SYSSTATUS_RESETDONE) != diff --git a/drivers/mtd/nand/omap_gpmc.c b/drivers/mtd/nand/omap_gpmc.c index ec1787f22..5e7e6b337 100644 --- a/drivers/mtd/nand/omap_gpmc.c +++ b/drivers/mtd/nand/omap_gpmc.c @@ -15,15 +15,13 @@  #include <linux/bch.h>  #include <linux/compiler.h>  #include <nand.h> -#ifdef CONFIG_AM33XX -#include <asm/arch/elm.h> -#endif +#include <asm/omap_elm.h> + +#define BADBLOCK_MARKER_LENGTH	2 +#define SECTOR_BYTES		512  static uint8_t cs; -static __maybe_unused struct nand_ecclayout hw_nand_oob = -	GPMC_NAND_HW_ECC_LAYOUT; -static __maybe_unused struct nand_ecclayout hw_bch8_nand_oob = -	GPMC_NAND_HW_BCH8_ECC_LAYOUT; +static __maybe_unused struct nand_ecclayout omap_ecclayout;  /*   * omap_nand_hwcontrol - Set the address pointers corretly for the @@ -233,6 +231,7 @@ struct nand_bch_priv {  	uint8_t type;  	uint8_t nibbles;  	struct bch_control *control; +	enum omap_ecc ecc_scheme;  };  /* bch types */ @@ -274,17 +273,15 @@ static void omap_hwecc_init_bch(struct nand_chip *chip, int32_t mode)  {  	uint32_t val;  	uint32_t dev_width = (chip->options & NAND_BUSWIDTH_16) >> 1; -#ifdef CONFIG_AM33XX  	uint32_t unused_length = 0; -#endif  	uint32_t wr_mode = BCH_WRAPMODE_6;  	struct nand_bch_priv *bch = chip->priv;  	/* Clear the ecc result registers, select ecc reg as 1 */  	writel(ECCCLEAR | ECCRESULTREG1, &gpmc_cfg->ecc_control); -#ifdef CONFIG_AM33XX -	wr_mode = BCH_WRAPMODE_1; +	if (bch->ecc_scheme == OMAP_ECC_BCH8_CODE_HW) { +		wr_mode = BCH_WRAPMODE_1;  	switch (bch->nibbles) {  	case ECC_BCH4_NIBBLES: @@ -320,7 +317,7 @@ static void omap_hwecc_init_bch(struct nand_chip *chip, int32_t mode)  		val |= (unused_length << 22);  		break;  	} -#else +	} else {  	/*  	 * This ecc_size_config setting is for BCH sw library.  	 * @@ -333,7 +330,7 @@ static void omap_hwecc_init_bch(struct nand_chip *chip, int32_t mode)  	 *  size1 = 32 (skip 32 nibbles = 16 bytes per sector in spare area)  	 */  	val = (32 << 22) | (0 << 12); -#endif +	}  	/* ecc size configuration */  	writel(val, &gpmc_cfg->ecc_size_config); @@ -376,9 +373,9 @@ static void __maybe_unused omap_ecc_disable(struct mtd_info *mtd)  }  /* - * BCH8 support (needs ELM and thus AM33xx-only) + * BCH support using ELM module   */ -#ifdef CONFIG_AM33XX +#ifdef CONFIG_NAND_OMAP_ELM  /*   * omap_read_bch8_result - Read BCH result for BCH8 level   * @@ -631,20 +628,20 @@ static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip,  	}  	return 0;  } -#endif /* CONFIG_AM33XX */ +#endif /* CONFIG_NAND_OMAP_ELM */  /*   * OMAP3 BCH8 support (with BCH library)   */ -#ifdef CONFIG_NAND_OMAP_BCH8 +#ifdef CONFIG_BCH  /* - *  omap_calculate_ecc_bch - Read BCH ECC result + *  omap_calculate_ecc_bch_sw - Read BCH ECC result   *   *  @mtd:	MTD device structure   *  @dat:	The pointer to data on which ecc is computed (unused here)   *  @ecc:	The ECC output buffer   */ -static int omap_calculate_ecc_bch(struct mtd_info *mtd, const uint8_t *dat, +static int omap_calculate_ecc_bch_sw(struct mtd_info *mtd, const uint8_t *dat,  				uint8_t *ecc)  {  	int ret = 0; @@ -689,13 +686,13 @@ static int omap_calculate_ecc_bch(struct mtd_info *mtd, const uint8_t *dat,  }  /** - * omap_correct_data_bch - Decode received data and correct errors + * omap_correct_data_bch_sw - Decode received data and correct errors   * @mtd: MTD device structure   * @data: page data   * @read_ecc: ecc read from nand flash   * @calc_ecc: ecc read from HW ECC registers   */ -static int omap_correct_data_bch(struct mtd_info *mtd, u_char *data, +static int omap_correct_data_bch_sw(struct mtd_info *mtd, u_char *data,  				 u_char *read_ecc, u_char *calc_ecc)  {  	int i, count; @@ -752,7 +749,150 @@ static void __maybe_unused omap_free_bch(struct mtd_info *mtd)  		chip_priv->control = NULL;  	}  } -#endif /* CONFIG_NAND_OMAP_BCH8 */ +#endif /* CONFIG_BCH */ + +/** + * omap_select_ecc_scheme - configures driver for particular ecc-scheme + * @nand: NAND chip device structure + * @ecc_scheme: ecc scheme to configure + * @pagesize: number of main-area bytes per page of NAND device + * @oobsize: number of OOB/spare bytes per page of NAND device + */ +static int omap_select_ecc_scheme(struct nand_chip *nand, +	enum omap_ecc ecc_scheme, unsigned int pagesize, unsigned int oobsize) { +	struct nand_bch_priv	*bch		= nand->priv; +	struct nand_ecclayout	*ecclayout	= nand->ecc.layout; +	int eccsteps = pagesize / SECTOR_BYTES; +	int i; + +	switch (ecc_scheme) { +	case OMAP_ECC_HAM1_CODE_SW: +		debug("nand: selected OMAP_ECC_HAM1_CODE_SW\n"); +		/* For this ecc-scheme, ecc.bytes, ecc.layout, ... are +		 * initialized in nand_scan_tail(), so just set ecc.mode */ +		bch_priv.control	= NULL; +		bch_priv.type		= 0; +		nand->ecc.mode		= NAND_ECC_SOFT; +		nand->ecc.layout	= NULL; +		nand->ecc.size		= pagesize; +		bch->ecc_scheme		= OMAP_ECC_HAM1_CODE_SW; +		break; + +	case OMAP_ECC_HAM1_CODE_HW: +		debug("nand: selected OMAP_ECC_HAM1_CODE_HW\n"); +		/* check ecc-scheme requirements before updating ecc info */ +		if ((3 * eccsteps) + BADBLOCK_MARKER_LENGTH > oobsize) { +			printf("nand: error: insufficient OOB: require=%d\n", ( +				(3 * eccsteps) + BADBLOCK_MARKER_LENGTH)); +			return -EINVAL; +		} +		bch_priv.control	= NULL; +		bch_priv.type		= 0; +		/* populate ecc specific fields */ +		nand->ecc.mode		= NAND_ECC_HW; +		nand->ecc.strength	= 1; +		nand->ecc.size		= SECTOR_BYTES; +		nand->ecc.bytes		= 3; +		nand->ecc.hwctl		= omap_enable_hwecc; +		nand->ecc.correct	= omap_correct_data; +		nand->ecc.calculate	= omap_calculate_ecc; +		/* define ecc-layout */ +		ecclayout->eccbytes	= nand->ecc.bytes * eccsteps; +		for (i = 0; i < ecclayout->eccbytes; i++) +			ecclayout->eccpos[i] = i + BADBLOCK_MARKER_LENGTH; +		ecclayout->oobfree[0].offset = i + BADBLOCK_MARKER_LENGTH; +		ecclayout->oobfree[0].length = oobsize - ecclayout->eccbytes - +						BADBLOCK_MARKER_LENGTH; +		bch->ecc_scheme		= OMAP_ECC_HAM1_CODE_HW; +		break; + +	case OMAP_ECC_BCH8_CODE_HW_DETECTION_SW: +#ifdef CONFIG_BCH +		debug("nand: selected OMAP_ECC_BCH8_CODE_HW_DETECTION_SW\n"); +		/* check ecc-scheme requirements before updating ecc info */ +		if ((13 * eccsteps) + BADBLOCK_MARKER_LENGTH > oobsize) { +			printf("nand: error: insufficient OOB: require=%d\n", ( +				(13 * eccsteps) + BADBLOCK_MARKER_LENGTH)); +			return -EINVAL; +		} +		/* check if BCH S/W library can be used for error detection */ +		bch_priv.control = init_bch(13, 8, 0x201b); +		if (!bch_priv.control) { +			printf("nand: error: could not init_bch()\n"); +			return -ENODEV; +		} +		bch_priv.type = ECC_BCH8; +		/* populate ecc specific fields */ +		nand->ecc.mode		= NAND_ECC_HW; +		nand->ecc.strength	= 8; +		nand->ecc.size		= SECTOR_BYTES; +		nand->ecc.bytes		= 13; +		nand->ecc.hwctl		= omap_enable_ecc_bch; +		nand->ecc.correct	= omap_correct_data_bch_sw; +		nand->ecc.calculate	= omap_calculate_ecc_bch_sw; +		/* define ecc-layout */ +		ecclayout->eccbytes	= nand->ecc.bytes * eccsteps; +		ecclayout->eccpos[0]	= BADBLOCK_MARKER_LENGTH; +		for (i = 1; i < ecclayout->eccbytes; i++) { +			if (i % nand->ecc.bytes) +				ecclayout->eccpos[i] = +						ecclayout->eccpos[i - 1] + 1; +			else +				ecclayout->eccpos[i] = +						ecclayout->eccpos[i - 1] + 2; +		} +		ecclayout->oobfree[0].offset = i + BADBLOCK_MARKER_LENGTH; +		ecclayout->oobfree[0].length = oobsize - ecclayout->eccbytes - +						BADBLOCK_MARKER_LENGTH; +		omap_hwecc_init_bch(nand, NAND_ECC_READ); +		bch->ecc_scheme		= OMAP_ECC_BCH8_CODE_HW_DETECTION_SW; +		break; +#else +		printf("nand: error: CONFIG_BCH required for ECC\n"); +		return -EINVAL; +#endif + +	case OMAP_ECC_BCH8_CODE_HW: +#ifdef CONFIG_NAND_OMAP_ELM +		debug("nand: selected OMAP_ECC_BCH8_CODE_HW\n"); +		/* check ecc-scheme requirements before updating ecc info */ +		if ((14 * eccsteps) + BADBLOCK_MARKER_LENGTH > oobsize) { +			printf("nand: error: insufficient OOB: require=%d\n", ( +				(14 * eccsteps) + BADBLOCK_MARKER_LENGTH)); +			return -EINVAL; +		} +		/* intialize ELM for ECC error detection */ +		elm_init(); +		bch_priv.type		= ECC_BCH8; +		/* populate ecc specific fields */ +		nand->ecc.mode		= NAND_ECC_HW; +		nand->ecc.strength	= 8; +		nand->ecc.size		= SECTOR_BYTES; +		nand->ecc.bytes		= 14; +		nand->ecc.hwctl		= omap_enable_ecc_bch; +		nand->ecc.correct	= omap_correct_data_bch; +		nand->ecc.calculate	= omap_calculate_ecc_bch; +		nand->ecc.read_page	= omap_read_page_bch; +		/* define ecc-layout */ +		ecclayout->eccbytes	= nand->ecc.bytes * eccsteps; +		for (i = 0; i < ecclayout->eccbytes; i++) +			ecclayout->eccpos[i] = i + BADBLOCK_MARKER_LENGTH; +		ecclayout->oobfree[0].offset = i + BADBLOCK_MARKER_LENGTH; +		ecclayout->oobfree[0].length = oobsize - ecclayout->eccbytes - +						BADBLOCK_MARKER_LENGTH; +		bch->ecc_scheme		= OMAP_ECC_BCH8_CODE_HW; +		break; +#else +		printf("nand: error: CONFIG_NAND_OMAP_ELM required for ECC\n"); +		return -EINVAL; +#endif + +	default: +		debug("nand: error: ecc scheme not enabled or supported\n"); +		return -EINVAL; +	} +	return 0; +}  #ifndef CONFIG_SPL_BUILD  /* @@ -763,77 +903,45 @@ static void __maybe_unused omap_free_bch(struct mtd_info *mtd)   * @eccstrength		- the number of bits that could be corrected   *			  (1 - hamming, 4 - BCH4, 8 - BCH8, 16 - BCH16)   */ -void omap_nand_switch_ecc(uint32_t hardware, uint32_t eccstrength) +int __maybe_unused omap_nand_switch_ecc(uint32_t hardware, uint32_t eccstrength)  {  	struct nand_chip *nand;  	struct mtd_info *mtd; +	int err = 0;  	if (nand_curr_device < 0 ||  	    nand_curr_device >= CONFIG_SYS_MAX_NAND_DEVICE ||  	    !nand_info[nand_curr_device].name) { -		printf("Error: Can't switch ecc, no devices available\n"); -		return; +		printf("nand: error: no NAND devices found\n"); +		return -ENODEV;  	}  	mtd = &nand_info[nand_curr_device];  	nand = mtd->priv; -  	nand->options |= NAND_OWN_BUFFERS; - -	/* Reset ecc interface */ -	nand->ecc.mode = NAND_ECC_NONE; -	nand->ecc.read_page = NULL; -	nand->ecc.write_page = NULL; -	nand->ecc.read_oob = NULL; -	nand->ecc.write_oob = NULL; -	nand->ecc.hwctl = NULL; -	nand->ecc.correct = NULL; -	nand->ecc.calculate = NULL; -	nand->ecc.strength = eccstrength; -  	/* Setup the ecc configurations again */  	if (hardware) {  		if (eccstrength == 1) { -			nand->ecc.mode = NAND_ECC_HW; -			nand->ecc.layout = &hw_nand_oob; -			nand->ecc.size = 512; -			nand->ecc.bytes = 3; -			nand->ecc.hwctl = omap_enable_hwecc; -			nand->ecc.correct = omap_correct_data; -			nand->ecc.calculate = omap_calculate_ecc; -			omap_hwecc_init(nand); -			printf("1-bit hamming HW ECC selected\n"); -		} -#if defined(CONFIG_AM33XX) || defined(CONFIG_NAND_OMAP_BCH8) -		else if (eccstrength == 8) { -			nand->ecc.mode = NAND_ECC_HW; -			nand->ecc.layout = &hw_bch8_nand_oob; -			nand->ecc.size = 512; -#ifdef CONFIG_AM33XX -			nand->ecc.bytes = 14; -			nand->ecc.read_page = omap_read_page_bch; -#else -			nand->ecc.bytes = 13; -#endif -			nand->ecc.hwctl = omap_enable_ecc_bch; -			nand->ecc.correct = omap_correct_data_bch; -			nand->ecc.calculate = omap_calculate_ecc_bch; -			omap_hwecc_init_bch(nand, NAND_ECC_READ); -			printf("8-bit BCH HW ECC selected\n"); +			err = omap_select_ecc_scheme(nand, +					OMAP_ECC_HAM1_CODE_HW, +					mtd->writesize, mtd->oobsize); +		} else if (eccstrength == 8) { +			err = omap_select_ecc_scheme(nand, +					OMAP_ECC_BCH8_CODE_HW, +					mtd->writesize, mtd->oobsize); +		} else { +			printf("nand: error: unsupported ECC scheme\n"); +			return -EINVAL;  		} -#endif  	} else { -		nand->ecc.mode = NAND_ECC_SOFT; -		/* Use mtd default settings */ -		nand->ecc.layout = NULL; -		nand->ecc.size = 0; -		printf("SW ECC selected\n"); +		err = omap_select_ecc_scheme(nand, OMAP_ECC_HAM1_CODE_SW, +					mtd->writesize, mtd->oobsize);  	}  	/* Update NAND handling after ECC mode switch */ -	nand_scan_tail(mtd); - -	nand->options &= ~NAND_OWN_BUFFERS; +	if (!err) +		err = nand_scan_tail(mtd); +	return err;  }  #endif /* CONFIG_SPL_BUILD */ @@ -856,7 +964,7 @@ int board_nand_init(struct nand_chip *nand)  {  	int32_t gpmc_config = 0;  	cs = 0; - +	int err = 0;  	/*  	 * xloader/Uboot's gpmc configuration would have configured GPMC for  	 * nand type of memory. The following logic scans and latches on to the @@ -873,7 +981,7 @@ int board_nand_init(struct nand_chip *nand)  		cs++;  	}  	if (cs >= GPMC_MAX_CS) { -		printf("NAND: Unable to find NAND settings in " +		printf("nand: error: Unable to find NAND settings in "  			"GPMC Configuration - quitting\n");  		return -ENODEV;  	} @@ -885,64 +993,27 @@ int board_nand_init(struct nand_chip *nand)  	nand->IO_ADDR_R = (void __iomem *)&gpmc_cfg->cs[cs].nand_dat;  	nand->IO_ADDR_W = (void __iomem *)&gpmc_cfg->cs[cs].nand_cmd; - -	nand->cmd_ctrl = omap_nand_hwcontrol; -	nand->options = NAND_NO_PADDING | NAND_CACHEPRG; +	nand->priv	= &bch_priv; +	nand->cmd_ctrl	= omap_nand_hwcontrol; +	nand->options	|= NAND_NO_PADDING | NAND_CACHEPRG;  	/* If we are 16 bit dev, our gpmc config tells us that */  	if ((readl(&gpmc_cfg->cs[cs].config1) & 0x3000) == 0x1000)  		nand->options |= NAND_BUSWIDTH_16;  	nand->chip_delay = 100; +	nand->ecc.layout = &omap_ecclayout; -#if defined(CONFIG_AM33XX) || defined(CONFIG_NAND_OMAP_BCH8) -#ifdef CONFIG_AM33XX -	/* AM33xx uses the ELM */ -	/* required in case of BCH */ -	elm_init(); -#else -	/* -	 * Whereas other OMAP based SoC do not have the ELM, they use the BCH -	 * SW library. -	 */ -	bch_priv.control = init_bch(13, 8, 0x201b /* hw polynominal */); -	if (!bch_priv.control) { -		puts("Could not init_bch()\n"); -		return -ENODEV; -	} -#endif -	/* BCH info that will be correct for SPL or overridden otherwise. */ -	nand->priv = &bch_priv; -#endif - -	/* Default ECC mode */ -#if defined(CONFIG_AM33XX) || defined(CONFIG_NAND_OMAP_BCH8) -	nand->ecc.mode = NAND_ECC_HW; -	nand->ecc.layout = &hw_bch8_nand_oob; -	nand->ecc.size = CONFIG_SYS_NAND_ECCSIZE; -	nand->ecc.bytes = CONFIG_SYS_NAND_ECCBYTES; -	nand->ecc.strength = 8; -	nand->ecc.hwctl = omap_enable_ecc_bch; -	nand->ecc.correct = omap_correct_data_bch; -	nand->ecc.calculate = omap_calculate_ecc_bch; -#ifdef CONFIG_AM33XX -	nand->ecc.read_page = omap_read_page_bch; -#endif -	omap_hwecc_init_bch(nand, NAND_ECC_READ); -#else -#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_NAND_SOFTECC) -	nand->ecc.mode = NAND_ECC_SOFT; +	/* select ECC scheme */ +#if defined(CONFIG_NAND_OMAP_ECCSCHEME) +	err = omap_select_ecc_scheme(nand, CONFIG_NAND_OMAP_ECCSCHEME, +			CONFIG_SYS_NAND_PAGE_SIZE, CONFIG_SYS_NAND_OOBSIZE);  #else -	nand->ecc.mode = NAND_ECC_HW; -	nand->ecc.layout = &hw_nand_oob; -	nand->ecc.size = CONFIG_SYS_NAND_ECCSIZE; -	nand->ecc.bytes = CONFIG_SYS_NAND_ECCBYTES; -	nand->ecc.hwctl = omap_enable_hwecc; -	nand->ecc.correct = omap_correct_data; -	nand->ecc.calculate = omap_calculate_ecc; -	nand->ecc.strength = 1; -	omap_hwecc_init(nand); -#endif +	/* pagesize and oobsize are not required to configure sw ecc-scheme */ +	err = omap_select_ecc_scheme(nand, OMAP_ECC_HAM1_CODE_SW, +			0, 0);  #endif +	if (err) +		return err;  #ifdef CONFIG_SPL_BUILD  	if (nand->options & NAND_BUSWIDTH_16) diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c index 067f8ef18..979e4af7c 100644 --- a/drivers/mtd/onenand/onenand_base.c +++ b/drivers/mtd/onenand/onenand_base.c @@ -761,7 +761,8 @@ static int onenand_transfer_auto_oob(struct mtd_info *mtd, uint8_t *buf,  	uint8_t *oob_buf = this->oob_buf;  	free = this->ecclayout->oobfree; -	for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES && free->length; i++, free++) { +	for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES_LARGE && free->length; +	     i++, free++) {  		if (readcol >= lastgap)  			readcol += free->offset - lastgap;  		if (readend >= lastgap) @@ -770,7 +771,8 @@ static int onenand_transfer_auto_oob(struct mtd_info *mtd, uint8_t *buf,  	}  	this->read_bufferram(mtd, 0, ONENAND_SPARERAM, oob_buf, 0, mtd->oobsize);  	free = this->ecclayout->oobfree; -	for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES && free->length; i++, free++) { +	for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES_LARGE && free->length; +	     i++, free++) {  		int free_end = free->offset + free->length;  		if (free->offset < readend && free_end > readcol) {  			int st = max_t(int,free->offset,readcol); @@ -1356,7 +1358,8 @@ static int onenand_fill_auto_oob(struct mtd_info *mtd, u_char *oob_buf,  	unsigned int i;  	free = this->ecclayout->oobfree; -	for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES && free->length; i++, free++) { +	for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES_LARGE && free->length; +	     i++, free++) {  		if (writecol >= lastgap)  			writecol += free->offset - lastgap;  		if (writeend >= lastgap) @@ -1364,7 +1367,8 @@ static int onenand_fill_auto_oob(struct mtd_info *mtd, u_char *oob_buf,  		lastgap = free->offset + free->length;  	}  	free = this->ecclayout->oobfree; -	for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES && free->length; i++, free++) { +	for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES_LARGE && free->length; +	     i++, free++) {  		int free_end = free->offset + free->length;  		if (free->offset < writeend && free_end > writecol) {  			int st = max_t(int,free->offset,writecol); @@ -2750,7 +2754,8 @@ int onenand_scan(struct mtd_info *mtd, int maxchips)  	 * the out of band area  	 */  	this->ecclayout->oobavail = 0; -	for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES && + +	for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES_LARGE &&  	    this->ecclayout->oobfree[i].length; i++)  		this->ecclayout->oobavail +=  			this->ecclayout->oobfree[i].length; diff --git a/drivers/net/designware.c b/drivers/net/designware.c index 8413d5776..22155b4d9 100644 --- a/drivers/net/designware.c +++ b/drivers/net/designware.c @@ -96,7 +96,7 @@ static int mac_reset(struct eth_device *dev)  	ulong start;  	int timeout = CONFIG_MACRESET_TIMEOUT; -	writel(DMAMAC_SRST, &dma_p->busmode); +	writel(readl(&dma_p->busmode) | DMAMAC_SRST, &dma_p->busmode);  	if (priv->interface != PHY_INTERFACE_MODE_RGMII)  		writel(MII_PORTSELECT, &mac_p->conf); diff --git a/drivers/net/designware.h b/drivers/net/designware.h index e80002a0e..5440c9215 100644 --- a/drivers/net/designware.h +++ b/drivers/net/designware.h @@ -112,7 +112,7 @@ struct dmamacdescr {  	u32 dmamac_cntl;  	void *dmamac_addr;  	struct dmamacdescr *dmamac_next; -}; +} __aligned(16);  /*   * txrx_status definitions @@ -224,8 +224,7 @@ struct dw_eth_dev {  	u32 tx_currdescnum;  	u32 rx_currdescnum;  	u32 phy_configured; -	int link_printed; -	u32 padding; +	u32 link_printed;  	struct dmamacdescr tx_mac_descrtable[CONFIG_TX_DESCR_NUM];  	struct dmamacdescr rx_mac_descrtable[CONFIG_RX_DESCR_NUM]; @@ -237,7 +236,7 @@ struct dw_eth_dev {  	struct eth_dma_regs *dma_regs_p;  	struct eth_device *dev; -} __attribute__ ((aligned(8))); +};  /* Speed specific definitions */  #define SPEED_10M		1 diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c index f7170e055..b68d808c7 100644 --- a/drivers/net/dm9000x.c +++ b/drivers/net/dm9000x.c @@ -342,6 +342,15 @@ static int dm9000_init(struct eth_device *dev, bd_t *bd)  	DM9000_iow(DM9000_ISR, ISR_ROOS | ISR_ROS | ISR_PTS | ISR_PRS);  	printf("MAC: %pM\n", dev->enetaddr); +	if (!is_valid_ether_addr(dev->enetaddr)) { +#ifdef CONFIG_RANDOM_MACADDR +		printf("Bad MAC address (uninitialized EEPROM?), randomizing\n"); +		eth_random_enetaddr(dev->enetaddr); +		printf("MAC: %pM\n", dev->enetaddr); +#else +		printf("WARNING: Bad MAC address (uninitialized EEPROM?)\n"); +#endif +	}  	/* fill device MAC address registers */  	for (i = 0, oft = DM9000_PAR; i < 6; i++, oft++) diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c index 57aa53dba..9a66e68ae 100644 --- a/drivers/net/e1000.c +++ b/drivers/net/e1000.c @@ -114,12 +114,13 @@ static int e1000_write_phy_reg(struct e1000_hw *hw, uint32_t reg_addr,  static int32_t e1000_phy_hw_reset(struct e1000_hw *hw);  static int e1000_phy_reset(struct e1000_hw *hw);  static int e1000_detect_gig_phy(struct e1000_hw *hw); -static void e1000_put_hw_eeprom_semaphore(struct e1000_hw *hw);  static void e1000_set_media_type(struct e1000_hw *hw);  static int32_t e1000_swfw_sync_acquire(struct e1000_hw *hw, uint16_t mask);  static int32_t e1000_check_phy_reset_block(struct e1000_hw *hw); +#ifndef CONFIG_E1000_NO_NVM +static void e1000_put_hw_eeprom_semaphore(struct e1000_hw *hw);  static int32_t e1000_read_eeprom(struct e1000_hw *hw, uint16_t offset,  		uint16_t words,  		uint16_t *data); @@ -885,6 +886,7 @@ static int e1000_validate_eeprom_checksum(struct e1000_hw *hw)  	return -E1000_ERR_EEPROM;  } +#endif /* CONFIG_E1000_NO_NVM */  /*****************************************************************************   * Set PHY to class A mode @@ -897,6 +899,7 @@ static int e1000_validate_eeprom_checksum(struct e1000_hw *hw)  static int32_t  e1000_set_phy_mode(struct e1000_hw *hw)  { +#ifndef CONFIG_E1000_NO_NVM  	int32_t ret_val;  	uint16_t eeprom_data; @@ -923,10 +926,11 @@ e1000_set_phy_mode(struct e1000_hw *hw)  			hw->phy_reset_disable = false;  		}  	} - +#endif  	return E1000_SUCCESS;  } +#ifndef CONFIG_E1000_NO_NVM  /***************************************************************************   *   * Obtaining software semaphore bit (SMBI) before resetting PHY. @@ -965,6 +969,7 @@ e1000_get_software_semaphore(struct e1000_hw *hw)  	return E1000_SUCCESS;  } +#endif  /***************************************************************************   * This function clears HW semaphore bits. @@ -977,6 +982,7 @@ e1000_get_software_semaphore(struct e1000_hw *hw)  static void  e1000_put_hw_eeprom_semaphore(struct e1000_hw *hw)  { +#ifndef CONFIG_E1000_NO_NVM  	 uint32_t swsm;  	DEBUGFUNC(); @@ -991,6 +997,7 @@ e1000_put_hw_eeprom_semaphore(struct e1000_hw *hw)  	} else  		swsm &= ~(E1000_SWSM_SWESMBI);  	E1000_WRITE_REG(hw, SWSM, swsm); +#endif  }  /*************************************************************************** @@ -1007,6 +1014,7 @@ e1000_put_hw_eeprom_semaphore(struct e1000_hw *hw)  static int32_t  e1000_get_hw_eeprom_semaphore(struct e1000_hw *hw)  { +#ifndef CONFIG_E1000_NO_NVM  	int32_t timeout;  	uint32_t swsm; @@ -1043,7 +1051,7 @@ e1000_get_hw_eeprom_semaphore(struct e1000_hw *hw)  				"SWESMBI bit is set.\n");  		return -E1000_ERR_EEPROM;  	} - +#endif  	return E1000_SUCCESS;  } @@ -1097,6 +1105,7 @@ static bool e1000_is_second_port(struct e1000_hw *hw)  	}  } +#ifndef CONFIG_E1000_NO_NVM  /******************************************************************************   * Reads the adapter's MAC address from the EEPROM and inverts the LSB for the   * second function of dual function devices @@ -1136,6 +1145,7 @@ e1000_read_mac_addr(struct eth_device *nic)  #endif  	return 0;  } +#endif  /******************************************************************************   * Initializes receive address filters. @@ -1764,9 +1774,11 @@ static int  e1000_setup_link(struct eth_device *nic)  {  	struct e1000_hw *hw = nic->priv; -	uint32_t ctrl_ext;  	int32_t ret_val; +#ifndef CONFIG_E1000_NO_NVM +	uint32_t ctrl_ext;  	uint16_t eeprom_data; +#endif  	DEBUGFUNC(); @@ -1775,6 +1787,7 @@ e1000_setup_link(struct eth_device *nic)  	if (e1000_check_phy_reset_block(hw))  		return E1000_SUCCESS; +#ifndef CONFIG_E1000_NO_NVM  	/* Read and store word 0x0F of the EEPROM. This word contains bits  	 * that determine the hardware's default PAUSE (flow control) mode,  	 * a bit that determines whether the HW defaults to enabling or @@ -1788,7 +1801,7 @@ e1000_setup_link(struct eth_device *nic)  		DEBUGOUT("EEPROM Read Error\n");  		return -E1000_ERR_EEPROM;  	} - +#endif  	if (hw->fc == e1000_fc_default) {  		switch (hw->mac_type) {  		case e1000_ich8lan: @@ -1797,6 +1810,7 @@ e1000_setup_link(struct eth_device *nic)  			hw->fc = e1000_fc_full;  			break;  		default: +#ifndef CONFIG_E1000_NO_NVM  			ret_val = e1000_read_eeprom(hw,  				EEPROM_INIT_CONTROL2_REG, 1, &eeprom_data);  			if (ret_val) { @@ -1809,6 +1823,7 @@ e1000_setup_link(struct eth_device *nic)  				    EEPROM_WORD0F_ASM_DIR)  				hw->fc = e1000_fc_tx_pause;  			else +#endif  				hw->fc = e1000_fc_full;  			break;  		} @@ -1828,6 +1843,7 @@ e1000_setup_link(struct eth_device *nic)  	DEBUGOUT("After fix-ups FlowControl is now = %x\n", hw->fc); +#ifndef CONFIG_E1000_NO_NVM  	/* Take the 4 bits from EEPROM word 0x0F that determine the initial  	 * polarity value for the SW controlled pins, and setup the  	 * Extended Device Control reg with that info. @@ -1840,6 +1856,7 @@ e1000_setup_link(struct eth_device *nic)  			    SWDPIO__EXT_SHIFT);  		E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext);  	} +#endif  	/* Call the necessary subroutine to configure the link. */  	ret_val = (hw->media_type == e1000_media_type_fiber) ? @@ -5196,6 +5213,7 @@ e1000_initialize(bd_t * bis)  		e1000_reset_hw(hw);  		list_add_tail(&hw->list_node, &e1000_hw_list); +#ifndef CONFIG_E1000_NO_NVM  		/* Validate the EEPROM and get chipset information */  #if !defined(CONFIG_MVBC_1G)  		if (e1000_init_eeprom_params(hw)) { @@ -5206,11 +5224,17 @@ e1000_initialize(bd_t * bis)  			continue;  #endif  		e1000_read_mac_addr(nic); +#endif  		e1000_get_bus_type(hw); +#ifndef CONFIG_E1000_NO_NVM  		printf("e1000: %02x:%02x:%02x:%02x:%02x:%02x\n       ",  		       nic->enetaddr[0], nic->enetaddr[1], nic->enetaddr[2],  		       nic->enetaddr[3], nic->enetaddr[4], nic->enetaddr[5]); +#else +		memset(nic->enetaddr, 0, 6); +		printf("e1000: no NVM\n"); +#endif  		/* Set up the function pointers and register the device */  		nic->init = e1000_init; diff --git a/drivers/net/e1000.h b/drivers/net/e1000.h index 25884f5bc..ff87af2ef 100644 --- a/drivers/net/e1000.h +++ b/drivers/net/e1000.h @@ -63,11 +63,14 @@ struct e1000_hw_stats;  /* Internal E1000 helper functions */  struct e1000_hw *e1000_find_card(unsigned int cardnum); + +#ifndef CONFIG_E1000_NO_NVM  int32_t e1000_acquire_eeprom(struct e1000_hw *hw);  void e1000_standby_eeprom(struct e1000_hw *hw);  void e1000_release_eeprom(struct e1000_hw *hw);  void e1000_raise_ee_clk(struct e1000_hw *hw, uint32_t *eecd);  void e1000_lower_ee_clk(struct e1000_hw *hw, uint32_t *eecd); +#endif  #ifdef CONFIG_E1000_SPI  int do_e1000_spi(cmd_tbl_t *cmdtp, struct e1000_hw *hw, @@ -1019,6 +1022,7 @@ struct e1000_hw_stats {  	uint64_t tsctfc;  }; +#ifndef CONFIG_E1000_NO_NVM  struct e1000_eeprom_info {  e1000_eeprom_type type;  	uint16_t word_size; @@ -1029,6 +1033,7 @@ e1000_eeprom_type type;  	bool use_eerd;  	bool use_eewr;  }; +#endif  typedef enum {      e1000_smart_speed_default = 0, @@ -1081,10 +1086,14 @@ struct e1000_hw {  	uint32_t io_base;  #endif  	uint32_t		asf_firmware_present; +#ifndef CONFIG_E1000_NO_NVM  	uint32_t		eeprom_semaphore_present; +#endif  	uint32_t		swfw_sync_present;  	uint32_t		swfwhw_semaphore_present; +#ifndef CONFIG_E1000_NO_NVM  	struct e1000_eeprom_info eeprom; +#endif  	e1000_ms_type		master_slave;  	e1000_ms_type		original_master_slave;  	e1000_ffe_config	ffe_config_state; diff --git a/drivers/net/fsl_mdio.c b/drivers/net/fsl_mdio.c index ce36bd7a3..1d88e6504 100644 --- a/drivers/net/fsl_mdio.c +++ b/drivers/net/fsl_mdio.c @@ -1,5 +1,5 @@  /* - * Copyright 2009-2010 Freescale Semiconductor, Inc. + * Copyright 2009-2010, 2013 Freescale Semiconductor, Inc.   *	Jun-jie Zhang <b18070@freescale.com>   *	Mingkai Hu <Mingkai.hu@freescale.com>   * @@ -13,7 +13,7 @@  #include <asm/errno.h>  #include <asm/fsl_enet.h> -void tsec_local_mdio_write(struct tsec_mii_mng *phyregs, int port_addr, +void tsec_local_mdio_write(struct tsec_mii_mng __iomem *phyregs, int port_addr,  		int dev_addr, int regnum, int value)  {  	int timeout = 1000000; @@ -26,7 +26,7 @@ void tsec_local_mdio_write(struct tsec_mii_mng *phyregs, int port_addr,  		;  } -int tsec_local_mdio_read(struct tsec_mii_mng *phyregs, int port_addr, +int tsec_local_mdio_read(struct tsec_mii_mng __iomem *phyregs, int port_addr,  		int dev_addr, int regnum)  {  	int value; @@ -57,7 +57,8 @@ int tsec_local_mdio_read(struct tsec_mii_mng *phyregs, int port_addr,  static int fsl_pq_mdio_reset(struct mii_dev *bus)  { -	struct tsec_mii_mng *regs = bus->priv; +	struct tsec_mii_mng __iomem *regs = +		(struct tsec_mii_mng __iomem *)bus->priv;  	/* Reset MII (due to new addresses) */  	out_be32(®s->miimcfg, MIIMCFG_RESET_MGMT); @@ -72,7 +73,8 @@ static int fsl_pq_mdio_reset(struct mii_dev *bus)  int tsec_phy_read(struct mii_dev *bus, int addr, int dev_addr, int regnum)  { -	struct tsec_mii_mng *phyregs = bus->priv; +	struct tsec_mii_mng __iomem *phyregs = +		(struct tsec_mii_mng __iomem *)bus->priv;  	return tsec_local_mdio_read(phyregs, addr, dev_addr, regnum);  } @@ -80,7 +82,8 @@ int tsec_phy_read(struct mii_dev *bus, int addr, int dev_addr, int regnum)  int tsec_phy_write(struct mii_dev *bus, int addr, int dev_addr, int regnum,  			u16 value)  { -	struct tsec_mii_mng *phyregs = bus->priv; +	struct tsec_mii_mng __iomem *phyregs = +		(struct tsec_mii_mng __iomem *)bus->priv;  	tsec_local_mdio_write(phyregs, addr, dev_addr, regnum, value); @@ -101,7 +104,7 @@ int fsl_pq_mdio_init(bd_t *bis, struct fsl_pq_mdio_info *info)  	bus->reset = fsl_pq_mdio_reset;  	sprintf(bus->name, info->name); -	bus->priv = info->regs; +	bus->priv = (void *)info->regs;  	return mdio_register(bus);  } diff --git a/drivers/net/mvgbe.c b/drivers/net/mvgbe.c index 6c901d1ea..0cd06b6a6 100644 --- a/drivers/net/mvgbe.c +++ b/drivers/net/mvgbe.c @@ -420,8 +420,9 @@ static int mvgbe_init(struct eth_device *dev)  {  	struct mvgbe_device *dmvgbe = to_mvgbe(dev);  	struct mvgbe_registers *regs = dmvgbe->regs; -#if (defined (CONFIG_MII) || defined (CONFIG_CMD_MII)) \ -	 && defined (CONFIG_SYS_FAULT_ECHO_LINK_DOWN) +#if (defined(CONFIG_MII) || defined(CONFIG_CMD_MII)) &&  \ +	!defined(CONFIG_PHYLIB) &&			 \ +	defined(CONFIG_SYS_FAULT_ECHO_LINK_DOWN)  	int i;  #endif  	/* setup RX rings */ diff --git a/drivers/net/npe/Makefile b/drivers/net/npe/Makefile index e36c0bbd6..077925521 100644 --- a/drivers/net/npe/Makefile +++ b/drivers/net/npe/Makefile @@ -8,7 +8,6 @@  LOCAL_CFLAGS  += -I$(TOPDIR)/drivers/net/npe/include -DCONFIG_IXP425_COMPONENT_ETHDB -D__linux  CFLAGS  += $(LOCAL_CFLAGS)  CPPFLAGS  += $(LOCAL_CFLAGS) # needed for depend -HOSTCFLAGS  += $(LOCAL_CFLAGS)  obj-y := npe.o \  	miiphy.o \ diff --git a/drivers/net/phy/atheros.c b/drivers/net/phy/atheros.c index 0f2dfd612..b20b4df98 100644 --- a/drivers/net/phy/atheros.c +++ b/drivers/net/phy/atheros.c @@ -40,7 +40,7 @@ static int ar8035_config(struct phy_device *phydev)  static struct phy_driver AR8021_driver =  {  	.name = "AR8021",  	.uid = 0x4dd040, -	.mask = 0xfffff0, +	.mask = 0x4fffff,  	.features = PHY_GBIT_FEATURES,  	.config = ar8021_config,  	.startup = genphy_startup, @@ -48,11 +48,11 @@ static struct phy_driver AR8021_driver =  {  };  static struct phy_driver AR8031_driver =  { -	.name = "AR8031", +	.name = "AR8031/AR8033",  	.uid = 0x4dd074, -	.mask = 0xfffff0, +	.mask = 0x4fffff,  	.features = PHY_GBIT_FEATURES, -	.config = genphy_config, +	.config = ar8021_config,  	.startup = genphy_startup,  	.shutdown = genphy_shutdown,  }; diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index a7450f832..5d7e3be52 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -100,6 +100,19 @@ int ksz9021_phy_extended_read(struct phy_device *phydev, int regnum)  	return phy_read(phydev, MDIO_DEVAD_NONE, MII_KSZ9021_EXTENDED_DATAR);  } + +static int ksz9021_phy_extread(struct phy_device *phydev, int addr, int devaddr, +			      int regnum) +{ +	return ksz9021_phy_extended_read(phydev, regnum); +} + +static int ksz9021_phy_extwrite(struct phy_device *phydev, int addr, +			       int devaddr, int regnum, u16 val) +{ +	return ksz9021_phy_extended_write(phydev, regnum, val); +} +  /* Micrel ksz9021 */  static int ksz9021_config(struct phy_device *phydev)  { @@ -131,6 +144,8 @@ static struct phy_driver ksz9021_driver = {  	.config = &ksz9021_config,  	.startup = &ksz90xx_startup,  	.shutdown = &genphy_shutdown, +	.writeext = &ksz9021_phy_extwrite, +	.readext = &ksz9021_phy_extread,  };  #endif @@ -171,14 +186,31 @@ int ksz9031_phy_extended_read(struct phy_device *phydev, int devaddr,  	return phy_read(phydev, MDIO_DEVAD_NONE, MII_KSZ9031_MMD_REG_DATA);  } +static int ksz9031_phy_extread(struct phy_device *phydev, int addr, int devaddr, +			       int regnum) +{ +	return ksz9031_phy_extended_read(phydev, devaddr, regnum, +					 MII_KSZ9031_MOD_DATA_NO_POST_INC); +}; + +static int ksz9031_phy_extwrite(struct phy_device *phydev, int addr, +				int devaddr, int regnum, u16 val) +{ +	return ksz9031_phy_extended_write(phydev, devaddr, regnum, +					 MII_KSZ9031_MOD_DATA_POST_INC_RW, val); +}; + +  static struct phy_driver ksz9031_driver = {  	.name = "Micrel ksz9031",  	.uid  = 0x221620, -	.mask = 0xfffffe, +	.mask = 0xfffff0,  	.features = PHY_GBIT_FEATURES,  	.config   = &genphy_config,  	.startup  = &ksz90xx_startup,  	.shutdown = &genphy_shutdown, +	.writeext = &ksz9031_phy_extwrite, +	.readext = &ksz9031_phy_extread,  };  int phy_micrel_init(void) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 62925bb28..c691fbbbc 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -275,13 +275,14 @@ int genphy_parse_link(struct phy_device *phydev)  	int mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMSR);  	/* We're using autonegotiation */ -	if (mii_reg & BMSR_ANEGCAPABLE) { +	if (phydev->supported & SUPPORTED_Autoneg) {  		u32 lpa = 0;  		int gblpa = 0;  		u32 estatus = 0;  		/* Check for gigabit capability */ -		if (mii_reg & BMSR_ERCAP) { +		if (phydev->supported & (SUPPORTED_1000baseT_Full | +					SUPPORTED_1000baseT_Half)) {  			/* We want a list of states supported by  			 * both PHYs in the link  			 */ diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index ddbbc35e2..a3ace6852 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -102,7 +102,7 @@ static int rtl8211x_startup(struct phy_device *phydev)  static struct phy_driver RTL8211B_driver = {  	.name = "RealTek RTL8211B",  	.uid = 0x1cc910, -	.mask = 0xfffff0, +	.mask = 0xffffff,  	.features = PHY_GBIT_FEATURES,  	.config = &rtl8211x_config,  	.startup = &rtl8211x_startup, @@ -113,7 +113,7 @@ static struct phy_driver RTL8211B_driver = {  static struct phy_driver RTL8211E_driver = {  	.name = "RealTek RTL8211E",  	.uid = 0x1cc915, -	.mask = 0xfffff0, +	.mask = 0xffffff,  	.features = PHY_GBIT_FEATURES,  	.config = &rtl8211x_config,  	.startup = &rtl8211x_startup, @@ -124,7 +124,7 @@ static struct phy_driver RTL8211E_driver = {  static struct phy_driver RTL8211DN_driver = {  	.name = "RealTek RTL8211DN",  	.uid = 0x1cc914, -	.mask = 0xfffff0, +	.mask = 0xffffff,  	.features = PHY_GBIT_FEATURES,  	.config = &rtl8211x_config,  	.startup = &rtl8211x_startup, diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c index 60ed92d20..bfd9815ab 100644 --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c @@ -12,6 +12,7 @@   */  #include <miiphy.h> +/* This code does not check the partner abilities. */  static int smsc_parse_status(struct phy_device *phydev)  {  	int mii_reg; @@ -64,7 +65,7 @@ static struct phy_driver lan8710_driver = {  	.mask = 0xffff0,  	.features = PHY_BASIC_FEATURES,  	.config = &genphy_config_aneg, -	.startup = &smsc_startup, +	.startup = &genphy_startup,  	.shutdown = &genphy_shutdown,  }; diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c index 5cf103e5a..c55597966 100644 --- a/drivers/net/phy/vitesse.c +++ b/drivers/net/phy/vitesse.c @@ -49,6 +49,15 @@  #define MIIM_VSC8574_18G_QSGMII		0x80e0  #define MIIM_VSC8574_18G_CMDSTAT	0x8000 +/* Vitesse VSC8514 control register */ +#define MIIM_VSC8514_GENERAL18		0x12 +#define MIIM_VSC8514_GENERAL19		0x13 +#define MIIM_VSC8514_GENERAL23		0x17 + +/* Vitesse VSC8514 gerenal purpose register 18 */ +#define MIIM_VSC8514_18G_QSGMII		0x80e0 +#define MIIM_VSC8514_18G_CMDSTAT	0x8000 +  /* CIS8201 */  static int vitesse_config(struct phy_device *phydev)  { @@ -148,7 +157,7 @@ static int vsc8601_config(struct phy_device *phydev)  static int vsc8574_config(struct phy_device *phydev)  {  	u32 val; -	/* configure regiser 19G for MAC */ +	/* configure register 19G for MAC */  	phy_write(phydev, MDIO_DEVAD_NONE, PHY_EXT_PAGE_ACCESS,  		  PHY_EXT_PAGE_ACCESS_GENERAL); @@ -188,6 +197,53 @@ static int vsc8574_config(struct phy_device *phydev)  	return 0;  } +static int vsc8514_config(struct phy_device *phydev) +{ +	u32 val; +	int timeout = 1000000; + +	/* configure register to access 19G */ +	phy_write(phydev, MDIO_DEVAD_NONE, PHY_EXT_PAGE_ACCESS, +		  PHY_EXT_PAGE_ACCESS_GENERAL); + +	val = phy_read(phydev, MDIO_DEVAD_NONE, MIIM_VSC8514_GENERAL19); +	if (phydev->interface == PHY_INTERFACE_MODE_QSGMII) { +		/* set bit 15:14 to '01' for QSGMII mode */ +		val = (val & 0x3fff) | (1 << 14); +		phy_write(phydev, MDIO_DEVAD_NONE, +			  MIIM_VSC8514_GENERAL19, val); +		/* Enable 4 ports MAC QSGMII */ +		phy_write(phydev, MDIO_DEVAD_NONE, MIIM_VSC8514_GENERAL18, +			  MIIM_VSC8514_18G_QSGMII); +	} else { +		/*TODO Add SGMII functionality once spec sheet +		 * for VSC8514 defines complete functionality +		 */ +	} + +	val = phy_read(phydev, MDIO_DEVAD_NONE, MIIM_VSC8514_GENERAL18); +	/* When bit 15 is cleared the command has completed */ +	while ((val & MIIM_VSC8514_18G_CMDSTAT) && timeout--) +		val = phy_read(phydev, MDIO_DEVAD_NONE, MIIM_VSC8514_GENERAL18); + +	if (0 == timeout) { +		printf("PHY 8514 config failed\n"); +		return -1; +	} + +	phy_write(phydev, MDIO_DEVAD_NONE, PHY_EXT_PAGE_ACCESS, 0); + +	/* configure register to access 23 */ +	val = phy_read(phydev, MDIO_DEVAD_NONE, MIIM_VSC8514_GENERAL23); +	/* set bits 10:8 to '000' */ +	val = (val & 0xf8ff); +	phy_write(phydev, MDIO_DEVAD_NONE, MIIM_VSC8514_GENERAL23, val); + +	genphy_config_aneg(phydev); + +	return 0; +} +  static struct phy_driver VSC8211_driver = {  	.name	= "Vitesse VSC8211",  	.uid	= 0xfc4b0, @@ -238,6 +294,16 @@ static struct phy_driver VSC8574_driver = {  	.shutdown = &genphy_shutdown,  }; +static struct phy_driver VSC8514_driver = { +	.name = "Vitesse VSC8514", +	.uid = 0x70570, +	.mask = 0xffff0, +	.features = PHY_GBIT_FEATURES, +	.config = &vsc8514_config, +	.startup = &vitesse_startup, +	.shutdown = &genphy_shutdown, +}; +  static struct phy_driver VSC8601_driver = {  	.name = "Vitesse VSC8601",  	.uid = 0x70420, @@ -298,6 +364,7 @@ int phy_vitesse_init(void)  	phy_register(&VSC8211_driver);  	phy_register(&VSC8221_driver);  	phy_register(&VSC8574_driver); +	phy_register(&VSC8514_driver);  	phy_register(&VSC8662_driver);  	phy_register(&cis8201_driver);  	phy_register(&cis8204_driver); diff --git a/drivers/net/rtl8139.c b/drivers/net/rtl8139.c index 4186699ff..208ce5ccc 100644 --- a/drivers/net/rtl8139.c +++ b/drivers/net/rtl8139.c @@ -188,7 +188,7 @@ static int rtl_transmit(struct eth_device *dev, void *packet, int length);  static int rtl_poll(struct eth_device *dev);  static void rtl_disable(struct eth_device *dev);  #ifdef CONFIG_MCAST_TFTP/*  This driver already accepts all b/mcast */ -static int rtl_bcast_addr (struct eth_device *dev, u8 bcast_mac, u8 set) +static int rtl_bcast_addr(struct eth_device *dev, const u8 *bcast_mac, u8 set)  {  	return (0);  } diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c index 13fa9c02f..d040ab171 100644 --- a/drivers/net/rtl8169.c +++ b/drivers/net/rtl8169.c @@ -246,6 +246,8 @@ static struct {  	{"RTL-8169sc/8110sc",	0x18, 0xff7e1880,},  	{"RTL-8168b/8111sb",	0x30, 0xff7e1880,},  	{"RTL-8168b/8111sb",	0x38, 0xff7e1880,}, +	{"RTL-8168d/8111d",	0x28, 0xff7e1880,}, +	{"RTL-8168evl/8111evl",	0x2e, 0xff7e1880,},  	{"RTL-8101e",		0x34, 0xff7e1880,},  	{"RTL-8100e",		0x32, 0xff7e1880,},  }; @@ -314,6 +316,7 @@ static const unsigned int rtl8169_rx_config =  static struct pci_device_id supported[] = {  	{PCI_VENDOR_ID_REALTEK, 0x8167}, +	{PCI_VENDOR_ID_REALTEK, 0x8168},  	{PCI_VENDOR_ID_REALTEK, 0x8169},  	{}  }; @@ -394,6 +397,50 @@ match:  	return 0;  } +/* + * Cache maintenance functions. These are simple wrappers around the more + * general purpose flush_cache() and invalidate_dcache_range() functions. + */ + +static void rtl_inval_rx_desc(struct RxDesc *desc) +{ +	unsigned long start = (unsigned long)desc & ~(ARCH_DMA_MINALIGN - 1); +	unsigned long end = ALIGN(start + sizeof(*desc), ARCH_DMA_MINALIGN); + +	invalidate_dcache_range(start, end); +} + +static void rtl_flush_rx_desc(struct RxDesc *desc) +{ +	flush_cache((unsigned long)desc, sizeof(*desc)); +} + +static void rtl_inval_tx_desc(struct TxDesc *desc) +{ +	unsigned long start = (unsigned long)desc & ~(ARCH_DMA_MINALIGN - 1); +	unsigned long end = ALIGN(start + sizeof(*desc), ARCH_DMA_MINALIGN); + +	invalidate_dcache_range(start, end); +} + +static void rtl_flush_tx_desc(struct TxDesc *desc) +{ +	flush_cache((unsigned long)desc, sizeof(*desc)); +} + +static void rtl_inval_buffer(void *buf, size_t size) +{ +	unsigned long start = (unsigned long)buf & ~(ARCH_DMA_MINALIGN - 1); +	unsigned long end = ALIGN(start + size, ARCH_DMA_MINALIGN); + +	invalidate_dcache_range(start, end); +} + +static void rtl_flush_buffer(void *buf, size_t size) +{ +	flush_cache((unsigned long)buf, size); +} +  /**************************************************************************  RECV - Receive a frame  ***************************************************************************/ @@ -411,14 +458,16 @@ static int rtl_recv(struct eth_device *dev)  	ioaddr = dev->iobase;  	cur_rx = tpc->cur_rx; -	flush_cache((unsigned long)&tpc->RxDescArray[cur_rx], -			sizeof(struct RxDesc)); + +	rtl_inval_rx_desc(&tpc->RxDescArray[cur_rx]); +  	if ((le32_to_cpu(tpc->RxDescArray[cur_rx].status) & OWNbit) == 0) {  		if (!(le32_to_cpu(tpc->RxDescArray[cur_rx].status) & RxRES)) {  			unsigned char rxdata[RX_BUF_LEN];  			length = (int) (le32_to_cpu(tpc->RxDescArray[cur_rx].  						status) & 0x00001FFF) - 4; +			rtl_inval_buffer(tpc->RxBufferRing[cur_rx], length);  			memcpy(rxdata, tpc->RxBufferRing[cur_rx], length);  			NetReceive(rxdata, length); @@ -430,8 +479,7 @@ static int rtl_recv(struct eth_device *dev)  					cpu_to_le32(OWNbit + RX_BUF_SIZE);  			tpc->RxDescArray[cur_rx].buf_addr =  				cpu_to_le32(bus_to_phys(tpc->RxBufferRing[cur_rx])); -			flush_cache((unsigned long)tpc->RxBufferRing[cur_rx], -					RX_BUF_SIZE); +			rtl_flush_rx_desc(&tpc->RxDescArray[cur_rx]);  		} else {  			puts("Error Rx");  		} @@ -473,7 +521,7 @@ static int rtl_send(struct eth_device *dev, void *packet, int length)  	/* point to the current txb incase multiple tx_rings are used */  	ptxb = tpc->Tx_skbuff[entry * MAX_ETH_FRAME_SIZE];  	memcpy(ptxb, (char *)packet, (int)length); -	flush_cache((unsigned long)ptxb, length); +	rtl_flush_buffer(ptxb, length);  	while (len < ETH_ZLEN)  		ptxb[len++] = '\0'; @@ -489,20 +537,20 @@ static int rtl_send(struct eth_device *dev, void *packet, int length)  			cpu_to_le32((OWNbit | EORbit | FSbit | LSbit) |  				    ((len > ETH_ZLEN) ? len : ETH_ZLEN));  	} +	rtl_flush_tx_desc(&tpc->TxDescArray[entry]);  	RTL_W8(TxPoll, 0x40);	/* set polling bit */  	tpc->cur_tx++;  	to = currticks() + TX_TIMEOUT;  	do { -		flush_cache((unsigned long)&tpc->TxDescArray[entry], -				sizeof(struct TxDesc)); +		rtl_inval_tx_desc(&tpc->TxDescArray[entry]);  	} while ((le32_to_cpu(tpc->TxDescArray[entry].status) & OWNbit)  				&& (currticks() < to));	/* wait */  	if (currticks() >= to) {  #ifdef DEBUG_RTL8169_TX -		puts ("tx timeout/error\n"); -		printf ("%s elapsed time : %d\n", __FUNCTION__, currticks()-stime); +		puts("tx timeout/error\n"); +		printf("%s elapsed time : %lu\n", __func__, currticks()-stime);  #endif  		ret = 0;  	} else { @@ -604,7 +652,7 @@ static void rtl8169_hw_start(struct eth_device *dev)  	RTL_W16(MultiIntr, RTL_R16(MultiIntr) & 0xF000);  #ifdef DEBUG_RTL8169 -	printf ("%s elapsed time : %d\n", __FUNCTION__, currticks()-stime); +	printf("%s elapsed time : %lu\n", __func__, currticks()-stime);  #endif  } @@ -638,11 +686,11 @@ static void rtl8169_init_ring(struct eth_device *dev)  		tpc->RxBufferRing[i] = &rxb[i * RX_BUF_SIZE];  		tpc->RxDescArray[i].buf_addr =  			cpu_to_le32(bus_to_phys(tpc->RxBufferRing[i])); -		flush_cache((unsigned long)tpc->RxBufferRing[i], RX_BUF_SIZE); +		rtl_flush_rx_desc(&tpc->RxDescArray[i]);  	}  #ifdef DEBUG_RTL8169 -	printf ("%s elapsed time : %d\n", __FUNCTION__, currticks()-stime); +	printf("%s elapsed time : %lu\n", __func__, currticks()-stime);  #endif  } @@ -683,7 +731,7 @@ static int rtl_reset(struct eth_device *dev, bd_t *bis)  	txb[5] = dev->enetaddr[5];  #ifdef DEBUG_RTL8169 -	printf ("%s elapsed time : %d\n", __FUNCTION__, currticks()-stime); +	printf("%s elapsed time : %lu\n", __func__, currticks()-stime);  #endif  	return 0;  } @@ -869,11 +917,25 @@ int rtl8169_initialize(bd_t *bis)  	int idx=0;  	while(1){ +		unsigned int region; +		u16 device; +  		/* Find RTL8169 */  		if ((devno = pci_find_devices(supported, idx++)) < 0)  			break; -		pci_read_config_dword(devno, PCI_BASE_ADDRESS_1, &iobase); +		pci_read_config_word(devno, PCI_DEVICE_ID, &device); +		switch (device) { +		case 0x8168: +			region = 2; +			break; + +		default: +			region = 1; +			break; +		} + +		pci_read_config_dword(devno, PCI_BASE_ADDRESS_0 + (region * 4), &iobase);  		iobase &= ~0xf;  		debug ("rtl8169: REALTEK RTL8169 @0x%x\n", iobase); diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c index d5a83e0bf..5e132f2b5 100644 --- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c @@ -4,6 +4,7 @@   * Copyright (C) 2008, 2011 Renesas Solutions Corp.   * Copyright (c) 2008, 2011 Nobuhiro Iwamatsu   * Copyright (c) 2007 Carlos Munoz <carlos@kenati.com> + * Copyright (C) 2013  Renesas Electronics Corporation   *   * SPDX-License-Identifier:	GPL-2.0+   */ @@ -25,13 +26,31 @@  #ifndef CONFIG_SH_ETHER_PHY_ADDR  # error "Please define CONFIG_SH_ETHER_PHY_ADDR"  #endif -#ifdef CONFIG_SH_ETHER_CACHE_WRITEBACK -#define flush_cache_wback(addr, len)	\ -			dcache_wback_range((u32)addr, (u32)(addr + len - 1)) + +#if defined(CONFIG_SH_ETHER_CACHE_WRITEBACK) && !defined(CONFIG_SYS_DCACHE_OFF) +#define flush_cache_wback(addr, len)    \ +		flush_dcache_range((u32)addr, (u32)(addr + len - 1))  #else  #define flush_cache_wback(...)  #endif +#if defined(CONFIG_SH_ETHER_CACHE_INVALIDATE) && defined(CONFIG_ARM) +#define invalidate_cache(addr, len)		\ +	{	\ +		u32 line_size = CONFIG_SH_ETHER_ALIGNE_SIZE;	\ +		u32 start, end;	\ +		\ +		start = (u32)addr;	\ +		end = start + len;	\ +		start &= ~(line_size - 1);	\ +		end = ((end + line_size - 1) & ~(line_size - 1));	\ +		\ +		invalidate_dcache_range(start, end);	\ +	} +#else +#define invalidate_cache(...) +#endif +  #define TIMEOUT_CNT 1000  int sh_eth_send(struct eth_device *dev, void *packet, int len) @@ -69,8 +88,11 @@ int sh_eth_send(struct eth_device *dev, void *packet, int len)  	/* Wait until packet is transmitted */  	timeout = TIMEOUT_CNT; -	while (port_info->tx_desc_cur->td0 & TD_TACT && timeout--) +	do { +		invalidate_cache(port_info->tx_desc_cur, +				 sizeof(struct tx_desc_s));  		udelay(100); +	} while (port_info->tx_desc_cur->td0 & TD_TACT && timeout--);  	if (timeout < 0) {  		printf(SHETHER_NAME ": transmit timeout\n"); @@ -94,12 +116,14 @@ int sh_eth_recv(struct eth_device *dev)  	uchar *packet;  	/* Check if the rx descriptor is ready */ +	invalidate_cache(port_info->rx_desc_cur, sizeof(struct rx_desc_s));  	if (!(port_info->rx_desc_cur->rd0 & RD_RACT)) {  		/* Check for errors */  		if (!(port_info->rx_desc_cur->rd0 & RD_RFE)) {  			len = port_info->rx_desc_cur->rd1 & 0xffff;  			packet = (uchar *)  				ADDR_TO_P2(port_info->rx_desc_cur->rd2); +			invalidate_cache(packet, len);  			NetReceive(packet, len);  		} @@ -108,7 +132,6 @@ int sh_eth_recv(struct eth_device *dev)  			port_info->rx_desc_cur->rd0 = RD_RACT | RD_RDLE;  		else  			port_info->rx_desc_cur->rd0 = RD_RACT; -  		/* Point to the next descriptor */  		port_info->rx_desc_cur++;  		if (port_info->rx_desc_cur >= @@ -237,15 +260,17 @@ static int sh_eth_rx_desc_init(struct sh_eth_dev *eth)  	 * Allocate rx data buffers. They must be 32 bytes aligned  and in  	 * P2 area  	 */ -	port_info->rx_buf_malloc = malloc(NUM_RX_DESC * MAX_BUF_SIZE + 31); +	port_info->rx_buf_malloc = malloc( +		NUM_RX_DESC * MAX_BUF_SIZE + RX_BUF_ALIGNE_SIZE - 1);  	if (!port_info->rx_buf_malloc) {  		printf(SHETHER_NAME ": malloc failed\n");  		ret = -ENOMEM;  		goto err_buf_malloc;  	} -	tmp_addr = (u32)(((int)port_info->rx_buf_malloc + (32 - 1)) & -			  ~(32 - 1)); +	tmp_addr = (u32)(((int)port_info->rx_buf_malloc +			  + (RX_BUF_ALIGNE_SIZE - 1)) & +			  ~(RX_BUF_ALIGNE_SIZE - 1));  	port_info->rx_buf_base = (u8 *)ADDR_TO_P2(tmp_addr);  	/* Initialize all descriptors */ @@ -351,8 +376,9 @@ static int sh_eth_config(struct sh_eth_dev *eth, bd_t *bd)  	struct phy_device *phy;  	/* Configure e-dmac registers */ -	sh_eth_write(eth, (sh_eth_read(eth, EDMR) & ~EMDR_DESC_R) | EDMR_EL, -		     EDMR); +	sh_eth_write(eth, (sh_eth_read(eth, EDMR) & ~EMDR_DESC_R) | +			(EMDR_DESC | EDMR_EL), EDMR); +  	sh_eth_write(eth, 0, EESIPR);  	sh_eth_write(eth, 0, TRSCER);  	sh_eth_write(eth, 0, TFTR); @@ -384,6 +410,8 @@ static int sh_eth_config(struct sh_eth_dev *eth, bd_t *bd)  #if defined(CONFIG_CPU_SH7734) || defined(CONFIG_R8A7740)  	sh_eth_write(eth, CONFIG_SH_ETHER_SH7734_MII, RMII_MII); +#elif defined(CONFIG_R8A7790) || defined(CONFIG_R8A7791) +	sh_eth_write(eth, sh_eth_read(eth, RMIIMR) | 0x1, RMIIMR);  #endif  	/* Configure phy */  	ret = sh_eth_phy_config(eth); @@ -407,7 +435,8 @@ static int sh_eth_config(struct sh_eth_dev *eth, bd_t *bd)  		sh_eth_write(eth, GECMR_100B, GECMR);  #elif defined(CONFIG_CPU_SH7757) || defined(CONFIG_CPU_SH7752)  		sh_eth_write(eth, 1, RTRATE); -#elif defined(CONFIG_CPU_SH7724) +#elif defined(CONFIG_CPU_SH7724) || defined(CONFIG_R8A7790) || \ +		defined(CONFIG_R8A7791)  		val = ECMR_RTM;  #endif  	} else if (phy->speed == 10) { diff --git a/drivers/net/sh_eth.h b/drivers/net/sh_eth.h index 9ad800e42..8aa71098c 100644 --- a/drivers/net/sh_eth.h +++ b/drivers/net/sh_eth.h @@ -31,6 +31,11 @@  #define ADDR_TO_P2(addr)	(addr)  #endif /* defined(CONFIG_SH) */ +/* base padding size is 16 */ +#ifndef CONFIG_SH_ETHER_ALIGNE_SIZE +#define CONFIG_SH_ETHER_ALIGNE_SIZE 16 +#endif +  /* Number of supported ports */  #define MAX_PORT_NUM	2 @@ -45,15 +50,16 @@  /* The size of the tx descriptor is determined by how much padding is used.     4, 20, or 52 bytes of padding can be used */ -#define TX_DESC_PADDING		4 -#define TX_DESC_SIZE		(12 + TX_DESC_PADDING) +#define TX_DESC_PADDING	(CONFIG_SH_ETHER_ALIGNE_SIZE - 12) +/* same as CONFIG_SH_ETHER_ALIGNE_SIZE */ +#define TX_DESC_SIZE	(12 + TX_DESC_PADDING)  /* Tx descriptor. We always use 3 bytes of padding */  struct tx_desc_s {  	volatile u32 td0;  	u32 td1;  	u32 td2;		/* Buffer start */ -	u32 padding; +	u8 padding[TX_DESC_PADDING];	/* aligned cache line size */  };  /* There is no limitation in the number of rx descriptors */ @@ -61,15 +67,18 @@ struct tx_desc_s {  /* The size of the rx descriptor is determined by how much padding is used.     4, 20, or 52 bytes of padding can be used */ -#define RX_DESC_PADDING		4 +#define RX_DESC_PADDING	(CONFIG_SH_ETHER_ALIGNE_SIZE - 12) +/* same as CONFIG_SH_ETHER_ALIGNE_SIZE */  #define RX_DESC_SIZE		(12 + RX_DESC_PADDING) +/* aligned cache line size */ +#define RX_BUF_ALIGNE_SIZE	(CONFIG_SH_ETHER_ALIGNE_SIZE > 32 ? 64 : 32)  /* Rx descriptor. We always use 4 bytes of padding */  struct rx_desc_s {  	volatile u32 rd0;  	volatile u32 rd1;  	u32 rd2;		/* Buffer start */ -	u32 padding; +	u8 padding[TX_DESC_PADDING];	/* aligned cache line size */  };  struct sh_eth_info { @@ -157,6 +166,7 @@ enum {  	TLFRCR,  	CERCR,  	CEECR, +	RMIIMR, /* R8A7790 */  	MAFCR,  	RTRATE,  	CSMR, @@ -263,6 +273,7 @@ static const u16 sh_eth_offset_fast_sh4[SH_ETH_MAX_REGISTER_OFFSET] = {  	[RMCR]	= 0x0058,  	[TFUCR]	= 0x0064,  	[RFOCR]	= 0x0068, +	[RMIIMR] = 0x006C,  	[FCFTR]	= 0x0070,  	[RPADIR]	= 0x0078,  	[TRIMD]	= 0x007c, @@ -290,6 +301,9 @@ static const u16 sh_eth_offset_fast_sh4[SH_ETH_MAX_REGISTER_OFFSET] = {  #elif defined(CONFIG_R8A7740)  #define SH_ETH_TYPE_GETHER  #define BASE_IO_ADDR	0xE9A00000 +#elif defined(CONFIG_R8A7790) || defined(CONFIG_R8A7791) +#define SH_ETH_TYPE_ETHER +#define BASE_IO_ADDR	0xEE700200  #endif  /* @@ -320,6 +334,14 @@ enum DMAC_M_BIT {  #endif  }; +#if CONFIG_SH_ETHER_ALIGNE_SIZE == 64 +# define EMDR_DESC EDMR_DL1 +#elif CONFIG_SH_ETHER_ALIGNE_SIZE == 32 +# define EMDR_DESC EDMR_DL0 +#elif CONFIG_SH_ETHER_ALIGNE_SIZE == 16 /* Default */ +# define EMDR_DESC 0 +#endif +  /* RFLR */  #define RFLR_RFL_MIN	0x05EE	/* Recv Frame length 1518 byte */ @@ -485,6 +507,8 @@ enum FELIC_MODE_BIT {  	ECMR_PRM = 0x00000001,  #ifdef CONFIG_CPU_SH7724  	ECMR_RTM = 0x00000010, +#elif defined(CONFIG_R8A7790) || defined(CONFIG_R8A7791) +	ECMR_RTM = 0x00000004,  #endif  }; diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index f5e314b9e..e9138f033 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -5,7 +5,7 @@   * terms of the GNU Public License, Version 2, incorporated   * herein by reference.   * - * Copyright 2004-2011 Freescale Semiconductor, Inc. + * Copyright 2004-2011, 2013 Freescale Semiconductor, Inc.   * (C) Copyright 2003, Motorola, Inc.   * author Andy Fleming   * @@ -25,21 +25,13 @@ DECLARE_GLOBAL_DATA_PTR;  #define TX_BUF_CNT		2 -static uint rxIdx;		/* index of the current RX buffer */ -static uint txIdx;		/* index of the current TX buffer */ - -typedef volatile struct rtxbd { -	txbd8_t txbd[TX_BUF_CNT]; -	rxbd8_t rxbd[PKTBUFSRX]; -} RTXBD; - -#define MAXCONTROLLERS	(8) - -static struct tsec_private *privlist[MAXCONTROLLERS]; -static int num_tsecs = 0; +static uint rx_idx;		/* index of the current RX buffer */ +static uint tx_idx;		/* index of the current TX buffer */  #ifdef __GNUC__ -static RTXBD rtx __attribute__ ((aligned(8))); +static struct txbd8 __iomem txbd[TX_BUF_CNT] __aligned(8); +static struct rxbd8 __iomem rxbd[PKTBUFSRX] __aligned(8); +  #else  #error "rtx must be 64-bit aligned"  #endif @@ -57,7 +49,7 @@ static struct tsec_info_struct tsec_info[] = {  #endif  #ifdef CONFIG_MPC85XX_FEC  	{ -		.regs = (tsec_t *)(TSEC_BASE_ADDR + 0x2000), +		.regs = TSEC_GET_REGS(2, 0x2000),  		.devname = CONFIG_MPC85XX_FEC_NAME,  		.phyaddr = FEC_PHY_ADDR,  		.flags = FEC_FLAGS, @@ -113,32 +105,31 @@ static void tsec_configure_serdes(struct tsec_private *priv)   * result.   * 2) Use the 8 most significant bits as a hash into a 256-entry   * table.  The table is controlled through 8 32-bit registers: - * gaddr0-7.  gaddr0's MSB is entry 0, and gaddr7's LSB is - * gaddr7.  This means that the 3 most significant bits in the + * gaddr0-7.  gaddr0's MSB is entry 0, and gaddr7's LSB is entry + * 255.  This means that the 3 most significant bits in the   * hash index which gaddr register to use, and the 5 other bits   * indicate which bit (assuming an IBM numbering scheme, which - * for PowerPC (tm) is usually the case) in the tregister holds + * for PowerPC (tm) is usually the case) in the register holds   * the entry. */  static int -tsec_mcast_addr (struct eth_device *dev, u8 mcast_mac, u8 set) +tsec_mcast_addr(struct eth_device *dev, const u8 *mcast_mac, u8 set)  { -	struct tsec_private *priv = privlist[1]; -	volatile tsec_t *regs = priv->regs; -	volatile u32  *reg_array, value; -	u8 result, whichbit, whichreg; +	struct tsec_private *priv = (struct tsec_private *)dev->priv; +	struct tsec __iomem *regs = priv->regs; +	u32 result, value; +	u8 whichbit, whichreg; -	result = (u8)((ether_crc(MAC_ADDR_LEN,mcast_mac) >> 24) & 0xff); -	whichbit = result & 0x1f;	/* the 5 LSB = which bit to set */ -	whichreg = result >> 5;		/* the 3 MSB = which reg to set it in */ -	value = (1 << (31-whichbit)); +	result = ether_crc(MAC_ADDR_LEN, mcast_mac); +	whichbit = (result >> 24) & 0x1f; /* the 5 LSB = which bit to set */ +	whichreg = result >> 29; /* the 3 MSB = which reg to set it in */ -	reg_array = &(regs->hash.gaddr0); +	value = 1 << (31-whichbit); + +	if (set) +		setbits_be32(®s->hash.gaddr0 + whichreg, value); +	else +		clrbits_be32(®s->hash.gaddr0 + whichreg, value); -	if (set) { -		reg_array[whichreg] |= value; -	} else { -		reg_array[whichreg] &= ~value; -	}  	return 0;  }  #endif /* Multicast TFTP ? */ @@ -147,7 +138,7 @@ tsec_mcast_addr (struct eth_device *dev, u8 mcast_mac, u8 set)   * those we don't care about (unless zero is bad, in which case,   * choose a more appropriate value)   */ -static void init_registers(tsec_t *regs) +static void init_registers(struct tsec __iomem *regs)  {  	/* Clear IEVENT */  	out_be32(®s->ievent, IEVENT_INIT_CLEAR); @@ -175,7 +166,7 @@ static void init_registers(tsec_t *regs)  	out_be32(®s->rctrl, 0x00000000);  	/* Init RMON mib registers */ -	memset((void *)&(regs->rmon), 0, sizeof(rmon_mib_t)); +	memset((void *)®s->rmon, 0, sizeof(regs->rmon));  	out_be32(®s->rmon.cam1, 0xffffffff);  	out_be32(®s->rmon.cam2, 0xffffffff); @@ -194,7 +185,7 @@ static void init_registers(tsec_t *regs)   */  static void adjust_link(struct tsec_private *priv, struct phy_device *phydev)  { -	tsec_t *regs = priv->regs; +	struct tsec __iomem *regs = priv->regs;  	u32 ecntrl, maccfg2;  	if (!phydev->link) { @@ -248,7 +239,7 @@ static void adjust_link(struct tsec_private *priv, struct phy_device *phydev)  void redundant_init(struct eth_device *dev)  {  	struct tsec_private *priv = dev->priv; -	tsec_t *regs = priv->regs; +	struct tsec __iomem *regs = priv->regs;  	uint t, count = 0;  	int fail = 1;  	static const u8 pkt[] = { @@ -281,23 +272,26 @@ void redundant_init(struct eth_device *dev)  	clrbits_be32(®s->dmactrl, DMACTRL_GRS | DMACTRL_GTS);  	do { +		uint16_t status;  		tsec_send(dev, (void *)pkt, sizeof(pkt));  		/* Wait for buffer to be received */ -		for (t = 0; rtx.rxbd[rxIdx].status & RXBD_EMPTY; t++) { +		for (t = 0; in_be16(&rxbd[rx_idx].status) & RXBD_EMPTY; t++) {  			if (t >= 10 * TOUT_LOOP) {  				printf("%s: tsec: rx error\n", dev->name);  				break;  			}  		} -		if (!memcmp(pkt, (void *)NetRxPackets[rxIdx], sizeof(pkt))) +		if (!memcmp(pkt, (void *)NetRxPackets[rx_idx], sizeof(pkt)))  			fail = 0; -		rtx.rxbd[rxIdx].length = 0; -		rtx.rxbd[rxIdx].status = -		    RXBD_EMPTY | (((rxIdx + 1) == PKTBUFSRX) ? RXBD_WRAP : 0); -		rxIdx = (rxIdx + 1) % PKTBUFSRX; +		out_be16(&rxbd[rx_idx].length, 0); +		status = RXBD_EMPTY; +		if ((rx_idx + 1) == PKTBUFSRX) +			status |= RXBD_WRAP; +		out_be16(&rxbd[rx_idx].status, status); +		rx_idx = (rx_idx + 1) % PKTBUFSRX;  		if (in_be32(®s->ievent) & IEVENT_BSY) {  			out_be32(®s->ievent, IEVENT_BSY); @@ -325,36 +319,39 @@ void redundant_init(struct eth_device *dev)   */  static void startup_tsec(struct eth_device *dev)  { -	int i;  	struct tsec_private *priv = (struct tsec_private *)dev->priv; -	tsec_t *regs = priv->regs; +	struct tsec __iomem *regs = priv->regs; +	uint16_t status; +	int i;  	/* reset the indices to zero */ -	rxIdx = 0; -	txIdx = 0; +	rx_idx = 0; +	tx_idx = 0;  #ifdef CONFIG_SYS_FSL_ERRATUM_NMG_ETSEC129  	uint svr;  #endif  	/* Point to the buffer descriptors */ -	out_be32(®s->tbase, (unsigned int)(&rtx.txbd[txIdx])); -	out_be32(®s->rbase, (unsigned int)(&rtx.rxbd[rxIdx])); +	out_be32(®s->tbase, (u32)&txbd[0]); +	out_be32(®s->rbase, (u32)&rxbd[0]);  	/* Initialize the Rx Buffer descriptors */  	for (i = 0; i < PKTBUFSRX; i++) { -		rtx.rxbd[i].status = RXBD_EMPTY; -		rtx.rxbd[i].length = 0; -		rtx.rxbd[i].bufPtr = (uint) NetRxPackets[i]; +		out_be16(&rxbd[i].status, RXBD_EMPTY); +		out_be16(&rxbd[i].length, 0); +		out_be32(&rxbd[i].bufptr, (u32)NetRxPackets[i]);  	} -	rtx.rxbd[PKTBUFSRX - 1].status |= RXBD_WRAP; +	status = in_be16(&rxbd[PKTBUFSRX - 1].status); +	out_be16(&rxbd[PKTBUFSRX - 1].status, status | RXBD_WRAP);  	/* Initialize the TX Buffer Descriptors */  	for (i = 0; i < TX_BUF_CNT; i++) { -		rtx.txbd[i].status = 0; -		rtx.txbd[i].length = 0; -		rtx.txbd[i].bufPtr = 0; +		out_be16(&txbd[i].status, 0); +		out_be16(&txbd[i].length, 0); +		out_be32(&txbd[i].bufptr, 0);  	} -	rtx.txbd[TX_BUF_CNT - 1].status |= TXBD_WRAP; +	status = in_be16(&txbd[TX_BUF_CNT - 1].status); +	out_be16(&txbd[TX_BUF_CNT - 1].status, status | TXBD_WRAP);  #ifdef CONFIG_SYS_FSL_ERRATUM_NMG_ETSEC129  	svr = get_svr(); @@ -378,66 +375,67 @@ static void startup_tsec(struct eth_device *dev)   */  static int tsec_send(struct eth_device *dev, void *packet, int length)  { -	int i; -	int result = 0;  	struct tsec_private *priv = (struct tsec_private *)dev->priv; -	tsec_t *regs = priv->regs; +	struct tsec __iomem *regs = priv->regs; +	uint16_t status; +	int result = 0; +	int i;  	/* Find an empty buffer descriptor */ -	for (i = 0; rtx.txbd[txIdx].status & TXBD_READY; i++) { +	for (i = 0; in_be16(&txbd[tx_idx].status) & TXBD_READY; i++) {  		if (i >= TOUT_LOOP) {  			debug("%s: tsec: tx buffers full\n", dev->name);  			return result;  		}  	} -	rtx.txbd[txIdx].bufPtr = (uint) packet; -	rtx.txbd[txIdx].length = length; -	rtx.txbd[txIdx].status |= -	    (TXBD_READY | TXBD_LAST | TXBD_CRC | TXBD_INTERRUPT); +	out_be32(&txbd[tx_idx].bufptr, (u32)packet); +	out_be16(&txbd[tx_idx].length, length); +	status = in_be16(&txbd[tx_idx].status); +	out_be16(&txbd[tx_idx].status, status | +		(TXBD_READY | TXBD_LAST | TXBD_CRC | TXBD_INTERRUPT));  	/* Tell the DMA to go */  	out_be32(®s->tstat, TSTAT_CLEAR_THALT);  	/* Wait for buffer to be transmitted */ -	for (i = 0; rtx.txbd[txIdx].status & TXBD_READY; i++) { +	for (i = 0; in_be16(&txbd[tx_idx].status) & TXBD_READY; i++) {  		if (i >= TOUT_LOOP) {  			debug("%s: tsec: tx error\n", dev->name);  			return result;  		}  	} -	txIdx = (txIdx + 1) % TX_BUF_CNT; -	result = rtx.txbd[txIdx].status & TXBD_STATS; +	tx_idx = (tx_idx + 1) % TX_BUF_CNT; +	result = in_be16(&txbd[tx_idx].status) & TXBD_STATS;  	return result;  }  static int tsec_recv(struct eth_device *dev)  { -	int length;  	struct tsec_private *priv = (struct tsec_private *)dev->priv; -	tsec_t *regs = priv->regs; - -	while (!(rtx.rxbd[rxIdx].status & RXBD_EMPTY)) { +	struct tsec __iomem *regs = priv->regs; -		length = rtx.rxbd[rxIdx].length; +	while (!(in_be16(&rxbd[rx_idx].status) & RXBD_EMPTY)) { +		int length = in_be16(&rxbd[rx_idx].length); +		uint16_t status = in_be16(&rxbd[rx_idx].status);  		/* Send the packet up if there were no errors */ -		if (!(rtx.rxbd[rxIdx].status & RXBD_STATS)) { -			NetReceive(NetRxPackets[rxIdx], length - 4); -		} else { -			printf("Got error %x\n", -			       (rtx.rxbd[rxIdx].status & RXBD_STATS)); -		} +		if (!(status & RXBD_STATS)) +			NetReceive(NetRxPackets[rx_idx], length - 4); +		else +			printf("Got error %x\n", (status & RXBD_STATS)); -		rtx.rxbd[rxIdx].length = 0; +		out_be16(&rxbd[rx_idx].length, 0); +		status = RXBD_EMPTY;  		/* Set the wrap bit if this is the last element in the list */ -		rtx.rxbd[rxIdx].status = -		    RXBD_EMPTY | (((rxIdx + 1) == PKTBUFSRX) ? RXBD_WRAP : 0); +		if ((rx_idx + 1) == PKTBUFSRX) +			status |= RXBD_WRAP; +		out_be16(&rxbd[rx_idx].status, status); -		rxIdx = (rxIdx + 1) % PKTBUFSRX; +		rx_idx = (rx_idx + 1) % PKTBUFSRX;  	}  	if (in_be32(®s->ievent) & IEVENT_BSY) { @@ -453,7 +451,7 @@ static int tsec_recv(struct eth_device *dev)  static void tsec_halt(struct eth_device *dev)  {  	struct tsec_private *priv = (struct tsec_private *)dev->priv; -	tsec_t *regs = priv->regs; +	struct tsec __iomem *regs = priv->regs;  	clrbits_be32(®s->dmactrl, DMACTRL_GRS | DMACTRL_GTS);  	setbits_be32(®s->dmactrl, DMACTRL_GRS | DMACTRL_GTS); @@ -475,11 +473,9 @@ static void tsec_halt(struct eth_device *dev)   */  static int tsec_init(struct eth_device *dev, bd_t * bd)  { -	uint tempval; -	char tmpbuf[MAC_ADDR_LEN]; -	int i;  	struct tsec_private *priv = (struct tsec_private *)dev->priv; -	tsec_t *regs = priv->regs; +	struct tsec __iomem *regs = priv->regs; +	u32 tempval;  	int ret;  	/* Make sure the controller is stopped */ @@ -492,16 +488,16 @@ static int tsec_init(struct eth_device *dev, bd_t * bd)  	out_be32(®s->ecntrl, ECNTRL_INIT_SETTINGS);  	/* Copy the station address into the address registers. -	 * Backwards, because little endian MACS are dumb */ -	for (i = 0; i < MAC_ADDR_LEN; i++) -		tmpbuf[MAC_ADDR_LEN - 1 - i] = dev->enetaddr[i]; - -	tempval = (tmpbuf[0] << 24) | (tmpbuf[1] << 16) | (tmpbuf[2] << 8) | -		  tmpbuf[3]; +	 * For a station address of 0x12345678ABCD in transmission +	 * order (BE), MACnADDR1 is set to 0xCDAB7856 and +	 * MACnADDR2 is set to 0x34120000. +	 */ +	tempval = (dev->enetaddr[5] << 24) | (dev->enetaddr[4] << 16) | +		  (dev->enetaddr[3] << 8)  |  dev->enetaddr[2];  	out_be32(®s->macstnaddr1, tempval); -	tempval = *((uint *) (tmpbuf + 4)); +	tempval = (dev->enetaddr[1] << 24) | (dev->enetaddr[0] << 16);  	out_be32(®s->macstnaddr2, tempval); @@ -527,7 +523,7 @@ static int tsec_init(struct eth_device *dev, bd_t * bd)  static phy_interface_t tsec_get_interface(struct tsec_private *priv)  { -	tsec_t *regs = priv->regs; +	struct tsec __iomem *regs = priv->regs;  	u32 ecntrl;  	ecntrl = in_be32(®s->ecntrl); @@ -576,7 +572,7 @@ static int init_phy(struct eth_device *dev)  {  	struct tsec_private *priv = (struct tsec_private *)dev->priv;  	struct phy_device *phydev; -	tsec_t *regs = priv->regs; +	struct tsec __iomem *regs = priv->regs;  	u32 supported = (SUPPORTED_10baseT_Half |  			SUPPORTED_10baseT_Full |  			SUPPORTED_100baseT_Half | @@ -626,7 +622,6 @@ static int tsec_initialize(bd_t *bis, struct tsec_info_struct *tsec_info)  	if (NULL == priv)  		return 0; -	privlist[num_tsecs++] = priv;  	priv->regs = tsec_info->regs;  	priv->phyregs_sgmii = tsec_info->miiregs_sgmii; @@ -684,7 +679,7 @@ int tsec_standard_init(bd_t *bis)  {  	struct fsl_pq_mdio_info info; -	info.regs = (struct tsec_mii_mng *)CONFIG_SYS_MDIO_BASE_ADDR; +	info.regs = TSEC_GET_MDIO_REGS_BASE(1);  	info.name = DEFAULT_MII_NAME;  	fsl_pq_mdio_init(bis, &info); diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c index 236a75311..6a017a810 100644 --- a/drivers/net/zynq_gem.c +++ b/drivers/net/zynq_gem.c @@ -43,11 +43,6 @@  #define ZYNQ_GEM_TXBUF_WRAP_MASK	0x40000000  #define ZYNQ_GEM_TXBUF_LAST_MASK	0x00008000 /* Last buffer */ -#define ZYNQ_GEM_TXSR_HRESPNOK_MASK	0x00000100 /* Transmit hresp not OK */ -#define ZYNQ_GEM_TXSR_URUN_MASK		0x00000040 /* Transmit underrun */ -/* Transmit buffs exhausted mid frame */ -#define ZYNQ_GEM_TXSR_BUFEXH_MASK	0x00000010 -  #define ZYNQ_GEM_NWCTRL_TXEN_MASK	0x00000008 /* Enable transmit */  #define ZYNQ_GEM_NWCTRL_RXEN_MASK	0x00000004 /* Enable receive */  #define ZYNQ_GEM_NWCTRL_MDEN_MASK	0x00000010 /* Enable MDIO port */ @@ -90,6 +85,11 @@   */  #define PHY_DETECT_MASK 0x1808 +/* TX BD status masks */ +#define ZYNQ_GEM_TXBUF_FRMLEN_MASK	0x000007ff +#define ZYNQ_GEM_TXBUF_EXHAUSTED	0x08000000 +#define ZYNQ_GEM_TXBUF_UNDERRUN		0x10000000 +  /* Device registers */  struct zynq_gem_regs {  	u32 nwctrl; /* Network Control reg */ @@ -123,12 +123,18 @@ struct emac_bd {  };  #define RX_BUF 3 +/* Page table entries are set to 1MB, or multiples of 1MB + * (not < 1MB). driver uses less bd's so use 1MB bdspace. + */ +#define BD_SPACE	0x100000 +/* BD separation space */ +#define BD_SEPRN_SPACE	64  /* Initialized, rxbd_current, rx_first_buf must be 0 after init */  struct zynq_gem_priv { -	struct emac_bd tx_bd; -	struct emac_bd rx_bd[RX_BUF]; -	char rxbuffers[RX_BUF * PKTSIZE_ALIGN]; +	struct emac_bd *tx_bd; +	struct emac_bd *rx_bd; +	char *rxbuffers;  	u32 rxbd_current;  	u32 rx_first_buf;  	int phyaddr; @@ -299,20 +305,18 @@ static int zynq_gem_init(struct eth_device *dev, bd_t * bis)  			readl(®s->stat[i]);  		/* Setup RxBD space */ -		memset(&(priv->rx_bd), 0, sizeof(priv->rx_bd)); -		/* Create the RxBD ring */ -		memset(&(priv->rxbuffers), 0, sizeof(priv->rxbuffers)); +		memset(priv->rx_bd, 0, RX_BUF * sizeof(struct emac_bd));  		for (i = 0; i < RX_BUF; i++) {  			priv->rx_bd[i].status = 0xF0000000;  			priv->rx_bd[i].addr = -					(u32)((char *)&(priv->rxbuffers) + +					((u32)(priv->rxbuffers) +  							(i * PKTSIZE_ALIGN));  		}  		/* WRAP bit to last BD */  		priv->rx_bd[--i].addr |= ZYNQ_GEM_RXBUF_WRAP_MASK;  		/* Write RxBDs to IP */ -		writel((u32)&(priv->rx_bd), ®s->rxqbase); +		writel((u32)priv->rx_bd, ®s->rxqbase);  		/* Setup for DMA Configuration register */  		writel(ZYNQ_GEM_DMACR_INIT, ®s->dmacr); @@ -368,32 +372,35 @@ static int zynq_gem_init(struct eth_device *dev, bd_t * bis)  static int zynq_gem_send(struct eth_device *dev, void *ptr, int len)  { -	u32 status; +	u32 addr, size;  	struct zynq_gem_priv *priv = dev->priv;  	struct zynq_gem_regs *regs = (struct zynq_gem_regs *)dev->iobase; -	const u32 mask = ZYNQ_GEM_TXSR_HRESPNOK_MASK | \ -			ZYNQ_GEM_TXSR_URUN_MASK | ZYNQ_GEM_TXSR_BUFEXH_MASK;  	/* setup BD */ -	writel((u32)&(priv->tx_bd), ®s->txqbase); +	writel((u32)priv->tx_bd, ®s->txqbase);  	/* Setup Tx BD */ -	memset((void *)&(priv->tx_bd), 0, sizeof(struct emac_bd)); +	memset(priv->tx_bd, 0, sizeof(struct emac_bd)); + +	priv->tx_bd->addr = (u32)ptr; +	priv->tx_bd->status = (len & ZYNQ_GEM_TXBUF_FRMLEN_MASK) | +				ZYNQ_GEM_TXBUF_LAST_MASK; -	priv->tx_bd.addr = (u32)ptr; -	priv->tx_bd.status = len | ZYNQ_GEM_TXBUF_LAST_MASK; +	addr = (u32) ptr; +	addr &= ~(ARCH_DMA_MINALIGN - 1); +	size = roundup(len, ARCH_DMA_MINALIGN); +	flush_dcache_range(addr, addr + size); +	barrier();  	/* Start transmit */  	setbits_le32(®s->nwctrl, ZYNQ_GEM_NWCTRL_STARTTX_MASK); -	/* Read the stat register to know if the packet has been transmitted */ -	status = readl(®s->txsr); -	if (status & mask) -		printf("Something has gone wrong here!? Status is 0x%x.\n", -		       status); +	/* Read TX BD status */ +	if (priv->tx_bd->status & ZYNQ_GEM_TXBUF_UNDERRUN) +		printf("TX underrun\n"); +	if (priv->tx_bd->status & ZYNQ_GEM_TXBUF_EXHAUSTED) +		printf("TX buffers exhausted in mid frame\n"); -	/* Clear Tx status register before leaving . */ -	writel(status, ®s->txsr);  	return 0;  } @@ -416,8 +423,12 @@ static int zynq_gem_recv(struct eth_device *dev)  	frame_len = current_bd->status & ZYNQ_GEM_RXBUF_LEN_MASK;  	if (frame_len) { -		NetReceive((u8 *) (current_bd->addr & -					ZYNQ_GEM_RXBUF_ADD_MASK), frame_len); +		u32 addr = current_bd->addr & ZYNQ_GEM_RXBUF_ADD_MASK; +		addr &= ~(ARCH_DMA_MINALIGN - 1); +		u32 size = roundup(frame_len, ARCH_DMA_MINALIGN); +		invalidate_dcache_range(addr, addr + size); + +		NetReceive((u8 *)addr, frame_len);  		if (current_bd->status & ZYNQ_GEM_RXBUF_SOF_MASK)  			priv->rx_first_buf = priv->rxbd_current; @@ -471,6 +482,7 @@ int zynq_gem_initialize(bd_t *bis, int base_addr, int phy_addr, u32 emio)  {  	struct eth_device *dev;  	struct zynq_gem_priv *priv; +	void *bd_space;  	dev = calloc(1, sizeof(*dev));  	if (dev == NULL) @@ -483,6 +495,18 @@ int zynq_gem_initialize(bd_t *bis, int base_addr, int phy_addr, u32 emio)  	}  	priv = dev->priv; +	/* Align rxbuffers to ARCH_DMA_MINALIGN */ +	priv->rxbuffers = memalign(ARCH_DMA_MINALIGN, RX_BUF * PKTSIZE_ALIGN); +	memset(priv->rxbuffers, 0, RX_BUF * PKTSIZE_ALIGN); + +	/* Align bd_space to 1MB */ +	bd_space = memalign(1 << MMU_SECTION_SHIFT, BD_SPACE); +	mmu_set_region_dcache_behaviour((u32)bd_space, BD_SPACE, DCACHE_OFF); + +	/* Initialize the bd spaces for tx and rx bd's */ +	priv->tx_bd = (struct emac_bd *)bd_space; +	priv->rx_bd = (struct emac_bd *)((u32)bd_space + BD_SEPRN_SPACE); +  	priv->phyaddr = phy_addr;  	priv->emio = emio; diff --git a/examples/api/Makefile b/examples/api/Makefile index 33cc91ba7..cad10a3ec 100644 --- a/examples/api/Makefile +++ b/examples/api/Makefile @@ -14,25 +14,22 @@ endif  include $(TOPDIR)/config.mk  # Resulting ELF and binary exectuables will be named demo and demo.bin -OUTPUT-$(CONFIG_API) = $(obj)demo -OUTPUT = $(OUTPUT-y) +OUTPUT = $(obj)demo  # Source files located in the examples/api directory -SOBJ_FILES-$(CONFIG_API) += crt0.o -COBJ_FILES-$(CONFIG_API) += demo.o -COBJ_FILES-$(CONFIG_API) += glue.o -COBJ_FILES-$(CONFIG_API) += libgenwrap.o +SOBJ_FILES-y += crt0.o +COBJ_FILES-y += demo.o +COBJ_FILES-y += glue.o +COBJ_FILES-y += libgenwrap.o  # Source files which exist outside the examples/api directory -EXT_COBJ_FILES-$(CONFIG_API) += lib/crc32.o -EXT_COBJ_FILES-$(CONFIG_API) += lib/ctype.o -EXT_COBJ_FILES-$(CONFIG_API) += lib/div64.o -EXT_COBJ_FILES-$(CONFIG_API) += lib/string.o -EXT_COBJ_FILES-$(CONFIG_API) += lib/time.o -EXT_COBJ_FILES-$(CONFIG_API) += lib/vsprintf.o -ifeq ($(ARCH),powerpc) -EXT_SOBJ_FILES-$(CONFIG_API) += arch/powerpc/lib/ppcstring.o -endif +EXT_COBJ_FILES-y += lib/crc32.o +EXT_COBJ_FILES-y += lib/ctype.o +EXT_COBJ_FILES-y += lib/div64.o +EXT_COBJ_FILES-y += lib/string.o +EXT_COBJ_FILES-y += lib/time.o +EXT_COBJ_FILES-y += lib/vsprintf.o +EXT_SOBJ_FILES-$(CONFIG_PPC) += arch/powerpc/lib/ppcstring.o  # Create a list of source files so their dependencies can be auto-generated  SRCS	+= $(addprefix $(SRCTREE)/,$(EXT_COBJ_FILES-y:.o=.c)) @@ -46,8 +43,6 @@ OBJS	+= $(addprefix $(obj),$(COBJ_FILES-y))  OBJS	+= $(addprefix $(obj),$(notdir $(EXT_COBJ_FILES-y)))  OBJS	+= $(addprefix $(obj),$(notdir $(EXT_SOBJ_FILES-y))) -CPPFLAGS += -I.. -  all:	$(obj).depend $(OUTPUT)  ######################################################################### diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile index 93469217e..f4f102b3e 100644 --- a/examples/standalone/Makefile +++ b/examples/standalone/Makefile @@ -52,8 +52,6 @@ SREC	:= $(addprefix $(obj),$(SREC))  gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`) -CPPFLAGS += -I.. -  # For PowerPC there's no need to compile standalone applications as a  # relocatable executable.  The relocation data is not needed, and  # also causes the entry point of the standalone application to be diff --git a/include/common.h b/include/common.h index 409515f49..8ca67f64f 100644 --- a/include/common.h +++ b/include/common.h @@ -923,7 +923,7 @@ static inline void unmap_sysmem(const void *vaddr)  {  } -static inline phys_addr_t map_to_sysmem(void *ptr) +static inline phys_addr_t map_to_sysmem(const void *ptr)  {  	return (phys_addr_t)(uintptr_t)ptr;  } diff --git a/include/configs/ASH405.h b/include/configs/ASH405.h index 9460be3b5..2f5340723 100644 --- a/include/configs/ASH405.h +++ b/include/configs/ASH405.h @@ -143,6 +143,8 @@  #define CONFIG_SYS_NAND_SKIP_BAD_DOT_I	1	/* ".i" read skips bad blocks   */  #define CONFIG_SYS_NAND_QUIET		1 +#define CONFIG_SYS_NAND_MAX_OOBFREE	2 +#define CONFIG_SYS_NAND_MAX_ECCPOS	56  /*-----------------------------------------------------------------------   * PCI stuff diff --git a/include/configs/C29XPCIE.h b/include/configs/C29XPCIE.h index f173b07b4..1cfb2c227 100644 --- a/include/configs/C29XPCIE.h +++ b/include/configs/C29XPCIE.h @@ -191,13 +191,14 @@  				| CSPR_MSEL_NAND \  				| CSPR_V)  #define CONFIG_SYS_NAND_AMASK	IFC_AMASK(64*1024) +#define CONFIG_SYS_NAND_OOBSIZE	0x00000280	/* 640b */  #define CONFIG_SYS_NAND_CSOR	(CSOR_NAND_ECC_ENC_EN	/* ECC on encode */ \  				| CSOR_NAND_ECC_DEC_EN	/* ECC on decode */ \  				| CSOR_NAND_ECC_MODE_4	/* 4-bit ECC */ \ -				| CSOR_NAND_RAL_2	/* RAL = 2 Bytes */ \ -				| CSOR_NAND_PGS_2K	/* Page Size = 2k */ \ -				| CSOR_NAND_SPRZ_64	/* Spare size = 64 */ \ -				| CSOR_NAND_PB(64))	/* 64 Pages Per Block */ +				| CSOR_NAND_RAL_3	/* RAL = 3 Bytes */ \ +				| CSOR_NAND_PGS_8K	/* Page Size = 8K */ \ +				| CSOR_NAND_SPRZ_CSOR_EXT /*oob in csor_ext*/\ +				| CSOR_NAND_PB(128))	/*128 Pages Per Block*/  #define CONFIG_SYS_NAND_FTIM0	(FTIM0_NAND_TCCST(0x01) | \  				FTIM0_NAND_TWP(0x0c)   | \  				FTIM0_NAND_TWCHT(0x08) | \ @@ -224,6 +225,7 @@  #define CONFIG_SYS_CSPR1		CONFIG_SYS_NAND_CSPR  #define CONFIG_SYS_AMASK1		CONFIG_SYS_NAND_AMASK  #define CONFIG_SYS_CSOR1		CONFIG_SYS_NAND_CSOR +#define CONFIG_SYS_CSOR1_EXT		CONFIG_SYS_NAND_OOBSIZE  #define CONFIG_SYS_CS1_FTIM0		CONFIG_SYS_NAND_FTIM0  #define CONFIG_SYS_CS1_FTIM1		CONFIG_SYS_NAND_FTIM1  #define CONFIG_SYS_CS1_FTIM2		CONFIG_SYS_NAND_FTIM2 diff --git a/include/configs/MPC8572DS.h b/include/configs/MPC8572DS.h index afb195fe4..63480ecb0 100644 --- a/include/configs/MPC8572DS.h +++ b/include/configs/MPC8572DS.h @@ -322,6 +322,8 @@  #define CONFIG_CMD_NAND		1  #define CONFIG_NAND_FSL_ELBC	1  #define CONFIG_SYS_NAND_BLOCK_SIZE    (128 * 1024) +#define CONFIG_SYS_NAND_MAX_OOBFREE	5 +#define CONFIG_SYS_NAND_MAX_ECCPOS	56  /* NAND boot: 4K NAND loader config */  #define CONFIG_SYS_NAND_SPL_SIZE	0x1000 diff --git a/include/configs/T4240QDS.h b/include/configs/T4240QDS.h index 3777ccb83..c96df54d9 100644 --- a/include/configs/T4240QDS.h +++ b/include/configs/T4240QDS.h @@ -229,6 +229,8 @@ unsigned long get_board_ddr_clk(void);  #define CONFIG_CMD_NAND  #define CONFIG_SYS_NAND_BLOCK_SIZE	(128 * 1024) +#define CONFIG_SYS_NAND_MAX_OOBFREE	2 +#define CONFIG_SYS_NAND_MAX_ECCPOS	256  #if defined(CONFIG_NAND)  #define CONFIG_SYS_CSPR0_EXT		CONFIG_SYS_NAND_CSPR_EXT diff --git a/include/configs/alpr.h b/include/configs/alpr.h index 2bf1986e3..61fdebac3 100644 --- a/include/configs/alpr.h +++ b/include/configs/alpr.h @@ -324,6 +324,8 @@  #define CONFIG_SYS_NAND_BASE_LIST	{ CONFIG_SYS_NAND_BASE + 0, CONFIG_SYS_NAND_BASE + 2,	\  				  CONFIG_SYS_NAND_BASE + 4, CONFIG_SYS_NAND_BASE + 6 }  #define CONFIG_SYS_NAND_QUIET_TEST	1	/* don't warn upon unknown NAND flash	*/ +#define CONFIG_SYS_NAND_MAX_OOBFREE	2 +#define CONFIG_SYS_NAND_MAX_ECCPOS	56  /*-----------------------------------------------------------------------   * External Bus Controller (EBC) Setup diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h index f35ed6fba..d75df9279 100644 --- a/include/configs/am335x_evm.h +++ b/include/configs/am335x_evm.h @@ -220,6 +220,8 @@  #define CONFIG_SPL_LDSCRIPT		"$(CPUDIR)/am33xx/u-boot-spl.lds"  #ifdef CONFIG_NAND +#define CONFIG_NAND_OMAP_GPMC +#define CONFIG_NAND_OMAP_ELM  #define CONFIG_SYS_NAND_5_ADDR_CYCLE  #define CONFIG_SYS_NAND_PAGE_COUNT	(CONFIG_SYS_NAND_BLOCK_SIZE / \  					 CONFIG_SYS_NAND_PAGE_SIZE) @@ -237,7 +239,8 @@  #define CONFIG_SYS_NAND_ECCSIZE		512  #define CONFIG_SYS_NAND_ECCBYTES	14 - +#define CONFIG_SYS_NAND_ONFI_DETECTION +#define CONFIG_NAND_OMAP_ECCSCHEME	OMAP_ECC_BCH8_CODE_HW  #define CONFIG_SYS_NAND_U_BOOT_START	CONFIG_SYS_TEXT_BASE  #define CONFIG_SYS_NAND_U_BOOT_OFFS	0x80000  #endif diff --git a/include/configs/am335x_igep0033.h b/include/configs/am335x_igep0033.h index 2c69d4e30..115d1b37c 100644 --- a/include/configs/am335x_igep0033.h +++ b/include/configs/am335x_igep0033.h @@ -187,6 +187,7 @@  /* NAND support */  #define CONFIG_NAND  #define CONFIG_NAND_OMAP_GPMC +#define CONFIG_NAND_OMAP_ELM  #define GPMC_NAND_ECC_LP_x16_LAYOUT	1  #define CONFIG_SYS_NAND_BASE		(0x08000000)	/* phys address CS0 */  #define CONFIG_SYS_MAX_NAND_DEVICE	1 @@ -263,6 +264,7 @@  #define CONFIG_SYS_NAND_ECCSIZE		512  #define CONFIG_SYS_NAND_ECCBYTES	14 +#define CONFIG_NAND_OMAP_ECCSCHEME	OMAP_ECC_BCH8_CODE_HW  #define	CONFIG_SYS_NAND_U_BOOT_START	CONFIG_SYS_TEXT_BASE diff --git a/include/configs/am3517_crane.h b/include/configs/am3517_crane.h index 6fd3fb904..468fb43ea 100644 --- a/include/configs/am3517_crane.h +++ b/include/configs/am3517_crane.h @@ -340,6 +340,7 @@  						10, 11, 12, 13}  #define CONFIG_SYS_NAND_ECCSIZE		512  #define CONFIG_SYS_NAND_ECCBYTES	3 +#define CONFIG_NAND_OMAP_ECCSCHEME	OMAP_ECC_HAM1_CODE_HW  #define CONFIG_SYS_NAND_U_BOOT_START	CONFIG_SYS_TEXT_BASE  #define CONFIG_SYS_NAND_U_BOOT_OFFS	0x80000 diff --git a/include/configs/am3517_evm.h b/include/configs/am3517_evm.h index 7e9c55edf..a3473b51b 100644 --- a/include/configs/am3517_evm.h +++ b/include/configs/am3517_evm.h @@ -334,6 +334,7 @@  						10, 11, 12, 13}  #define CONFIG_SYS_NAND_ECCSIZE		512  #define CONFIG_SYS_NAND_ECCBYTES	3 +#define CONFIG_NAND_OMAP_ECCSCHEME	OMAP_ECC_HAM1_CODE_HW  #define CONFIG_SYS_NAND_U_BOOT_START	CONFIG_SYS_TEXT_BASE  #define CONFIG_SYS_NAND_U_BOOT_OFFS	0x80000 diff --git a/include/configs/devkit8000.h b/include/configs/devkit8000.h index 474a5687a..4f43ba988 100644 --- a/include/configs/devkit8000.h +++ b/include/configs/devkit8000.h @@ -327,6 +327,7 @@  #define CONFIG_SYS_NAND_ECCSIZE		512  #define CONFIG_SYS_NAND_ECCBYTES	3 +#define CONFIG_NAND_OMAP_ECCSCHEME	OMAP_ECC_HAM1_CODE_HW  #define CONFIG_SYS_NAND_U_BOOT_START   CONFIG_SYS_TEXT_BASE diff --git a/include/configs/mcx.h b/include/configs/mcx.h index a2f7cf711..dcd29ce7c 100644 --- a/include/configs/mcx.h +++ b/include/configs/mcx.h @@ -353,7 +353,6 @@  #define CONFIG_SPL_FRAMEWORK  #define CONFIG_SPL_BOARD_INIT  #define CONFIG_SPL_NAND_SIMPLE -#define CONFIG_SPL_NAND_SOFTECC  #define CONFIG_SPL_LIBCOMMON_SUPPORT  #define CONFIG_SPL_LIBDISK_SUPPORT @@ -395,6 +394,7 @@  					 56, 57, 58, 59, 60, 61, 62, 63}  #define CONFIG_SYS_NAND_ECCSIZE		256  #define CONFIG_SYS_NAND_ECCBYTES	3 +#define CONFIG_NAND_OMAP_ECCSCHEME	OMAP_ECC_HAM1_CODE_SW  #define CONFIG_SYS_NAND_U_BOOT_START   CONFIG_SYS_TEXT_BASE diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h index bba39d428..9eab1903f 100644 --- a/include/configs/omap3_beagle.h +++ b/include/configs/omap3_beagle.h @@ -431,6 +431,7 @@  						10, 11, 12, 13}  #define CONFIG_SYS_NAND_ECCSIZE		512  #define CONFIG_SYS_NAND_ECCBYTES	3 +#define CONFIG_NAND_OMAP_ECCSCHEME	OMAP_ECC_HAM1_CODE_HW  #define CONFIG_SYS_NAND_U_BOOT_START	CONFIG_SYS_TEXT_BASE  #define CONFIG_SYS_NAND_U_BOOT_OFFS	0x80000 diff --git a/include/configs/omap3_evm.h b/include/configs/omap3_evm.h index 3ace8bb6e..b7638fb8a 100644 --- a/include/configs/omap3_evm.h +++ b/include/configs/omap3_evm.h @@ -107,6 +107,7 @@  						10, 11, 12, 13}  #define CONFIG_SYS_NAND_ECCSIZE		512  #define CONFIG_SYS_NAND_ECCBYTES	3 +#define CONFIG_NAND_OMAP_ECCSCHEME	OMAP_ECC_HAM1_CODE_HW  #define CONFIG_SYS_NAND_U_BOOT_START   CONFIG_SYS_TEXT_BASE  #define CONFIG_SYS_NAND_U_BOOT_OFFS	0x80000 diff --git a/include/configs/omap3_evm_quick_nand.h b/include/configs/omap3_evm_quick_nand.h index 9ecd70d55..4427e88b7 100644 --- a/include/configs/omap3_evm_quick_nand.h +++ b/include/configs/omap3_evm_quick_nand.h @@ -86,6 +86,7 @@  						10, 11, 12, 13}  #define CONFIG_SYS_NAND_ECCSIZE		512  #define CONFIG_SYS_NAND_ECCBYTES	3 +#define CONFIG_NAND_OMAP_ECCSCHEME	OMAP_ECC_HAM1_CODE_HW  #define CONFIG_SYS_NAND_U_BOOT_START   CONFIG_SYS_TEXT_BASE  #define CONFIG_SYS_NAND_U_BOOT_OFFS	0x80000 diff --git a/include/configs/omap3_igep00x0.h b/include/configs/omap3_igep00x0.h index 75d7d70d2..71062a601 100644 --- a/include/configs/omap3_igep00x0.h +++ b/include/configs/omap3_igep00x0.h @@ -362,6 +362,7 @@  						10, 11, 12, 13}  #define CONFIG_SYS_NAND_ECCSIZE		512  #define CONFIG_SYS_NAND_ECCBYTES	3 +#define CONFIG_NAND_OMAP_ECCSCHEME	OMAP_ECC_HAM1_CODE_HW  #define CONFIG_SYS_NAND_U_BOOT_START	CONFIG_SYS_TEXT_BASE  #define CONFIG_SYS_NAND_U_BOOT_OFFS	0x80000  #endif diff --git a/include/configs/omap3_overo.h b/include/configs/omap3_overo.h index 84b4aeee2..e0f026269 100644 --- a/include/configs/omap3_overo.h +++ b/include/configs/omap3_overo.h @@ -324,6 +324,7 @@  						10, 11, 12, 13}  #define CONFIG_SYS_NAND_ECCSIZE		512  #define CONFIG_SYS_NAND_ECCBYTES	3 +#define CONFIG_NAND_OMAP_ECCSCHEME	OMAP_ECC_HAM1_CODE_HW  #define CONFIG_SYS_NAND_U_BOOT_START	CONFIG_SYS_TEXT_BASE  #define CONFIG_SYS_NAND_U_BOOT_OFFS	0x80000 diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h index 0884ad3a0..a4edc624b 100644 --- a/include/configs/sandbox.h +++ b/include/configs/sandbox.h @@ -75,7 +75,6 @@  #define CONFIG_SYS_LOAD_ADDR		0x00000000  #define CONFIG_SYS_MEMTEST_START	0x00100000  #define CONFIG_SYS_MEMTEST_END		(CONFIG_SYS_MEMTEST_START + 0x1000) -#define CONFIG_PHYS_64BIT  #define CONFIG_SYS_FDT_LOAD_ADDR	0x1000000  /* Size of our emulated memory */ diff --git a/include/configs/siemens-am33x-common.h b/include/configs/siemens-am33x-common.h index 745e3bea5..f37653fea 100644 --- a/include/configs/siemens-am33x-common.h +++ b/include/configs/siemens-am33x-common.h @@ -195,6 +195,7 @@  #define CONFIG_SYS_NAND_ECCSIZE		512  #define CONFIG_SYS_NAND_ECCBYTES	14 +#define CONFIG_NAND_OMAP_ECCSCHEME	OMAP_ECC_BCH8_CODE_HW  #define CONFIG_SYS_NAND_ECCSTEPS	4  #define	CONFIG_SYS_NAND_ECCTOTAL	(CONFIG_SYS_NAND_ECCBYTES * \ @@ -430,6 +431,7 @@  		"\0"  #define CONFIG_NAND_OMAP_GPMC +#define CONFIG_NAND_OMAP_ELM  #define GPMC_NAND_ECC_LP_x16_LAYOUT	1  #define CONFIG_SYS_NAND_BASE		(0x08000000)	/* physical address */  							/* to access nand at */ diff --git a/include/configs/spieval.h b/include/configs/spieval.h deleted file mode 100644 index 07668de4d..000000000 --- a/include/configs/spieval.h +++ /dev/null @@ -1,494 +0,0 @@ -/* - * (C) Copyright 2003-2005 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * (C) Copyright 2004-2005 - * Martin Krause, TQ-Systems GmbH, martin.krause@tqs.de - * - * SPDX-License-Identifier:	GPL-2.0+ - */ - -#ifndef __CONFIG_H -#define __CONFIG_H - -/* - * High Level Configuration Options - * (easy to change) - */ - -#define CONFIG_MPC5xxx		1	/* This is an MPC5xxx CPU */ -#define CONFIG_MPC5200		1	/* (more precisely an MPC5200 CPU) */ -#define CONFIG_TQM5200		1	/* ... on TQM5200 module */ -#undef CONFIG_TQM5200_REV100		/*  define for revision 100 modules */ -#define CONFIG_STK52XX		1	/* ... on a STK52XX base board */ -#define CONFIG_STK52XX_REV100	1	/*  define for revision 100 baseboards */ - -#define CONFIG_SYS_MPC5XXX_CLKIN	33000000 /* ... running at 33.000000MHz */ - -#define CONFIG_HIGH_BATS	1	/* High BATs supported */ - -/* - * Serial console configuration - */ -#define CONFIG_PSC_CONSOLE	6	/* console is on PSC6 */ -#define CONFIG_BAUDRATE		115200	/* ... at 115200 bps */ -#define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, 115200, 230400 } - -#ifdef CONFIG_STK52XX -#undef CONFIG_PS2KBD			/* AT-PS/2 Keyboard		*/ -#define CONFIG_PS2MULT			/* .. on PS/2 Multiplexer	*/ -#define CONFIG_PS2SERIAL	6	/* .. on PSC6			*/ -#define CONFIG_PS2MULT_DELAY	(CONFIG_SYS_HZ/2)	/* Initial delay	*/ -#define CONFIG_BOARD_EARLY_INIT_R -#endif /* CONFIG_STK52XX */ - -/* - * PCI Mapping: - * 0x40000000 - 0x4fffffff - PCI Memory - * 0x50000000 - 0x50ffffff - PCI IO Space - */ -#ifdef CONFIG_STK52XX -#define CONFIG_PCI		1 -#define CONFIG_PCI_PNP		1 -/* #define CONFIG_PCI_SCAN_SHOW	1 */ - -#define CONFIG_PCI_MEM_BUS	0x40000000 -#define CONFIG_PCI_MEM_PHYS	CONFIG_PCI_MEM_BUS -#define CONFIG_PCI_MEM_SIZE	0x10000000 - -#define CONFIG_PCI_IO_BUS	0x50000000 -#define CONFIG_PCI_IO_PHYS	CONFIG_PCI_IO_BUS -#define CONFIG_PCI_IO_SIZE	0x01000000 - -#define CONFIG_EEPRO100		1 -#define CONFIG_SYS_RX_ETH_BUFFER	8  /* use 8 rx buffer on eepro100  */ -#define CONFIG_NS8382X		1 -#endif	/* CONFIG_STK52XX */ - -/* - * Video console - */ -#if 1 -#define CONFIG_VIDEO -#define CONFIG_VIDEO_SM501 -#define CONFIG_VIDEO_SM501_32BPP -#define CONFIG_CFB_CONSOLE -#define CONFIG_VIDEO_LOGO -#define CONFIG_VGA_AS_SINGLE_DEVICE -#define CONFIG_CONSOLE_EXTRA_INFO -#define CONFIG_VIDEO_SW_CURSOR -#define CONFIG_SPLASH_SCREEN -#define CONFIG_SYS_CONSOLE_IS_IN_ENV -#endif - -/* Partitions */ -#define CONFIG_MAC_PARTITION -#define CONFIG_DOS_PARTITION -#define CONFIG_ISO_PARTITION - -/* USB */ -#ifdef CONFIG_STK52XX -#define CONFIG_USB_OHCI -#define CONFIG_USB_STORAGE -#endif - -/* POST support */ -#define CONFIG_POST		(CONFIG_SYS_POST_MEMORY   | \ -				 CONFIG_SYS_POST_CPU	   | \ -				 CONFIG_SYS_POST_I2C) - -#ifdef CONFIG_POST -/* preserve space for the post_word at end of on-chip SRAM */ -#define MPC5XXX_SRAM_POST_SIZE MPC5XXX_SRAM_SIZE-4 -#endif - - -/* - * BOOTP options - */ -#define CONFIG_BOOTP_BOOTFILESIZE -#define CONFIG_BOOTP_BOOTPATH -#define CONFIG_BOOTP_GATEWAY -#define CONFIG_BOOTP_HOSTNAME - - -/* - * Command line configuration. - */ -#include <config_cmd_default.h> - -#define CONFIG_CMD_ASKENV -#define CONFIG_CMD_DATE -#define CONFIG_CMD_DHCP -#define CONFIG_CMD_ECHO -#define CONFIG_CMD_EEPROM -#define CONFIG_CMD_I2C -#define CONFIG_CMD_MII -#define CONFIG_CMD_NFS -#define CONFIG_CMD_PING -#define CONFIG_CMD_REGINFO -#define CONFIG_CMD_SNTP - -#if defined(CONFIG_MINIFAP) || defined(CONFIG_STK52XX) -    #define CONFIG_CMD_IDE -    #define CONFIG_CMD_FAT -    #define CONFIG_CMD_EXT2 -#endif - -#ifdef CONFIG_STK52XX -    #define CONFIG_CMD_USB -    #define CONFIG_CMD_FAT -#endif - -#ifdef CONFIG_VIDEO -    #define CONFIG_CMD_BMP -#endif - -#ifdef CONFIG_PCI -    #define CONFIG_CMD_PCI -    #define CONFIG_PCIAUTO_SKIP_HOST_BRIDGE	1 -#endif - -#ifdef CONFIG_POST -#define CONFIG_CMD_DIAG -#endif - - -#define	CONFIG_TIMESTAMP		/* display image timestamps */ - -#if (CONFIG_SYS_TEXT_BASE == 0xFC000000)		/* Boot low */ -#   define CONFIG_SYS_LOWBOOT		1 -#endif - -/* - * Autobooting - */ -#define CONFIG_BOOTDELAY	5	/* autoboot after 5 seconds */ - -#define CONFIG_PREBOOT	"echo;" \ -	"echo Type \\\"run flash_nfs\\\" to mount root filesystem over NFS;" \ -	"echo" - -#undef	CONFIG_BOOTARGS - -#define CONFIG_EXTRA_ENV_SETTINGS					\ -	"netdev=eth0\0"							\ -	"rootpath=/opt/eldk/ppc_6xx\0"					\ -	"ramargs=setenv bootargs root=/dev/ram rw\0"			\ -	"nfsargs=setenv bootargs root=/dev/nfs rw "			\ -		"nfsroot=${serverip}:${rootpath}\0"			\ -	"addip=setenv bootargs ${bootargs} "				\ -		"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}"	\ -		":${hostname}:${netdev}:off panic=1\0"			\ -	"flash_self=run ramargs addip;"					\ -		"bootm ${kernel_addr} ${ramdisk_addr}\0"		\ -	"flash_nfs=run nfsargs addip;"					\ -		"bootm ${kernel_addr}\0"				\ -	"net_nfs=tftp 200000 ${bootfile};run nfsargs addip;bootm\0"	\ -	"bootfile=/tftpboot/tqm5200/uImage\0"				\ -	"load=tftp 200000 ${u-boot}\0"					\ -	"u-boot=/tftpboot/tqm5200/u-boot.bin\0"				\ -	"update=protect off FC000000 FC05FFFF;"				\ -		"erase FC000000 FC05FFFF;"				\ -		"cp.b 200000 FC000000 ${filesize};"			\ -		"protect on FC000000 FC05FFFF\0"			\ -	"" - -#define CONFIG_BOOTCOMMAND	"run net_nfs" - -/* - * IPB Bus clocking configuration. - */ -#define CONFIG_SYS_IPBCLK_EQUALS_XLBCLK		/* define for 133MHz speed */ - -#if defined(CONFIG_SYS_IPBCLK_EQUALS_XLBCLK) -/* - * PCI Bus clocking configuration - * - * Actually a PCI Clock of 66 MHz is only set (in cpu_init.c) if - * CONFIG_SYS_IPBCLK_EQUALS_XLBCLK is defined. This is because a PCI Clock - * of 66 MHz yet hasn't been tested with a IPB Bus Clock of 66 MHz. - */ -#define CONFIG_SYS_PCICLK_EQUALS_IPBCLK_DIV2	/* define for 66MHz speed */ -#endif - -/* - * I2C configuration - */ -#define CONFIG_HARD_I2C		1	/* I2C with hardware support */ -#ifdef CONFIG_TQM5200_REV100 -#define CONFIG_SYS_I2C_MODULE		1	/* Select I2C module #1 for rev. 100 board */ -#else -#define CONFIG_SYS_I2C_MODULE		2	/* Select I2C module #2 for all other revs */ -#endif - -/* - * I2C clock frequency - * - * Please notice, that the resulting clock frequency could differ from the - * configured value. This is because the I2C clock is derived from system - * clock over a frequency divider with only a few divider values. U-boot - * calculates the best approximation for CONFIG_SYS_I2C_SPEED. However the calculated - * approximation allways lies below the configured value, never above. - */ -#define CONFIG_SYS_I2C_SPEED		100000 /* 100 kHz */ -#define CONFIG_SYS_I2C_SLAVE		0x7F - -/* - * EEPROM configuration for onboard EEPROM M24C32 (M24C64 should work - * also). For other EEPROMs configuration should be verified. On Mini-FAP the - * EEPROM (24C64) is on the same I2C address (but on other I2C bus), so the - * same configuration could be used. - */ -#define CONFIG_SYS_I2C_EEPROM_ADDR		0x50	/* 1010000x */ -#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN		2 -#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS	5	/* =32 Bytes per write */ -#define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS	20 - -/* - * HW-Monitor configuration on Mini-FAP - */ -#if defined (CONFIG_MINIFAP) -#define CONFIG_SYS_I2C_HWMON_ADDR		0x2C -#endif - -/* List of I2C addresses to be verified by POST */ -#if defined (CONFIG_MINIFAP) -#undef CONFIG_SYS_POST_I2C_ADDRS -#define CONFIG_SYS_POST_I2C_ADDRS	{CONFIG_SYS_I2C_EEPROM_ADDR,	\ -					 CONFIG_SYS_I2C_HWMON_ADDR,	\ -					 CONFIG_SYS_I2C_SLAVE} -#endif - -/* - * Flash configuration - */ -#define CONFIG_SYS_FLASH_BASE		CONFIG_SYS_TEXT_BASE /* 0xFC000000 */ - -/* use CFI flash driver if no module variant is spezified */ -#define CONFIG_SYS_FLASH_CFI		1	/* Flash is CFI conformant */ -#define CONFIG_FLASH_CFI_DRIVER	1	/* Use the common driver */ -#define CONFIG_SYS_FLASH_BANKS_LIST	{ CONFIG_SYS_BOOTCS_START } -#define CONFIG_SYS_FLASH_EMPTY_INFO -#define CONFIG_SYS_FLASH_SIZE		0x04000000 /* 64 MByte */ -#define CONFIG_SYS_MAX_FLASH_SECT	512	/* max num of sects on one chip */ -#undef CONFIG_SYS_FLASH_USE_BUFFER_WRITE	/* not supported yet for AMD */ - -#if !defined(CONFIG_SYS_LOWBOOT) -#define CONFIG_ENV_ADDR		(CONFIG_SYS_FLASH_BASE + 0x00760000 + 0x00800000) -#else	/* CONFIG_SYS_LOWBOOT */ -#define CONFIG_ENV_ADDR		(CONFIG_SYS_FLASH_BASE + 0x00060000) -#endif	/* CONFIG_SYS_LOWBOOT */ -#define CONFIG_SYS_MAX_FLASH_BANKS	1	/* max num of flash banks -					   (= chip selects) */ -#define CONFIG_SYS_FLASH_ERASE_TOUT	240000	/* Flash Erase Timeout (in ms)	*/ -#define CONFIG_SYS_FLASH_WRITE_TOUT	500	/* Flash Write Timeout (in ms)	*/ - - -/* - * Environment settings - */ -#define CONFIG_ENV_IS_IN_FLASH	1 -#define CONFIG_ENV_SIZE		0x10000 -#define CONFIG_ENV_SECT_SIZE	0x20000 -#define CONFIG_ENV_ADDR_REDUND	(CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE) -#define	CONFIG_ENV_SIZE_REDUND	(CONFIG_ENV_SIZE) - -/* - * Memory map - */ -#define CONFIG_SYS_MBAR		0xF0000000 -#define CONFIG_SYS_SDRAM_BASE		0x00000000 -#define CONFIG_SYS_DEFAULT_MBAR	0x80000000 - -/* Use ON-Chip SRAM until RAM will be available */ -#define CONFIG_SYS_INIT_RAM_ADDR	MPC5XXX_SRAM -#ifdef CONFIG_POST -/* preserve space for the post_word at end of on-chip SRAM */ -#define CONFIG_SYS_INIT_RAM_SIZE	MPC5XXX_SRAM_POST_SIZE -#else -#define CONFIG_SYS_INIT_RAM_SIZE	MPC5XXX_SRAM_SIZE -#endif - - -#define CONFIG_SYS_GBL_DATA_OFFSET	(CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) -#define CONFIG_SYS_INIT_SP_OFFSET	CONFIG_SYS_GBL_DATA_OFFSET - -#define CONFIG_SYS_MONITOR_BASE	CONFIG_SYS_TEXT_BASE -#if (CONFIG_SYS_MONITOR_BASE < CONFIG_SYS_FLASH_BASE) -#   define CONFIG_SYS_RAMBOOT		1 -#endif - -#define CONFIG_SYS_MONITOR_LEN		(384 << 10)	/* Reserve 384 kB for Monitor	*/ -#define CONFIG_SYS_MALLOC_LEN		(128 << 10)	/* Reserve 128 kB for malloc()	*/ -#define CONFIG_SYS_BOOTMAPSZ		(8 << 20)	/* Initial Memory map for Linux */ - -/* - * Ethernet configuration - */ -#define CONFIG_MPC5xxx_FEC	1 -/* - * Define CONFIG_FEC_10MBIT to force FEC at 10Mb - */ -/* #define CONFIG_FEC_10MBIT 1 */ -#define CONFIG_PHY_ADDR		0x00 - -/* - * GPIO configuration - * - * use pin gpio_wkup_6 as second SDRAM chip select (mem_cs1): - *	Bit 0 (mask: 0x80000000): 1 - * use ALT CAN position: Bits 2-3 (mask: 0x30000000): - *	00 -> No Alternatives, CAN1/2 on PSC2 according to PSC2 setting. - *	01 -> CAN1 on I2C1, CAN2 on Tmr0/1. - *	      Use for REV200 STK52XX boards. Do not use with REV100 modules - *	      (because, there I2C1 is used as I2C bus) - * use PSC1 as UART: Bits 28-31 (mask: 0x00000007): 0100 - * use PSC2 as CAN: Bits 25:27 (mask: 0x00000030) - *	000 -> All PSC2 pins are GIOPs - *	001 -> CAN1/2 on PSC2 pins - *	       Use for REV100 STK52xx boards - * use PSC6: - *   on STK52xx: - *	use as UART. Pins PSC6_0 to PSC6_3 are used. - *	Bits 9:11 (mask: 0x00700000): - *	   101 -> PSC6 : Extended POST test is not available - *   on MINI-FAP and TQM5200_IB: - *	use PSC6_0 to PSC6_3 as GPIO: Bits 9:11 (mask: 0x00700000): - *	   000 -> PSC6 could not be used as UART, CODEC or IrDA - *   GPIO on PSC6_3 is used in post_hotkeys_pressed() to enable extended POST - *   tests. - */ -#if defined (CONFIG_MINIFAP) -# define CONFIG_SYS_GPS_PORT_CONFIG	0x91000004 -#elif defined (CONFIG_STK52XX) -# if defined (CONFIG_STK52XX_REV100) -#  define CONFIG_SYS_GPS_PORT_CONFIG	0x81500014 -# else /* STK52xx REV200 and above */ -#  if defined (CONFIG_TQM5200_REV100) -#   error TQM5200 REV100 not supported on STK52XX REV200 or above -#  else/* TQM5200 REV200 and above */ -#   define CONFIG_SYS_GPS_PORT_CONFIG	0x91500004 -#  endif -# endif -#else  /* TMQ5200 Inbetriebnahme-Board */ -# define CONFIG_SYS_GPS_PORT_CONFIG	0x81000004 -#endif - -/* - * RTC configuration - */ -#define CONFIG_RTC_MPC5200	1	/* use internal MPC5200 RTC */ - -/* - * Miscellaneous configurable options - */ -#define CONFIG_SYS_LONGHELP			/* undef to save memory	    */ -#if defined(CONFIG_CMD_KGDB) -#define CONFIG_SYS_CBSIZE		1024	/* Console I/O Buffer Size  */ -#else -#define CONFIG_SYS_CBSIZE		256	/* Console I/O Buffer Size  */ -#endif -#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16) /* Print Buffer Size */ -#define CONFIG_SYS_MAXARGS		16	/* max number of command args	*/ -#define CONFIG_SYS_BARGSIZE		CONFIG_SYS_CBSIZE	/* Boot Argument Buffer Size	*/ - -/* Enable an alternate, more extensive memory test */ -#define CONFIG_SYS_ALT_MEMTEST - -#define CONFIG_SYS_MEMTEST_START	0x00100000	/* memtest works on */ -#define CONFIG_SYS_MEMTEST_END		0x00f00000	/* 1 ... 15 MB in DRAM	*/ - -#define CONFIG_SYS_LOAD_ADDR		0x100000	/* default load address */ - -#define CONFIG_SYS_CACHELINE_SIZE	32	/* For MPC5xxx CPUs */ -#if defined(CONFIG_CMD_KGDB) -#  define CONFIG_SYS_CACHELINE_SHIFT	5	/* log base 2 of the above value */ -#endif - -/* - * Enable loopw command. - */ -#define CONFIG_LOOPW - -/* - * Various low-level settings - */ -#define CONFIG_SYS_HID0_INIT		HID0_ICE | HID0_ICFI -#define CONFIG_SYS_HID0_FINAL		HID0_ICE - -#define CONFIG_SYS_BOOTCS_START	CONFIG_SYS_FLASH_BASE -#define CONFIG_SYS_BOOTCS_SIZE		CONFIG_SYS_FLASH_SIZE -#ifdef CONFIG_SYS_PCICLK_EQUALS_IPBCLK_DIV2 -#define CONFIG_SYS_BOOTCS_CFG		0x0008DF30 /* for pci_clk  = 66 MHz */ -#else -#define CONFIG_SYS_BOOTCS_CFG		0x0004DF30 /* for pci_clk = 33 MHz */ -#endif -#define CONFIG_SYS_CS0_START		CONFIG_SYS_FLASH_BASE -#define CONFIG_SYS_CS0_SIZE		CONFIG_SYS_FLASH_SIZE - -#define CONFIG_LAST_STAGE_INIT - -/* - * SRAM - Do not map below 2 GB in address space, because this area is used - * for SDRAM autosizing. - */ -#define CONFIG_SYS_CS2_START		0xE5000000 -#define CONFIG_SYS_CS2_SIZE		0x100000	/* 1 MByte */ -#define CONFIG_SYS_CS2_CFG		0x0004D930 - -/* - * Grafic controller - Do not map below 2 GB in address space, because this - * area is used for SDRAM autosizing. - */ -#define SM501_FB_BASE		0xE0000000 -#define CONFIG_SYS_CS1_START		(SM501_FB_BASE) -#define CONFIG_SYS_CS1_SIZE		0x4000000	/* 64 MByte */ -#define CONFIG_SYS_CS1_CFG		0x8F48FF70 -#define SM501_MMIO_BASE		CONFIG_SYS_CS1_START + 0x03E00000 - -#define CONFIG_SYS_CS_BURST		0x00000000 -#define CONFIG_SYS_CS_DEADCYCLE	0x33333311	/* 1 dead cycle for flash and SM501 */ - -#define CONFIG_SYS_RESET_ADDRESS	0xff000000 - -/*----------------------------------------------------------------------- - * USB stuff - *----------------------------------------------------------------------- - */ -#define CONFIG_USB_CLOCK	0x0001BBBB -#define CONFIG_USB_CONFIG	0x00001000 - -/*----------------------------------------------------------------------- - * IDE/ATA stuff Supports IDE harddisk - *----------------------------------------------------------------------- - */ - -#undef	CONFIG_IDE_8xx_PCCARD		/* Use IDE with PC Card Adapter */ - -#undef	CONFIG_IDE_8xx_DIRECT		/* Direct IDE	 not supported	*/ -#undef	CONFIG_IDE_LED			/* LED	 for ide not supported	*/ - -#define CONFIG_IDE_RESET		/* reset for ide supported	*/ -#define CONFIG_IDE_PREINIT - -#define CONFIG_SYS_IDE_MAXBUS		1	/* max. 1 IDE bus		*/ -#define CONFIG_SYS_IDE_MAXDEVICE	2	/* max. 2 drives per IDE bus	*/ - -#define CONFIG_SYS_ATA_IDE0_OFFSET	0x0000 - -#define CONFIG_SYS_ATA_BASE_ADDR	MPC5XXX_ATA - -/* Offset for data I/O			*/ -#define CONFIG_SYS_ATA_DATA_OFFSET	(0x0060) - -/* Offset for normal register accesses	*/ -#define CONFIG_SYS_ATA_REG_OFFSET	(CONFIG_SYS_ATA_DATA_OFFSET) - -/* Offset for alternate registers	*/ -#define CONFIG_SYS_ATA_ALT_OFFSET	(0x005C) - -/* Interval between registers						     */ -#define CONFIG_SYS_ATA_STRIDE		4 - -#endif /* __CONFIG_H */ diff --git a/include/configs/tam3517-common.h b/include/configs/tam3517-common.h index 6112c1b7a..439fc47eb 100644 --- a/include/configs/tam3517-common.h +++ b/include/configs/tam3517-common.h @@ -224,7 +224,6 @@  #define CONFIG_SPL_BOARD_INIT  #define CONFIG_SPL_CONSOLE  #define CONFIG_SPL_NAND_SIMPLE -#define CONFIG_SPL_NAND_SOFTECC  #define CONFIG_SPL_NAND_WORKSPACE	0x8f07f000 /* below BSS */  #define CONFIG_SPL_LIBCOMMON_SUPPORT @@ -261,6 +260,7 @@  					 56, 57, 58, 59, 60, 61, 62, 63}  #define CONFIG_SYS_NAND_ECCSIZE		256  #define CONFIG_SYS_NAND_ECCBYTES	3 +#define CONFIG_NAND_OMAP_ECCSCHEME	OMAP_ECC_HAM1_CODE_SW  #define CONFIG_SYS_NAND_U_BOOT_START	CONFIG_SYS_TEXT_BASE diff --git a/include/configs/tricorder.h b/include/configs/tricorder.h index afd870762..cc4001fcd 100644 --- a/include/configs/tricorder.h +++ b/include/configs/tricorder.h @@ -138,8 +138,9 @@  #define CONFIG_SYS_MAX_NAND_DEVICE	1		/* Max number of NAND */  							/* devices */ -#define CONFIG_NAND_OMAP_BCH8  #define CONFIG_BCH +#define CONFIG_SYS_NAND_MAX_OOBFREE	2 +#define CONFIG_SYS_NAND_MAX_ECCPOS	56  /* commands to include */  #include <config_cmd_default.h> @@ -374,6 +375,7 @@  #define CONFIG_SYS_NAND_ECCSIZE		512  #define CONFIG_SYS_NAND_ECCBYTES	13 +#define CONFIG_NAND_OMAP_ECCSCHEME	OMAP_ECC_BCH8_CODE_HW_DETECTION_SW  #define CONFIG_SYS_NAND_U_BOOT_START	CONFIG_SYS_TEXT_BASE diff --git a/include/fsl_ifc.h b/include/fsl_ifc.h index 3e9b01b3b..be6c10715 100644 --- a/include/fsl_ifc.h +++ b/include/fsl_ifc.h @@ -77,6 +77,7 @@  #define CSOR_NAND_PGS_512		0x00000000  #define CSOR_NAND_PGS_2K		0x00080000  #define CSOR_NAND_PGS_4K		0x00100000 +#define CSOR_NAND_PGS_8K		0x00180000  /* Spare region Size */  #define CSOR_NAND_SPRZ_MASK		0x0000E000  #define CSOR_NAND_SPRZ_SHIFT		13 @@ -86,6 +87,7 @@  #define CSOR_NAND_SPRZ_210		0x00006000  #define CSOR_NAND_SPRZ_218		0x00008000  #define CSOR_NAND_SPRZ_224		0x0000A000 +#define CSOR_NAND_SPRZ_CSOR_EXT	0x0000C000  /* Pages Per Block */  #define CSOR_NAND_PB_MASK		0x00000700  #define CSOR_NAND_PB_SHIFT		8 diff --git a/include/fsl_mdio.h b/include/fsl_mdio.h index 9c0b76277..b58713d89 100644 --- a/include/fsl_mdio.h +++ b/include/fsl_mdio.h @@ -1,5 +1,5 @@  /* - * Copyright 2009-2012 Freescale Semiconductor, Inc. + * Copyright 2009-2012, 2013 Freescale Semiconductor, Inc.   *	Jun-jie Zhang <b18070@freescale.com>   *	Mingkai Hu <Mingkai.hu@freescale.com>   * @@ -31,9 +31,9 @@  #define MIIMIND_BUSY		0x00000001  #define MIIMIND_NOTVALID	0x00000004 -void tsec_local_mdio_write(struct tsec_mii_mng *phyregs, int port_addr, +void tsec_local_mdio_write(struct tsec_mii_mng __iomem *phyregs, int port_addr,  		int dev_addr, int reg, int value); -int tsec_local_mdio_read(struct tsec_mii_mng *phyregs, int port_addr, +int tsec_local_mdio_read(struct tsec_mii_mng __iomem *phyregs, int port_addr,  		int dev_addr, int regnum);  int tsec_phy_read(struct mii_dev *bus, int addr, int dev_addr, int regnum);  int tsec_phy_write(struct mii_dev *bus, int addr, int dev_addr, int regnum, @@ -44,7 +44,7 @@ int memac_mdio_read(struct mii_dev *bus, int port_addr, int dev_addr,  		int regnum);  struct fsl_pq_mdio_info { -	struct tsec_mii_mng *regs; +	struct tsec_mii_mng __iomem *regs;  	char *name;  };  int fsl_pq_mdio_init(bd_t *bis, struct fsl_pq_mdio_info *info); diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 6f44abdc1..a65b68155 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -96,6 +96,29 @@ struct mtd_oob_ops {  	uint8_t		*oobbuf;  }; +#ifdef CONFIG_SYS_NAND_MAX_OOBFREE +#define MTD_MAX_OOBFREE_ENTRIES_LARGE	CONFIG_SYS_NAND_MAX_OOBFREE +#else +#define MTD_MAX_OOBFREE_ENTRIES_LARGE	32 +#endif + +#ifdef CONFIG_SYS_NAND_MAX_ECCPOS +#define MTD_MAX_ECCPOS_ENTRIES_LARGE	CONFIG_SYS_NAND_MAX_ECCPOS +#else +#define MTD_MAX_ECCPOS_ENTRIES_LARGE	640 +#endif + +/* + * ECC layout control structure. Exported to userspace for + * diagnosis and to allow creation of raw images + */ +struct nand_ecclayout { +	uint32_t eccbytes; +	uint32_t eccpos[MTD_MAX_ECCPOS_ENTRIES_LARGE]; +	uint32_t oobavail; +	struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES_LARGE]; +}; +  struct mtd_info {  	u_char type;  	u_int32_t flags; diff --git a/include/micrel.h b/include/micrel.h index e1c62d83c..04c9ecf3b 100644 --- a/include/micrel.h +++ b/include/micrel.h @@ -15,6 +15,11 @@  #define MII_KSZ9031_MOD_DATA_POST_INC_RW	0x8000  #define MII_KSZ9031_MOD_DATA_POST_INC_W		0xC000 +#define MII_KSZ9031_EXT_RGMII_CTRL_SIG_SKEW	0x4 +#define MII_KSZ9031_EXT_RGMII_RX_DATA_SKEW	0x5 +#define MII_KSZ9031_EXT_RGMII_TX_DATA_SKEW	0x6 +#define MII_KSZ9031_EXT_RGMII_CLOCK_SKEW	0x8 +  struct phy_device;  int ksz9021_phy_extended_write(struct phy_device *phydev, int regnum, u16 val);  int ksz9021_phy_extended_read(struct phy_device *phydev, int regnum); diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h index d51c1abd1..ac3c29876 100644 --- a/include/mtd/mtd-abi.h +++ b/include/mtd/mtd-abi.h @@ -155,18 +155,6 @@ struct nand_oobfree {  	uint32_t length;  }; -#define MTD_MAX_OOBFREE_ENTRIES	8 -/* - * ECC layout control structure. Exported to userspace for - * diagnosis and to allow creation of raw images - */ -struct nand_ecclayout { -	uint32_t eccbytes; -	uint32_t eccpos[128]; -	uint32_t oobavail; -	struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES]; -}; -  /**   * struct mtd_ecc_stats - error correction stats   * diff --git a/include/net.h b/include/net.h index 5aedc17aa..0802fad87 100644 --- a/include/net.h +++ b/include/net.h @@ -89,7 +89,7 @@ struct eth_device {  	int  (*recv) (struct eth_device *);  	void (*halt) (struct eth_device *);  #ifdef CONFIG_MCAST_TFTP -	int (*mcast) (struct eth_device *, u32 ip, u8 set); +	int (*mcast) (struct eth_device *, const u8 *enetaddr, u8 set);  #endif  	int  (*write_hwaddr) (struct eth_device *);  	struct eth_device *next; diff --git a/include/os.h b/include/os.h index 8665f70ed..950433daa 100644 --- a/include/os.h +++ b/include/os.h @@ -11,6 +11,8 @@  #ifndef __OS_H__  #define __OS_H__ +#include <linux/types.h> +  struct sandbox_state;  /** @@ -116,7 +118,7 @@ void os_usleep(unsigned long usec);   *   * \return A monotonic increasing time scaled in nano seconds   */ -u64 os_get_nsec(void); +uint64_t os_get_nsec(void);  /**   * Parse arguments and update sandbox state. diff --git a/include/phy.h b/include/phy.h index f86ffb920..1f22fa180 100644 --- a/include/phy.h +++ b/include/phy.h @@ -125,6 +125,9 @@ struct phy_driver {  	/* Called when bringing down the controller */  	int (*shutdown)(struct phy_device *phydev); +	int (*readext)(struct phy_device *phydev, int addr, int devad, int reg); +	int (*writeext)(struct phy_device *phydev, int addr, int devad, int reg, +			u16 val);  	struct list_head list;  }; diff --git a/include/tsec.h b/include/tsec.h index f0f3d4d59..1046426c5 100644 --- a/include/tsec.h +++ b/include/tsec.h @@ -7,7 +7,7 @@   *  terms of the GNU Public License, Version 2, incorporated   *  herein by reference.   * - * Copyright 2004, 2007, 2009, 2011  Freescale Semiconductor, Inc. + * Copyright 2004, 2007, 2009, 2011, 2013 Freescale Semiconductor, Inc.   * (C) Copyright 2003, Motorola, Inc.   * maintained by Xianghua Xiao (x.xiao@motorola.com)   * author Andy Fleming @@ -27,13 +27,26 @@  #define CONFIG_SYS_MDIO_BASE_ADDR (MDIO_BASE_ADDR + 0x520) +#define TSEC_GET_REGS(num, offset) \ +	(struct tsec __iomem *)\ +	(TSEC_BASE_ADDR + (((num) - 1) * (offset))) + +#define TSEC_GET_REGS_BASE(num) \ +	TSEC_GET_REGS((num), TSEC_SIZE) + +#define TSEC_GET_MDIO_REGS(num, offset) \ +	(struct tsec_mii_mng __iomem *)\ +	(CONFIG_SYS_MDIO_BASE_ADDR  + ((num) - 1) * (offset)) + +#define TSEC_GET_MDIO_REGS_BASE(num) \ +	TSEC_GET_MDIO_REGS((num), TSEC_MDIO_OFFSET) +  #define DEFAULT_MII_NAME "FSL_MDIO"  #define STD_TSEC_INFO(num) \  {			\ -	.regs = (tsec_t *)(TSEC_BASE_ADDR + ((num - 1) * TSEC_SIZE)), \ -	.miiregs_sgmii = (struct tsec_mii_mng *)(CONFIG_SYS_MDIO_BASE_ADDR \ -					 + (num - 1) * TSEC_MDIO_OFFSET), \ +	.regs = TSEC_GET_REGS_BASE(num), \ +	.miiregs_sgmii = TSEC_GET_MDIO_REGS_BASE(num), \  	.devname = CONFIG_TSEC##num##_NAME, \  	.phyaddr = TSEC##num##_PHY_ADDR, \  	.flags = TSEC##num##_FLAGS, \ @@ -42,9 +55,8 @@  #define SET_STD_TSEC_INFO(x, num) \  {			\ -	x.regs = (tsec_t *)(TSEC_BASE_ADDR + ((num - 1) * TSEC_SIZE)); \ -	x.miiregs_sgmii = (struct tsec_mii_mng *)(CONFIG_SYS_MDIO_BASE_ADDR \ -					  + (num - 1) * TSEC_MDIO_OFFSET); \ +	x.regs = TSEC_GET_REGS_BASE(num); \ +	x.miiregs_sgmii = TSEC_GET_MDIO_REGS_BASE(num); \  	x.devname = CONFIG_TSEC##num##_NAME; \  	x.phyaddr = TSEC##num##_PHY_ADDR; \  	x.flags = TSEC##num##_FLAGS;\ @@ -186,195 +198,190 @@  #define RXBD_TRUNCATED		0x0001  #define RXBD_STATS		0x003f -typedef struct txbd8 -{ -	ushort	     status;	     /* Status Fields */ -	ushort	     length;	     /* Buffer length */ -	uint	     bufPtr;	     /* Buffer Pointer */ -} txbd8_t; +struct txbd8 { +	uint16_t     status;	     /* Status Fields */ +	uint16_t     length;	     /* Buffer length */ +	uint32_t     bufptr;	     /* Buffer Pointer */ +}; -typedef struct rxbd8 -{ -	ushort	     status;	     /* Status Fields */ -	ushort	     length;	     /* Buffer Length */ -	uint	     bufPtr;	     /* Buffer Pointer */ -} rxbd8_t; +struct rxbd8 { +	uint16_t     status;	     /* Status Fields */ +	uint16_t     length;	     /* Buffer Length */ +	uint32_t     bufptr;	     /* Buffer Pointer */ +}; -typedef struct rmon_mib -{ +struct tsec_rmon_mib {  	/* Transmit and Receive Counters */ -	uint	tr64;		/* Transmit and Receive 64-byte Frame Counter */ -	uint	tr127;		/* Transmit and Receive 65-127 byte Frame Counter */ -	uint	tr255;		/* Transmit and Receive 128-255 byte Frame Counter */ -	uint	tr511;		/* Transmit and Receive 256-511 byte Frame Counter */ -	uint	tr1k;		/* Transmit and Receive 512-1023 byte Frame Counter */ -	uint	trmax;		/* Transmit and Receive 1024-1518 byte Frame Counter */ -	uint	trmgv;		/* Transmit and Receive 1519-1522 byte Good VLAN Frame */ +	u32	tr64;		/* Tx/Rx 64-byte Frame Counter */ +	u32	tr127;		/* Tx/Rx 65-127 byte Frame Counter */ +	u32	tr255;		/* Tx/Rx 128-255 byte Frame Counter */ +	u32	tr511;		/* Tx/Rx 256-511 byte Frame Counter */ +	u32	tr1k;		/* Tx/Rx 512-1023 byte Frame Counter */ +	u32	trmax;		/* Tx/Rx 1024-1518 byte Frame Counter */ +	u32	trmgv;		/* Tx/Rx 1519-1522 byte Good VLAN Frame */  	/* Receive Counters */ -	uint	rbyt;		/* Receive Byte Counter */ -	uint	rpkt;		/* Receive Packet Counter */ -	uint	rfcs;		/* Receive FCS Error Counter */ -	uint	rmca;		/* Receive Multicast Packet (Counter) */ -	uint	rbca;		/* Receive Broadcast Packet */ -	uint	rxcf;		/* Receive Control Frame Packet */ -	uint	rxpf;		/* Receive Pause Frame Packet */ -	uint	rxuo;		/* Receive Unknown OP Code */ -	uint	raln;		/* Receive Alignment Error */ -	uint	rflr;		/* Receive Frame Length Error */ -	uint	rcde;		/* Receive Code Error */ -	uint	rcse;		/* Receive Carrier Sense Error */ -	uint	rund;		/* Receive Undersize Packet */ -	uint	rovr;		/* Receive Oversize Packet */ -	uint	rfrg;		/* Receive Fragments */ -	uint	rjbr;		/* Receive Jabber */ -	uint	rdrp;		/* Receive Drop */ +	u32	rbyt;		/* Receive Byte Counter */ +	u32	rpkt;		/* Receive Packet Counter */ +	u32	rfcs;		/* Receive FCS Error Counter */ +	u32	rmca;		/* Receive Multicast Packet (Counter) */ +	u32	rbca;		/* Receive Broadcast Packet */ +	u32	rxcf;		/* Receive Control Frame Packet */ +	u32	rxpf;		/* Receive Pause Frame Packet */ +	u32	rxuo;		/* Receive Unknown OP Code */ +	u32	raln;		/* Receive Alignment Error */ +	u32	rflr;		/* Receive Frame Length Error */ +	u32	rcde;		/* Receive Code Error */ +	u32	rcse;		/* Receive Carrier Sense Error */ +	u32	rund;		/* Receive Undersize Packet */ +	u32	rovr;		/* Receive Oversize Packet */ +	u32	rfrg;		/* Receive Fragments */ +	u32	rjbr;		/* Receive Jabber */ +	u32	rdrp;		/* Receive Drop */  	/* Transmit Counters */ -	uint	tbyt;		/* Transmit Byte Counter */ -	uint	tpkt;		/* Transmit Packet */ -	uint	tmca;		/* Transmit Multicast Packet */ -	uint	tbca;		/* Transmit Broadcast Packet */ -	uint	txpf;		/* Transmit Pause Control Frame */ -	uint	tdfr;		/* Transmit Deferral Packet */ -	uint	tedf;		/* Transmit Excessive Deferral Packet */ -	uint	tscl;		/* Transmit Single Collision Packet */ +	u32	tbyt;		/* Transmit Byte Counter */ +	u32	tpkt;		/* Transmit Packet */ +	u32	tmca;		/* Transmit Multicast Packet */ +	u32	tbca;		/* Transmit Broadcast Packet */ +	u32	txpf;		/* Transmit Pause Control Frame */ +	u32	tdfr;		/* Transmit Deferral Packet */ +	u32	tedf;		/* Transmit Excessive Deferral Packet */ +	u32	tscl;		/* Transmit Single Collision Packet */  	/* (0x2_n700) */ -	uint	tmcl;		/* Transmit Multiple Collision Packet */ -	uint	tlcl;		/* Transmit Late Collision Packet */ -	uint	txcl;		/* Transmit Excessive Collision Packet */ -	uint	tncl;		/* Transmit Total Collision */ +	u32	tmcl;		/* Transmit Multiple Collision Packet */ +	u32	tlcl;		/* Transmit Late Collision Packet */ +	u32	txcl;		/* Transmit Excessive Collision Packet */ +	u32	tncl;		/* Transmit Total Collision */ -	uint	res2; +	u32	res2; -	uint	tdrp;		/* Transmit Drop Frame */ -	uint	tjbr;		/* Transmit Jabber Frame */ -	uint	tfcs;		/* Transmit FCS Error */ -	uint	txcf;		/* Transmit Control Frame */ -	uint	tovr;		/* Transmit Oversize Frame */ -	uint	tund;		/* Transmit Undersize Frame */ -	uint	tfrg;		/* Transmit Fragments Frame */ +	u32	tdrp;		/* Transmit Drop Frame */ +	u32	tjbr;		/* Transmit Jabber Frame */ +	u32	tfcs;		/* Transmit FCS Error */ +	u32	txcf;		/* Transmit Control Frame */ +	u32	tovr;		/* Transmit Oversize Frame */ +	u32	tund;		/* Transmit Undersize Frame */ +	u32	tfrg;		/* Transmit Fragments Frame */  	/* General Registers */ -	uint	car1;		/* Carry Register One */ -	uint	car2;		/* Carry Register Two */ -	uint	cam1;		/* Carry Register One Mask */ -	uint	cam2;		/* Carry Register Two Mask */ -} rmon_mib_t; +	u32	car1;		/* Carry Register One */ +	u32	car2;		/* Carry Register Two */ +	u32	cam1;		/* Carry Register One Mask */ +	u32	cam2;		/* Carry Register Two Mask */ +}; -typedef struct tsec_hash_regs -{ -	uint	iaddr0;		/* Individual Address Register 0 */ -	uint	iaddr1;		/* Individual Address Register 1 */ -	uint	iaddr2;		/* Individual Address Register 2 */ -	uint	iaddr3;		/* Individual Address Register 3 */ -	uint	iaddr4;		/* Individual Address Register 4 */ -	uint	iaddr5;		/* Individual Address Register 5 */ -	uint	iaddr6;		/* Individual Address Register 6 */ -	uint	iaddr7;		/* Individual Address Register 7 */ -	uint	res1[24]; -	uint	gaddr0;		/* Group Address Register 0 */ -	uint	gaddr1;		/* Group Address Register 1 */ -	uint	gaddr2;		/* Group Address Register 2 */ -	uint	gaddr3;		/* Group Address Register 3 */ -	uint	gaddr4;		/* Group Address Register 4 */ -	uint	gaddr5;		/* Group Address Register 5 */ -	uint	gaddr6;		/* Group Address Register 6 */ -	uint	gaddr7;		/* Group Address Register 7 */ -	uint	res2[24]; -} tsec_hash_t; +struct tsec_hash_regs { +	u32	iaddr0;		/* Individual Address Register 0 */ +	u32	iaddr1;		/* Individual Address Register 1 */ +	u32	iaddr2;		/* Individual Address Register 2 */ +	u32	iaddr3;		/* Individual Address Register 3 */ +	u32	iaddr4;		/* Individual Address Register 4 */ +	u32	iaddr5;		/* Individual Address Register 5 */ +	u32	iaddr6;		/* Individual Address Register 6 */ +	u32	iaddr7;		/* Individual Address Register 7 */ +	u32	res1[24]; +	u32	gaddr0;		/* Group Address Register 0 */ +	u32	gaddr1;		/* Group Address Register 1 */ +	u32	gaddr2;		/* Group Address Register 2 */ +	u32	gaddr3;		/* Group Address Register 3 */ +	u32	gaddr4;		/* Group Address Register 4 */ +	u32	gaddr5;		/* Group Address Register 5 */ +	u32	gaddr6;		/* Group Address Register 6 */ +	u32	gaddr7;		/* Group Address Register 7 */ +	u32	res2[24]; +}; -typedef struct tsec -{ +struct tsec {  	/* General Control and Status Registers (0x2_n000) */ -	uint	res000[4]; +	u32	res000[4]; -	uint	ievent;		/* Interrupt Event */ -	uint	imask;		/* Interrupt Mask */ -	uint	edis;		/* Error Disabled */ -	uint	res01c; -	uint	ecntrl;		/* Ethernet Control */ -	uint	minflr;		/* Minimum Frame Length */ -	uint	ptv;		/* Pause Time Value */ -	uint	dmactrl;	/* DMA Control */ -	uint	tbipa;		/* TBI PHY Address */ +	u32	ievent;		/* Interrupt Event */ +	u32	imask;		/* Interrupt Mask */ +	u32	edis;		/* Error Disabled */ +	u32	res01c; +	u32	ecntrl;		/* Ethernet Control */ +	u32	minflr;		/* Minimum Frame Length */ +	u32	ptv;		/* Pause Time Value */ +	u32	dmactrl;	/* DMA Control */ +	u32	tbipa;		/* TBI PHY Address */ -	uint	res034[3]; -	uint	res040[48]; +	u32	res034[3]; +	u32	res040[48];  	/* Transmit Control and Status Registers (0x2_n100) */ -	uint	tctrl;		/* Transmit Control */ -	uint	tstat;		/* Transmit Status */ -	uint	res108; -	uint	tbdlen;		/* Tx BD Data Length */ -	uint	res110[5]; -	uint	ctbptr;		/* Current TxBD Pointer */ -	uint	res128[23]; -	uint	tbptr;		/* TxBD Pointer */ -	uint	res188[30]; +	u32	tctrl;		/* Transmit Control */ +	u32	tstat;		/* Transmit Status */ +	u32	res108; +	u32	tbdlen;		/* Tx BD Data Length */ +	u32	res110[5]; +	u32	ctbptr;		/* Current TxBD Pointer */ +	u32	res128[23]; +	u32	tbptr;		/* TxBD Pointer */ +	u32	res188[30];  	/* (0x2_n200) */ -	uint	res200; -	uint	tbase;		/* TxBD Base Address */ -	uint	res208[42]; -	uint	ostbd;		/* Out of Sequence TxBD */ -	uint	ostbdp;		/* Out of Sequence Tx Data Buffer Pointer */ -	uint	res2b8[18]; +	u32	res200; +	u32	tbase;		/* TxBD Base Address */ +	u32	res208[42]; +	u32	ostbd;		/* Out of Sequence TxBD */ +	u32	ostbdp;		/* Out of Sequence Tx Data Buffer Pointer */ +	u32	res2b8[18];  	/* Receive Control and Status Registers (0x2_n300) */ -	uint	rctrl;		/* Receive Control */ -	uint	rstat;		/* Receive Status */ -	uint	res308; -	uint	rbdlen;		/* RxBD Data Length */ -	uint	res310[4]; -	uint	res320; -	uint	crbptr;	/* Current Receive Buffer Pointer */ -	uint	res328[6]; -	uint	mrblr;	/* Maximum Receive Buffer Length */ -	uint	res344[16]; -	uint	rbptr;	/* RxBD Pointer */ -	uint	res388[30]; +	u32	rctrl;		/* Receive Control */ +	u32	rstat;		/* Receive Status */ +	u32	res308; +	u32	rbdlen;		/* RxBD Data Length */ +	u32	res310[4]; +	u32	res320; +	u32	crbptr;	/* Current Receive Buffer Pointer */ +	u32	res328[6]; +	u32	mrblr;	/* Maximum Receive Buffer Length */ +	u32	res344[16]; +	u32	rbptr;	/* RxBD Pointer */ +	u32	res388[30];  	/* (0x2_n400) */ -	uint	res400; -	uint	rbase;	/* RxBD Base Address */ -	uint	res408[62]; +	u32	res400; +	u32	rbase;	/* RxBD Base Address */ +	u32	res408[62];  	/* MAC Registers (0x2_n500) */ -	uint	maccfg1;	/* MAC Configuration #1 */ -	uint	maccfg2;	/* MAC Configuration #2 */ -	uint	ipgifg;		/* Inter Packet Gap/Inter Frame Gap */ -	uint	hafdup;		/* Half-duplex */ -	uint	maxfrm;		/* Maximum Frame */ -	uint	res514; -	uint	res518; +	u32	maccfg1;	/* MAC Configuration #1 */ +	u32	maccfg2;	/* MAC Configuration #2 */ +	u32	ipgifg;		/* Inter Packet Gap/Inter Frame Gap */ +	u32	hafdup;		/* Half-duplex */ +	u32	maxfrm;		/* Maximum Frame */ +	u32	res514; +	u32	res518; -	uint	res51c; +	u32	res51c; -	uint	resmdio[6]; +	u32	resmdio[6]; -	uint	res538; +	u32	res538; -	uint	ifstat;		/* Interface Status */ -	uint	macstnaddr1;	/* Station Address, part 1 */ -	uint	macstnaddr2;	/* Station Address, part 2 */ -	uint	res548[46]; +	u32	ifstat;		/* Interface Status */ +	u32	macstnaddr1;	/* Station Address, part 1 */ +	u32	macstnaddr2;	/* Station Address, part 2 */ +	u32	res548[46];  	/* (0x2_n600) */ -	uint	res600[32]; +	u32	res600[32];  	/* RMON MIB Registers (0x2_n680-0x2_n73c) */ -	rmon_mib_t	rmon; -	uint	res740[48]; +	struct tsec_rmon_mib	rmon; +	u32	res740[48];  	/* Hash Function Registers (0x2_n800) */ -	tsec_hash_t	hash; +	struct tsec_hash_regs	hash; -	uint	res900[128]; +	u32	res900[128];  	/* Pattern Registers (0x2_nb00) */ -	uint	resb00[62]; -	uint	attr;	   /* Default Attribute Register */ -	uint	attreli;	   /* Default Attribute Extract Length and Index */ +	u32	resb00[62]; +	u32	attr; /* Default Attribute Register */ +	u32	attreli; /* Default Attribute Extract Length and Index */  	/* TSEC Future Expansion Space (0x2_nc00-0x2_nffc) */ -	uint	resc00[256]; -} tsec_t; +	u32	resc00[256]; +};  #define TSEC_GIGABIT (1 << 0) @@ -383,8 +390,8 @@ typedef struct tsec  #define TSEC_SGMII	(1 << 2)	/* MAC-PHY interface uses SGMII */  struct tsec_private { -	tsec_t *regs; -	struct tsec_mii_mng *phyregs_sgmii; +	struct tsec __iomem *regs; +	struct tsec_mii_mng __iomem *phyregs_sgmii;  	struct phy_device *phydev;  	phy_interface_t interface;  	struct mii_dev *bus; @@ -394,8 +401,8 @@ struct tsec_private {  };  struct tsec_info_struct { -	tsec_t *regs; -	struct tsec_mii_mng *miiregs_sgmii; +	struct tsec __iomem *regs; +	struct tsec_mii_mng __iomem *miiregs_sgmii;  	char *devname;  	char *mii_devname;  	phy_interface_t interface; diff --git a/lib/Makefile b/lib/Makefile index 4e3b500f5..e787f77be 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -6,6 +6,13 @@  #  ifndef CONFIG_SPL_BUILD + +obj-$(CONFIG_RSA) += rsa/ +obj-$(CONFIG_LZMA) += lzma/ +obj-$(CONFIG_LZO) += lzo/ +obj-$(CONFIG_ZLIB) += zlib/ +obj-$(CONFIG_TIZEN) += tizen/ +  obj-$(CONFIG_AES) += aes.o  obj-$(CONFIG_BZIP2) += bzlib.o  obj-$(CONFIG_BZIP2) += bzlib_crctable.o diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 51fa86833..207314fa7 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -86,10 +86,10 @@ fdt_addr_t fdtdec_get_addr_size(const void *blob, int node,  			size = (fdt_size_t *)((char *)cell +  					sizeof(fdt_addr_t));  			*sizep = fdt_size_to_cpu(*size); -			debug("addr=%p, size=%p\n", (void *)addr, -			      (void *)*sizep); +			debug("addr=%08lx, size=%08x\n", +			      (ulong)addr, *sizep);  		} else { -			debug("%p\n", (void *)addr); +			debug("%08lx\n", (ulong)addr);  		}  		return addr;  	} @@ -611,7 +611,7 @@ int fdtdec_decode_region(const void *blob, int node,  	if (!cell || (len != sizeof(fdt_addr_t) * 2))  		return -1; -	*ptrp = (void *)fdt_addr_to_cpu(*cell); +	*ptrp = map_sysmem(fdt_addr_to_cpu(*cell), *size);  	*size = fdt_size_to_cpu(cell[1]);  	debug("%s: size=%zx\n", __func__, *size);  	return 0; diff --git a/nand_spl/board/amcc/acadia/Makefile b/nand_spl/board/amcc/acadia/Makefile index 20459c92e..022a20555 100644 --- a/nand_spl/board/amcc/acadia/Makefile +++ b/nand_spl/board/amcc/acadia/Makefile @@ -24,11 +24,9 @@ OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))  __OBJS	:= $(SOBJS) $(COBJS)  LNDIR	:= $(nandobj)board/$(BOARDDIR) -ALL	= $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin \ +all: $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin \  	$(nandobj)System.map -all:	$(obj).depend $(ALL) -  $(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl  	$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@ @@ -37,13 +35,12 @@ $(nandobj)u-boot-spl.bin:	$(nandobj)u-boot-spl  $(nandobj)u-boot-spl:	$(OBJS) $(nandobj)u-boot.lds  	cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \ -		-Map $(nandobj)u-boot-spl.map \ -		-o $(nandobj)u-boot-spl +		-Map $(nandobj)u-boot-spl.map -o $@  $(nandobj)System.map:	$(nandobj)u-boot-spl  		@$(NM) $< | \  		grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \ -		sort > $(nandobj)System.map +		sort > $@  $(nandobj)u-boot.lds: $(LDSCRIPT)  	$(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@ @@ -52,43 +49,43 @@ $(nandobj)u-boot.lds: $(LDSCRIPT)  # from cpu directory  $(obj)cache.S: -	@rm -f $(obj)cache.S -	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/cache.S $(obj)cache.S +	@rm -f $@ +	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/cache.S $@  $(obj)gpio.c: -	@rm -f $(obj)gpio.c -	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/gpio.c $(obj)gpio.c +	@rm -f $@ +	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/gpio.c $@  $(obj)ndfc.c: -	@rm -f $(obj)ndfc.c -	ln -s $(SRCTREE)/drivers/mtd/nand/ndfc.c $(obj)ndfc.c +	@rm -f $@ +	ln -s $(SRCTREE)/drivers/mtd/nand/ndfc.c $@  $(obj)resetvec.S: -	@rm -f $(obj)resetvec.S -	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/resetvec.S $(obj)resetvec.S +	@rm -f $@ +	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/resetvec.S $@  $(obj)start.S: -	@rm -f $(obj)start.S -	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/start.S $(obj)start.S +	@rm -f $@ +	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/start.S $@  # from board directory  $(obj)memory.c: -	@rm -f $(obj)memory.c -	ln -s $(SRCTREE)/board/amcc/acadia/memory.c $(obj)memory.c +	@rm -f $@ +	ln -s $(SRCTREE)/board/amcc/acadia/memory.c $@  $(obj)pll.c: -	@rm -f $(obj)pll.c -	ln -s $(SRCTREE)/board/amcc/acadia/pll.c $(obj)pll.c +	@rm -f $@ +	ln -s $(SRCTREE)/board/amcc/acadia/pll.c $@  # from nand_spl directory  $(obj)nand_boot.c: -	@rm -f $(obj)nand_boot.c -	ln -s $(SRCTREE)/nand_spl/nand_boot.c $(obj)nand_boot.c +	@rm -f $@ +	ln -s $(SRCTREE)/nand_spl/nand_boot.c $@  # from drivers/mtd/nand directory  $(obj)nand_ecc.c: -	@rm -f $(obj)nand_ecc.c -	ln -s $(SRCTREE)/drivers/mtd/nand/nand_ecc.c $(obj)nand_ecc.c +	@rm -f $@ +	ln -s $(SRCTREE)/drivers/mtd/nand/nand_ecc.c $@  ######################################################################### diff --git a/nand_spl/board/amcc/bamboo/Makefile b/nand_spl/board/amcc/bamboo/Makefile index ca3dab4f2..d413a480a 100644 --- a/nand_spl/board/amcc/bamboo/Makefile +++ b/nand_spl/board/amcc/bamboo/Makefile @@ -24,9 +24,7 @@ OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))  __OBJS	:= $(SOBJS) $(COBJS)  LNDIR	:= $(nandobj)board/$(BOARDDIR) -ALL	= $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin - -all:	$(obj).depend $(ALL) +all: $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin  $(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl  	$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@ @@ -36,8 +34,7 @@ $(nandobj)u-boot-spl.bin:	$(nandobj)u-boot-spl  $(nandobj)u-boot-spl:	$(OBJS) $(nandobj)u-boot.lds  	cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \ -		-Map $(nandobj)u-boot-spl.map \ -		-o $(nandobj)u-boot-spl +		-Map $(nandobj)u-boot-spl.map -o $@  $(nandobj)u-boot.lds: $(LDSCRIPT)  	$(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@ @@ -46,36 +43,36 @@ $(nandobj)u-boot.lds: $(LDSCRIPT)  # from cpu directory  $(obj)ndfc.c: -	@rm -f $(obj)ndfc.c -	ln -s $(SRCTREE)/drivers/mtd/nand/ndfc.c $(obj)ndfc.c +	@rm -f $@ +	ln -s $(SRCTREE)/drivers/mtd/nand/ndfc.c $@  $(obj)resetvec.S: -	@rm -f $(obj)resetvec.S -	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/resetvec.S $(obj)resetvec.S +	@rm -f $@ +	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/resetvec.S $@  $(obj)start.S: -	@rm -f $(obj)start.S -	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/start.S $(obj)start.S +	@rm -f $@ +	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/start.S $@  # from board directory  $(obj)init.S: -	@rm -f $(obj)init.S -	ln -s $(SRCTREE)/board/amcc/bamboo/init.S $(obj)init.S +	@rm -f $@ +	ln -s $(SRCTREE)/board/amcc/bamboo/init.S $@  # from nand_spl directory  $(obj)nand_boot.c: -	@rm -f $(obj)nand_boot.c -	ln -s $(SRCTREE)/nand_spl/nand_boot.c $(obj)nand_boot.c +	@rm -f $@ +	ln -s $(SRCTREE)/nand_spl/nand_boot.c $@  # from drivers/mtd/nand directory  $(obj)nand_ecc.c: -	@rm -f $(obj)nand_ecc.c -	ln -s $(SRCTREE)/drivers/mtd/nand/nand_ecc.c $(obj)nand_ecc.c +	@rm -f $@ +	ln -s $(SRCTREE)/drivers/mtd/nand/nand_ecc.c $@  ifneq ($(OBJTREE), $(SRCTREE))  $(obj)sdram.c: -	@rm -f $(obj)sdram.c -	ln -s $(SRCTREE)/nand_spl/board/$(BOARDDIR)/sdram.c $(obj)sdram.c +	@rm -f $@ +	ln -s $(SRCTREE)/nand_spl/board/$(BOARDDIR)/sdram.c $@  endif  ######################################################################### diff --git a/nand_spl/board/amcc/canyonlands/Makefile b/nand_spl/board/amcc/canyonlands/Makefile index f50d84b8c..b2ef03f78 100644 --- a/nand_spl/board/amcc/canyonlands/Makefile +++ b/nand_spl/board/amcc/canyonlands/Makefile @@ -29,9 +29,7 @@ OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))  __OBJS	:= $(SOBJS) $(COBJS)  LNDIR	:= $(nandobj)board/$(BOARDDIR) -ALL	= $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin - -all:	$(obj).depend $(ALL) +all: $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin  $(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl  	$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@ @@ -41,8 +39,7 @@ $(nandobj)u-boot-spl.bin:	$(nandobj)u-boot-spl  $(nandobj)u-boot-spl:	$(OBJS) $(nandobj)u-boot.lds  	cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \ -		-Map $(nandobj)u-boot-spl.map \ -		-o $(nandobj)u-boot-spl +		-Map $(nandobj)u-boot-spl.map -o $@  $(nandobj)u-boot.lds: $(LDSCRIPT)  	$(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@ @@ -51,36 +48,36 @@ $(nandobj)u-boot.lds: $(LDSCRIPT)  # from cpu directory  $(obj)ndfc.c: -	@rm -f $(obj)ndfc.c -	ln -s $(SRCTREE)/drivers/mtd/nand/ndfc.c $(obj)ndfc.c +	@rm -f $@ +	ln -s $(SRCTREE)/drivers/mtd/nand/ndfc.c $@  $(obj)resetvec.S: -	@rm -f $(obj)resetvec.S -	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/resetvec.S $(obj)resetvec.S +	@rm -f $@ +	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/resetvec.S $@  $(obj)start.S: -	@rm -f $(obj)start.S -	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/start.S $(obj)start.S +	@rm -f $@ +	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/start.S $@  # from board directory  $(obj)init.S: -	@rm -f $(obj)init.S -	ln -s $(SRCTREE)/board/amcc/canyonlands/init.S $(obj)init.S +	@rm -f $@ +	ln -s $(SRCTREE)/board/amcc/canyonlands/init.S $@  # from nand_spl directory  $(obj)nand_boot.c: -	@rm -f $(obj)nand_boot.c -	ln -s $(SRCTREE)/nand_spl/nand_boot.c $(obj)nand_boot.c +	@rm -f $@ +	ln -s $(SRCTREE)/nand_spl/nand_boot.c $@  # from drivers/mtd/nand directory  $(obj)nand_ecc.c: -	@rm -f $(obj)nand_ecc.c -	ln -s $(SRCTREE)/drivers/mtd/nand/nand_ecc.c $(obj)nand_ecc.c +	@rm -f $@ +	ln -s $(SRCTREE)/drivers/mtd/nand/nand_ecc.c $@  ifneq ($(OBJTREE), $(SRCTREE))  $(obj)ddr2_fixed.c: -	@rm -f $(obj)ddr2_fixed.c -	ln -s $(SRCTREE)/nand_spl/board/$(BOARDDIR)/ddr2_fixed.c $(obj)ddr2_fixed.c +	@rm -f $@ +	ln -s $(SRCTREE)/nand_spl/board/$(BOARDDIR)/ddr2_fixed.c $@  endif  ######################################################################### diff --git a/nand_spl/board/amcc/kilauea/Makefile b/nand_spl/board/amcc/kilauea/Makefile index 8b4206f57..5899b9efe 100644 --- a/nand_spl/board/amcc/kilauea/Makefile +++ b/nand_spl/board/amcc/kilauea/Makefile @@ -24,9 +24,7 @@ OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))  __OBJS	:= $(SOBJS) $(COBJS)  LNDIR	:= $(nandobj)board/$(BOARDDIR) -ALL	= $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin - -all:	$(obj).depend $(ALL) +all: $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin  $(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl  	$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@ @@ -36,8 +34,7 @@ $(nandobj)u-boot-spl.bin:	$(nandobj)u-boot-spl  $(nandobj)u-boot-spl:	$(OBJS) $(nandobj)u-boot.lds  	cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \ -		-Map $(nandobj)u-boot-spl.map \ -		-o $(nandobj)u-boot-spl +		-Map $(nandobj)u-boot-spl.map -o $@  $(nandobj)u-boot.lds: $(LDSCRIPT)  	$(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@ @@ -46,38 +43,38 @@ $(nandobj)u-boot.lds: $(LDSCRIPT)  # from cpu directory  $(obj)44x_spd_ddr2.c: $(obj)ecc.h -	@rm -f $(obj)44x_spd_ddr2.c -	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/44x_spd_ddr2.c $(obj)44x_spd_ddr2.c +	@rm -f $@ +	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/44x_spd_ddr2.c $@  $(obj)cache.S: -	@rm -f $(obj)cache.S -	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/cache.S $(obj)cache.S +	@rm -f $@ +	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/cache.S $@  $(obj)ecc.h: -	@rm -f $(obj)ecc.h -	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/ecc.h $(obj)ecc.h +	@rm -f $@ +	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/ecc.h $@  $(obj)ndfc.c: -	@rm -f $(obj)ndfc.c -	ln -s $(SRCTREE)/drivers/mtd/nand/ndfc.c $(obj)ndfc.c +	@rm -f $@ +	ln -s $(SRCTREE)/drivers/mtd/nand/ndfc.c $@  $(obj)resetvec.S: -	@rm -f $(obj)resetvec.S -	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/resetvec.S $(obj)resetvec.S +	@rm -f $@ +	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/resetvec.S $@  $(obj)start.S: -	@rm -f $(obj)start.S -	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/start.S $(obj)start.S +	@rm -f $@ +	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/start.S $@  # from nand_spl directory  $(obj)nand_boot.c: -	@rm -f $(obj)nand_boot.c -	ln -s $(SRCTREE)/nand_spl/nand_boot.c $(obj)nand_boot.c +	@rm -f $@ +	ln -s $(SRCTREE)/nand_spl/nand_boot.c $@  # from drivers/nand directory  $(obj)nand_ecc.c: -	@rm -f $(obj)nand_ecc.c -	ln -s $(SRCTREE)/drivers/mtd/nand/nand_ecc.c $(obj)nand_ecc.c +	@rm -f $@ +	ln -s $(SRCTREE)/drivers/mtd/nand/nand_ecc.c $@  ######################################################################### diff --git a/nand_spl/board/amcc/sequoia/Makefile b/nand_spl/board/amcc/sequoia/Makefile index 0fcf030d4..fea6c4e48 100644 --- a/nand_spl/board/amcc/sequoia/Makefile +++ b/nand_spl/board/amcc/sequoia/Makefile @@ -24,9 +24,7 @@ OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))  __OBJS	:= $(SOBJS) $(COBJS)  LNDIR	:= $(nandobj)board/$(BOARDDIR) -ALL	= $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin - -all:	$(obj).depend $(ALL) +all: $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin  $(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl  	$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@ @@ -36,8 +34,7 @@ $(nandobj)u-boot-spl.bin:	$(nandobj)u-boot-spl  $(nandobj)u-boot-spl:	$(OBJS) $(nandobj)u-boot.lds  	cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \ -		-Map $(nandobj)u-boot-spl.map \ -		-o $(nandobj)u-boot-spl +		-Map $(nandobj)u-boot-spl.map -o $@  $(nandobj)u-boot.lds: $(LDSCRIPT)  	$(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@ @@ -46,41 +43,41 @@ $(nandobj)u-boot.lds: $(LDSCRIPT)  # from cpu directory  $(obj)denali_data_eye.c: -	@rm -f $(obj)denali_data_eye.c -	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/denali_data_eye.c $(obj)denali_data_eye.c +	@rm -f $@ +	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/denali_data_eye.c $@  $(obj)ndfc.c: -	@rm -f $(obj)ndfc.c -	ln -s $(SRCTREE)/drivers/mtd/nand/ndfc.c $(obj)ndfc.c +	@rm -f $@ +	ln -s $(SRCTREE)/drivers/mtd/nand/ndfc.c $@  $(obj)resetvec.S: -	@rm -f $(obj)resetvec.S -	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/resetvec.S $(obj)resetvec.S +	@rm -f $@ +	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/resetvec.S $@  $(obj)start.S: -	@rm -f $(obj)start.S -	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/start.S $(obj)start.S +	@rm -f $@ +	ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/start.S $@  # from board directory  $(obj)init.S: -	@rm -f $(obj)init.S -	ln -s $(SRCTREE)/board/amcc/sequoia/init.S $(obj)init.S +	@rm -f $@ +	ln -s $(SRCTREE)/board/amcc/sequoia/init.S $@  $(obj)sdram.c: -	@rm -f $(obj)sdram.c +	@rm -f $@  	@rm -f $(obj)sdram.h -	ln -s $(SRCTREE)/board/amcc/sequoia/sdram.c $(obj)sdram.c +	ln -s $(SRCTREE)/board/amcc/sequoia/sdram.c $@  	ln -s $(SRCTREE)/board/amcc/sequoia/sdram.h $(obj)sdram.h  # from nand_spl directory  $(obj)nand_boot.c: -	@rm -f $(obj)nand_boot.c -	ln -s $(SRCTREE)/nand_spl/nand_boot.c $(obj)nand_boot.c +	@rm -f $@ +	ln -s $(SRCTREE)/nand_spl/nand_boot.c $@  # from drivers/mtd/nand directory  $(obj)nand_ecc.c: -	@rm -f $(obj)nand_ecc.c -	ln -s $(SRCTREE)/drivers/mtd/nand/nand_ecc.c $(obj)nand_ecc.c +	@rm -f $@ +	ln -s $(SRCTREE)/drivers/mtd/nand/nand_ecc.c $@  ######################################################################### diff --git a/nand_spl/board/freescale/mpc8315erdb/Makefile b/nand_spl/board/freescale/mpc8315erdb/Makefile index 5b11d1067..c49a6e0b8 100644 --- a/nand_spl/board/freescale/mpc8315erdb/Makefile +++ b/nand_spl/board/freescale/mpc8315erdb/Makefile @@ -28,9 +28,7 @@ OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))  __OBJS	:= $(SOBJS) $(COBJS)  LNDIR	:= $(nandobj)board/$(BOARDDIR) -ALL	= $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin - -all:	$(obj).depend $(ALL) +all: $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin  $(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl  	$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@ @@ -40,8 +38,7 @@ $(nandobj)u-boot-spl.bin:	$(nandobj)u-boot-spl  $(nandobj)u-boot-spl:	$(OBJS) $(nandobj)u-boot.lds  	cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \ -		-Map $(nandobj)u-boot-spl.map \ -		-o $(nandobj)u-boot-spl +		-Map $(nandobj)u-boot-spl.map -o $@  $(nandobj)u-boot.lds: $(LDSCRIPT)  	$(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@ @@ -49,32 +46,31 @@ $(nandobj)u-boot.lds: $(LDSCRIPT)  # create symbolic links for common files  $(obj)start.S: -	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc83xx/start.S $(obj)start.S +	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc83xx/start.S $@  $(obj)nand_boot_fsl_elbc.c: -	ln -sf $(SRCTREE)/nand_spl/nand_boot_fsl_elbc.c \ -	       $(obj)nand_boot_fsl_elbc.c +	ln -sf $(SRCTREE)/nand_spl/nand_boot_fsl_elbc.c $@  $(obj)sdram.c: -	ln -sf $(SRCTREE)/board/$(BOARDDIR)/sdram.c $(obj)sdram.c +	ln -sf $(SRCTREE)/board/$(BOARDDIR)/sdram.c $@  $(obj)$(BOARD).c: -	ln -sf $(SRCTREE)/board/$(BOARDDIR)/$(BOARD).c $(obj)$(BOARD).c +	ln -sf $(SRCTREE)/board/$(BOARDDIR)/$(BOARD).c $@  $(obj)ns16550.c: -	ln -sf $(SRCTREE)/drivers/serial/ns16550.c $(obj)ns16550.c +	ln -sf $(SRCTREE)/drivers/serial/ns16550.c $@  $(obj)spl_minimal.c: -	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc83xx/spl_minimal.c $(obj)spl_minimal.c +	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc83xx/spl_minimal.c $@  $(obj)cache.c: -	ln -sf $(SRCTREE)/arch/powerpc/lib/cache.c $(obj)cache.c +	ln -sf $(SRCTREE)/arch/powerpc/lib/cache.c $@  $(obj)time.c: -	ln -sf $(SRCTREE)/arch/powerpc/lib/time.c $(obj)time.c +	ln -sf $(SRCTREE)/arch/powerpc/lib/time.c $@  $(obj)ticks.S: -	ln -sf $(SRCTREE)/arch/powerpc/lib/ticks.S $(obj)ticks.S +	ln -sf $(SRCTREE)/arch/powerpc/lib/ticks.S $@  ######################################################################### diff --git a/nand_spl/board/freescale/mpc8536ds/Makefile b/nand_spl/board/freescale/mpc8536ds/Makefile index d3dac2074..62330815c 100644 --- a/nand_spl/board/freescale/mpc8536ds/Makefile +++ b/nand_spl/board/freescale/mpc8536ds/Makefile @@ -30,9 +30,7 @@ OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))  __OBJS	:= $(SOBJS) $(COBJS)  LNDIR	:= $(nandobj)board/$(BOARDDIR) -ALL	= $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin - -all:	$(obj).depend $(ALL) +all: $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin  $(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl  	$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@ @@ -42,8 +40,7 @@ $(nandobj)u-boot-spl.bin:	$(nandobj)u-boot-spl  $(nandobj)u-boot-spl:	$(OBJS) $(nandobj)u-boot-nand_spl.lds  	cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \ -		-Map $(nandobj)u-boot-spl.map \ -		-o $(nandobj)u-boot-spl +		-Map $(nandobj)u-boot-spl.map -o $@  $(nandobj)u-boot-nand_spl.lds: $(LDSCRIPT)  	$(CPP) $(CPPFLAGS) $(LDPPFLAGS) -I$(nandobj)/board/$(BOARDDIR) \ @@ -52,58 +49,57 @@ $(nandobj)u-boot-nand_spl.lds: $(LDSCRIPT)  # create symbolic links for common files  $(obj)cache.c: -	@rm -f $(obj)cache.c -	ln -sf $(SRCTREE)/arch/powerpc/lib/cache.c $(obj)cache.c +	@rm -f $@ +	ln -sf $(SRCTREE)/arch/powerpc/lib/cache.c $@  $(obj)cpu_init_early.c: -	@rm -f $(obj)cpu_init_early.c -	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/cpu_init_early.c $(obj)cpu_init_early.c +	@rm -f $@ +	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/cpu_init_early.c $@  $(obj)spl_minimal.c: -	@rm -f $(obj)spl_minimal.c -	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/spl_minimal.c $(obj)spl_minimal.c +	@rm -f $@ +	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/spl_minimal.c $@  $(obj)fsl_law.c: -	@rm -f $(obj)fsl_law.c -	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc8xxx/law.c $(obj)fsl_law.c +	@rm -f $@ +	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc8xxx/law.c $@  $(obj)law.c: -	@rm -f $(obj)law.c -	ln -sf $(SRCTREE)/board/$(BOARDDIR)/law.c $(obj)law.c +	@rm -f $@ +	ln -sf $(SRCTREE)/board/$(BOARDDIR)/law.c $@  $(obj)nand_boot_fsl_elbc.c: -	@rm -f $(obj)nand_boot_fsl_elbc.c -	ln -sf $(SRCTREE)/nand_spl/nand_boot_fsl_elbc.c \ -	       $(obj)nand_boot_fsl_elbc.c +	@rm -f $@ +	ln -sf $(SRCTREE)/nand_spl/nand_boot_fsl_elbc.c $@  $(obj)ns16550.c: -	@rm -f $(obj)ns16550.c -	ln -sf $(SRCTREE)/drivers/serial/ns16550.c $(obj)ns16550.c +	@rm -f $@ +	ln -sf $(SRCTREE)/drivers/serial/ns16550.c $@  $(obj)resetvec.S: -	@rm -f $(obj)resetvec.S -	ln -s $(SRCTREE)/$(CPUDIR)/resetvec.S $(obj)resetvec.S +	@rm -f $@ +	ln -s $(SRCTREE)/$(CPUDIR)/resetvec.S $@  $(obj)fixed_ivor.S: -	@rm -f $(obj)fixed_ivor.S -	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/fixed_ivor.S $(obj)fixed_ivor.S +	@rm -f $@ +	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/fixed_ivor.S $@  $(obj)start.S: $(obj)fixed_ivor.S -	@rm -f $(obj)start.S -	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/start.S $(obj)start.S +	@rm -f $@ +	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/start.S $@  $(obj)tlb.c: -	@rm -f $(obj)tlb.c -	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/tlb.c $(obj)tlb.c +	@rm -f $@ +	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/tlb.c $@  $(obj)tlb_table.c: -	@rm -f $(obj)tlb_table.c -	ln -sf $(SRCTREE)/board/$(BOARDDIR)/tlb.c $(obj)tlb_table.c +	@rm -f $@ +	ln -sf $(SRCTREE)/board/$(BOARDDIR)/tlb.c $@  ifneq ($(OBJTREE), $(SRCTREE))  $(obj)nand_boot.c: -	@rm -f $(obj)nand_boot.c -	ln -s $(SRCTREE)/nand_spl/board/$(BOARDDIR)/nand_boot.c $(obj)nand_boot.c +	@rm -f $@ +	ln -s $(SRCTREE)/nand_spl/board/$(BOARDDIR)/nand_boot.c $@  endif  ######################################################################### diff --git a/nand_spl/board/freescale/mpc8569mds/Makefile b/nand_spl/board/freescale/mpc8569mds/Makefile index d3dac2074..62330815c 100644 --- a/nand_spl/board/freescale/mpc8569mds/Makefile +++ b/nand_spl/board/freescale/mpc8569mds/Makefile @@ -30,9 +30,7 @@ OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))  __OBJS	:= $(SOBJS) $(COBJS)  LNDIR	:= $(nandobj)board/$(BOARDDIR) -ALL	= $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin - -all:	$(obj).depend $(ALL) +all: $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin  $(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl  	$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@ @@ -42,8 +40,7 @@ $(nandobj)u-boot-spl.bin:	$(nandobj)u-boot-spl  $(nandobj)u-boot-spl:	$(OBJS) $(nandobj)u-boot-nand_spl.lds  	cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \ -		-Map $(nandobj)u-boot-spl.map \ -		-o $(nandobj)u-boot-spl +		-Map $(nandobj)u-boot-spl.map -o $@  $(nandobj)u-boot-nand_spl.lds: $(LDSCRIPT)  	$(CPP) $(CPPFLAGS) $(LDPPFLAGS) -I$(nandobj)/board/$(BOARDDIR) \ @@ -52,58 +49,57 @@ $(nandobj)u-boot-nand_spl.lds: $(LDSCRIPT)  # create symbolic links for common files  $(obj)cache.c: -	@rm -f $(obj)cache.c -	ln -sf $(SRCTREE)/arch/powerpc/lib/cache.c $(obj)cache.c +	@rm -f $@ +	ln -sf $(SRCTREE)/arch/powerpc/lib/cache.c $@  $(obj)cpu_init_early.c: -	@rm -f $(obj)cpu_init_early.c -	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/cpu_init_early.c $(obj)cpu_init_early.c +	@rm -f $@ +	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/cpu_init_early.c $@  $(obj)spl_minimal.c: -	@rm -f $(obj)spl_minimal.c -	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/spl_minimal.c $(obj)spl_minimal.c +	@rm -f $@ +	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/spl_minimal.c $@  $(obj)fsl_law.c: -	@rm -f $(obj)fsl_law.c -	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc8xxx/law.c $(obj)fsl_law.c +	@rm -f $@ +	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc8xxx/law.c $@  $(obj)law.c: -	@rm -f $(obj)law.c -	ln -sf $(SRCTREE)/board/$(BOARDDIR)/law.c $(obj)law.c +	@rm -f $@ +	ln -sf $(SRCTREE)/board/$(BOARDDIR)/law.c $@  $(obj)nand_boot_fsl_elbc.c: -	@rm -f $(obj)nand_boot_fsl_elbc.c -	ln -sf $(SRCTREE)/nand_spl/nand_boot_fsl_elbc.c \ -	       $(obj)nand_boot_fsl_elbc.c +	@rm -f $@ +	ln -sf $(SRCTREE)/nand_spl/nand_boot_fsl_elbc.c $@  $(obj)ns16550.c: -	@rm -f $(obj)ns16550.c -	ln -sf $(SRCTREE)/drivers/serial/ns16550.c $(obj)ns16550.c +	@rm -f $@ +	ln -sf $(SRCTREE)/drivers/serial/ns16550.c $@  $(obj)resetvec.S: -	@rm -f $(obj)resetvec.S -	ln -s $(SRCTREE)/$(CPUDIR)/resetvec.S $(obj)resetvec.S +	@rm -f $@ +	ln -s $(SRCTREE)/$(CPUDIR)/resetvec.S $@  $(obj)fixed_ivor.S: -	@rm -f $(obj)fixed_ivor.S -	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/fixed_ivor.S $(obj)fixed_ivor.S +	@rm -f $@ +	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/fixed_ivor.S $@  $(obj)start.S: $(obj)fixed_ivor.S -	@rm -f $(obj)start.S -	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/start.S $(obj)start.S +	@rm -f $@ +	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/start.S $@  $(obj)tlb.c: -	@rm -f $(obj)tlb.c -	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/tlb.c $(obj)tlb.c +	@rm -f $@ +	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/tlb.c $@  $(obj)tlb_table.c: -	@rm -f $(obj)tlb_table.c -	ln -sf $(SRCTREE)/board/$(BOARDDIR)/tlb.c $(obj)tlb_table.c +	@rm -f $@ +	ln -sf $(SRCTREE)/board/$(BOARDDIR)/tlb.c $@  ifneq ($(OBJTREE), $(SRCTREE))  $(obj)nand_boot.c: -	@rm -f $(obj)nand_boot.c -	ln -s $(SRCTREE)/nand_spl/board/$(BOARDDIR)/nand_boot.c $(obj)nand_boot.c +	@rm -f $@ +	ln -s $(SRCTREE)/nand_spl/board/$(BOARDDIR)/nand_boot.c $@  endif  ######################################################################### diff --git a/nand_spl/board/freescale/mpc8572ds/Makefile b/nand_spl/board/freescale/mpc8572ds/Makefile index d3dac2074..62330815c 100644 --- a/nand_spl/board/freescale/mpc8572ds/Makefile +++ b/nand_spl/board/freescale/mpc8572ds/Makefile @@ -30,9 +30,7 @@ OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))  __OBJS	:= $(SOBJS) $(COBJS)  LNDIR	:= $(nandobj)board/$(BOARDDIR) -ALL	= $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin - -all:	$(obj).depend $(ALL) +all: $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin  $(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl  	$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@ @@ -42,8 +40,7 @@ $(nandobj)u-boot-spl.bin:	$(nandobj)u-boot-spl  $(nandobj)u-boot-spl:	$(OBJS) $(nandobj)u-boot-nand_spl.lds  	cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \ -		-Map $(nandobj)u-boot-spl.map \ -		-o $(nandobj)u-boot-spl +		-Map $(nandobj)u-boot-spl.map -o $@  $(nandobj)u-boot-nand_spl.lds: $(LDSCRIPT)  	$(CPP) $(CPPFLAGS) $(LDPPFLAGS) -I$(nandobj)/board/$(BOARDDIR) \ @@ -52,58 +49,57 @@ $(nandobj)u-boot-nand_spl.lds: $(LDSCRIPT)  # create symbolic links for common files  $(obj)cache.c: -	@rm -f $(obj)cache.c -	ln -sf $(SRCTREE)/arch/powerpc/lib/cache.c $(obj)cache.c +	@rm -f $@ +	ln -sf $(SRCTREE)/arch/powerpc/lib/cache.c $@  $(obj)cpu_init_early.c: -	@rm -f $(obj)cpu_init_early.c -	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/cpu_init_early.c $(obj)cpu_init_early.c +	@rm -f $@ +	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/cpu_init_early.c $@  $(obj)spl_minimal.c: -	@rm -f $(obj)spl_minimal.c -	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/spl_minimal.c $(obj)spl_minimal.c +	@rm -f $@ +	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/spl_minimal.c $@  $(obj)fsl_law.c: -	@rm -f $(obj)fsl_law.c -	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc8xxx/law.c $(obj)fsl_law.c +	@rm -f $@ +	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc8xxx/law.c $@  $(obj)law.c: -	@rm -f $(obj)law.c -	ln -sf $(SRCTREE)/board/$(BOARDDIR)/law.c $(obj)law.c +	@rm -f $@ +	ln -sf $(SRCTREE)/board/$(BOARDDIR)/law.c $@  $(obj)nand_boot_fsl_elbc.c: -	@rm -f $(obj)nand_boot_fsl_elbc.c -	ln -sf $(SRCTREE)/nand_spl/nand_boot_fsl_elbc.c \ -	       $(obj)nand_boot_fsl_elbc.c +	@rm -f $@ +	ln -sf $(SRCTREE)/nand_spl/nand_boot_fsl_elbc.c $@  $(obj)ns16550.c: -	@rm -f $(obj)ns16550.c -	ln -sf $(SRCTREE)/drivers/serial/ns16550.c $(obj)ns16550.c +	@rm -f $@ +	ln -sf $(SRCTREE)/drivers/serial/ns16550.c $@  $(obj)resetvec.S: -	@rm -f $(obj)resetvec.S -	ln -s $(SRCTREE)/$(CPUDIR)/resetvec.S $(obj)resetvec.S +	@rm -f $@ +	ln -s $(SRCTREE)/$(CPUDIR)/resetvec.S $@  $(obj)fixed_ivor.S: -	@rm -f $(obj)fixed_ivor.S -	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/fixed_ivor.S $(obj)fixed_ivor.S +	@rm -f $@ +	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/fixed_ivor.S $@  $(obj)start.S: $(obj)fixed_ivor.S -	@rm -f $(obj)start.S -	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/start.S $(obj)start.S +	@rm -f $@ +	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/start.S $@  $(obj)tlb.c: -	@rm -f $(obj)tlb.c -	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/tlb.c $(obj)tlb.c +	@rm -f $@ +	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/tlb.c $@  $(obj)tlb_table.c: -	@rm -f $(obj)tlb_table.c -	ln -sf $(SRCTREE)/board/$(BOARDDIR)/tlb.c $(obj)tlb_table.c +	@rm -f $@ +	ln -sf $(SRCTREE)/board/$(BOARDDIR)/tlb.c $@  ifneq ($(OBJTREE), $(SRCTREE))  $(obj)nand_boot.c: -	@rm -f $(obj)nand_boot.c -	ln -s $(SRCTREE)/nand_spl/board/$(BOARDDIR)/nand_boot.c $(obj)nand_boot.c +	@rm -f $@ +	ln -s $(SRCTREE)/nand_spl/board/$(BOARDDIR)/nand_boot.c $@  endif  ######################################################################### diff --git a/nand_spl/board/freescale/p1023rds/Makefile b/nand_spl/board/freescale/p1023rds/Makefile index e89d4054a..dbdfa1989 100644 --- a/nand_spl/board/freescale/p1023rds/Makefile +++ b/nand_spl/board/freescale/p1023rds/Makefile @@ -25,9 +25,7 @@ OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))  __OBJS	:= $(SOBJS) $(COBJS)  LNDIR	:= $(nandobj)board/$(BOARDDIR) -ALL	= $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin - -all:	$(obj).depend $(ALL) +all: $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin  $(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl  	$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@ @@ -37,8 +35,7 @@ $(nandobj)u-boot-spl.bin:	$(nandobj)u-boot-spl  $(nandobj)u-boot-spl:	$(OBJS) $(nandobj)u-boot-nand_spl.lds  	cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \ -		-Map $(nandobj)u-boot-spl.map \ -		-o $(nandobj)u-boot-spl +		-Map $(nandobj)u-boot-spl.map -o $@  $(nandobj)u-boot-nand_spl.lds: $(LDSCRIPT)  	$(CPP) $(CPPFLAGS) $(LDPPFLAGS) -I$(nandobj)/board/$(BOARDDIR) \ @@ -47,58 +44,57 @@ $(nandobj)u-boot-nand_spl.lds: $(LDSCRIPT)  # create symbolic links for common files  $(obj)cache.c: -	@rm -f $(obj)cache.c -	ln -sf $(SRCTREE)/arch/powerpc/lib/cache.c $(obj)cache.c +	@rm -f $@ +	ln -sf $(SRCTREE)/arch/powerpc/lib/cache.c $@  $(obj)cpu_init_early.c: -	@rm -f $(obj)cpu_init_early.c -	ln -sf $(SRCTREE)/$(CPUDIR)/cpu_init_early.c $(obj)cpu_init_early.c +	@rm -f $@ +	ln -sf $(SRCTREE)/$(CPUDIR)/cpu_init_early.c $@  $(obj)spl_minimal.c: -	@rm -f $(obj)spl_minimal.c -	ln -sf $(SRCTREE)/$(CPUDIR)/spl_minimal.c $(obj)spl_minimal.c +	@rm -f $@ +	ln -sf $(SRCTREE)/$(CPUDIR)/spl_minimal.c $@  $(obj)fsl_law.c: -	@rm -f $(obj)fsl_law.c -	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc8xxx/law.c $(obj)fsl_law.c +	@rm -f $@ +	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc8xxx/law.c $@  $(obj)law.c: -	@rm -f $(obj)law.c -	ln -sf $(SRCTREE)/board/$(BOARDDIR)/law.c $(obj)law.c +	@rm -f $@ +	ln -sf $(SRCTREE)/board/$(BOARDDIR)/law.c $@  $(obj)nand_boot_fsl_elbc.c: -	@rm -f $(obj)nand_boot_fsl_elbc.c -	ln -sf $(SRCTREE)/nand_spl/nand_boot_fsl_elbc.c \ -	       $(obj)nand_boot_fsl_elbc.c +	@rm -f $@ +	ln -sf $(SRCTREE)/nand_spl/nand_boot_fsl_elbc.c $@  $(obj)ns16550.c: -	@rm -f $(obj)ns16550.c -	ln -sf $(SRCTREE)/drivers/serial/ns16550.c $(obj)ns16550.c +	@rm -f $@ +	ln -sf $(SRCTREE)/drivers/serial/ns16550.c $@  $(obj)resetvec.S: -	@rm -f $(obj)resetvec.S -	ln -s $(SRCTREE)/$(CPUDIR)/resetvec.S $(obj)resetvec.S +	@rm -f $@ +	ln -s $(SRCTREE)/$(CPUDIR)/resetvec.S $@  $(obj)fixed_ivor.S: -	@rm -f $(obj)fixed_ivor.S -	ln -sf $(SRCTREE)/$(CPUDIR)/fixed_ivor.S $(obj)fixed_ivor.S +	@rm -f $@ +	ln -sf $(SRCTREE)/$(CPUDIR)/fixed_ivor.S $@  $(obj)start.S: $(obj)fixed_ivor.S -	@rm -f $(obj)start.S -	ln -sf $(SRCTREE)/$(CPUDIR)/start.S $(obj)start.S +	@rm -f $@ +	ln -sf $(SRCTREE)/$(CPUDIR)/start.S $@  $(obj)tlb.c: -	@rm -f $(obj)tlb.c -	ln -sf $(SRCTREE)/$(CPUDIR)/tlb.c $(obj)tlb.c +	@rm -f $@ +	ln -sf $(SRCTREE)/$(CPUDIR)/tlb.c $@  $(obj)tlb_table.c: -	@rm -f $(obj)tlb_table.c -	ln -sf $(SRCTREE)/board/$(BOARDDIR)/tlb.c $(obj)tlb_table.c +	@rm -f $@ +	ln -sf $(SRCTREE)/board/$(BOARDDIR)/tlb.c $@  ifneq ($(OBJTREE), $(SRCTREE))  $(obj)nand_boot.c: -	@rm -f $(obj)nand_boot.c -	ln -s $(SRCTREE)/nand_spl/board/$(BOARDDIR)/nand_boot.c $(obj)nand_boot.c +	@rm -f $@ +	ln -s $(SRCTREE)/nand_spl/board/$(BOARDDIR)/nand_boot.c $@  endif  ######################################################################### diff --git a/nand_spl/board/freescale/p1_p2_rdb/Makefile b/nand_spl/board/freescale/p1_p2_rdb/Makefile index d3dac2074..62330815c 100644 --- a/nand_spl/board/freescale/p1_p2_rdb/Makefile +++ b/nand_spl/board/freescale/p1_p2_rdb/Makefile @@ -30,9 +30,7 @@ OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))  __OBJS	:= $(SOBJS) $(COBJS)  LNDIR	:= $(nandobj)board/$(BOARDDIR) -ALL	= $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin - -all:	$(obj).depend $(ALL) +all: $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin  $(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl  	$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@ @@ -42,8 +40,7 @@ $(nandobj)u-boot-spl.bin:	$(nandobj)u-boot-spl  $(nandobj)u-boot-spl:	$(OBJS) $(nandobj)u-boot-nand_spl.lds  	cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \ -		-Map $(nandobj)u-boot-spl.map \ -		-o $(nandobj)u-boot-spl +		-Map $(nandobj)u-boot-spl.map -o $@  $(nandobj)u-boot-nand_spl.lds: $(LDSCRIPT)  	$(CPP) $(CPPFLAGS) $(LDPPFLAGS) -I$(nandobj)/board/$(BOARDDIR) \ @@ -52,58 +49,57 @@ $(nandobj)u-boot-nand_spl.lds: $(LDSCRIPT)  # create symbolic links for common files  $(obj)cache.c: -	@rm -f $(obj)cache.c -	ln -sf $(SRCTREE)/arch/powerpc/lib/cache.c $(obj)cache.c +	@rm -f $@ +	ln -sf $(SRCTREE)/arch/powerpc/lib/cache.c $@  $(obj)cpu_init_early.c: -	@rm -f $(obj)cpu_init_early.c -	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/cpu_init_early.c $(obj)cpu_init_early.c +	@rm -f $@ +	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/cpu_init_early.c $@  $(obj)spl_minimal.c: -	@rm -f $(obj)spl_minimal.c -	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/spl_minimal.c $(obj)spl_minimal.c +	@rm -f $@ +	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/spl_minimal.c $@  $(obj)fsl_law.c: -	@rm -f $(obj)fsl_law.c -	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc8xxx/law.c $(obj)fsl_law.c +	@rm -f $@ +	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc8xxx/law.c $@  $(obj)law.c: -	@rm -f $(obj)law.c -	ln -sf $(SRCTREE)/board/$(BOARDDIR)/law.c $(obj)law.c +	@rm -f $@ +	ln -sf $(SRCTREE)/board/$(BOARDDIR)/law.c $@  $(obj)nand_boot_fsl_elbc.c: -	@rm -f $(obj)nand_boot_fsl_elbc.c -	ln -sf $(SRCTREE)/nand_spl/nand_boot_fsl_elbc.c \ -	       $(obj)nand_boot_fsl_elbc.c +	@rm -f $@ +	ln -sf $(SRCTREE)/nand_spl/nand_boot_fsl_elbc.c $@  $(obj)ns16550.c: -	@rm -f $(obj)ns16550.c -	ln -sf $(SRCTREE)/drivers/serial/ns16550.c $(obj)ns16550.c +	@rm -f $@ +	ln -sf $(SRCTREE)/drivers/serial/ns16550.c $@  $(obj)resetvec.S: -	@rm -f $(obj)resetvec.S -	ln -s $(SRCTREE)/$(CPUDIR)/resetvec.S $(obj)resetvec.S +	@rm -f $@ +	ln -s $(SRCTREE)/$(CPUDIR)/resetvec.S $@  $(obj)fixed_ivor.S: -	@rm -f $(obj)fixed_ivor.S -	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/fixed_ivor.S $(obj)fixed_ivor.S +	@rm -f $@ +	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/fixed_ivor.S $@  $(obj)start.S: $(obj)fixed_ivor.S -	@rm -f $(obj)start.S -	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/start.S $(obj)start.S +	@rm -f $@ +	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/start.S $@  $(obj)tlb.c: -	@rm -f $(obj)tlb.c -	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/tlb.c $(obj)tlb.c +	@rm -f $@ +	ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/tlb.c $@  $(obj)tlb_table.c: -	@rm -f $(obj)tlb_table.c -	ln -sf $(SRCTREE)/board/$(BOARDDIR)/tlb.c $(obj)tlb_table.c +	@rm -f $@ +	ln -sf $(SRCTREE)/board/$(BOARDDIR)/tlb.c $@  ifneq ($(OBJTREE), $(SRCTREE))  $(obj)nand_boot.c: -	@rm -f $(obj)nand_boot.c -	ln -s $(SRCTREE)/nand_spl/board/$(BOARDDIR)/nand_boot.c $(obj)nand_boot.c +	@rm -f $@ +	ln -s $(SRCTREE)/nand_spl/board/$(BOARDDIR)/nand_boot.c $@  endif  ######################################################################### diff --git a/nand_spl/board/sheldon/simpc8313/Makefile b/nand_spl/board/sheldon/simpc8313/Makefile index 08739edc4..90f132c34 100644 --- a/nand_spl/board/sheldon/simpc8313/Makefile +++ b/nand_spl/board/sheldon/simpc8313/Makefile @@ -28,9 +28,7 @@ OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))  __OBJS	:= $(SOBJS) $(COBJS)  LNDIR	:= $(nandobj)board/$(BOARDDIR) -ALL	= $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin - -all:	$(obj).depend $(ALL) +all: $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin  $(nandobj)u-boot-spl-16k.bin:	$(nandobj)u-boot-spl  	$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@ @@ -40,8 +38,7 @@ $(nandobj)u-boot-spl.bin:	$(nandobj)u-boot-spl  $(nandobj)u-boot-spl:	$(OBJS) $(nandobj)u-boot.lds  	cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \ -		-Map $(nandobj)u-boot-spl.map \ -		-o $(nandobj)u-boot-spl +		-Map $(nandobj)u-boot-spl.map -o $@  $(nandobj)u-boot.lds: $(LDSCRIPT)  	$(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@ diff --git a/net/tftp.c b/net/tftp.c index 6d333d559..966d1cfba 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -281,7 +281,7 @@ static void update_block_number(void)  	 * number of 0 this means that there was a wrap  	 * around of the (16 bit) counter.  	 */ -	if (TftpBlock == 0) { +	if (TftpBlock == 0 && TftpLastBlock != 0) {  		TftpBlockWrap++;  		TftpBlockWrapOffset += TftpBlkSize * TFTP_SEQUENCE_SIZE;  		TftpTimeoutCount = 0; /* we've done well, reset thhe timeout */ @@ -849,6 +849,9 @@ TftpStartServer(void)  	TftpState = STATE_RECV_WRQ;  	net_set_udp_handler(TftpHandler); + +	/* zero out server ether in case the server ip has changed */ +	memset(NetServerEther, 0, 6);  }  #endif /* CONFIG_CMD_TFTPSRV */ diff --git a/post/board/lwmon/Makefile b/post/board/lwmon/Makefile index 1ac7aa511..b23debcab 100644 --- a/post/board/lwmon/Makefile +++ b/post/board/lwmon/Makefile @@ -5,6 +5,4 @@  # SPDX-License-Identifier:	GPL-2.0+  # -CPPFLAGS += -I$(TOPDIR) -  obj-$(CONFIG_HAS_POST)	+= sysmon.o diff --git a/post/board/lwmon5/Makefile b/post/board/lwmon5/Makefile index d8b195289..a50ce67cd 100644 --- a/post/board/lwmon5/Makefile +++ b/post/board/lwmon5/Makefile @@ -5,6 +5,4 @@  #  # SPDX-License-Identifier:	GPL-2.0+ -CPPFLAGS += -I$(TOPDIR) -  obj-$(CONFIG_HAS_POST)	+= sysmon.o watchdog.o dspic.o fpga.o dsp.o gdc.o diff --git a/post/board/netta/Makefile b/post/board/netta/Makefile index cd27a5ce3..5c37f497c 100644 --- a/post/board/netta/Makefile +++ b/post/board/netta/Makefile @@ -5,6 +5,4 @@  # SPDX-License-Identifier:	GPL-2.0+  # -CPPFLAGS += -I$(TOPDIR) -  obj-$(CONFIG_HAS_POST)	+= codec.o dsp.o diff --git a/post/board/pdm360ng/Makefile b/post/board/pdm360ng/Makefile index 3f748892a..b43b77b2d 100644 --- a/post/board/pdm360ng/Makefile +++ b/post/board/pdm360ng/Makefile @@ -5,6 +5,4 @@  # SPDX-License-Identifier:	GPL-2.0+  # -CPPFLAGS += -I$(TOPDIR) -  obj-$(CONFIG_HAS_POST)	+= coproc_com.o diff --git a/post/cpu/mpc83xx/Makefile b/post/cpu/mpc83xx/Makefile index 0643d01a7..4b3c50e6a 100644 --- a/post/cpu/mpc83xx/Makefile +++ b/post/cpu/mpc83xx/Makefile @@ -5,6 +5,4 @@  # SPDX-License-Identifier:	GPL-2.0+  # -CPPFLAGS += -I$(TOPDIR) -  obj-$(CONFIG_HAS_POST)	+= ecc.o diff --git a/post/cpu/mpc8xx/Makefile b/post/cpu/mpc8xx/Makefile index 7a2930a79..f8bb6c934 100644 --- a/post/cpu/mpc8xx/Makefile +++ b/post/cpu/mpc8xx/Makefile @@ -5,7 +5,5 @@  # SPDX-License-Identifier:	GPL-2.0+  # -CPPFLAGS += -I$(TOPDIR) -  obj-$(CONFIG_HAS_POST)	+= cache_8xx.o  obj-$(CONFIG_HAS_POST)	+= cache.o ether.o spr.o uart.o usb.o watchdog.o diff --git a/post/cpu/ppc4xx/Makefile b/post/cpu/ppc4xx/Makefile index b7435c825..ed3e8e87f 100644 --- a/post/cpu/ppc4xx/Makefile +++ b/post/cpu/ppc4xx/Makefile @@ -5,8 +5,6 @@  # SPDX-License-Identifier:	GPL-2.0+  # -CPPFLAGS += -I$(TOPDIR) -  obj-$(CONFIG_HAS_POST)	+= cache_4xx.o  obj-$(CONFIG_HAS_POST)	+= cache.o  obj-$(CONFIG_HAS_POST)	+= denali_ecc.o diff --git a/post/drivers/Makefile b/post/drivers/Makefile index 2f6844cca..328f880b1 100644 --- a/post/drivers/Makefile +++ b/post/drivers/Makefile @@ -5,6 +5,4 @@  # SPDX-License-Identifier:	GPL-2.0+  # -CPPFLAGS += -I$(TOPDIR) -  obj-$(CONFIG_HAS_POST)	+= flash.o i2c.o memory.o rtc.o diff --git a/post/lib_powerpc/Makefile b/post/lib_powerpc/Makefile index f19fea3e5..d2b8a940d 100644 --- a/post/lib_powerpc/Makefile +++ b/post/lib_powerpc/Makefile @@ -5,8 +5,6 @@  # SPDX-License-Identifier:	GPL-2.0+  # -CPPFLAGS += -I$(TOPDIR) -  obj-$(CONFIG_HAS_POST) += asm.o  obj-$(CONFIG_HAS_POST) += cpu.o cmp.o cmpi.o two.o twox.o three.o threex.o  obj-$(CONFIG_HAS_POST) += threei.o andi.o srawi.o rlwnm.o rlwinm.o rlwimi.o diff --git a/post/lib_powerpc/fpu/Makefile b/post/lib_powerpc/fpu/Makefile index 6aec96c02..ee01a313f 100644 --- a/post/lib_powerpc/fpu/Makefile +++ b/post/lib_powerpc/fpu/Makefile @@ -5,8 +5,6 @@  # SPDX-License-Identifier:	GPL-2.0+  # -CPPFLAGS += -I$(TOPDIR) -  obj-$(CONFIG_HAS_POST)	+= 20001122-1.o  obj-$(CONFIG_HAS_POST)	+= 20010114-2.o  obj-$(CONFIG_HAS_POST)	+= 20010226-1.o diff --git a/tools/buildman/README b/tools/buildman/README index 090b65311..c30c1d411 100644 --- a/tools/buildman/README +++ b/tools/buildman/README @@ -89,10 +89,16 @@ a few commits or boards, it will be pretty slow. As a tip, if you don't  plan to use your machine for anything else, you can use -T to increase the  number of threads beyond the default. -Buildman lets you build all boards, or a subset. Specify the subset using -the board name, architecture name, SOC name, or anything else in the -boards.cfg file. So 'at91' will build all AT91 boards (arm), powerpc will -build all PowerPC boards. +Buildman lets you build all boards, or a subset. Specify the subset by passing +command-line arguments that list the desired board name, architecture name, +SOC name, or anything else in the boards.cfg file. Multiple arguments are +allowed. Each argument will be interpreted as a regular expression, so +behaviour is a superset of exact or substring matching. Examples are: + +* 'tegra20'      All boards with a Tegra20 SoC +* 'tegra'        All boards with any Tegra Soc (Tegra20, Tegra30, Tegra114...) +* '^tegra[23]0$' All boards with either Tegra20 or Tegra30 SoC +* 'powerpc'      All PowerPC boards  Buildman does not store intermediate object files. It optionally copies  the binary output into a directory when a build is successful. Size @@ -643,7 +649,7 @@ snapper9260=${at91-boards} BUILD_TAG=442  snapper9g45=${at91-boards} BUILD_TAG=443  This will use 'make ENABLE_AT91_TEST=1 BUILD_TAG=442' for snapper9260 -and 'make ENABLE_AT91_TEST=1 BUILD_TAG=442' for snapper9g45. A special +and 'make ENABLE_AT91_TEST=1 BUILD_TAG=443' for snapper9g45. A special  variable ${target} is available to access the target name (snapper9260 and  snapper9g20 in this case). Variables are resolved recursively. diff --git a/tools/buildman/board.py b/tools/buildman/board.py index 1d3db206b..5172a473e 100644 --- a/tools/buildman/board.py +++ b/tools/buildman/board.py @@ -3,6 +3,8 @@  # SPDX-License-Identifier:	GPL-2.0+  # +import re +  class Board:      """A particular board that we can build"""      def __init__(self, status, arch, cpu, soc, vendor, board_name, target, options): @@ -135,14 +137,22 @@ class Boards:              due to each argument, arranged by argument.          """          result = {} +        argres = {}          for arg in args:              result[arg] = 0 +            argres[arg] = re.compile(arg)          result['all'] = 0          for board in self._boards:              if args:                  for arg in args: -                    if arg in board.props: +                    argre = argres[arg] +                    match = False +                    for prop in board.props: +                        match = argre.match(prop) +                        if match: +                            break +                    if match:                          if not board.build_it:                              board.build_it = True                              result[arg] += 1 diff --git a/tools/imls/Makefile b/tools/imls/Makefile deleted file mode 100644 index b045df2df..000000000 --- a/tools/imls/Makefile +++ /dev/null @@ -1,84 +0,0 @@ -# -# (C) Copyright 2009 Marco Stornelli <marco.stornelli@gmail.com> -# -# SPDX-License-Identifier:	GPL-2.0+ -# - -include $(TOPDIR)/config.mk - -# Generated executable files -BIN_FILES-y += imls - -# Source files which exist outside the tools/imls directory -EXT_OBJ_FILES-y += lib/crc32.o -EXT_OBJ_FILES-y += lib/md5.o -EXT_OBJ_FILES-y += lib/sha1.o -EXT_OBJ_FILES-y += common/image.o - -# Source files located in the tools/imls directory -OBJ_FILES-y += imls.o - -# Flattened device tree objects -LIBFDT_OBJ_FILES-y += fdt.o -LIBFDT_OBJ_FILES-y += fdt_ro.o -LIBFDT_OBJ_FILES-y += fdt_rw.o -LIBFDT_OBJ_FILES-y += fdt_strerror.o -LIBFDT_OBJ_FILES-y += fdt_wip.o - -# now $(obj) is defined -SRCS	+= $(addprefix $(SRCTREE)/,$(EXT_OBJ_FILES-y:.o=.c)) -SRCS	+= $(addprefix $(SRCTREE)/tools/,$(OBJ_FILES-y:.o=.c)) -SRCS	+= $(addprefix $(SRCTREE)/lib/libfdt/,$(LIBFDT_OBJ_FILES-y:.o=.c)) -BINS	:= $(addprefix $(obj),$(sort $(BIN_FILES-y))) -LIBFDT_OBJS	:= $(addprefix $(obj),$(LIBFDT_OBJ_FILES-y)) - -# -# Compile for a hosted environment on the target -# Define __KERNEL_STRICT_NAMES to prevent typedef overlaps -# -HOSTCPPFLAGS  = -idirafter $(SRCTREE)/include \ -		-idirafter $(SRCTREE)/arch/$(ARCH)/include \ -		-idirafter $(OBJTREE)/include \ -		-I $(SRCTREE)/lib/libfdt \ -		-I $(SRCTREE)/tools \ -		-DUSE_HOSTCC -D__KERNEL_STRICT_NAMES - -ifeq ($(MTD_VERSION),old) -HOSTCPPFLAGS += -DMTD_OLD -endif - -all:	$(BINS) - -$(obj)imls:	$(obj)imls.o $(obj)crc32.o $(obj)image.o $(obj)md5.o \ -		$(obj)sha1.o $(LIBFDT_OBJS) -	$(CC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^ -	$(STRIP) $@ - -# Some files complain if compiled with -pedantic, use HOSTCFLAGS_NOPED -$(obj)image.o: $(SRCTREE)/common/image.c -	$(CC) -g $(HOSTCFLAGS_NOPED) -c -o $@ $< - -$(obj)imls.o: $(SRCTREE)/tools/imls/imls.c -	$(CC) -g $(HOSTCFLAGS_NOPED) -c -o $@ $< - -# Some of the tool objects need to be accessed from outside the tools/imls directory -$(obj)%.o: $(SRCTREE)/common/%.c -	$(CC) -g $(HOSTCFLAGS_NOPED) -c -o $@ $< - -$(obj)%.o: $(SRCTREE)/lib/%.c -	$(CC) -g $(HOSTCFLAGS) -c -o $@ $< - -$(obj)%.o: $(SRCTREE)/lib/libfdt/%.c -	$(CC) -g $(HOSTCFLAGS_NOPED) -c -o $@ $< - -clean: -	rm -rf *.o imls - -######################################################################### - -# defines $(obj).depend target -include $(SRCTREE)/rules.mk - -sinclude $(obj).depend - -######################################################################### diff --git a/tools/imls/README b/tools/imls/README deleted file mode 100644 index 9adf92305..000000000 --- a/tools/imls/README +++ /dev/null @@ -1,41 +0,0 @@ -# -# (C) Copyright 2009 Marco Stornelli <marco.stornelli@gmail.com> -# -# SPDX-License-Identifier:	GPL-2.0+ -# - -IMLS -------------- - -imls is an implementation of a Linux command line tool to access -to raw flash partitions and list images made with mkimage command. - -For building against older versions of the MTD headers (meaning before -v2.6.8-rc1) it is required to pass the argument "MTD_VERSION=old" to -make. - -Usage examples --------------- - -1) Flash with sectors of 128KiB and 32 sectors: - -> imls -c 32 -s 131072 /dev/mtd0 -Searching... -Image Name:   foo -Created:      Fri Apr 10 18:11:30 2009 -Image Type:   Intel x86 Linux Standalone Program (uncompressed) -Data Size:    10716 Bytes = 10.46 kB = 0.01 MB -Load Address: 00000000 -Entry Point:  00000000 - -2) Flash with sectors of 64KiB and 128 sectors and with a search offset of one -sector: - -> imls -o 1 -c 128 -s 65536 /dev/mtd0 -Searching... -Image Name:   foo -Created:      Fri Apr 10 18:11:30 2009 -Image Type:   Intel x86 Linux Standalone Program (uncompressed) -Data Size:    10716 Bytes = 10.46 kB = 0.01 MB -Load Address: 00000000 -Entry Point:  00000000 diff --git a/tools/imls/imls.c b/tools/imls/imls.c deleted file mode 100644 index 95043b450..000000000 --- a/tools/imls/imls.c +++ /dev/null @@ -1,256 +0,0 @@ -/* - * (C) Copyright 2009 Marco Stornelli - * - * SPDX-License-Identifier:	GPL-2.0+ - */ - -#include <errno.h> -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <stddef.h> -#include <string.h> -#include <sys/types.h> -#include <sys/ioctl.h> -#include <sys/stat.h> -#include <unistd.h> -#include <asm/page.h> - -#ifdef MTD_OLD -#include <stdint.h> -#include <linux/mtd/mtd.h> -#else -#define  __user	/* nothing */ -#include <mtd/mtd-user.h> -#endif - -#include <sha1.h> -#include <libfdt.h> -#include <fdt_support.h> -#include <image.h> - -#define MIN(a, b) (((a) < (b)) ? (a) : (b)) - -extern unsigned long crc32(unsigned long crc, const char *buf, unsigned int len); -static void usage(void); -static int image_verify_header(char *ptr, int fd); -static int flash_bad_block(int fd, uint8_t mtd_type, loff_t start); - -char	*cmdname; -char	*devicefile; - -unsigned int sectorcount = 0; -int sflag = 0; -unsigned int sectoroffset = 0; -unsigned int sectorsize = 0; -int cflag = 0; - -int main (int argc, char **argv) -{ -	int fd = -1, err = 0, readbyte = 0, j; -	struct mtd_info_user mtdinfo; -	char buf[sizeof(image_header_t)]; -	int found = 0; - -	cmdname = *argv; - -	while (--argc > 0 && **++argv == '-') { -		while (*++*argv) { -			switch (**argv) { -			case 'c': -				if (--argc <= 0) -					usage (); -				sectorcount = (unsigned int)atoi(*++argv); -				cflag = 1; -				goto NXTARG; -			case 'o': -				if (--argc <= 0) -					usage (); -				sectoroffset = (unsigned int)atoi(*++argv); -				goto NXTARG; - -			case 's': -				if (--argc <= 0) -					usage (); -				sectorsize = (unsigned int)atoi(*++argv); -				sflag = 1; -				goto NXTARG; -			default: -				usage (); -			} -		} -NXTARG:		; -	} - -	if (argc != 1 || cflag == 0 || sflag == 0) -		usage(); - -	devicefile = *argv; - -	fd = open(devicefile, O_RDONLY); -	if (fd < 0) { -		fprintf (stderr, "%s: Can't open %s: %s\n", -			 cmdname, devicefile, strerror(errno)); -		exit(EXIT_FAILURE); -	} - -	err = ioctl(fd, MEMGETINFO, &mtdinfo); -	if (err < 0) { -		fprintf(stderr, "%s: Cannot get MTD information: %s\n",cmdname, -			strerror(errno)); -		exit(EXIT_FAILURE); -	} - -	if (mtdinfo.type != MTD_NORFLASH && mtdinfo.type != MTD_NANDFLASH) { -		fprintf(stderr, "%s: Unsupported flash type %u\n", -			cmdname, mtdinfo.type); -		exit(EXIT_FAILURE); -	} - -	if (sectorsize * sectorcount != mtdinfo.size) { -		fprintf(stderr, "%s: Partition size (%d) incompatible with " -			"sector size and count\n", cmdname, mtdinfo.size); -		exit(EXIT_FAILURE); -	} - -	if (sectorsize * sectoroffset >= mtdinfo.size) { -		fprintf(stderr, "%s: Partition size (%d) incompatible with " -			"sector offset given\n", cmdname, mtdinfo.size); -		exit(EXIT_FAILURE); -	} - -	if (sectoroffset > sectorcount - 1) { -		fprintf(stderr, "%s: Sector offset cannot be grater than " -			"sector count minus one\n", cmdname); -		exit(EXIT_FAILURE); -	} - -	printf("Searching....\n"); - -	for (j = sectoroffset; j < sectorcount; ++j) { - -		if (lseek(fd, j*sectorsize, SEEK_SET) != j*sectorsize) { -			fprintf(stderr, "%s: lseek failure: %s\n", -			cmdname, strerror(errno)); -			exit(EXIT_FAILURE); -		} - -		err = flash_bad_block(fd, mtdinfo.type, j*sectorsize); -		if (err < 0) -			exit(EXIT_FAILURE); -		if (err) -			continue; /* Skip and jump to next */ - -		readbyte = read(fd, buf, sizeof(image_header_t)); -		if (readbyte != sizeof(image_header_t)) { -			fprintf(stderr, "%s: Can't read from device: %s\n", -			cmdname, strerror(errno)); -			exit(EXIT_FAILURE); -		} - -		if (fdt_check_header(buf)) { -			/* old-style image */ -			if (image_verify_header(buf, fd)) { -				found = 1; -				image_print_contents((image_header_t *)buf); -			} -		} else { -			/* FIT image */ -			fit_print_contents(buf); -		} - -	} - -	close(fd); - -	if(!found) -		printf("No images found\n"); - -	exit(EXIT_SUCCESS); -} - -void usage() -{ -	fprintf (stderr, "Usage:\n" -			 "       %s [-o offset] -s size -c count device\n" -			 "          -o ==> number of sectors to use as offset\n" -			 "          -c ==> number of sectors\n" -			 "          -s ==> size of sectors (byte)\n", -		cmdname); - -	exit(EXIT_FAILURE); -} - -static int image_verify_header(char *ptr, int fd) -{ -	int len, nread; -	char *data; -	uint32_t checksum; -	image_header_t *hdr = (image_header_t *)ptr; -	char buf[PAGE_SIZE]; - -	if (image_get_magic(hdr) != IH_MAGIC) -		return 0; - -	data = (char *)hdr; -	len  = image_get_header_size(); - -	checksum = image_get_hcrc(hdr); -	hdr->ih_hcrc = htonl(0);	/* clear for re-calculation */ - -	if (crc32(0, data, len) != checksum) { -		fprintf(stderr, -		      "%s: Maybe image found but it has bad header checksum!\n", -		      cmdname); -		return 0; -	} - -	len = image_get_size(hdr); -	checksum = 0; - -	while (len > 0) { -		nread = read(fd, buf, MIN(len,PAGE_SIZE)); -		if (nread != MIN(len,PAGE_SIZE)) { -			fprintf(stderr, -				"%s: Error while reading: %s\n", -				cmdname, strerror(errno)); -			exit(EXIT_FAILURE); -		} -		checksum = crc32(checksum, buf, nread); -		len -= nread; -	} - -	if (checksum != image_get_dcrc(hdr)) { -		fprintf (stderr, -			"%s: Maybe image found but it has corrupted data!\n", -			cmdname); -		return 0; -	} - -	return 1; -} - -/* - * Test for bad block on NAND, just returns 0 on NOR, on NAND: - * 0	- block is good - * > 0	- block is bad - * < 0	- failed to test - */ -static int flash_bad_block(int fd, uint8_t mtd_type, loff_t start) -{ -	if (mtd_type == MTD_NANDFLASH) { -		int badblock = ioctl(fd, MEMGETBADBLOCK, &start); - -		if (badblock < 0) { -			fprintf(stderr,"%s: Cannot read bad block mark: %s\n", -				cmdname, strerror(errno)); -			return badblock; -		} - -		if (badblock) { -			return badblock; -		} -	} - -	return 0; -} diff --git a/tools/patman/README b/tools/patman/README index e6d307062..59f1776f5 100644 --- a/tools/patman/README +++ b/tools/patman/README @@ -180,6 +180,14 @@ END  	together and put after the cover letter. Can appear multiple  	times. +Commit-notes: +blah blah +blah blah +more blah blah +END +	Similar, but for a single commit (patch). These notes will appear +	immediately below the --- cut in the patch file. +   Signed-off-by: Their Name <email>  	A sign-off is added automatically to your patches (this is  	probably a bug). If you put this tag in your patches, it will @@ -227,7 +235,7 @@ TEST=...  Change-Id:  Review URL:  Reviewed-on: - +Commit-xxxx: (except Commit-notes)  Exercise for the reader: Try adding some tags to one of your current  patch series and see how the patches turn out. diff --git a/tools/patman/commit.py b/tools/patman/commit.py index 900cfb3a5..89cce7f88 100644 --- a/tools/patman/commit.py +++ b/tools/patman/commit.py @@ -21,6 +21,7 @@ class Commit:          changes: Dict containing a list of changes (single line strings).              The dict is indexed by change version (an integer)          cc_list: List of people to aliases/emails to cc on this commit +        notes: List of lines in the commit (not series) notes      """      def __init__(self, hash):          self.hash = hash @@ -28,6 +29,7 @@ class Commit:          self.tags = []          self.changes = {}          self.cc_list = [] +        self.notes = []      def AddChange(self, version, info):          """Add a new change line to the change list for a version. diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py index c2045230a..684204c63 100644 --- a/tools/patman/patchstream.py +++ b/tools/patman/patchstream.py @@ -30,7 +30,10 @@ re_cover = re.compile('^Cover-letter:')  re_cover_cc = re.compile('^Cover-letter-cc: *(.*)')  # Patch series tag -re_series = re.compile('^Series-([a-z-]*): *(.*)') +re_series_tag = re.compile('^Series-([a-z-]*): *(.*)') + +# Commit series tag +re_commit_tag = re.compile('^Commit-([a-z-]*): *(.*)')  # Commit tags that we want to collect and keep  re_tag = re.compile('^(Tested-by|Acked-by|Reviewed-by|Cc): (.*)') @@ -90,6 +93,20 @@ class PatchStream:          if self.is_log:              self.series.AddTag(self.commit, line, name, value) +    def AddToCommit(self, line, name, value): +        """Add a new Commit-xxx tag. + +        When a Commit-xxx tag is detected, we come here to record it. + +        Args: +            line: Source line containing tag (useful for debug/error messages) +            name: Tag name (part after 'Commit-') +            value: Tag value (part after 'Commit-xxx: ') +        """ +        if name == 'notes': +            self.in_section = 'commit-' + name +            self.skip_blank = False +      def CloseCommit(self):          """Save the current commit into our commit list, and reset our state"""          if self.commit and self.is_log: @@ -138,7 +155,8 @@ class PatchStream:                  line = line[4:]          # Handle state transition and skipping blank lines -        series_match = re_series.match(line) +        series_tag_match = re_series_tag.match(line) +        commit_tag_match = re_commit_tag.match(line)          commit_match = re_commit.match(line) if self.is_log else None          cover_cc_match = re_cover_cc.match(line)          tag_match = None @@ -165,6 +183,9 @@ class PatchStream:                  elif self.in_section == 'notes':                      if self.is_log:                          self.series.notes += self.section +                elif self.in_section == 'commit-notes': +                    if self.is_log: +                        self.commit.notes += self.section                  else:                      self.warn.append("Unknown section '%s'" % self.in_section)                  self.in_section = None @@ -178,7 +199,7 @@ class PatchStream:              self.commit.subject = line          # Detect the tags we want to remove, and skip blank lines -        elif re_remove.match(line): +        elif re_remove.match(line) and not commit_tag_match:              self.skip_blank = True              # TEST= should be the last thing in the commit, so remove @@ -211,9 +232,9 @@ class PatchStream:              self.skip_blank = False          # Detect Series-xxx tags -        elif series_match: -            name = series_match.group(1) -            value = series_match.group(2) +        elif series_tag_match: +            name = series_tag_match.group(1) +            value = series_tag_match.group(2)              if name == 'changes':                  # value is the version number: e.g. 1, or 2                  try: @@ -226,6 +247,14 @@ class PatchStream:                  self.AddToSeries(line, name, value)                  self.skip_blank = True +        # Detect Commit-xxx tags +        elif commit_tag_match: +            name = commit_tag_match.group(1) +            value = commit_tag_match.group(2) +            if name == 'notes': +                self.AddToCommit(line, name, value) +                self.skip_blank = True +          # Detect the start of a new commit          elif commit_match:              self.CloseCommit() @@ -276,7 +305,7 @@ class PatchStream:                  out = []                  log = self.series.MakeChangeLog(self.commit)                  out += self.FormatTags(self.tags) -                out += [line] + log +                out += [line] + self.commit.notes + [''] + log              elif self.found_test:                  if not re_allowed_after_test.match(line):                      self.lines_after_test += 1 diff --git a/tools/updater/Makefile b/tools/updater/Makefile deleted file mode 100644 index 19dd5eb6f..000000000 --- a/tools/updater/Makefile +++ /dev/null @@ -1,89 +0,0 @@ -# -# (C) Copyright 2000-2006 -# Wolfgang Denk, DENX Software Engineering, wd@denx.de. -# -# SPDX-License-Identifier:	GPL-2.0+ -# - -LOAD_ADDR = 0x40000 - -include $(TOPDIR)/config.mk - -PROG		= $(obj)updater -IMAGE		= $(obj)updater.image - -COBJS		= update.o flash.o flash_hw.o utils.o cmd_flash.o string.o ctype.o dummy.o -COBJS_LINKS	= stubs.o -AOBJS		= ppcstring.o -AOBJS_LINKS	= memio.o - -OBJS	:= $(addprefix $(obj),$(COBJS) $(COBJS_LINKS) $(AOBJS) $(AOBJS_LINKS)) -SRCS	:= $(COBJS:.o=.c) $(AOBJS:.o=.S) $(addprefix $(obj), $(COBJS_LINKS:.o:.c) $(AOBJS_LINKS:.o:.S)) - -CPPFLAGS += -I$(TOPDIR) -I$(TOPDIR)/board/MAI/AmigaOneG3SE -CFLAGS   += -I$(TOPDIR)/board/MAI/AmigaOneG3SE -AFLAGS   += -I$(TOPDIR)/board/MAI/AmigaOneG3SE - -DEPS = $(OBJTREE)/u-boot.bin $(OBJTREE)/tools/mkimage -ifneq ($(DEPS),$(wildcard $(DEPS))) -$(error "updater: Missing required objects, please run regular build first") -endif - -all:	$(obj).depend $(PROG) $(IMAGE) - -######################################################################### - -$(obj)%.srec:	%.o $(LIB) -	$(LD) -g -Ttext $(LOAD_ADDR) -o $(<:.o=) -e $(<:.o=) $< $(LIB) -	$(OBJCOPY) -O srec $(<:.o=) $@ - -$(obj)%.o: %.c -	$(CC) $(CFLAGS) -c -o $@ $< - -$(obj)%.o: %.S -	$(CC) $(AFLAGS) -c -o $@ $< - -$(obj)memio.o: $(obj)memio.S -	$(CC) $(AFLAGS) -c -o $@ $< - -$(obj)memio.S: -	rm -f $(obj)memio.c -	ln -s $(SRCTREE)/board/MAI/AmigaOneG3SE/memio.S $(obj)memio.S - -$(obj)stubs.o: $(obj)stubs.c -	$(CC) $(CFLAGS) -c -o $@ $< - -$(obj)stubs.c: -	rm -f $(obj)stubs.c -	ln -s $(SRCTREE)/examples/stubs.c $(obj)stubs.c - -######################################################################### - -$(obj)updater: $(OBJS) -	$(LD) -g -Ttext $(LOAD_ADDR) -o $(obj)updater -e _main $(OBJS) -	$(OBJCOPY) -O binary $(obj)updater $(obj)updater.bin - -$(obj)updater.image: $(obj)updater $(OBJTREE)/u-boot.bin -	cat >/tmp/tempimage $(obj)updater.bin junk $(OBJTREE)/u-boot.bin -	$(OBJTREE)/tools/mkimage -A ppc -O u-boot -T standalone -C none -a $(LOAD_ADDR) \ -	-e `$(NM) $(obj)updater | grep _main | cut --bytes=0-8` \ -	-n "Firmware Updater" -d /tmp/tempimage $(obj)updater.image -	rm /tmp/tempimage -	cp $(obj)updater.image /tftpboot - -(obj)updater.image2: $(obj)updater $(OBJTREE)/u-boot.bin -	cat >/tmp/tempimage $(obj)updater.bin junk ../../create_image/image -	$(OBJTREE)/tools/mkimage -A ppc -O u-boot -T standalone -C none -a $(LOAD_ADDR) \ -	-e `$(NM) $(obj)updater | grep _main | cut --bytes=0-8` \ -	-n "Firmware Updater" -d /tmp/tempimage $(obj)updater.image -	rm /tmp/tempimage -	cp $(obj)updater.image /tftpboot - -######################################################################### - -# defines $(obj).depend target -include $(SRCTREE)/rules.mk - -sinclude $(obj).depend - -######################################################################### diff --git a/tools/updater/cmd_flash.c b/tools/updater/cmd_flash.c deleted file mode 100644 index 3a604d00d..000000000 --- a/tools/updater/cmd_flash.c +++ /dev/null @@ -1,401 +0,0 @@ -/* - * (C) Copyright 2000 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * SPDX-License-Identifier:	GPL-2.0+ - */ - -/* - * FLASH support - */ -#include <common.h> -#include <command.h> -#include <flash.h> - -#if defined(CONFIG_CMD_FLASH) - -extern flash_info_t flash_info[];	/* info for FLASH chips */ - -/* - * The user interface starts numbering for Flash banks with 1 - * for historical reasons. - */ - -/* - * this routine looks for an abbreviated flash range specification. - * the syntax is B:SF[-SL], where B is the bank number, SF is the first - * sector to erase, and SL is the last sector to erase (defaults to SF). - * bank numbers start at 1 to be consistent with other specs, sector numbers - * start at zero. - * - * returns:	1	- correct spec; *pinfo, *psf and *psl are - *			  set appropriately - *		0	- doesn't look like an abbreviated spec - *		-1	- looks like an abbreviated spec, but got - *			  a parsing error, a number out of range, - *			  or an invalid flash bank. - */ -static int -abbrev_spec(char *str, flash_info_t **pinfo, int *psf, int *psl) -{ -    flash_info_t *fp; -    int bank, first, last; -    char *p, *ep; - -    if ((p = strchr(str, ':')) == NULL) -	return 0; -    *p++ = '\0'; - -    bank = simple_strtoul(str, &ep, 10); -    if (ep == str || *ep != '\0' || -      bank < 1 || bank > CONFIG_SYS_MAX_FLASH_BANKS || -      (fp = &flash_info[bank - 1])->flash_id == FLASH_UNKNOWN) -	return -1; - -    str = p; -    if ((p = strchr(str, '-')) != NULL) -	*p++ = '\0'; - -    first = simple_strtoul(str, &ep, 10); -    if (ep == str || *ep != '\0' || first >= fp->sector_count) -	return -1; - -    if (p != NULL) { -	last = simple_strtoul(p, &ep, 10); -	if (ep == p || *ep != '\0' || -	  last < first || last >= fp->sector_count) -	    return -1; -    } -    else -	last = first; - -    *pinfo = fp; -    *psf = first; -    *psl = last; - -    return 1; -} -int do_flinfo (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) -{ -	ulong bank; - -	if (argc == 1) {	/* print info for all FLASH banks */ -		for (bank=0; bank <CONFIG_SYS_MAX_FLASH_BANKS; ++bank) { -			printf ("\nBank # %ld: ", bank+1); - -			flash_print_info (&flash_info[bank]); -		} -		return 0; -	} - -	bank = simple_strtoul(argv[1], NULL, 16); -	if ((bank < 1) || (bank > CONFIG_SYS_MAX_FLASH_BANKS)) { -		printf ("Only FLASH Banks # 1 ... # %d supported\n", -			CONFIG_SYS_MAX_FLASH_BANKS); -		return 1; -	} -	printf ("\nBank # %ld: ", bank); -	flash_print_info (&flash_info[bank-1]); -	return 0; -} -int do_flerase(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) -{ -	flash_info_t *info; -	ulong bank, addr_first, addr_last; -	int n, sect_first, sect_last; -	int rcode = 0; - -	if (argc < 2) -		return cmd_usage(cmdtp); - -	if (strcmp(argv[1], "all") == 0) { -		for (bank=1; bank<=CONFIG_SYS_MAX_FLASH_BANKS; ++bank) { -			printf ("Erase Flash Bank # %ld ", bank); -			info = &flash_info[bank-1]; -			rcode = flash_erase (info, 0, info->sector_count-1); -		} -		return rcode; -	} - -	if ((n = abbrev_spec(argv[1], &info, §_first, §_last)) != 0) { -		if (n < 0) { -			printf("Bad sector specification\n"); -			return 1; -		} -		printf ("Erase Flash Sectors %d-%d in Bank # %d ", -			sect_first, sect_last, (info-flash_info)+1); -		rcode = flash_erase(info, sect_first, sect_last); -		return rcode; -	} - -	if (argc != 3) -		return cmd_usage(cmdtp); - -	if (strcmp(argv[1], "bank") == 0) { -		bank = simple_strtoul(argv[2], NULL, 16); -		if ((bank < 1) || (bank > CONFIG_SYS_MAX_FLASH_BANKS)) { -			printf ("Only FLASH Banks # 1 ... # %d supported\n", -				CONFIG_SYS_MAX_FLASH_BANKS); -			return 1; -		} -		printf ("Erase Flash Bank # %ld ", bank); -		info = &flash_info[bank-1]; -		rcode = flash_erase (info, 0, info->sector_count-1); -		return rcode; -	} - -	addr_first = simple_strtoul(argv[1], NULL, 16); -	addr_last  = simple_strtoul(argv[2], NULL, 16); - -	if (addr_first >= addr_last) -		return cmd_usage(cmdtp); - -	printf ("Erase Flash from 0x%08lx to 0x%08lx ", addr_first, addr_last); -	rcode = flash_sect_erase(addr_first, addr_last); -	return rcode; -} - -int flash_sect_erase (ulong addr_first, ulong addr_last) -{ -	flash_info_t *info; -	ulong bank; -	int s_first, s_last; -	int erased; -	int rcode = 0; - -	erased = 0; - -	for (bank=0,info = &flash_info[0]; bank < CONFIG_SYS_MAX_FLASH_BANKS; ++bank, ++info) { -		ulong b_end; -		int sect; - -		if (info->flash_id == FLASH_UNKNOWN) { -			continue; -		} - -		b_end = info->start[0] + info->size - 1; /* bank end addr */ - -		s_first = -1;		/* first sector to erase	*/ -		s_last  = -1;		/* last  sector to erase	*/ - -		for (sect=0; sect < info->sector_count; ++sect) { -			ulong end;		/* last address in current sect	*/ -			short s_end; - -			s_end = info->sector_count - 1; - -			end = (sect == s_end) ? b_end : info->start[sect + 1] - 1; - -			if (addr_first > end) -				continue; -			if (addr_last < info->start[sect]) -				continue; - -			if (addr_first == info->start[sect]) { -				s_first = sect; -			} -			if (addr_last  == end) { -				s_last  = sect; -			} -		} -		if (s_first>=0 && s_first<=s_last) { -			erased += s_last - s_first + 1; -			rcode = flash_erase (info, s_first, s_last); -		} -	} -	if (erased) { -	    /*	printf ("Erased %d sectors\n", erased); */ -	} else { -		printf ("Error: start and/or end address" -			" not on sector boundary\n"); -		rcode = 1; -	} -	return rcode; -} - - -int do_protect(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) -{ -	flash_info_t *info; -	ulong bank, addr_first, addr_last; -	int i, p, n, sect_first, sect_last; -	int rcode = 0; - -	if (argc < 3) -		return cmd_usage(cmdtp); - -	if (strcmp(argv[1], "off") == 0) -		p = 0; -	else if (strcmp(argv[1], "on") == 0) -		p = 1; -	else -		return cmd_usage(cmdtp); - -	if (strcmp(argv[2], "all") == 0) { -		for (bank=1; bank<=CONFIG_SYS_MAX_FLASH_BANKS; ++bank) { -			info = &flash_info[bank-1]; -			if (info->flash_id == FLASH_UNKNOWN) { -				continue; -			} -			/*printf ("%sProtect Flash Bank # %ld\n", */ -			/*	p ? "" : "Un-", bank); */ - -			for (i=0; i<info->sector_count; ++i) { -#if defined(CONFIG_SYS_FLASH_PROTECTION) -				if (flash_real_protect(info, i, p)) -					rcode = 1; -				putc ('.'); -#else -				info->protect[i] = p; -#endif	/* CONFIG_SYS_FLASH_PROTECTION */ -			} -		} - -#if defined(CONFIG_SYS_FLASH_PROTECTION) -		if (!rcode) puts (" done\n"); -#endif	/* CONFIG_SYS_FLASH_PROTECTION */ - -		return rcode; -	} - -	if ((n = abbrev_spec(argv[2], &info, §_first, §_last)) != 0) { -		if (n < 0) { -			printf("Bad sector specification\n"); -			return 1; -		} -		/*printf("%sProtect Flash Sectors %d-%d in Bank # %d\n", */ -		/*	p ? "" : "Un-", sect_first, sect_last, */ -		/*	(info-flash_info)+1); */ -		for (i = sect_first; i <= sect_last; i++) { -#if defined(CONFIG_SYS_FLASH_PROTECTION) -			if (flash_real_protect(info, i, p)) -				rcode =  1; -			putc ('.'); -#else -			info->protect[i] = p; -#endif	/* CONFIG_SYS_FLASH_PROTECTION */ -		} - -#if defined(CONFIG_SYS_FLASH_PROTECTION) -		if (!rcode) puts (" done\n"); -#endif	/* CONFIG_SYS_FLASH_PROTECTION */ - -		return rcode; -	} - -	if (argc != 4) -		return cmd_usage(cmdtp); - -	if (strcmp(argv[2], "bank") == 0) { -		bank = simple_strtoul(argv[3], NULL, 16); -		if ((bank < 1) || (bank > CONFIG_SYS_MAX_FLASH_BANKS)) { -			printf ("Only FLASH Banks # 1 ... # %d supported\n", -				CONFIG_SYS_MAX_FLASH_BANKS); -			return 1; -		} -		printf ("%sProtect Flash Bank # %ld\n", -			p ? "" : "Un-", bank); -		info = &flash_info[bank-1]; - -		if (info->flash_id == FLASH_UNKNOWN) { -			printf ("missing or unknown FLASH type\n"); -			return 1; -		} -		for (i=0; i<info->sector_count; ++i) { -#if defined(CONFIG_SYS_FLASH_PROTECTION) -			if (flash_real_protect(info, i, p)) -				rcode =  1; -			putc ('.'); -#else -			info->protect[i] = p; -#endif	/* CONFIG_SYS_FLASH_PROTECTION */ -		} - -#if defined(CONFIG_SYS_FLASH_PROTECTION) -		if (!rcode) -			puts(" done\n"); -#endif	/* CONFIG_SYS_FLASH_PROTECTION */ - -		return rcode; -	} - -	addr_first = simple_strtoul(argv[2], NULL, 16); -	addr_last  = simple_strtoul(argv[3], NULL, 16); - -	if (addr_first >= addr_last) -		return cmd_usage(cmdtp); - -	return flash_sect_protect (p, addr_first, addr_last); -} -int flash_sect_protect (int p, ulong addr_first, ulong addr_last) -{ -	flash_info_t *info; -	ulong bank; -	int s_first, s_last; -	int protected, i; -	int rcode = 0; - -	protected = 0; - -	for (bank=0,info = &flash_info[0]; bank < CONFIG_SYS_MAX_FLASH_BANKS; ++bank, ++info) { -		ulong b_end; -		int sect; - -		if (info->flash_id == FLASH_UNKNOWN) { -			continue; -		} - -		b_end = info->start[0] + info->size - 1; /* bank end addr */ - -		s_first = -1;		/* first sector to erase	*/ -		s_last  = -1;		/* last  sector to erase	*/ - -		for (sect=0; sect < info->sector_count; ++sect) { -			ulong end;		/* last address in current sect	*/ -			short s_end; - -			s_end = info->sector_count - 1; - -			end = (sect == s_end) ? b_end : info->start[sect + 1] - 1; - -			if (addr_first > end) -				continue; -			if (addr_last < info->start[sect]) -				continue; - -			if (addr_first == info->start[sect]) { -				s_first = sect; -			} -			if (addr_last  == end) { -				s_last  = sect; -			} -		} -		if (s_first>=0 && s_first<=s_last) { -			protected += s_last - s_first + 1; -			for (i=s_first; i<=s_last; ++i) { -#if defined(CONFIG_SYS_FLASH_PROTECTION) -				if (flash_real_protect(info, i, p)) -					rcode = 1; -				putc ('.'); -#else -				info->protect[i] = p; -#endif	/* CONFIG_SYS_FLASH_PROTECTION */ -			} -		} -#if defined(CONFIG_SYS_FLASH_PROTECTION) -		if (!rcode) putc ('\n'); -#endif	/* CONFIG_SYS_FLASH_PROTECTION */ - -	} -	if (protected) { -	    /*	printf ("%sProtected %d sectors\n", */ -	    /*	p ? "" : "Un-", protected); */ -	} else { -	    printf ("Error: start and/or end address" -			" not on sector boundary\n"); -		rcode = 1; -	} -	return rcode; -} - -#endif diff --git a/tools/updater/ctype.c b/tools/updater/ctype.c deleted file mode 100644 index 96fa9ed11..000000000 --- a/tools/updater/ctype.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (C) Copyright 2000 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * SPDX-License-Identifier:	GPL-2.0+ - */ - -/* - *  linux/lib/ctype.c - * - *  Copyright (C) 1991, 1992  Linus Torvalds - */ - -#include <linux/ctype.h> - -unsigned char _ctype[] = { -_C,_C,_C,_C,_C,_C,_C,_C,			/* 0-7 */ -_C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C,		/* 8-15 */ -_C,_C,_C,_C,_C,_C,_C,_C,			/* 16-23 */ -_C,_C,_C,_C,_C,_C,_C,_C,			/* 24-31 */ -_S|_SP,_P,_P,_P,_P,_P,_P,_P,			/* 32-39 */ -_P,_P,_P,_P,_P,_P,_P,_P,			/* 40-47 */ -_D,_D,_D,_D,_D,_D,_D,_D,			/* 48-55 */ -_D,_D,_P,_P,_P,_P,_P,_P,			/* 56-63 */ -_P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U,	/* 64-71 */ -_U,_U,_U,_U,_U,_U,_U,_U,			/* 72-79 */ -_U,_U,_U,_U,_U,_U,_U,_U,			/* 80-87 */ -_U,_U,_U,_P,_P,_P,_P,_P,			/* 88-95 */ -_P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L,	/* 96-103 */ -_L,_L,_L,_L,_L,_L,_L,_L,			/* 104-111 */ -_L,_L,_L,_L,_L,_L,_L,_L,			/* 112-119 */ -_L,_L,_L,_P,_P,_P,_P,_C,			/* 120-127 */ -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,		/* 128-143 */ -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,		/* 144-159 */ -_S|_SP,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,   /* 160-175 */ -_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,       /* 176-191 */ -_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,       /* 192-207 */ -_U,_U,_U,_U,_U,_U,_U,_P,_U,_U,_U,_U,_U,_U,_U,_L,       /* 208-223 */ -_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,       /* 224-239 */ -_L,_L,_L,_L,_L,_L,_L,_P,_L,_L,_L,_L,_L,_L,_L,_L};      /* 240-255 */ diff --git a/tools/updater/dummy.c b/tools/updater/dummy.c deleted file mode 100644 index 9fe5ac1b1..000000000 --- a/tools/updater/dummy.c +++ /dev/null @@ -1 +0,0 @@ -volatile int __dummy = 0xDEADBEEF; diff --git a/tools/updater/flash.c b/tools/updater/flash.c deleted file mode 100644 index 538887207..000000000 --- a/tools/updater/flash.c +++ /dev/null @@ -1,168 +0,0 @@ -/* - * (C) Copyright 2000-2006 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * SPDX-License-Identifier:	GPL-2.0+ - */ - -#include <common.h> -#include <flash.h> - -extern flash_info_t  flash_info[]; /* info for FLASH chips */ - -/*----------------------------------------------------------------------- - * Functions - */ - -/*----------------------------------------------------------------------- - * Set protection status for monitor sectors - * - * The monitor is always located in the _first_ Flash bank. - * If necessary you have to map the second bank at lower addresses. - */ -void -flash_protect (int flag, ulong from, ulong to, flash_info_t *info) -{ -	ulong b_end = info->start[0] + info->size - 1;	/* bank end address */ -	short s_end = info->sector_count - 1;	/* index of last sector */ -	int i; - -	/* Do nothing if input data is bad. */ -	if (info->sector_count == 0 || info->size == 0 || to < from) { -		return; -	} - -	/* There is nothing to do if we have no data about the flash -	 * or the protect range and flash range don't overlap. -	 */ -	if (info->flash_id == FLASH_UNKNOWN || -	    to < info->start[0] || from > b_end) { -		return; -	} - -	for (i=0; i<info->sector_count; ++i) { -		ulong end;		/* last address in current sect	*/ - -		end = (i == s_end) ? b_end : info->start[i + 1] - 1; - -		/* Update protection if any part of the sector -		 * is in the specified range. -		 */ -		if (from <= end && to >= info->start[i]) { -			if (flag & FLAG_PROTECT_CLEAR) { -#if defined(CONFIG_SYS_FLASH_PROTECTION) -				flash_real_protect(info, i, 0); -#else -				info->protect[i] = 0; -#endif	/* CONFIG_SYS_FLASH_PROTECTION */ -			} -			else if (flag & FLAG_PROTECT_SET) { -#if defined(CONFIG_SYS_FLASH_PROTECTION) -				flash_real_protect(info, i, 1); -#else -				info->protect[i] = 1; -#endif	/* CONFIG_SYS_FLASH_PROTECTION */ -			} -		} -	} -} - -/*----------------------------------------------------------------------- - */ - -flash_info_t * -addr2info (ulong addr) -{ -#ifndef CONFIG_SPD823TS -	flash_info_t *info; -	int i; - -	for (i=0, info = &flash_info[0]; i<CONFIG_SYS_MAX_FLASH_BANKS; ++i, ++info) { -		if (info->flash_id != FLASH_UNKNOWN && -		    addr >= info->start[0] && -		    /* WARNING - The '- 1' is needed if the flash -		     * is at the end of the address space, since -		     * info->start[0] + info->size wraps back to 0. -		     * Please don't change this unless you understand this. -		     */ -		    addr <= info->start[0] + info->size - 1) { -			return (info); -		} -	} -#endif /* CONFIG_SPD823TS */ - -	return (NULL); -} - -/*----------------------------------------------------------------------- - * Copy memory to flash. - * Make sure all target addresses are within Flash bounds, - * and no protected sectors are hit. - * Returns: - * ERR_OK          0 - OK - * ERR_TIMOUT      1 - write timeout - * ERR_NOT_ERASED  2 - Flash not erased - * ERR_PROTECTED   4 - target range includes protected sectors - * ERR_INVAL       8 - target address not in Flash memory - * ERR_ALIGN       16 - target address not aligned on boundary - *			(only some targets require alignment) - */ -int -flash_write (char *src, ulong addr, ulong cnt) -{ -#ifdef CONFIG_SPD823TS -	return (ERR_TIMOUT);	/* any other error codes are possible as well */ -#else -	int i; -	ulong         end        = addr + cnt - 1; -	flash_info_t *info_first = addr2info (addr); -	flash_info_t *info_last  = addr2info (end ); -	flash_info_t *info; -	int j; - -	if (cnt == 0) { -		return (ERR_OK); -	} - -	if (!info_first || !info_last) { -		return (ERR_INVAL); -	} - -	for (info = info_first; info <= info_last; ++info) { -		ulong b_end = info->start[0] + info->size;	/* bank end addr */ -		short s_end = info->sector_count - 1; -		for (i=0; i<info->sector_count; ++i) { -			ulong e_addr = (i == s_end) ? b_end : info->start[i + 1]; - -			if ((end >= info->start[i]) && (addr < e_addr) && -			    (info->protect[i] != 0) ) { -				return (ERR_PROTECTED); -			} -		} -	} - -	printf("\rWriting "); -	for (j=0; j<20; j++) putc(177); -	printf("\rWriting "); - -	/* finally write data to flash */ -	for (info = info_first; info <= info_last && cnt>0; ++info) { -		ulong len; - -		len = info->start[0] + info->size - addr; -		if (len > cnt) -			len = cnt; - -		if ((i = write_buff(info, src, addr, len)) != 0) { -			return (i); -		} -		cnt  -= len; -		addr += len; -		src  += len; -	} -	return (ERR_OK); -#endif /* CONFIG_SPD823TS */ -} - -/*----------------------------------------------------------------------- - */ diff --git a/tools/updater/flash_hw.c b/tools/updater/flash_hw.c deleted file mode 100644 index 54a910b17..000000000 --- a/tools/updater/flash_hw.c +++ /dev/null @@ -1,643 +0,0 @@ -/* - * (C) Copyright 2001 - * Josh Huber <huber@mclx.com>, Mission Critical Linux, Inc. - * - * (C) Copyright 2002 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * SPDX-License-Identifier:	GPL-2.0+ - */ - -#include <common.h> -#include <flash.h> -#include <asm/io.h> -#include <memio.h> - -/*---------------------------------------------------------------------*/ -#undef DEBUG_FLASH - -#ifdef DEBUG_FLASH -#define DEBUGF(fmt,args...) printf(fmt ,##args) -#else -#define DEBUGF(fmt,args...) -#endif -/*---------------------------------------------------------------------*/ - -flash_info_t	flash_info[]; - -static ulong flash_get_size (ulong addr, flash_info_t *info); -static int flash_get_offsets (ulong base, flash_info_t *info); -static int write_word (flash_info_t *info, ulong dest, ulong data); -static void flash_reset (ulong addr); - -int flash_xd_nest; - -static void flash_to_xd(void) -{ -    unsigned char x; - -    flash_xd_nest ++; - -    if (flash_xd_nest == 1) -    { -	DEBUGF("Flash on XD\n"); -	x = pci_read_cfg_byte(0, 0, 0x74); -	pci_write_cfg_byte(0, 0, 0x74, x|1); -    } -} - -static void flash_to_mem(void) -{ -    unsigned char x; - -    flash_xd_nest --; - -    if (flash_xd_nest == 0) -    { -	DEBUGF("Flash on memory bus\n"); -	x = pci_read_cfg_byte(0, 0, 0x74); -	pci_write_cfg_byte(0, 0, 0x74, x&0xFE); -    } -} - -unsigned long flash_init_old(void) -{ -    int i; - -    for (i = 0; i < CONFIG_SYS_MAX_FLASH_BANKS; i++) -    { -	flash_info[i].flash_id = FLASH_UNKNOWN; -	flash_info[i].sector_count = 0; -	flash_info[i].size = 0; -    } - - -    return 1; -} - -unsigned long flash_init (void) -{ -	unsigned int i; -	unsigned long flash_size = 0; - -	flash_xd_nest = 0; - -	flash_to_xd(); - -	/* Init: no FLASHes known */ -	for (i=0; i<CONFIG_SYS_MAX_FLASH_BANKS; ++i) { -		flash_info[i].flash_id = FLASH_UNKNOWN; -		flash_info[i].sector_count = 0; -		flash_info[i].size = 0; -	} - -	DEBUGF("\n## Get flash size @ 0x%08x\n", CONFIG_SYS_FLASH_BASE); - -	flash_size = flash_get_size (CONFIG_SYS_FLASH_BASE, flash_info); - -	DEBUGF("## Flash bank size: %08lx\n", flash_size); - -	if (flash_size) { -#if CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE && \ -    CONFIG_SYS_MONITOR_BASE < CONFIG_SYS_FLASH_BASE + CONFIG_SYS_FLASH_MAX_SIZE -		/* monitor protection ON by default */ -		flash_protect(FLAG_PROTECT_SET, -			      CONFIG_SYS_MONITOR_BASE, -			      CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN - 1, -			      &flash_info[0]); -#endif - -#ifdef CONFIG_ENV_IS_IN_FLASH -		/* ENV protection ON by default */ -		flash_protect(FLAG_PROTECT_SET, -			      CONFIG_ENV_ADDR, -			      CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE - 1, -			      &flash_info[0]); -#endif - -	} else { -		printf ("Warning: the BOOT Flash is not initialised !"); -	} - -	flash_to_mem(); - -	return flash_size; -} - -/* - * The following code cannot be run from FLASH! - */ -static ulong flash_get_size (ulong addr, flash_info_t *info) -{ -	short i; -	uchar value; -	uchar *x = (uchar *)addr; - -	flash_to_xd(); - -	/* Write auto select command: read Manufacturer ID */ -	x[0x0555] =  0xAA; -	__asm__ volatile ("sync\n eieio"); -	x[0x02AA] =  0x55; -	__asm__ volatile ("sync\n eieio"); -	x[0x0555] =  0x90; -	__asm__ volatile ("sync\n eieio"); - -	value = x[0]; -	__asm__ volatile ("sync\n eieio"); - -	DEBUGF("Manuf. ID @ 0x%08lx: 0x%08x\n", (ulong)addr, value); - -	switch (value | (value << 16)) { -		case AMD_MANUFACT: -			info->flash_id = FLASH_MAN_AMD; -			break; - -		case FUJ_MANUFACT: -			info->flash_id = FLASH_MAN_FUJ; -			break; - -		case STM_MANUFACT: -			info->flash_id = FLASH_MAN_STM; -			break; - -		default: -			info->flash_id = FLASH_UNKNOWN; -			info->sector_count = 0; -			info->size = 0; -			flash_reset (addr); -			return 0; -	} - -	value = x[1]; -	__asm__ volatile ("sync\n eieio"); - -	DEBUGF("Device ID @ 0x%08lx: 0x%08x\n", addr+1, value); - -	switch (value) { -		case AMD_ID_F040B: -			DEBUGF("Am29F040B\n"); -			info->flash_id += FLASH_AM040; -			info->sector_count = 8; -			info->size = 0x00080000; -			break;			/* => 512 kB		*/ - -		case AMD_ID_LV040B: -			DEBUGF("Am29LV040B\n"); -			info->flash_id += FLASH_AM040; -			info->sector_count = 8; -			info->size = 0x00080000; -			break;			/* => 512 kB		*/ - -		case AMD_ID_LV400T: -			DEBUGF("Am29LV400T\n"); -			info->flash_id += FLASH_AM400T; -			info->sector_count = 11; -			info->size = 0x00100000; -			break;			/* => 1 MB		*/ - -		case AMD_ID_LV400B: -			DEBUGF("Am29LV400B\n"); -			info->flash_id += FLASH_AM400B; -			info->sector_count = 11; -			info->size = 0x00100000; -			break;			/* => 1 MB		*/ - -		case AMD_ID_LV800T: -			DEBUGF("Am29LV800T\n"); -			info->flash_id += FLASH_AM800T; -			info->sector_count = 19; -			info->size = 0x00200000; -			break;			/* => 2 MB		*/ - -		case AMD_ID_LV800B: -			DEBUGF("Am29LV400B\n"); -			info->flash_id += FLASH_AM800B; -			info->sector_count = 19; -			info->size = 0x00200000; -			break;			/* => 2 MB		*/ - -		case AMD_ID_LV160T: -			DEBUGF("Am29LV160T\n"); -			info->flash_id += FLASH_AM160T; -			info->sector_count = 35; -			info->size = 0x00400000; -			break;			/* => 4 MB		*/ - -		case AMD_ID_LV160B: -			DEBUGF("Am29LV160B\n"); -			info->flash_id += FLASH_AM160B; -			info->sector_count = 35; -			info->size = 0x00400000; -			break;			/* => 4 MB		*/ - -		case AMD_ID_LV320T: -			DEBUGF("Am29LV320T\n"); -			info->flash_id += FLASH_AM320T; -			info->sector_count = 67; -			info->size = 0x00800000; -			break;			/* => 8 MB		*/ - -#if 0 -		/* Has the same ID as AMD_ID_LV320T, to be fixed */ -		case AMD_ID_LV320B: -			DEBUGF("Am29LV320B\n"); -			info->flash_id += FLASH_AM320B; -			info->sector_count = 67; -			info->size = 0x00800000; -			break;			/* => 8 MB		*/ -#endif - -		case AMD_ID_LV033C: -			DEBUGF("Am29LV033C\n"); -			info->flash_id += FLASH_AM033C; -			info->sector_count = 64; -			info->size = 0x01000000; -			break;			/* => 16Mb		*/ - -		case STM_ID_F040B: -			DEBUGF("M29F040B\n"); -			info->flash_id += FLASH_AM040; -			info->sector_count = 8; -			info->size = 0x00080000; -			break;			/* => 512 kB		*/ - -		default: -			info->flash_id = FLASH_UNKNOWN; -			flash_reset (addr); -			flash_to_mem(); -			return (0);		/* => no or unknown flash */ - -	} - -	if (info->sector_count > CONFIG_SYS_MAX_FLASH_SECT) { -		printf ("** ERROR: sector count %d > max (%d) **\n", -			info->sector_count, CONFIG_SYS_MAX_FLASH_SECT); -		info->sector_count = CONFIG_SYS_MAX_FLASH_SECT; -	} - -	if (! flash_get_offsets (addr, info)) { -		flash_reset (addr); -		flash_to_mem(); -		return 0; -	} - -	/* check for protected sectors */ -	for (i = 0; i < info->sector_count; i++) { -		/* read sector protection at sector address, (A7 .. A0) = 0x02 */ -		/* D0 = 1 if protected */ -		value = in8(info->start[i] + 2); -		iobarrier_rw(); -		info->protect[i] = (value & 1) != 0; -	} - -	/* -	 * Reset bank to read mode -	 */ -	flash_reset (addr); - -	flash_to_mem(); - -	return (info->size); -} - -static int flash_get_offsets (ulong base, flash_info_t *info) -{ -	unsigned int i; - -	switch (info->flash_id & FLASH_TYPEMASK) { -		case FLASH_AM040: -			/* set sector offsets for uniform sector type	*/ -			for (i = 0; i < info->sector_count; i++) { -				info->start[i] = base + i * info->size / -							    info->sector_count; -			} -			break; -		default: -			return 0; -	} - -	return 1; -} - -int flash_erase (flash_info_t *info, int s_first, int s_last) -{ -	volatile ulong addr = info->start[0]; -	int flag, prot, sect, l_sect; -	ulong start, now, last; - -	flash_to_xd(); - -	if (s_first < 0 || s_first > s_last) { -		if (info->flash_id == FLASH_UNKNOWN) { -			printf ("- missing\n"); -		} else { -			printf ("- no sectors to erase\n"); -		} -		flash_to_mem(); -		return 1; -	} - -	if (info->flash_id == FLASH_UNKNOWN) { -		printf ("Can't erase unknown flash type %08lx - aborted\n", -			info->flash_id); -		flash_to_mem(); -		return 1; -	} - -	prot = 0; -	for (sect=s_first; sect<=s_last; ++sect) { -		if (info->protect[sect]) { -			prot++; -		} -	} - -	if (prot) { -		printf ("- Warning: %d protected sectors will not be erased!\n", -			prot); -	} else { -		printf (""); -	} - -	l_sect = -1; - -	/* Disable interrupts which might cause a timeout here */ -	flag = disable_interrupts(); - -	out8(addr + 0x555, 0xAA); -	iobarrier_rw(); -	out8(addr + 0x2AA, 0x55); -	iobarrier_rw(); -	out8(addr + 0x555, 0x80); -	iobarrier_rw(); -	out8(addr + 0x555, 0xAA); -	iobarrier_rw(); -	out8(addr + 0x2AA, 0x55); -	iobarrier_rw(); - -	/* Start erase on unprotected sectors */ -	for (sect = s_first; sect<=s_last; sect++) { -		if (info->protect[sect] == 0) {	/* not protected */ -			addr = info->start[sect]; -			out8(addr, 0x30); -			iobarrier_rw(); -			l_sect = sect; -		} -	} - -	/* re-enable interrupts if necessary */ -	if (flag) -		enable_interrupts(); - -	/* wait at least 80us - let's wait 1 ms */ -	udelay (1000); - -	/* -	 * We wait for the last triggered sector -	 */ -	if (l_sect < 0) -		goto DONE; - -	start = get_timer (0); -	last  = start; -	addr = info->start[l_sect]; - -	DEBUGF ("Start erase timeout: %d\n", CONFIG_SYS_FLASH_ERASE_TOUT); - -	while ((in8(addr) & 0x80) != 0x80) { -		if ((now = get_timer(start)) > CONFIG_SYS_FLASH_ERASE_TOUT) { -			printf ("Timeout\n"); -			flash_reset (info->start[0]); -			flash_to_mem(); -			return 1; -		} -		/* show that we're waiting */ -		if ((now - last) > 1000) {	/* every second */ -			putc ('.'); -			last = now; -		} -		iobarrier_rw(); -	} - -DONE: -	/* reset to read mode */ -	flash_reset (info->start[0]); -	flash_to_mem(); - -	printf (" done\n"); -	return 0; -} - -/* - * Copy memory to flash, returns: - * 0 - OK - * 1 - write timeout - * 2 - Flash not erased - */ -int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt) -{ -	ulong cp, wp, data; -	int i, l, rc; -	ulong out_cnt = 0; - -	flash_to_xd(); - -	wp = (addr & ~3);	/* get lower word aligned address */ - -	/* -	 * handle unaligned start bytes -	 */ -	if ((l = addr - wp) != 0) { -		data = 0; -		for (i=0, cp=wp; i<l; ++i, ++cp) { -			data = (data << 8) | (*(uchar *)cp); -		} -		for (; i<4 && cnt>0; ++i) { -			data = (data << 8) | *src++; -			--cnt; -			++cp; -		} -		for (; cnt==0 && i<4; ++i, ++cp) { -			data = (data << 8) | (*(uchar *)cp); -		} - -		if ((rc = write_word(info, wp, data)) != 0) { -			flash_to_mem(); -			return (rc); -		} -		wp += 4; -	} - -	putc(219); - -	/* -	 * handle word aligned part -	 */ -	while (cnt >= 4) { -	    if (out_cnt>26214) -	    { -		putc(219); -		out_cnt = 0; -	    } -	    data = 0; -	    for (i=0; i<4; ++i) { -		data = (data << 8) | *src++; -	    } -	    if ((rc = write_word(info, wp, data)) != 0) { -		flash_to_mem(); -		return (rc); -	    } -	    wp  += 4; -	    cnt -= 4; -	    out_cnt += 4; -	} - -	if (cnt == 0) { -		flash_to_mem(); -		return (0); -	} - -	/* -	 * handle unaligned tail bytes -	 */ -	data = 0; -	for (i=0, cp=wp; i<4 && cnt>0; ++i, ++cp) { -		data = (data << 8) | *src++; -		--cnt; -	} -	for (; i<4; ++i, ++cp) { -		data = (data << 8) | (*(uchar *)cp); -	} - -	flash_to_mem(); -	return (write_word(info, wp, data)); -} - -/* - * Write a word to Flash, returns: - * 0 - OK - * 1 - write timeout - * 2 - Flash not erased - */ -static int write_word (flash_info_t *info, ulong dest, ulong data) -{ -	volatile ulong addr = info->start[0]; -	ulong start; -	int i; - -	flash_to_xd(); - -	/* Check if Flash is (sufficiently) erased */ -	if ((in32(dest) & data) != data) { -		flash_to_mem(); -		return (2); -	} - -	/* write each byte out */ -	for (i = 0; i < 4; i++) { -		char *data_ch = (char *)&data; -		int flag = disable_interrupts(); - -		out8(addr + 0x555, 0xAA); -		iobarrier_rw(); -		out8(addr + 0x2AA, 0x55); -		iobarrier_rw(); -		out8(addr + 0x555, 0xA0); -		iobarrier_rw(); -		out8(dest+i, data_ch[i]); -		iobarrier_rw(); - -		/* re-enable interrupts if necessary */ -		if (flag) -			enable_interrupts(); - -		/* data polling for D7 */ -		start = get_timer (0); -		while ((in8(dest+i) & 0x80) != (data_ch[i] & 0x80)) { -			if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) { -				flash_reset (addr); -				flash_to_mem(); -				return (1); -			} -			iobarrier_rw(); -		} -	} - -	flash_reset (addr); -	flash_to_mem(); -	return (0); -} - -/* - * Reset bank to read mode - */ -static void flash_reset (ulong addr) -{ -	flash_to_xd(); -	out8(addr, 0xF0);	/* reset bank */ -	iobarrier_rw(); -	flash_to_mem(); -} - -void flash_print_info (flash_info_t *info) -{ -	int i; - -	if (info->flash_id == FLASH_UNKNOWN) { -		printf ("missing or unknown FLASH type\n"); -		return; -	} - -	switch (info->flash_id & FLASH_VENDMASK) { -	case FLASH_MAN_AMD:	printf ("AMD ");		break; -	case FLASH_MAN_FUJ:	printf ("FUJITSU ");		break; -	case FLASH_MAN_BM:	printf ("BRIGHT MICRO ");	break; -	case FLASH_MAN_STM:	printf ("SGS THOMSON ");	break; -	default:		printf ("Unknown Vendor ");	break; -	} - -	switch (info->flash_id & FLASH_TYPEMASK) { -	case FLASH_AM040:	printf ("29F040 or 29LV040 (4 Mbit, uniform sectors)\n"); -				break; -	case FLASH_AM400B:	printf ("AM29LV400B (4 Mbit, bottom boot sect)\n"); -				break; -	case FLASH_AM400T:	printf ("AM29LV400T (4 Mbit, top boot sector)\n"); -				break; -	case FLASH_AM800B:	printf ("AM29LV800B (8 Mbit, bottom boot sect)\n"); -				break; -	case FLASH_AM800T:	printf ("AM29LV800T (8 Mbit, top boot sector)\n"); -				break; -	case FLASH_AM160B:	printf ("AM29LV160B (16 Mbit, bottom boot sect)\n"); -				break; -	case FLASH_AM160T:	printf ("AM29LV160T (16 Mbit, top boot sector)\n"); -				break; -	case FLASH_AM320B:	printf ("AM29LV320B (32 Mbit, bottom boot sect)\n"); -				break; -	case FLASH_AM320T:	printf ("AM29LV320T (32 Mbit, top boot sector)\n"); -				break; -	default:		printf ("Unknown Chip Type\n"); -				break; -	} - -	if (info->size % 0x100000 == 0) { -		printf ("  Size: %ld MB in %d Sectors\n", -			info->size / 0x100000, info->sector_count); -	} else if (info->size % 0x400 == 0) { -		printf ("  Size: %ld KB in %d Sectors\n", -			info->size / 0x400, info->sector_count); -	} else { -		printf ("  Size: %ld B in %d Sectors\n", -			info->size, info->sector_count); -	} - -	printf ("  Sector Start Addresses:"); -	for (i=0; i<info->sector_count; ++i) { -		if ((i % 5) == 0) -			printf ("\n   "); -		printf (" %08lX%s", -			info->start[i], -			info->protect[i] ? " (RO)" : "     " -		); -	} -	printf ("\n"); -} diff --git a/tools/updater/junk b/tools/updater/junk deleted file mode 100644 index f73285a83..000000000 --- a/tools/updater/junk +++ /dev/null @@ -1 +0,0 @@ -................................................................................................................................................................................................................................................................
\ No newline at end of file diff --git a/tools/updater/ppcstring.S b/tools/updater/ppcstring.S deleted file mode 100644 index 8152ac9b0..000000000 --- a/tools/updater/ppcstring.S +++ /dev/null @@ -1,213 +0,0 @@ -/* - * String handling functions for PowerPC. - * - * Copyright (C) 1996 Paul Mackerras. - * - * SPDX-License-Identifier:	GPL-2.0+ - */ -#include <ppc_asm.tmpl> -#include <asm/errno.h> - -	.globl	strcpy -strcpy: -	addi	r5,r3,-1 -	addi	r4,r4,-1 -1:	lbzu	r0,1(r4) -	cmpwi	0,r0,0 -	stbu	r0,1(r5) -	bne	1b -	blr - -	.globl	strncpy -strncpy: -	cmpwi	0,r5,0 -	beqlr -	mtctr	r5 -	addi	r6,r3,-1 -	addi	r4,r4,-1 -1:	lbzu	r0,1(r4) -	cmpwi	0,r0,0 -	stbu	r0,1(r6) -	bdnzf	2,1b		/* dec ctr, branch if ctr != 0 && !cr0.eq */ -	blr - -	.globl	strcat -strcat: -	addi	r5,r3,-1 -	addi	r4,r4,-1 -1:	lbzu	r0,1(r5) -	cmpwi	0,r0,0 -	bne	1b -	addi	r5,r5,-1 -1:	lbzu	r0,1(r4) -	cmpwi	0,r0,0 -	stbu	r0,1(r5) -	bne	1b -	blr - -	.globl	strcmp -strcmp: -	addi	r5,r3,-1 -	addi	r4,r4,-1 -1:	lbzu	r3,1(r5) -	cmpwi	1,r3,0 -	lbzu	r0,1(r4) -	subf.	r3,r0,r3 -	beqlr	1 -	beq	1b -	blr - -	.globl	strlen -strlen: -	addi	r4,r3,-1 -1:	lbzu	r0,1(r4) -	cmpwi	0,r0,0 -	bne	1b -	subf	r3,r3,r4 -	blr - -	.globl	memset -memset: -	rlwimi	r4,r4,8,16,23 -	rlwimi	r4,r4,16,0,15 -	addi	r6,r3,-4 -	cmplwi	0,r5,4 -	blt	7f -	stwu	r4,4(r6) -	beqlr -	andi.	r0,r6,3 -	add	r5,r0,r5 -	subf	r6,r0,r6 -	rlwinm	r0,r5,32-2,2,31 -	mtctr	r0 -	bdz	6f -1:	stwu	r4,4(r6) -	bdnz	1b -6:	andi.	r5,r5,3 -7:	cmpwi	0,r5,0 -	beqlr -	mtctr	r5 -	addi	r6,r6,3 -8:	stbu	r4,1(r6) -	bdnz	8b -	blr - -	.globl	bcopy -bcopy: -	mr	r6,r3 -	mr	r3,r4 -	mr	r4,r6 -	b	memcpy - -	.globl	memmove -memmove: -	cmplw	0,r3,r4 -	bgt	backwards_memcpy -	/* fall through */ - -	.globl	memcpy -memcpy: -	rlwinm.	r7,r5,32-3,3,31		/* r0 = r5 >> 3 */ -	addi	r6,r3,-4 -	addi	r4,r4,-4 -	beq	2f			/* if less than 8 bytes to do */ -	andi.	r0,r6,3			/* get dest word aligned */ -	mtctr	r7 -	bne	5f -1:	lwz	r7,4(r4) -	lwzu	r8,8(r4) -	stw	r7,4(r6) -	stwu	r8,8(r6) -	bdnz	1b -	andi.	r5,r5,7 -2:	cmplwi	0,r5,4 -	blt	3f -	lwzu	r0,4(r4) -	addi	r5,r5,-4 -	stwu	r0,4(r6) -3:	cmpwi	0,r5,0 -	beqlr -	mtctr	r5 -	addi	r4,r4,3 -	addi	r6,r6,3 -4:	lbzu	r0,1(r4) -	stbu	r0,1(r6) -	bdnz	4b -	blr -5:	subfic	r0,r0,4 -	mtctr	r0 -6:	lbz	r7,4(r4) -	addi	r4,r4,1 -	stb	r7,4(r6) -	addi	r6,r6,1 -	bdnz	6b -	subf	r5,r0,r5 -	rlwinm.	r7,r5,32-3,3,31 -	beq	2b -	mtctr	r7 -	b	1b - -	.globl	backwards_memcpy -backwards_memcpy: -	rlwinm.	r7,r5,32-3,3,31		/* r0 = r5 >> 3 */ -	add	r6,r3,r5 -	add	r4,r4,r5 -	beq	2f -	andi.	r0,r6,3 -	mtctr	r7 -	bne	5f -1:	lwz	r7,-4(r4) -	lwzu	r8,-8(r4) -	stw	r7,-4(r6) -	stwu	r8,-8(r6) -	bdnz	1b -	andi.	r5,r5,7 -2:	cmplwi	0,r5,4 -	blt	3f -	lwzu	r0,-4(r4) -	subi	r5,r5,4 -	stwu	r0,-4(r6) -3:	cmpwi	0,r5,0 -	beqlr -	mtctr	r5 -4:	lbzu	r0,-1(r4) -	stbu	r0,-1(r6) -	bdnz	4b -	blr -5:	mtctr	r0 -6:	lbzu	r7,-1(r4) -	stbu	r7,-1(r6) -	bdnz	6b -	subf	r5,r0,r5 -	rlwinm.	r7,r5,32-3,3,31 -	beq	2b -	mtctr	r7 -	b	1b - -	.globl	memcmp -memcmp: -	cmpwi	0,r5,0 -	ble-	2f -	mtctr	r5 -	addi	r6,r3,-1 -	addi	r4,r4,-1 -1:	lbzu	r3,1(r6) -	lbzu	r0,1(r4) -	subf.	r3,r0,r3 -	bdnzt	2,1b -	blr -2:	li	r3,0 -	blr - -	.global	memchr -memchr: -	cmpwi	0,r5,0 -	ble-	2f -	mtctr	r5 -	addi	r3,r3,-1 -1:	lbzu	r0,1(r3) -	cmpw	0,r0,r4 -	bdnzf	2,1b -	beqlr -2:	li	r3,0 -	blr diff --git a/tools/updater/string.c b/tools/updater/string.c deleted file mode 100644 index 954fb01e2..000000000 --- a/tools/updater/string.c +++ /dev/null @@ -1,340 +0,0 @@ -/* - *  linux/lib/string.c - * - *  Copyright (C) 1991, 1992  Linus Torvalds - */ - -/* - * stupid library routines.. The optimized versions should generally be found - * as inline code in <asm-xx/string.h> - * - * These are buggy as well.. - */ - -#include <linux/types.h> -#include <linux/string.h> -#include <malloc.h> - -#define __HAVE_ARCH_BCOPY -#define __HAVE_ARCH_MEMCMP -#define __HAVE_ARCH_MEMCPY -#define __HAVE_ARCH_MEMMOVE -#define __HAVE_ARCH_MEMSET -#define __HAVE_ARCH_STRCAT -#define __HAVE_ARCH_STRCMP -#define __HAVE_ARCH_STRCPY -#define __HAVE_ARCH_STRLEN -#define __HAVE_ARCH_STRNCPY - -char * ___strtok = NULL; - -#ifndef __HAVE_ARCH_STRCPY -char * strcpy(char * dest,const char *src) -{ -	char *tmp = dest; - -	while ((*dest++ = *src++) != '\0') -		/* nothing */; -	return tmp; -} -#endif - -#ifndef __HAVE_ARCH_STRNCPY -char * strncpy(char * dest,const char *src,size_t count) -{ -	char *tmp = dest; - -	while (count-- && (*dest++ = *src++) != '\0') -		/* nothing */; - -	return tmp; -} -#endif - -#ifndef __HAVE_ARCH_STRCAT -char * strcat(char * dest, const char * src) -{ -	char *tmp = dest; - -	while (*dest) -		dest++; -	while ((*dest++ = *src++) != '\0') -		; - -	return tmp; -} -#endif - -#ifndef __HAVE_ARCH_STRNCAT -char * strncat(char *dest, const char *src, size_t count) -{ -	char *tmp = dest; - -	if (count) { -		while (*dest) -			dest++; -		while ((*dest++ = *src++)) { -			if (--count == 0) { -				*dest = '\0'; -				break; -			} -		} -	} - -	return tmp; -} -#endif - -#ifndef __HAVE_ARCH_STRCMP -int strcmp(const char * cs,const char * ct) -{ -	register signed char __res; - -	while (1) { -		if ((__res = *cs - *ct++) != 0 || !*cs++) -			break; -	} - -	return __res; -} -#endif - -#ifndef __HAVE_ARCH_STRNCMP -int strncmp(const char * cs,const char * ct,size_t count) -{ -	register signed char __res = 0; - -	while (count) { -		if ((__res = *cs - *ct++) != 0 || !*cs++) -			break; -		count--; -	} - -	return __res; -} -#endif - -#ifndef __HAVE_ARCH_STRCHR -char * strchr(const char * s, int c) -{ -	for(; *s != (char) c; ++s) -		if (*s == '\0') -			return NULL; -	return (char *) s; -} -#endif - -#ifndef __HAVE_ARCH_STRRCHR -char * strrchr(const char * s, int c) -{ -       const char *p = s + strlen(s); -       do { -	   if (*p == (char)c) -	       return (char *)p; -       } while (--p >= s); -       return NULL; -} -#endif - -#ifndef __HAVE_ARCH_STRLEN -size_t strlen(const char * s) -{ -	const char *sc; - -	for (sc = s; *sc != '\0'; ++sc) -		/* nothing */; -	return sc - s; -} -#endif - -#ifndef __HAVE_ARCH_STRNLEN -size_t strnlen(const char * s, size_t count) -{ -	const char *sc; - -	for (sc = s; count-- && *sc != '\0'; ++sc) -		/* nothing */; -	return sc - s; -} -#endif - -#ifndef __HAVE_ARCH_STRDUP -char * strdup(const char *s) -{ -	char *new; - -	if ((s == NULL)	|| -	    ((new = malloc (strlen(s) + 1)) == NULL) ) { -		return NULL; -	} - -	strcpy (new, s); -	return new; -} -#endif - -#ifndef __HAVE_ARCH_STRSPN -size_t strspn(const char *s, const char *accept) -{ -	const char *p; -	const char *a; -	size_t count = 0; - -	for (p = s; *p != '\0'; ++p) { -		for (a = accept; *a != '\0'; ++a) { -			if (*p == *a) -				break; -		} -		if (*a == '\0') -			return count; -		++count; -	} - -	return count; -} -#endif - -#ifndef __HAVE_ARCH_STRPBRK -char * strpbrk(const char * cs,const char * ct) -{ -	const char *sc1,*sc2; - -	for( sc1 = cs; *sc1 != '\0'; ++sc1) { -		for( sc2 = ct; *sc2 != '\0'; ++sc2) { -			if (*sc1 == *sc2) -				return (char *) sc1; -		} -	} -	return NULL; -} -#endif - -#ifndef __HAVE_ARCH_STRTOK -char * strtok(char * s,const char * ct) -{ -	char *sbegin, *send; - -	sbegin  = s ? s : ___strtok; -	if (!sbegin) { -		return NULL; -	} -	sbegin += strspn(sbegin,ct); -	if (*sbegin == '\0') { -		___strtok = NULL; -		return( NULL ); -	} -	send = strpbrk( sbegin, ct); -	if (send && *send != '\0') -		*send++ = '\0'; -	___strtok = send; -	return (sbegin); -} -#endif - -#ifndef __HAVE_ARCH_MEMSET -void * memset(void * s,char c,size_t count) -{ -	char *xs = (char *) s; - -	while (count--) -		*xs++ = c; - -	return s; -} -#endif - -#ifndef __HAVE_ARCH_BCOPY -char * bcopy(const char * src, char * dest, int count) -{ -	char *tmp = dest; - -	while (count--) -		*tmp++ = *src++; - -	return dest; -} -#endif - -#ifndef __HAVE_ARCH_MEMCPY -void * memcpy(void * dest,const void *src,size_t count) -{ -	char *tmp = (char *) dest, *s = (char *) src; - -	while (count--) -		*tmp++ = *s++; - -	return dest; -} -#endif - -#ifndef __HAVE_ARCH_MEMMOVE -void * memmove(void * dest,const void *src,size_t count) -{ -	char *tmp, *s; - -	if (dest <= src) { -		tmp = (char *) dest; -		s = (char *) src; -		while (count--) -			*tmp++ = *s++; -		} -	else { -		tmp = (char *) dest + count; -		s = (char *) src + count; -		while (count--) -			*--tmp = *--s; -		} - -	return dest; -} -#endif - -#ifndef __HAVE_ARCH_MEMCMP -int memcmp(const void * cs,const void * ct,size_t count) -{ -	const unsigned char *su1, *su2; -	signed char res = 0; - -	for( su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--) -		if ((res = *su1 - *su2) != 0) -			break; -	return res; -} -#endif - -/* - * find the first occurrence of byte 'c', or 1 past the area if none - */ -#ifndef __HAVE_ARCH_MEMSCAN -void * memscan(void * addr, int c, size_t size) -{ -	unsigned char * p = (unsigned char *) addr; - -	while (size) { -		if (*p == c) -			return (void *) p; -		p++; -		size--; -	} -	return (void *) p; -} -#endif - -#ifndef __HAVE_ARCH_STRSTR -char * strstr(const char * s1,const char * s2) -{ -	int l1, l2; - -	l2 = strlen(s2); -	if (!l2) -		return (char *) s1; -	l1 = strlen(s1); -	while (l1 >= l2) { -		l1--; -		if (!memcmp(s1,s2,l2)) -			return (char *) s1; -		s1++; -	} -	return NULL; -} -#endif diff --git a/tools/updater/update.c b/tools/updater/update.c deleted file mode 100644 index 18f122ad2..000000000 --- a/tools/updater/update.c +++ /dev/null @@ -1,63 +0,0 @@ -#include <common.h> -#include <exports.h> - -extern unsigned long __dummy; -void do_reset (void); -void do_updater(void); - -void _main(void) -{ -    int i; -    printf("U-Boot Firmware Updater\n\n\n"); -    printf("****************************************************\n" -	       "*  ATTENTION!! PLEASE READ THIS NOTICE CAREFULLY!  *\n" -	       "****************************************************\n\n" -	       "This program  will update your computer's  firmware.\n" -	       "Do NOT  remove the disk,  reset the  machine,  or do\n" -	       "anything that  might disrupt functionality.  If this\n"); -    printf("Program fails, your computer  might be unusable, and\n" -	       "you will  need to return your  board for reflashing.\n" -	       "If you find this too risky,  remove the diskette and\n" -	       "switch off your  machine now.  Otherwise  press the \n" -	       "SPACE key now to start the process\n\n"); -    do -    { -	char x; -	while (!tstc()); -	x = getc(); -	if (x == ' ') break; -    } while (1); - -    do_updater(); - -    i = 5; - -    printf("\nUpdate done. Please remove diskette.\n"); -    printf("The machine will automatically reset in %d seconds\n", i); -    printf("You can switch off/reset now when the floppy is removed\n\n"); - -    while (i) -    { -	printf("Resetting in %d\r", i); -	udelay(1000000); -	i--; -    } -    do_reset(); -    while (1); -} - -void do_updater(void) -{ -    unsigned long *addr = &__dummy + 65; -    unsigned long flash_size = flash_init(); -    int rc; - -    flash_sect_protect(0, 0xFFF00000, 0xFFF7FFFF); -    printf("Erasing "); -    flash_sect_erase(0xFFF00000, 0xFFF7FFFF); -    printf("Writing "); -    rc = flash_write((uchar *)addr, 0xFFF00000, 0x7FFFF); -    if (rc != 0) printf("\nFlashing failed due to error %d\n", rc); -    else printf("\ndone\n"); -    flash_sect_protect(1, 0xFFF00000, 0xFFF7FFFF); -} diff --git a/tools/updater/utils.c b/tools/updater/utils.c deleted file mode 100644 index 61a611876..000000000 --- a/tools/updater/utils.c +++ /dev/null @@ -1,148 +0,0 @@ -#include <common.h> -#include <asm/processor.h> -#include <memio.h> -#include <linux/ctype.h> - -static __inline__ unsigned long -get_msr(void) -{ -	unsigned long msr; - -	asm volatile("mfmsr %0" : "=r" (msr) :); -	return msr; -} - -static __inline__ void -set_msr(unsigned long msr) -{ -	asm volatile("mtmsr %0" : : "r" (msr)); -} - -static __inline__ unsigned long -get_dec(void) -{ -	unsigned long val; - -	asm volatile("mfdec %0" : "=r" (val) :); -	return val; -} - - -static __inline__ void -set_dec(unsigned long val) -{ -	asm volatile("mtdec %0" : : "r" (val)); -} - - -void -enable_interrupts(void) -{ -    set_msr (get_msr() | MSR_EE); -} - -/* returns flag if MSR_EE was set before */ -int -disable_interrupts(void) -{ -    ulong msr; - -    msr = get_msr(); -    set_msr (msr & ~MSR_EE); -    return ((msr & MSR_EE) != 0); -} - -u8 in8(u32 port) -{ -    return in_byte(port); -} - -void out8(u32 port, u8 val) -{ -    out_byte(port, val); -} - -unsigned long in32(u32 port) -{ -    return in_long(port); -} - -unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base) -{ -	unsigned long result = 0,value; - -	if (*cp == '0') { -		cp++; -		if ((*cp == 'x') && isxdigit(cp[1])) { -			base = 16; -			cp++; -		} -		if (!base) { -			base = 8; -		} -	} -	if (!base) { -		base = 10; -	} -	while (isxdigit(*cp) && (value = isdigit(*cp) ? *cp-'0' : (islower(*cp) -	    ? toupper(*cp) : *cp)-'A'+10) < base) { -		result = result*base + value; -		cp++; -	} -	if (endp) -		*endp = (char *)cp; -	return result; -} - -long simple_strtol(const char *cp,char **endp,unsigned int base) -{ -	if(*cp=='-') -		return -simple_strtoul(cp+1,endp,base); -	return simple_strtoul(cp,endp,base); -} - -static inline void -soft_restart(unsigned long addr) -{ -	/* SRR0 has system reset vector, SRR1 has default MSR value */ -	/* rfi restores MSR from SRR1 and sets the PC to the SRR0 value */ - -	__asm__ __volatile__ ("mtspr    26, %0"         :: "r" (addr)); -	__asm__ __volatile__ ("li       4, (1 << 6)"    ::: "r4"); -	__asm__ __volatile__ ("mtspr    27, 4"); -	__asm__ __volatile__ ("rfi"); - -	while(1);       /* not reached */ -} - -void -do_reset (void) -{ -	ulong addr; -	/* flush and disable I/D cache */ -	__asm__ __volatile__ ("mfspr    3, 1008"        ::: "r3"); -	__asm__ __volatile__ ("ori      5, 5, 0xcc00"   ::: "r5"); -	__asm__ __volatile__ ("ori      4, 3, 0xc00"    ::: "r4"); -	__asm__ __volatile__ ("andc     5, 3, 5"        ::: "r5"); -	__asm__ __volatile__ ("sync"); -	__asm__ __volatile__ ("mtspr    1008, 4"); -	__asm__ __volatile__ ("isync"); -	__asm__ __volatile__ ("sync"); -	__asm__ __volatile__ ("mtspr    1008, 5"); -	__asm__ __volatile__ ("isync"); -	__asm__ __volatile__ ("sync"); - -#ifdef CONFIG_SYS_RESET_ADDRESS -	addr = CONFIG_SYS_RESET_ADDRESS; -#else -	/* -	 * note: when CONFIG_SYS_MONITOR_BASE points to a RAM address, -	 * CONFIG_SYS_MONITOR_BASE - sizeof (ulong) is usually a valid -	 * address. Better pick an address known to be invalid on your -	 * system and assign it to CONFIG_SYS_RESET_ADDRESS. -	 */ -	addr = CONFIG_SYS_MONITOR_BASE - sizeof (ulong); -#endif -	soft_restart(addr); -	while(1);       /* not reached */ -} |