diff options
Diffstat (limited to 'include')
204 files changed, 4303 insertions, 342 deletions
| diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h index 5416f468b..8cfc3fa77 100644 --- a/include/asm-generic/global_data.h +++ b/include/asm-generic/global_data.h @@ -68,9 +68,6 @@ typedef struct global_data {  	unsigned long env_addr;	/* Address  of Environment struct */  	unsigned long env_valid;	/* Checksum of Environment valid? */ -	/* TODO: is this the same as relocaddr, or something else? */ -	unsigned long dest_addr;	/* Post-relocation address of U-Boot */ -	unsigned long dest_addr_sp;  	unsigned long ram_top;	/* Top address of RAM used by U-Boot */  	unsigned long relocaddr;	/* Start address of U-Boot in RAM */ @@ -85,6 +82,9 @@ typedef struct global_data {  	unsigned long fdt_size;	/* Space reserved for relocated FDT */  	void **jt;		/* jump table */  	char env_buf[32];	/* buffer for getenv() before reloc. */ +#ifdef CONFIG_TRACE +	void		*trace_buff;	/* The trace buffer */ +#endif  	struct arch_global_data arch;	/* architecture-specific data */  } gd_t;  #endif diff --git a/include/bootstage.h b/include/bootstage.h index 6dc0422ba..ef07a87e8 100644 --- a/include/bootstage.h +++ b/include/bootstage.h @@ -37,6 +37,24 @@ enum bootstage_flags {  	BOOTSTAGEF_ALLOC	= 1 << 1,	/* Allocate an id */  }; +/* bootstate sub-IDs used for kernel and ramdisk ranges */ +enum { +	BOOTSTAGE_SUB_FORMAT, +	BOOTSTAGE_SUB_FORMAT_OK, +	BOOTSTAGE_SUB_NO_UNIT_NAME, +	BOOTSTAGE_SUB_UNIT_NAME, +	BOOTSTAGE_SUB_SUBNODE, + +	BOOTSTAGE_SUB_CHECK, +	BOOTSTAGE_SUB_HASH = 5, +	BOOTSTAGE_SUB_CHECK_ARCH = 5, +	BOOTSTAGE_SUB_CHECK_ALL, +	BOOTSTAGE_SUB_GET_DATA, +	BOOTSTAGE_SUB_CHECK_ALL_OK = 7, +	BOOTSTAGE_SUB_GET_DATA_OK, +	BOOTSTAGE_SUB_LOAD, +}; +  /*   * A list of boot stages that we know about. Each of these indicates the   * state that we are at, and the action that we are about to perform. For @@ -137,43 +155,24 @@ enum bootstage_id {  	BOOTSTAGE_ID_NET_DONE_ERR,  	BOOTSTAGE_ID_NET_DONE, +	BOOTSTAGE_ID_FIT_FDT_START = 90,  	/*  	 * Boot stages related to loading a FIT image. Some of these are a  	 * bit wonky.  	 */ -	BOOTSTAGE_ID_FIT_FORMAT = 100, -	BOOTSTAGE_ID_FIT_NO_UNIT_NAME, -	BOOTSTAGE_ID_FIT_UNIT_NAME, -	BOOTSTAGE_ID_FIT_CONFIG, -	BOOTSTAGE_ID_FIT_CHECK_SUBIMAGE, -	BOOTSTAGE_ID_FIT_CHECK_HASH = 104, - -	BOOTSTAGE_ID_FIT_CHECK_ARCH, -	BOOTSTAGE_ID_FIT_CHECK_KERNEL, -	BOOTSTAGE_ID_FIT_CHECKED, +	BOOTSTAGE_ID_FIT_KERNEL_START = 100, -	BOOTSTAGE_ID_FIT_KERNEL_INFO_ERR = 107, -	BOOTSTAGE_ID_FIT_KERNEL_INFO, +	BOOTSTAGE_ID_FIT_CONFIG = 110,  	BOOTSTAGE_ID_FIT_TYPE, +	BOOTSTAGE_ID_FIT_KERNEL_INFO,  	BOOTSTAGE_ID_FIT_COMPRESSION,  	BOOTSTAGE_ID_FIT_OS,  	BOOTSTAGE_ID_FIT_LOADADDR,  	BOOTSTAGE_ID_OVERWRITTEN, -	BOOTSTAGE_ID_FIT_RD_FORMAT = 120, -	BOOTSTAGE_ID_FIT_RD_FORMAT_OK, -	BOOTSTAGE_ID_FIT_RD_NO_UNIT_NAME, -	BOOTSTAGE_ID_FIT_RD_UNIT_NAME, -	BOOTSTAGE_ID_FIT_RD_SUBNODE, - -	BOOTSTAGE_ID_FIT_RD_CHECK, -	BOOTSTAGE_ID_FIT_RD_HASH = 125, -	BOOTSTAGE_ID_FIT_RD_CHECK_ALL, -	BOOTSTAGE_ID_FIT_RD_GET_DATA, -	BOOTSTAGE_ID_FIT_RD_CHECK_ALL_OK = 127, -	BOOTSTAGE_ID_FIT_RD_GET_DATA_OK, -	BOOTSTAGE_ID_FIT_RD_LOAD, +	/* Next 10 IDs used by BOOTSTAGE_SUB_... */ +	BOOTSTAGE_ID_FIT_RD_START = 120,	/* Ramdisk stages */  	BOOTSTAGE_ID_IDE_FIT_READ = 140,  	BOOTSTAGE_ID_IDE_FIT_READ_OK, diff --git a/include/command.h b/include/command.h index 65692fd2a..9e05ddc13 100644 --- a/include/command.h +++ b/include/command.h @@ -110,6 +110,8 @@ static inline int bootm_maybe_autostart(cmd_tbl_t *cmdtp, const char *cmd)  }  #endif +extern int do_bootz(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]); +  extern int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc,  			   char *const argv[]); diff --git a/include/common.h b/include/common.h index e682bd823..e5220cf67 100644 --- a/include/common.h +++ b/include/common.h @@ -310,9 +310,6 @@ int	readline_into_buffer(const char *const prompt, char *buffer,  int	parse_line (char *, char *[]);  void	init_cmd_timeout(void);  void	reset_cmd_timeout(void); -#ifdef CONFIG_MENU -int	abortboot(int bootdelay); -#endif  extern char console_buffer[];  /* arch/$(ARCH)/lib/board.c */ @@ -753,6 +750,10 @@ void	irq_install_handler(int, interrupt_handler_t *, void *);  void	irq_free_handler   (int);  void	reset_timer	   (void);  ulong	get_timer	   (ulong base); + +/* Return value of monotonic microsecond timer */ +unsigned long timer_get_us(void); +  void	enable_interrupts  (void);  int	disable_interrupts (void); diff --git a/include/commproc.h b/include/commproc.h index 7ca28c836..6959905ef 100644 --- a/include/commproc.h +++ b/include/commproc.h @@ -127,6 +127,7 @@ typedef struct cpm_buf_desc {  */  #define PROFF_SCC1	((uint)0x0000)  #define PROFF_IIC	((uint)0x0080) +#define PROFF_REVNUM	((uint)0x00b0)  #define PROFF_SCC2	((uint)0x0100)  #define PROFF_SPI	((uint)0x0180)  #define PROFF_SCC3	((uint)0x0200) diff --git a/include/configs/A3000.h b/include/configs/A3000.h index b85244a89..d506a558c 100644 --- a/include/configs/A3000.h +++ b/include/configs/A3000.h @@ -96,6 +96,7 @@   *-----------------------------------------------------------------------   */  #define CONFIG_PCI			/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #undef	CONFIG_PCI_PNP  #define CONFIG_PCI_SCAN_SHOW		/* print pci devices @ startup	*/ diff --git a/include/configs/APC405.h b/include/configs/APC405.h index 9a65cbced..1e392290d 100644 --- a/include/configs/APC405.h +++ b/include/configs/APC405.h @@ -218,6 +218,7 @@  #define PCI_HOST_AUTO		2	/* detected via arbiter enable  */  #define CONFIG_PCI			/* include pci support          */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_HOST PCI_HOST_FORCE	/* select pci host function     */  #define CONFIG_PCI_PNP			/* do pci plug-and-play         */  					/* resource configuration       */ diff --git a/include/configs/AR405.h b/include/configs/AR405.h index 99944766d..7337f5374 100644 --- a/include/configs/AR405.h +++ b/include/configs/AR405.h @@ -157,6 +157,7 @@  #define PCI_HOST_AUTO	2		/* detected via arbiter enable	*/  #define CONFIG_PCI			/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_HOST PCI_HOST_FORCE	/* select pci host function	*/  #define CONFIG_PCI_PNP			/* do pci plug-and-play		*/  					/* resource configuration	*/ diff --git a/include/configs/ASH405.h b/include/configs/ASH405.h index 09aa763c1..35c37731c 100644 --- a/include/configs/ASH405.h +++ b/include/configs/ASH405.h @@ -172,6 +172,7 @@  #define PCI_HOST_AUTO	2		/* detected via arbiter enable	*/  #define CONFIG_PCI			/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_HOST PCI_HOST_HOST	/* select pci host function	*/  #undef	CONFIG_PCI_PNP			/* do pci plug-and-play		*/  					/* resource configuration	*/ diff --git a/include/configs/B4860QDS.h b/include/configs/B4860QDS.h index 1c9d08e25..a823f9f3a 100644 --- a/include/configs/B4860QDS.h +++ b/include/configs/B4860QDS.h @@ -34,6 +34,15 @@  #define CONFIG_RESET_VECTOR_ADDRESS	0xfffffffc  #endif +#ifdef CONFIG_SRIO_PCIE_BOOT_SLAVE +/* Set 1M boot space */ +#define CONFIG_SYS_SRIO_PCIE_BOOT_SLAVE_ADDR (CONFIG_SYS_TEXT_BASE & 0xfff00000) +#define CONFIG_SYS_SRIO_PCIE_BOOT_SLAVE_ADDR_PHYS \ +		(0x300000000ull | CONFIG_SYS_SRIO_PCIE_BOOT_SLAVE_ADDR) +#define CONFIG_RESET_VECTOR_ADDRESS 0xfffffffc +#define CONFIG_SYS_NO_FLASH +#endif +  /* High Level Configuration Options */  #define CONFIG_BOOKE  #define CONFIG_E500			/* BOOKE e500 family */ @@ -63,6 +72,7 @@  #define CONFIG_SYS_SRIO  #define CONFIG_SRIO1			/* SRIO port 1 */  #define CONFIG_SRIO2			/* SRIO port 2 */ +#define CONFIG_SRIO_PCIE_BOOT_MASTER  #endif  #define CONFIG_FSL_LAW			/* Use common FSL init code */ @@ -84,14 +94,15 @@  #define CONFIG_ENV_OVERWRITE  #ifdef CONFIG_SYS_NO_FLASH +#if !defined(CONFIG_SRIO_PCIE_BOOT_SLAVE) && !defined(CONFIG_RAMBOOT_PBL)  #define CONFIG_ENV_IS_NOWHERE +#endif  #else  #define CONFIG_FLASH_CFI_DRIVER  #define CONFIG_SYS_FLASH_CFI  #define CONFIG_SYS_FLASH_USE_BUFFER_WRITE  #endif -#ifndef CONFIG_SYS_NO_FLASH  #if defined(CONFIG_SPIFLASH)  #define CONFIG_SYS_EXTRA_ENV_RELOC  #define CONFIG_ENV_IS_IN_SPI_FLASH @@ -113,16 +124,18 @@  #define CONFIG_ENV_IS_IN_NAND  #define CONFIG_ENV_SIZE			CONFIG_SYS_NAND_BLOCK_SIZE  #define CONFIG_ENV_OFFSET		(5 * CONFIG_SYS_NAND_BLOCK_SIZE) +#elif defined(CONFIG_SRIO_PCIE_BOOT_SLAVE) +#define CONFIG_ENV_IS_IN_REMOTE +#define CONFIG_ENV_ADDR		0xffe20000 +#define CONFIG_ENV_SIZE		0x2000 +#elif defined(CONFIG_ENV_IS_NOWHERE) +#define CONFIG_ENV_SIZE		0x2000  #else  #define CONFIG_ENV_IS_IN_FLASH  #define CONFIG_ENV_ADDR		(CONFIG_SYS_MONITOR_BASE - CONFIG_ENV_SECT_SIZE)  #define CONFIG_ENV_SIZE		0x2000  #define CONFIG_ENV_SECT_SIZE	0x20000 /* 128K (one sector) */  #endif -#else /* CONFIG_SYS_NO_FLASH */ -#define CONFIG_ENV_SIZE                0x2000 -#define CONFIG_ENV_SECT_SIZE   0x20000 /* 128K (one sector) */ -#endif  #ifndef __ASSEMBLY__  unsigned long get_board_sys_clk(void); @@ -223,7 +236,7 @@ unsigned long get_board_ddr_clk(void);  /* NOR Flash Timing Params */  #define CONFIG_SYS_NOR_CSOR	CSOR_NOR_ADM_SHIFT(4)  #define CONFIG_SYS_NOR_FTIM0	(FTIM0_NOR_TACSE(0x01) | \ -				FTIM0_NOR_TEADC(0x01) | \ +				FTIM0_NOR_TEADC(0x04) | \  				FTIM0_NOR_TEAHC(0x20))  #define CONFIG_SYS_NOR_FTIM1	(FTIM1_NOR_TACO(0x35) | \  				FTIM1_NOR_TRAD_NOR(0x1A) |\ @@ -600,6 +613,16 @@ unsigned long get_board_ddr_clk(void);  #elif defined(CONFIG_NAND)  #define CONFIG_SYS_QE_FMAN_FW_IN_NAND  #define CONFIG_SYS_QE_FMAN_FW_ADDR	(6 * CONFIG_SYS_NAND_BLOCK_SIZE) +#elif defined(CONFIG_SRIO_PCIE_BOOT_SLAVE) +/* + * Slave has no ucode locally, it can fetch this from remote. When implementing + * in two corenet boards, slave's ucode could be stored in master's memory + * space, the address can be mapped from slave TLB->slave LAW-> + * slave SRIO or PCIE outbound window->master inbound window-> + * master LAW->the ucode address in master's memory space. + */ +#define CONFIG_SYS_QE_FMAN_FW_IN_REMOTE +#define CONFIG_SYS_QE_FMAN_FW_ADDR	0xFFE00000  #else  #define CONFIG_SYS_QE_FMAN_FW_IN_NOR  #define CONFIG_SYS_QE_FMAN_FW_ADDR		0xEFF40000 @@ -620,6 +643,7 @@ unsigned long get_board_ddr_clk(void);  #endif  #ifdef CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_NET_MULTI  #define CONFIG_PCI_PNP			/* do pci plug-and-play */  #define CONFIG_E1000 diff --git a/include/configs/BSC9131RDB.h b/include/configs/BSC9131RDB.h index fd076e09a..b5911c694 100644 --- a/include/configs/BSC9131RDB.h +++ b/include/configs/BSC9131RDB.h @@ -40,10 +40,34 @@  #define CONFIG_RESET_VECTOR_ADDRESS	0x1107fffc  #endif -#ifndef CONFIG_SYS_MONITOR_BASE -#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE    /* start of monitor */ +#ifdef CONFIG_NAND +#define CONFIG_SPL +#define CONFIG_SPL_INIT_MINIMAL +#define CONFIG_SPL_SERIAL_SUPPORT +#define CONFIG_SPL_NAND_SUPPORT +#define CONFIG_SPL_NAND_MINIMAL +#define CONFIG_SPL_FLUSH_IMAGE +#define CONFIG_SPL_TARGET		"u-boot-with-spl.bin" + +#define CONFIG_SYS_TEXT_BASE		0x00201000 +#define CONFIG_SPL_TEXT_BASE		0xFFFFE000 +#define CONFIG_SPL_MAX_SIZE		8192 +#define CONFIG_SPL_RELOC_TEXT_BASE	0x00100000 +#define CONFIG_SPL_RELOC_STACK		0x00100000 +#define CONFIG_SYS_NAND_U_BOOT_SIZE	((512 << 10) - 0x2000) +#define CONFIG_SYS_NAND_U_BOOT_DST	(0x00200000 - CONFIG_SPL_MAX_SIZE) +#define CONFIG_SYS_NAND_U_BOOT_START	0x00200000 +#define CONFIG_SYS_NAND_U_BOOT_OFFS	0 +#define CONFIG_SYS_LDSCRIPT	"arch/powerpc/cpu/mpc85xx/u-boot-nand.lds" +#endif + +#ifdef CONFIG_SPL_BUILD +#define CONFIG_SYS_MONITOR_BASE	CONFIG_SPL_TEXT_BASE +#else +#define CONFIG_SYS_MONITOR_BASE	CONFIG_SYS_TEXT_BASE	/* start of monitor */  #endif +  /* High Level Configuration Options */  #define CONFIG_BOOKE			/* BOOKE */  #define CONFIG_E500			/* BOOKE e500 family */ @@ -55,7 +79,11 @@  #define CONFIG_ENV_OVERWRITE  #define CONFIG_DDR_CLK_FREQ	66666666 /* DDRCLK on 9131 RDB */ +#if defined(CONFIG_SYS_CLK_100) +#define CONFIG_SYS_CLK_FREQ    100000000 /* SYSCLK for 9131 RDB */ +#else  #define CONFIG_SYS_CLK_FREQ	66666666 /* SYSCLK for 9131 RDB */ +#endif  #define CONFIG_HWCONFIG  /* @@ -125,16 +153,21 @@ extern unsigned long get_sdram_size(void);  #define CONFIG_SYS_IMMR		CONFIG_SYS_CCSRBAR	/* PQII uses */  							/* CONFIG_SYS_IMMR */ +/* DSP CCSRBAR */ +#define CONFIG_SYS_FSL_DSP_CCSRBAR	CONFIG_SYS_FSL_DSP_CCSRBAR_DEFAULT +#define CONFIG_SYS_FSL_DSP_CCSRBAR_PHYS	CONFIG_SYS_FSL_DSP_CCSRBAR_DEFAULT  /*   * Memory map   *   * 0x0000_0000	0x3FFF_FFFF	DDR			1G cacheable   * 0x8800_0000	0x8810_0000	IFC internal SRAM		1M + * 0xB000_0000	0xB0FF_FFFF	DSP core M2 memory	16M   * 0xC100_0000	0xC13F_FFFF	MAPLE-2F		4M   * 0xC1F0_0000	0xC1F3_FFFF	PA L2 SRAM Region 0	256K   * 0xC1F8_0000	0xC1F9_FFFF	PA L2 SRAM Region 1	128K   * 0xFED0_0000	0xFED0_3FFF	SEC Secured RAM		16K + * 0xFF60_0000	0xFF6F_FFFF	DSP CCSR		1M   * 0xFF70_0000	0xFF7F_FFFF	PA CCSR			1M   * 0xFF80_0000	0xFFFF_FFFF	Boot Page & NAND flash buffer	8M   * @@ -214,6 +247,9 @@ extern unsigned long get_sdram_size(void);  #define CONFIG_SYS_NS16550_SERIAL  #define CONFIG_SYS_NS16550_REG_SIZE	1  #define CONFIG_SYS_NS16550_CLK		get_bus_freq(0) +#ifdef CONFIG_SPL_BUILD +#define CONFIG_NS16550_MIN_FUNCTIONS +#endif  #define CONFIG_SYS_CONSOLE_IS_IN_ENV	/* determine from environment */ @@ -295,7 +331,6 @@ extern unsigned long get_sdram_size(void);  /*   * Environment   */ -#if defined(CONFIG_SYS_RAMBOOT)  #if defined(CONFIG_RAMBOOT_SPIFLASH)  #define CONFIG_ENV_IS_IN_SPI_FLASH  #define CONFIG_ENV_SPI_BUS	0 @@ -305,15 +340,16 @@ extern unsigned long get_sdram_size(void);  #define CONFIG_ENV_OFFSET	0x100000	/* 1MB */  #define CONFIG_ENV_SECT_SIZE	0x10000  #define CONFIG_ENV_SIZE		0x2000 -#else -#define CONFIG_ENV_IS_NOWHERE		/* Store ENV in memory only */ -#define CONFIG_ENV_ADDR			(CONFIG_SYS_MONITOR_BASE - 0x1000) -#define CONFIG_ENV_SIZE			0x2000 -#endif -#else -#define CONFIG_ENV_IS_NOWHERE	1	/* Store ENV in memory only */ +#elif defined(CONFIG_NAND) +#define CONFIG_ENV_IS_IN_NAND +#define CONFIG_SYS_EXTRA_ENV_RELOC +#define CONFIG_ENV_SIZE		CONFIG_SYS_NAND_BLOCK_SIZE +#define CONFIG_ENV_OFFSET	((512 * 1024) + CONFIG_SYS_NAND_BLOCK_SIZE) +#define CONFIG_ENV_RANGE	(3 * CONFIG_ENV_SIZE) +#elif defined(CONFIG_SYS_RAMBOOT) +#define CONFIG_ENV_IS_NOWHERE	/* Store ENV in memory only */  #define CONFIG_ENV_ADDR		(CONFIG_SYS_MONITOR_BASE - 0x1000) -#define CONFIG_ENV_SIZE		0x400 +#define CONFIG_ENV_SIZE		0x2000  #endif  #define CONFIG_LOADS_ECHO		/* echo on for serial download */ @@ -406,7 +442,9 @@ extern unsigned long get_sdram_size(void);  	"fdtfile=bsc9131rdb.dtb\0"		\  	"bdev=sda1\0"	\  	"hwconfig=usb1:dr_mode=host,phy_type=ulpi\0"	\ -	"othbootargs=ramdisk_size=600000 \0" \ +	"bootm_size=0x37000000\0"	\ +	"othbootargs=ramdisk_size=600000 " \ +	"default_hugepagesz=256m hugepagesz=256m hugepages=1\0" \  	"usbext2boot=setenv bootargs root=/dev/ram rw "	\  	"console=$consoledev,$baudrate $othbootargs; "	\  	"usb start;"			\ diff --git a/include/configs/BSC9132QDS.h b/include/configs/BSC9132QDS.h index 431c68696..3aa44435a 100644 --- a/include/configs/BSC9132QDS.h +++ b/include/configs/BSC9132QDS.h @@ -49,6 +49,27 @@  #define CONFIG_RESET_VECTOR_ADDRESS	0x1107fffc  #endif +#ifdef CONFIG_NAND +#define CONFIG_SPL +#define CONFIG_SPL_INIT_MINIMAL +#define CONFIG_SPL_SERIAL_SUPPORT +#define CONFIG_SPL_NAND_SUPPORT +#define CONFIG_SPL_NAND_MINIMAL +#define CONFIG_SPL_FLUSH_IMAGE +#define CONFIG_SPL_TARGET		"u-boot-with-spl.bin" + +#define CONFIG_SYS_TEXT_BASE		0x00201000 +#define CONFIG_SPL_TEXT_BASE		0xFFFFE000 +#define CONFIG_SPL_MAX_SIZE		8192 +#define CONFIG_SPL_RELOC_TEXT_BASE	0x00100000 +#define CONFIG_SPL_RELOC_STACK		0x00100000 +#define CONFIG_SYS_NAND_U_BOOT_SIZE	((512 << 10) - 0x2000) +#define CONFIG_SYS_NAND_U_BOOT_DST	(0x00200000 - CONFIG_SPL_MAX_SIZE) +#define CONFIG_SYS_NAND_U_BOOT_START	0x00200000 +#define CONFIG_SYS_NAND_U_BOOT_OFFS	0 +#define CONFIG_SYS_LDSCRIPT	"arch/powerpc/cpu/mpc85xx/u-boot-nand.lds" +#endif +  #ifndef CONFIG_SYS_TEXT_BASE  #define CONFIG_SYS_TEXT_BASE		0x8ff80000  #endif @@ -57,11 +78,12 @@  #define CONFIG_RESET_VECTOR_ADDRESS	0x8ffffffc  #endif -#ifndef CONFIG_SYS_MONITOR_BASE -#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE    /* start of monitor */ +#ifdef CONFIG_SPL_BUILD +#define CONFIG_SYS_MONITOR_BASE	CONFIG_SPL_TEXT_BASE +#else +#define CONFIG_SYS_MONITOR_BASE	CONFIG_SYS_TEXT_BASE	/* start of monitor */  #endif -  /* High Level Configuration Options */  #define CONFIG_BOOKE			/* BOOKE */  #define CONFIG_E500			/* BOOKE e500 family */ @@ -73,6 +95,7 @@  #if defined(CONFIG_PCI)  #define CONFIG_PCIE1			/* PCIE controler 1 (slot 1) */  #define CONFIG_FSL_PCI_INIT		/* Use common FSL init code */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_FSL_PCIE_RESET		/* need PCIe reset errata */  #define CONFIG_SYS_PCI_64BIT		/* enable 64-bit PCI resources */ @@ -221,6 +244,10 @@ combinations. this should be removed later   * IFC Definitions   */  /* NOR Flash on IFC */ + +#ifdef CONFIG_SPL_BUILD +#define CONFIG_SYS_NO_FLASH +#endif  #define CONFIG_SYS_FLASH_BASE		0x88000000  #define CONFIG_SYS_MAX_FLASH_SECT	1024	/* Max number of sector: 32M */ @@ -301,7 +328,9 @@ combinations. this should be removed later  #define CONFIG_SYS_NAND_BLOCK_SIZE	(128 * 1024) +#ifndef CONFIG_SPL_BUILD  #define CONFIG_FSL_QIXIS +#endif  #ifdef CONFIG_FSL_QIXIS  #define CONFIG_SYS_FPGA_BASE	0xffb00000  #define CONFIG_SYS_I2C_FPGA_ADDR	0x66 @@ -337,6 +366,22 @@ combinations. this should be removed later  #endif  /* Set up IFC registers for boot location NOR/NAND */ +#if defined(CONFIG_NAND) +#define CONFIG_SYS_CSPR0		CONFIG_SYS_NAND_CSPR +#define CONFIG_SYS_AMASK0		CONFIG_SYS_NAND_AMASK +#define CONFIG_SYS_CSOR0		CONFIG_SYS_NAND_CSOR +#define CONFIG_SYS_CS0_FTIM0		CONFIG_SYS_NAND_FTIM0 +#define CONFIG_SYS_CS0_FTIM1		CONFIG_SYS_NAND_FTIM1 +#define CONFIG_SYS_CS0_FTIM2		CONFIG_SYS_NAND_FTIM2 +#define CONFIG_SYS_CS0_FTIM3		CONFIG_SYS_NAND_FTIM3 +#define CONFIG_SYS_CSPR1		CONFIG_SYS_NOR_CSPR +#define CONFIG_SYS_AMASK1		CONFIG_SYS_NOR_AMASK +#define CONFIG_SYS_CSOR1		CONFIG_SYS_NOR_CSOR +#define CONFIG_SYS_CS1_FTIM0		CONFIG_SYS_NOR_FTIM0 +#define CONFIG_SYS_CS1_FTIM1		CONFIG_SYS_NOR_FTIM1 +#define CONFIG_SYS_CS1_FTIM2		CONFIG_SYS_NOR_FTIM2 +#define CONFIG_SYS_CS1_FTIM3		CONFIG_SYS_NOR_FTIM3 +#else  #define CONFIG_SYS_CSPR0		CONFIG_SYS_NOR_CSPR  #define CONFIG_SYS_AMASK0		CONFIG_SYS_NOR_AMASK  #define CONFIG_SYS_CSOR0		CONFIG_SYS_NOR_CSOR @@ -351,6 +396,7 @@ combinations. this should be removed later  #define CONFIG_SYS_CS1_FTIM1		CONFIG_SYS_NAND_FTIM1  #define CONFIG_SYS_CS1_FTIM2		CONFIG_SYS_NAND_FTIM2  #define CONFIG_SYS_CS1_FTIM3		CONFIG_SYS_NAND_FTIM3 +#endif  #define CONFIG_BOARD_EARLY_INIT_F	/* Call board_pre_init */  #define CONFIG_BOARD_EARLY_INIT_R @@ -373,6 +419,9 @@ combinations. this should be removed later  #define CONFIG_SYS_NS16550_SERIAL  #define CONFIG_SYS_NS16550_REG_SIZE	1  #define CONFIG_SYS_NS16550_CLK		get_bus_freq(0) +#ifdef CONFIG_SPL_BUILD +#define CONFIG_NS16550_MIN_FUNCTIONS +#endif  #define CONFIG_SERIAL_MULTI	1 /* Enable both serial ports */  #define CONFIG_SYS_CONSOLE_IS_IN_ENV	/* determine from environment */ @@ -502,7 +551,6 @@ combinations. this should be removed later  /*   * Environment   */ -#if defined(CONFIG_SYS_RAMBOOT)  #if defined(CONFIG_RAMBOOT_SDCARD)  #define CONFIG_ENV_IS_IN_MMC  #define CONFIG_SYS_MMC_ENV_DEV		0 @@ -516,11 +564,15 @@ combinations. this should be removed later  #define CONFIG_ENV_OFFSET	0x100000	/* 1MB */  #define CONFIG_ENV_SECT_SIZE	0x10000  #define CONFIG_ENV_SIZE		0x2000 -#else +#elif defined(CONFIG_NAND) +#define CONFIG_ENV_IS_IN_NAND +#define CONFIG_ENV_SIZE		CONFIG_SYS_NAND_BLOCK_SIZE +#define CONFIG_ENV_OFFSET	((512 * 1024) + CONFIG_SYS_NAND_BLOCK_SIZE) +#define CONFIG_ENV_RANGE	(3 * CONFIG_ENV_SIZE) +#elif defined(CONFIG_SYS_RAMBOOT)  #define CONFIG_ENV_IS_NOWHERE		/* Store ENV in memory only */  #define CONFIG_ENV_ADDR			(CONFIG_SYS_MONITOR_BASE - 0x1000)  #define CONFIG_ENV_SIZE			0x2000 -#endif  #else  #define CONFIG_ENV_IS_IN_FLASH  #if CONFIG_SYS_MONITOR_BASE > 0xfff80000 diff --git a/include/configs/CATcenter.h b/include/configs/CATcenter.h index 1e3a5640e..7017f8c19 100644 --- a/include/configs/CATcenter.h +++ b/include/configs/CATcenter.h @@ -327,6 +327,7 @@  #define PCI_HOST_AUTO	2		/* detected via arbiter enable	*/  #define CONFIG_PCI			/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_HOST PCI_HOST_FORCE	 /* select pci host function	 */  #undef	CONFIG_PCI_PNP			/* do pci plug-and-play		*/  					/* resource configuration	*/ diff --git a/include/configs/CPC45.h b/include/configs/CPC45.h index e102c365c..c7904a188 100644 --- a/include/configs/CPC45.h +++ b/include/configs/CPC45.h @@ -450,6 +450,7 @@   *-----------------------------------------------------------------------   */  #define CONFIG_PCI			/* include pci support			*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_SYS_EARLY_PCI_INIT  #undef	CONFIG_PCI_PNP  #undef	CONFIG_PCI_SCAN_SHOW diff --git a/include/configs/CPCI2DP.h b/include/configs/CPCI2DP.h index 11cf58b14..bbd93ac50 100644 --- a/include/configs/CPCI2DP.h +++ b/include/configs/CPCI2DP.h @@ -146,6 +146,7 @@  #define PCI_HOST_AUTO   2               /* detected via arbiter enable  */  #define CONFIG_PCI			/* include pci support	        */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_HOST	PCI_HOST_AUTO   /* select pci host function     */  #define CONFIG_PCI_PNP			/* do pci plug-and-play         */  					/* resource configuration       */ diff --git a/include/configs/CPCI405.h b/include/configs/CPCI405.h index e3e5ebc53..36476e013 100644 --- a/include/configs/CPCI405.h +++ b/include/configs/CPCI405.h @@ -155,6 +155,7 @@  #define PCI_HOST_AUTO   2               /* detected via arbiter enable  */  #define CONFIG_PCI			/* include pci support	        */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_HOST	PCI_HOST_AUTO   /* select pci host function     */  #define CONFIG_PCI_PNP			/* do pci plug-and-play         */  					/* resource configuration       */ diff --git a/include/configs/CPCI4052.h b/include/configs/CPCI4052.h index c4fff486d..4c12c85c2 100644 --- a/include/configs/CPCI4052.h +++ b/include/configs/CPCI4052.h @@ -176,6 +176,7 @@  #define PCI_HOST_AUTO   2               /* detected via arbiter enable  */  #define CONFIG_PCI			/* include pci support	        */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_HOST	PCI_HOST_AUTO   /* select pci host function     */  #define CONFIG_PCI_PNP			/* do pci plug-and-play         */  					/* resource configuration       */ diff --git a/include/configs/CPCI405AB.h b/include/configs/CPCI405AB.h index 9122cbd87..96b6c0ab6 100644 --- a/include/configs/CPCI405AB.h +++ b/include/configs/CPCI405AB.h @@ -173,6 +173,7 @@  #define PCI_HOST_AUTO	2		/* detected via arbiter enable	*/  #define CONFIG_PCI			/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_HOST PCI_HOST_AUTO	/* select pci host function	*/  #define CONFIG_PCI_PNP			/* do pci plug-and-play		*/  					/* resource configuration	*/ diff --git a/include/configs/CPCI405DT.h b/include/configs/CPCI405DT.h index f778af7e3..c4cc5fd73 100644 --- a/include/configs/CPCI405DT.h +++ b/include/configs/CPCI405DT.h @@ -177,6 +177,7 @@  #define PCI_HOST_AUTO   2               /* detected via arbiter enable  */  #define CONFIG_PCI			/* include pci support	        */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_HOST	PCI_HOST_AUTO   /* select pci host function     */  #define CONFIG_PCI_PNP			/* do pci plug-and-play         */  					/* resource configuration       */ diff --git a/include/configs/CPCIISER4.h b/include/configs/CPCIISER4.h index 35daed05e..78c66c76a 100644 --- a/include/configs/CPCIISER4.h +++ b/include/configs/CPCIISER4.h @@ -140,6 +140,7 @@  #define PCI_HOST_AUTO	2		/* detected via arbiter enable	*/  #define CONFIG_PCI			/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_HOST PCI_HOST_AUTO	/* select pci host function	*/  #define CONFIG_PCI_PNP			/* do pci plug-and-play		*/  					/* resource configuration	*/ diff --git a/include/configs/CPU87.h b/include/configs/CPU87.h index aa5ce2958..3e9c21cc9 100644 --- a/include/configs/CPU87.h +++ b/include/configs/CPU87.h @@ -192,6 +192,7 @@  #define CONFIG_CMD_I2C  #ifdef CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE      #define CONFIG_CMD_PCI  #endif diff --git a/include/configs/CU824.h b/include/configs/CU824.h index a3ceed17f..6632196ad 100644 --- a/include/configs/CU824.h +++ b/include/configs/CU824.h @@ -288,6 +288,7 @@   *-----------------------------------------------------------------------   */  #define CONFIG_PCI			/* include pci support			*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #undef CONFIG_PCI_PNP diff --git a/include/configs/DU440.h b/include/configs/DU440.h index bbe271303..4970ea657 100644 --- a/include/configs/DU440.h +++ b/include/configs/DU440.h @@ -357,6 +357,7 @@ int du440_phy_addr(int devnum);   * PCI stuff   */  #define CONFIG_PCI			/* include pci support	        */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_PNP			/* do (not) pci plug-and-play   */  #define CONFIG_PCI_SCAN_SHOW		/* show pci devices on startup  */  #define CONFIG_SYS_PCI_TARGBASE       0x80000000 /* PCIaddr mapped to CONFIG_SYS_PCI_MEMBASE*/ diff --git a/include/configs/ELPPC.h b/include/configs/ELPPC.h index 220372ccd..d10f4c18a 100644 --- a/include/configs/ELPPC.h +++ b/include/configs/ELPPC.h @@ -242,6 +242,7 @@   * PCI stuff   */  #define CONFIG_PCI                                /* include pci support */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_PNP                            /* pci plug-and-play */  #define CONFIG_PCI_HOST         PCI_HOST_AUTO  #undef  CONFIG_PCI_SCAN_SHOW diff --git a/include/configs/G2000.h b/include/configs/G2000.h index 08ba8404b..b6769ae68 100644 --- a/include/configs/G2000.h +++ b/include/configs/G2000.h @@ -216,6 +216,7 @@  #define PCI_HOST_AUTO   2               /* detected via arbiter enable  */  #define CONFIG_PCI			/* include pci support	        */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_HOST	PCI_HOST_HOST   /* select pci host function     */  #define CONFIG_PCI_PNP			/* do pci plug-and-play         */  					/* resource configuration       */ diff --git a/include/configs/HH405.h b/include/configs/HH405.h index 444413d8d..d65377f58 100644 --- a/include/configs/HH405.h +++ b/include/configs/HH405.h @@ -231,6 +231,7 @@  #define PCI_HOST_AUTO   2               /* detected via arbiter enable  */  #define CONFIG_PCI			/* include pci support	        */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_HOST	PCI_HOST_HOST   /* select pci host function     */  #define CONFIG_PCI_PNP			/* do pci plug-and-play         */  					/* resource configuration       */ diff --git a/include/configs/HIDDEN_DRAGON.h b/include/configs/HIDDEN_DRAGON.h index a62ef6364..dbad1fd6a 100644 --- a/include/configs/HIDDEN_DRAGON.h +++ b/include/configs/HIDDEN_DRAGON.h @@ -93,6 +93,7 @@   *-----------------------------------------------------------------------   */  #define CONFIG_PCI				/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #undef CONFIG_PCI_PNP diff --git a/include/configs/HWW1U1A.h b/include/configs/HWW1U1A.h index 791763aaa..2b72a3348 100644 --- a/include/configs/HWW1U1A.h +++ b/include/configs/HWW1U1A.h @@ -188,6 +188,7 @@  #define CONFIG_PCI_PNP		/* Scan PCI busses			*/  #define CONFIG_CMD_PCI		/* Enable the "pci" command		*/  #define CONFIG_FSL_PCI_INIT	/* Common FreeScale PCI initialization	*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_FSL_PCIE_RESET	/* We have PCI-E reset errata		*/  #define CONFIG_SYS_PCI_64BIT	/* PCI resources are 64-bit		*/  #define CONFIG_PCI_SCAN_SHOW	/* Display PCI scan during boot		*/ diff --git a/include/configs/JSE.h b/include/configs/JSE.h index e0a0d8e46..6ce789d7f 100644 --- a/include/configs/JSE.h +++ b/include/configs/JSE.h @@ -226,6 +226,7 @@  #define PCI_HOST_AUTO	2		/* detected via arbiter enable	*/  #define CONFIG_PCI			/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_HOST PCI_HOST_FORCE	/* select pci host function	*/  #undef	CONFIG_PCI_PNP			/* do pci plug-and-play		*/  					/* resource configuration	*/ diff --git a/include/configs/KAREF.h b/include/configs/KAREF.h index 546e28b8f..8d5e8ff65 100644 --- a/include/configs/KAREF.h +++ b/include/configs/KAREF.h @@ -268,6 +268,7 @@   *----------------------------------------------------------------------*/  /* General PCI */  #define CONFIG_PCI			     /* include pci support	*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_PNP			     /* do pci plug-and-play	*/  #define CONFIG_PCI_SCAN_SHOW		     /* show pci devices	*/  #define CONFIG_SYS_PCI_TARGBASE      (CONFIG_SYS_PCI_MEMBASE) diff --git a/include/configs/MERGERBOX.h b/include/configs/MERGERBOX.h index 30fb6c2ff..249663951 100644 --- a/include/configs/MERGERBOX.h +++ b/include/configs/MERGERBOX.h @@ -36,6 +36,7 @@  #define CONFIG_SYS_TEXT_BASE	0xFC000000  #define CONFIG_PCI	1 +#define CONFIG_PCI_INDIRECT_BRIDGE 1  #define	CONFIG_MASK_AER_AO  #define CONFIG_DISPLAY_AER_FULL diff --git a/include/configs/METROBOX.h b/include/configs/METROBOX.h index 286f8690a..d1ef559cf 100644 --- a/include/configs/METROBOX.h +++ b/include/configs/METROBOX.h @@ -333,6 +333,7 @@   *----------------------------------------------------------------------*/  /* General PCI */  #define CONFIG_PCI			     /* include pci support	*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_PNP			     /* do pci plug-and-play	*/  #define CONFIG_PCI_SCAN_SHOW		     /* show pci devices	*/  #define CONFIG_SYS_PCI_TARGBASE      (CONFIG_SYS_PCI_MEMBASE) diff --git a/include/configs/MIP405.h b/include/configs/MIP405.h index 979495a72..0d023ab9f 100644 --- a/include/configs/MIP405.h +++ b/include/configs/MIP405.h @@ -206,6 +206,7 @@  #define PCI_HOST_AUTO   2               /* detected via arbiter enable  */  #define CONFIG_PCI			/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_HOST PCI_HOST_FORCE	/* configure as pci-host	*/  #define CONFIG_PCI_PNP			/* pci plug-and-play		*/  					/* resource configuration	*/ diff --git a/include/configs/MOUSSE.h b/include/configs/MOUSSE.h index 1391ce517..b3dbd6fae 100644 --- a/include/configs/MOUSSE.h +++ b/include/configs/MOUSSE.h @@ -330,6 +330,7 @@   *-----------------------------------------------------------------------   */  #define CONFIG_PCI			/* include pci support			*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #undef CONFIG_PCI_PNP diff --git a/include/configs/MPC8260ADS.h b/include/configs/MPC8260ADS.h index c4c41c77d..c312b7781 100644 --- a/include/configs/MPC8260ADS.h +++ b/include/configs/MPC8260ADS.h @@ -195,6 +195,7 @@  /*PCI*/  #if CONFIG_ADSTYPE >= CONFIG_SYS_PQ2FADS  #define CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_PCI_PNP  #define CONFIG_PCI_BOOTDELAY 0  #define CONFIG_PCI_SCAN_SHOW diff --git a/include/configs/MPC8266ADS.h b/include/configs/MPC8266ADS.h index 0474140fb..c5aa58650 100644 --- a/include/configs/MPC8266ADS.h +++ b/include/configs/MPC8266ADS.h @@ -137,6 +137,7 @@  /* PCI */  #define CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_PCI_PNP  #define CONFIG_PCI_BOOTDELAY 0  #undef CONFIG_PCI_SCAN_SHOW diff --git a/include/configs/MPC8308RDB.h b/include/configs/MPC8308RDB.h index 95a1885ac..f10555ce0 100644 --- a/include/configs/MPC8308RDB.h +++ b/include/configs/MPC8308RDB.h @@ -402,6 +402,7 @@  #define CONFIG_SYS_SCCR_PCIEXP1CM	1  #define CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_PCIE  #define CONFIG_PCI_PNP		/* do pci plug-and-play */ diff --git a/include/configs/MPC8313ERDB.h b/include/configs/MPC8313ERDB.h index c28dfe006..1d753e76b 100644 --- a/include/configs/MPC8313ERDB.h +++ b/include/configs/MPC8313ERDB.h @@ -76,6 +76,7 @@  #endif  #define CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_FSL_ELBC 1  #define CONFIG_MISC_INIT_R diff --git a/include/configs/MPC8315ERDB.h b/include/configs/MPC8315ERDB.h index 767b9763e..ee806c440 100644 --- a/include/configs/MPC8315ERDB.h +++ b/include/configs/MPC8315ERDB.h @@ -405,6 +405,7 @@  #define CONFIG_SYS_PCIE2_IO_SIZE	0x00800000  #define CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_PCIE  #define CONFIG_PCI_PNP		/* do pci plug-and-play */ diff --git a/include/configs/MPC8323ERDB.h b/include/configs/MPC8323ERDB.h index 8d5ed0f7a..ac4c25396 100644 --- a/include/configs/MPC8323ERDB.h +++ b/include/configs/MPC8323ERDB.h @@ -264,6 +264,7 @@  #define CONFIG_SYS_PCI1_IO_SIZE		0x04000000	/* 64M */  #ifdef CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_PCI_SKIP_HOST_BRIDGE  #define CONFIG_PCI_PNP		/* do pci plug-and-play */ diff --git a/include/configs/MPC832XEMDS.h b/include/configs/MPC832XEMDS.h index f592d3a3a..7c31f4795 100644 --- a/include/configs/MPC832XEMDS.h +++ b/include/configs/MPC832XEMDS.h @@ -360,6 +360,7 @@  #ifdef CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_PCI_PNP		/* do pci plug-and-play */  #define CONFIG_83XX_PCI_STREAMING diff --git a/include/configs/MPC8349EMDS.h b/include/configs/MPC8349EMDS.h index e5529c700..212089c23 100644 --- a/include/configs/MPC8349EMDS.h +++ b/include/configs/MPC8349EMDS.h @@ -666,6 +666,7 @@  /* PCI @ 0x80000000 */  #ifdef CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_SYS_IBAT1L	(CONFIG_SYS_PCI1_MEM_BASE \  				| BATL_PP_RW \  				| BATL_MEMCOHERENCE) diff --git a/include/configs/MPC8349ITX.h b/include/configs/MPC8349ITX.h index 2c3f1f62a..1130b59a2 100644 --- a/include/configs/MPC8349ITX.h +++ b/include/configs/MPC8349ITX.h @@ -393,6 +393,7 @@ boards, we say we have two, but don't display a message if we find only one. */   * PCI   */  #ifdef CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_MPC83XX_PCI2 diff --git a/include/configs/MPC8360EMDS.h b/include/configs/MPC8360EMDS.h index a1fbd5e4a..a71ac2bd3 100644 --- a/include/configs/MPC8360EMDS.h +++ b/include/configs/MPC8360EMDS.h @@ -458,6 +458,7 @@  #ifdef CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_PCI_PNP		/* do pci plug-and-play */  #define CONFIG_83XX_PCI_STREAMING diff --git a/include/configs/MPC8360ERDK.h b/include/configs/MPC8360ERDK.h index fc0095281..fcca5424e 100644 --- a/include/configs/MPC8360ERDK.h +++ b/include/configs/MPC8360ERDK.h @@ -314,6 +314,7 @@  #define CONFIG_SYS_PCI1_IO_SIZE		0x100000 /* 1M */  #ifdef CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_PCI_PNP		/* do pci plug-and-play */ diff --git a/include/configs/MPC837XEMDS.h b/include/configs/MPC837XEMDS.h index 82436618b..480468f2d 100644 --- a/include/configs/MPC837XEMDS.h +++ b/include/configs/MPC837XEMDS.h @@ -395,6 +395,7 @@  #define CONFIG_SYS_PCIE2_IO_SIZE	0x00800000  #ifdef CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #ifndef __ASSEMBLY__  extern int board_pci_host_broken(void);  #endif diff --git a/include/configs/MPC837XERDB.h b/include/configs/MPC837XERDB.h index 9ad7e3a90..d5c9d059e 100644 --- a/include/configs/MPC837XERDB.h +++ b/include/configs/MPC837XERDB.h @@ -421,6 +421,7 @@  #define CONFIG_SYS_PCIE2_IO_SIZE	0x00800000  #ifdef CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_PCI_PNP		/* do pci plug-and-play */  #undef CONFIG_PCI_SCAN_SHOW	/* show pci devices on startup */ diff --git a/include/configs/MPC8536DS.h b/include/configs/MPC8536DS.h index bcd77b608..cc2b7c332 100644 --- a/include/configs/MPC8536DS.h +++ b/include/configs/MPC8536DS.h @@ -84,6 +84,7 @@  #define CONFIG_PCIE2		1	/* PCIE controler 2 (slot 2) */  #define CONFIG_PCIE3		1	/* PCIE controler 3 (ULI bridge) */  #define CONFIG_FSL_PCI_INIT	1	/* Use common FSL init code */ +#define CONFIG_PCI_INDIRECT_BRIDGE 1	/* indirect PCI bridge support */  #define CONFIG_FSL_PCIE_RESET	1	/* need PCIe reset errata */  #define CONFIG_SYS_PCI_64BIT	1	/* enable 64-bit PCI resources */ diff --git a/include/configs/MPC8540ADS.h b/include/configs/MPC8540ADS.h index a0fe15e86..6cb00ee66 100644 --- a/include/configs/MPC8540ADS.h +++ b/include/configs/MPC8540ADS.h @@ -52,6 +52,7 @@  #endif  #define CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_SYS_PCI_64BIT	1	/* enable 64-bit PCI resources */  #define CONFIG_TSEC_ENET		/* tsec ethernet support */  #define CONFIG_ENV_OVERWRITE diff --git a/include/configs/MPC8541CDS.h b/include/configs/MPC8541CDS.h index a6bea153d..d0e6ca65b 100644 --- a/include/configs/MPC8541CDS.h +++ b/include/configs/MPC8541CDS.h @@ -40,6 +40,7 @@  #define	CONFIG_SYS_TEXT_BASE	0xfff80000  #define CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_SYS_PCI_64BIT	1	/* enable 64-bit PCI resources */  #define CONFIG_TSEC_ENET		/* tsec ethernet support */  #define CONFIG_ENV_OVERWRITE diff --git a/include/configs/MPC8544DS.h b/include/configs/MPC8544DS.h index d5f3c5f56..09d0835c6 100644 --- a/include/configs/MPC8544DS.h +++ b/include/configs/MPC8544DS.h @@ -44,6 +44,7 @@  #define CONFIG_PCIE2		1	/* PCIE controler 2 (slot 2) */  #define CONFIG_PCIE3		1	/* PCIE controler 3 (ULI bridge) */  #define CONFIG_FSL_PCI_INIT	1	/* Use common FSL init code */ +#define CONFIG_PCI_INDIRECT_BRIDGE 1	/* indirect PCI bridge support */  #define CONFIG_FSL_PCIE_RESET	1	/* need PCIe reset errata */  #define CONFIG_SYS_PCI_64BIT	1	/* enable 64-bit PCI resources */ diff --git a/include/configs/MPC8548CDS.h b/include/configs/MPC8548CDS.h index 0e22cc7e1..d070f6adc 100644 --- a/include/configs/MPC8548CDS.h +++ b/include/configs/MPC8548CDS.h @@ -52,6 +52,7 @@  #define CONFIG_PCIE1		/* PCIE controler 1 (slot 1) */  #undef CONFIG_PCI2  #define CONFIG_FSL_PCI_INIT	1	/* Use common FSL init code */ +#define CONFIG_PCI_INDIRECT_BRIDGE 1	/* indirect PCI bridge support */  #define CONFIG_FSL_PCIE_RESET	1	/* need PCIe reset errata */  #define CONFIG_SYS_PCI_64BIT	1	/* enable 64-bit PCI resources */ diff --git a/include/configs/MPC8555CDS.h b/include/configs/MPC8555CDS.h index 266cb54c9..483556b31 100644 --- a/include/configs/MPC8555CDS.h +++ b/include/configs/MPC8555CDS.h @@ -40,6 +40,7 @@  #define	CONFIG_SYS_TEXT_BASE	0xfff80000  #define CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_SYS_PCI_64BIT	1	/* enable 64-bit PCI resources */  #define CONFIG_TSEC_ENET		/* tsec ethernet support */  #define CONFIG_ENV_OVERWRITE diff --git a/include/configs/MPC8560ADS.h b/include/configs/MPC8560ADS.h index 35d15f427..525e88fa1 100644 --- a/include/configs/MPC8560ADS.h +++ b/include/configs/MPC8560ADS.h @@ -49,6 +49,7 @@  #define	CONFIG_SYS_TEXT_BASE	0xfff80000  #define CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_SYS_PCI_64BIT	1	/* enable 64-bit PCI resources */  #define CONFIG_TSEC_ENET		/* tsec ethernet support */  #undef CONFIG_ETHER_ON_FCC             /* cpm FCC ethernet support */ diff --git a/include/configs/MPC8568MDS.h b/include/configs/MPC8568MDS.h index 5d69fb66d..f1bfdcbd2 100644 --- a/include/configs/MPC8568MDS.h +++ b/include/configs/MPC8568MDS.h @@ -42,6 +42,7 @@  #define CONFIG_PCI1		1	/* PCI controller */  #define CONFIG_PCIE1		1	/* PCIE controller */  #define CONFIG_FSL_PCI_INIT	1	/* use common fsl pci init code */ +#define CONFIG_PCI_INDIRECT_BRIDGE 1	/* indirect PCI bridge support */  #define CONFIG_FSL_PCIE_RESET	1	/* need PCIe reset errata */  #define CONFIG_SYS_PCI_64BIT	1	/* enable 64-bit PCI resources */  #define CONFIG_TSEC_ENET		/* tsec ethernet support */ diff --git a/include/configs/MPC8569MDS.h b/include/configs/MPC8569MDS.h index acd3276e9..c54755fab 100644 --- a/include/configs/MPC8569MDS.h +++ b/include/configs/MPC8569MDS.h @@ -41,6 +41,7 @@  #define CONFIG_PCI		1	/* Disable PCI/PCIE */  #define CONFIG_PCIE1		1	/* PCIE controller */  #define CONFIG_FSL_PCI_INIT	1	/* use common fsl pci init code */ +#define CONFIG_PCI_INDIRECT_BRIDGE 1	/* indirect PCI bridge support */  #define CONFIG_FSL_PCIE_RESET	1	/* need PCIe reset errata */  #define CONFIG_SYS_PCI_64BIT	1	/* enable 64-bit PCI resources */  #define CONFIG_QE			/* Enable QE */ diff --git a/include/configs/MPC8572DS.h b/include/configs/MPC8572DS.h index d233365b7..25303c4f6 100644 --- a/include/configs/MPC8572DS.h +++ b/include/configs/MPC8572DS.h @@ -71,6 +71,7 @@  #define CONFIG_PCIE2		1	/* PCIE controler 2 (slot 2) */  #define CONFIG_PCIE3		1	/* PCIE controler 3 (ULI bridge) */  #define CONFIG_FSL_PCI_INIT	1	/* Use common FSL init code */ +#define CONFIG_PCI_INDIRECT_BRIDGE 1	/* indirect PCI bridge support */  #define CONFIG_FSL_PCIE_RESET	1	/* need PCIe reset errata */  #define CONFIG_SYS_PCI_64BIT	1	/* enable 64-bit PCI resources */ diff --git a/include/configs/MPC8610HPCD.h b/include/configs/MPC8610HPCD.h index c61982745..f791e7682 100644 --- a/include/configs/MPC8610HPCD.h +++ b/include/configs/MPC8610HPCD.h @@ -51,6 +51,7 @@  #define CONFIG_PCIE1		1	/* PCIe 1 connected to ULI bridge */  #define CONFIG_PCIE2		1	/* PCIe 2 connected to slot */  #define CONFIG_FSL_PCI_INIT	1	/* Use common FSL init code */ +#define CONFIG_PCI_INDIRECT_BRIDGE 1	/* indirect PCI bridge support */  #define CONFIG_SYS_PCI_64BIT	1	/* enable 64-bit PCI resources */  #define CONFIG_FSL_LAW		1	/* Use common FSL init code */ diff --git a/include/configs/MPC8641HPCN.h b/include/configs/MPC8641HPCN.h index 264309772..4a3ca017e 100644 --- a/include/configs/MPC8641HPCN.h +++ b/include/configs/MPC8641HPCN.h @@ -510,6 +510,7 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);   * BAT2		Rapidio Memory   */  #ifdef CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_SYS_DBAT2L	(BAT_PHYS_ADDR(CONFIG_SYS_PCIE1_MEM_PHYS_LOW, \  					       CONFIG_SYS_PCIE1_MEM_PHYS_HIGH) \  				 | BATL_PP_RW | BATL_CACHEINHIBIT \ diff --git a/include/configs/MUSENKI.h b/include/configs/MUSENKI.h index 84a167d2a..8b0415158 100644 --- a/include/configs/MUSENKI.h +++ b/include/configs/MUSENKI.h @@ -87,6 +87,7 @@   *-----------------------------------------------------------------------   */  #define CONFIG_PCI			/* include pci support          */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #undef CONFIG_PCI_PNP diff --git a/include/configs/MVBLM7.h b/include/configs/MVBLM7.h index a9c00acc9..afd4c0356 100644 --- a/include/configs/MVBLM7.h +++ b/include/configs/MVBLM7.h @@ -42,6 +42,7 @@  #define CONFIG_SYS_IMMR		0xE0000000  #define CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_PCI_SKIP_HOST_BRIDGE  #define CONFIG_HARD_I2C  #define CONFIG_TSEC_ENET diff --git a/include/configs/MVBLUE.h b/include/configs/MVBLUE.h index 52d172925..21f286e0f 100644 --- a/include/configs/MVBLUE.h +++ b/include/configs/MVBLUE.h @@ -154,6 +154,7 @@   */  #define CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_PCI_PNP  #define CONFIG_PCI_SCAN_SHOW diff --git a/include/configs/OCRTC.h b/include/configs/OCRTC.h index 47110aff2..4a9341765 100644 --- a/include/configs/OCRTC.h +++ b/include/configs/OCRTC.h @@ -136,6 +136,7 @@  #define PCI_HOST_AUTO	2		/* detected via arbiter enable	*/  #define CONFIG_PCI			/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_HOST PCI_HOST_AUTO	/* select pci host function	*/  #define CONFIG_PCI_PNP			/* do pci plug-and-play		*/  					/* resource configuration	*/ diff --git a/include/configs/ORSG.h b/include/configs/ORSG.h index 9f754c2a8..cd1f4254a 100644 --- a/include/configs/ORSG.h +++ b/include/configs/ORSG.h @@ -134,6 +134,7 @@  #define PCI_HOST_AUTO	2		/* detected via arbiter enable	*/  #define CONFIG_PCI			/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_HOST PCI_HOST_ADAPTER /* select pci adapter		*/  #undef	CONFIG_PCI_PNP			/* no pci plug-and-play		*/  					/* resource configuration	*/ diff --git a/include/configs/P1010RDB.h b/include/configs/P1010RDB.h index 437ee6ee6..7b28a27bc 100644 --- a/include/configs/P1010RDB.h +++ b/include/configs/P1010RDB.h @@ -31,10 +31,10 @@  #define CONFIG_PHYS_64BIT  #endif -#ifdef CONFIG_P1010RDB  #define CONFIG_P1010 +#define CONFIG_E500			/* BOOKE e500 family */ +#include <asm/config_mpc85xx.h>  #define CONFIG_NAND_FSL_IFC -#endif  #ifdef CONFIG_SDCARD  #define CONFIG_RAMBOOT_SDCARD @@ -48,15 +48,25 @@  #define CONFIG_RESET_VECTOR_ADDRESS	0x1107fffc  #endif -#ifdef CONFIG_NAND	/* NAND Boot */ -#define CONFIG_RAMBOOT_NAND -#define CONFIG_NAND_U_BOOT -#define CONFIG_SYS_TEXT_BASE_SPL	0xff800000 -#ifdef CONFIG_NAND_SPL -#define CONFIG_SYS_MONITOR_BASE		CONFIG_SYS_TEXT_BASE_SPL -#else -#define CONFIG_SYS_TEXT_BASE		0x11001000 -#endif /* CONFIG_NAND_SPL */ +#ifdef CONFIG_NAND +#define CONFIG_SPL +#define CONFIG_SPL_INIT_MINIMAL +#define CONFIG_SPL_SERIAL_SUPPORT +#define CONFIG_SPL_NAND_SUPPORT +#define CONFIG_SPL_NAND_MINIMAL +#define CONFIG_SPL_FLUSH_IMAGE +#define CONFIG_SPL_TARGET		"u-boot-with-spl.bin" + +#define CONFIG_SYS_TEXT_BASE		0x00201000 +#define CONFIG_SPL_TEXT_BASE		0xFFFFE000 +#define CONFIG_SPL_MAX_SIZE		8192 +#define CONFIG_SPL_RELOC_TEXT_BASE	0x00100000 +#define CONFIG_SPL_RELOC_STACK		0x00100000 +#define CONFIG_SYS_NAND_U_BOOT_SIZE	((512 << 10) - 0x2000) +#define CONFIG_SYS_NAND_U_BOOT_DST	(0x00200000 - CONFIG_SPL_MAX_SIZE) +#define CONFIG_SYS_NAND_U_BOOT_START	0x00200000 +#define CONFIG_SYS_NAND_U_BOOT_OFFS	0 +#define CONFIG_SYS_LDSCRIPT	"arch/powerpc/cpu/mpc85xx/u-boot-nand.lds"  #endif @@ -74,8 +84,10 @@  #define CONFIG_RESET_VECTOR_ADDRESS	0xeffffffc  #endif -#ifndef CONFIG_SYS_MONITOR_BASE -#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE    /* start of monitor */ +#ifdef CONFIG_SPL_BUILD +#define CONFIG_SYS_MONITOR_BASE	CONFIG_SPL_TEXT_BASE +#else +#define CONFIG_SYS_MONITOR_BASE	CONFIG_SYS_TEXT_BASE	/* start of monitor */  #endif  /* High Level Configuration Options */ @@ -90,6 +102,7 @@  #define CONFIG_PCIE1			/* PCIE controler 1 (slot 1) */  #define CONFIG_PCIE2			/* PCIE controler 2 (slot 2) */  #define CONFIG_FSL_PCI_INIT		/* Use common FSL init code */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_FSL_PCIE_RESET		/* need PCIe reset errata */  #define CONFIG_SYS_PCI_64BIT		/* enable 64-bit PCI resources */ @@ -241,7 +254,7 @@ extern unsigned long get_sdram_size(void);  #define CONFIG_SYS_CCSRBAR_PHYS_LOW		CONFIG_SYS_CCSRBAR  /* Don't relocate CCSRBAR while in NAND_SPL */ -#ifdef CONFIG_NAND_SPL +#ifdef CONFIG_SPL_BUILD  #define CONFIG_SYS_CCSR_DO_NOT_RELOCATE  #endif @@ -267,6 +280,10 @@ extern unsigned long get_sdram_size(void);   * IFC Definitions   */  /* NOR Flash on IFC */ +#ifdef CONFIG_SPL_BUILD +#define CONFIG_SYS_NO_FLASH +#endif +  #define CONFIG_SYS_FLASH_BASE		0xee000000  #define CONFIG_SYS_MAX_FLASH_SECT	256	/* 32M */ @@ -352,7 +369,7 @@ extern unsigned long get_sdram_size(void);  #define CONFIG_SYS_NAND_DDR_LAW		11  /* Set up IFC registers for boot location NOR/NAND */ -#if defined(CONFIG_NAND_U_BOOT) || defined(CONFIG_NAND_SECBOOT) +#if defined(CONFIG_NAND) || defined(CONFIG_NAND_SECBOOT)  #define CONFIG_SYS_CSPR0		CONFIG_SYS_NAND_CSPR  #define CONFIG_SYS_AMASK0		CONFIG_SYS_NAND_AMASK  #define CONFIG_SYS_CSOR0		CONFIG_SYS_NAND_CSOR @@ -384,15 +401,6 @@ extern unsigned long get_sdram_size(void);  #define CONFIG_SYS_CS1_FTIM3		CONFIG_SYS_NAND_FTIM3  #endif -/* NAND boot: 8K NAND loader config */ -#define CONFIG_SYS_NAND_SPL_SIZE	0x2000 -#define CONFIG_SYS_NAND_U_BOOT_SIZE	(512 << 10) -#define CONFIG_SYS_NAND_U_BOOT_DST	(0x11000000 - CONFIG_SYS_NAND_SPL_SIZE) -#define CONFIG_SYS_NAND_U_BOOT_START	0x11000000 -#define CONFIG_SYS_NAND_U_BOOT_OFFS	(0) -#define CONFIG_SYS_NAND_U_BOOT_RELOC	0x10000 -#define CONFIG_SYS_NAND_U_BOOT_RELOC_SP	(CONFIG_SYS_NAND_U_BOOT_RELOC + 0x10000) -  /* CPLD on IFC */  #define CONFIG_SYS_CPLD_BASE		0xffb00000 @@ -420,14 +428,20 @@ extern unsigned long get_sdram_size(void);  #define CONFIG_SYS_CS3_FTIM3		0x0  #endif	/* CONFIG_SDCARD */ -#if defined(CONFIG_RAMBOOT_SDCARD) || defined(CONFIG_RAMBOOT_SPIFLASH) || \ -    defined(CONFIG_RAMBOOT_NAND) +#if defined(CONFIG_RAMBOOT_SDCARD) || defined(CONFIG_RAMBOOT_SPIFLASH)  #define CONFIG_SYS_RAMBOOT  #define CONFIG_SYS_EXTRA_ENV_RELOC  #else  #undef CONFIG_SYS_RAMBOOT  #endif +#ifdef CONFIG_SYS_FSL_ERRATUM_IFC_A003399 +#if !defined(CONFIG_SPL) && !defined(CONFIG_SYS_RAMBOOT)\ +	&& !defined(CONFIG_SECURE_BOOT) +#define CONFIG_A003399_NOR_WORKAROUND +#endif +#endif +  #define CONFIG_BOARD_EARLY_INIT_F	/* Call board_pre_init */  #define CONFIG_BOARD_EARLY_INIT_R @@ -449,7 +463,7 @@ extern unsigned long get_sdram_size(void);  #define CONFIG_SYS_NS16550_SERIAL  #define CONFIG_SYS_NS16550_REG_SIZE	1  #define CONFIG_SYS_NS16550_CLK		get_bus_freq(0) -#ifdef CONFIG_NAND_SPL +#ifdef CONFIG_SPL_BUILD  #define CONFIG_NS16550_MIN_FUNCTIONS  #endif @@ -504,7 +518,7 @@ extern unsigned long get_sdram_size(void);   * SPI interface will not be available in case of NAND boot SPI CS0 will be   * used for SLIC   */ -#if !defined(CONFIG_NAND_U_BOOT) || !defined(CONFIG_NAND_SECBOOT) +#if !defined(CONFIG_NAND) || !defined(CONFIG_NAND_SECBOOT)  /* eSPI - Enhanced SPI */  #define CONFIG_FSL_ESPI  #define CONFIG_SPI_FLASH @@ -599,7 +613,6 @@ extern unsigned long get_sdram_size(void);  /*   * Environment   */ -#if defined(CONFIG_SYS_RAMBOOT)  #if defined(CONFIG_RAMBOOT_SDCARD)  #define CONFIG_ENV_IS_IN_MMC  #define CONFIG_FSL_FIXED_MMC_LOCATION @@ -614,16 +627,15 @@ extern unsigned long get_sdram_size(void);  #define CONFIG_ENV_OFFSET	0x100000	/* 1MB */  #define CONFIG_ENV_SECT_SIZE	0x10000  #define CONFIG_ENV_SIZE		0x2000 -#elif defined(CONFIG_NAND_U_BOOT) +#elif defined(CONFIG_NAND)  #define CONFIG_ENV_IS_IN_NAND  #define CONFIG_ENV_SIZE		CONFIG_SYS_NAND_BLOCK_SIZE -#define CONFIG_ENV_OFFSET	CONFIG_SYS_NAND_U_BOOT_SIZE +#define CONFIG_ENV_OFFSET	((512 * 1024) + CONFIG_SYS_NAND_BLOCK_SIZE)  #define CONFIG_ENV_RANGE	(3 * CONFIG_ENV_SIZE) -#else +#elif defined(CONFIG_SYS_RAMBOOT)  #define CONFIG_ENV_IS_NOWHERE		/* Store ENV in memory only */  #define CONFIG_ENV_ADDR			(CONFIG_SYS_MONITOR_BASE - 0x1000)  #define CONFIG_ENV_SIZE			0x2000 -#endif  #else  #define CONFIG_ENV_IS_IN_FLASH  #if CONFIG_SYS_MONITOR_BASE > 0xfff80000 diff --git a/include/configs/P1022DS.h b/include/configs/P1022DS.h index 8b13b107e..9c27182dc 100644 --- a/include/configs/P1022DS.h +++ b/include/configs/P1022DS.h @@ -316,7 +316,6 @@  #define CONFIG_SYS_HUSH_PARSER  /* Video */ -#define CONFIG_FSL_DIU_FB  #ifdef CONFIG_FSL_DIU_FB  #define CONFIG_SYS_DIU_ADDR	(CONFIG_SYS_CCSRBAR + 0x10000) @@ -336,7 +335,6 @@  #endif  #ifndef CONFIG_FSL_DIU_FB -#define CONFIG_ATI  #endif  #ifdef CONFIG_ATI @@ -458,6 +456,7 @@  #define CONFIG_SYS_PCIE3_IO_SIZE	0x00010000	/* 64k */  #ifdef CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_PCI_PNP			/* do pci plug-and-play */  #define CONFIG_PCI_SCAN_SHOW		/* show pci devices on startup */  #define CONFIG_E1000			/* Define e1000 pci Ethernet card */ diff --git a/include/configs/P1023RDB.h b/include/configs/P1023RDB.h new file mode 100644 index 000000000..fee8040e2 --- /dev/null +++ b/include/configs/P1023RDB.h @@ -0,0 +1,401 @@ +/* + * Copyright 2013 Freescale Semiconductor, Inc. + * + * Authors:  Roy Zang <tie-fei.zang@freescale.com> + *	     Chunhe Lan <Chunhe.Lan@freescale.com> + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef __CONFIG_H +#define __CONFIG_H + +#ifndef CONFIG_SYS_TEXT_BASE +#define CONFIG_SYS_TEXT_BASE	0xeff80000 +#endif + +#ifndef CONFIG_SYS_MONITOR_BASE +#define CONFIG_SYS_MONITOR_BASE	CONFIG_SYS_TEXT_BASE	/* start of monitor */ +#endif + +#ifndef CONFIG_RESET_VECTOR_ADDRESS +#define CONFIG_RESET_VECTOR_ADDRESS	0xeffffffc +#endif + +/* High Level Configuration Options */ +#define CONFIG_BOOKE		/* BOOKE */ +#define CONFIG_E500		/* BOOKE e500 family */ +#define CONFIG_MPC85xx +#define CONFIG_P1023 +#define CONFIG_MP		/* support multiple processors */ + +#define CONFIG_FSL_ELBC		/* Has Enhanced localbus controller */ +#define CONFIG_PCI		/* Enable PCI/PCIE */ +#define CONFIG_PCI_INDIRECT_BRIDGE     /* indirect PCI bridge support */ +#define CONFIG_PCIE1		/* PCIE controler 1 (slot 1) */ +#define CONFIG_PCIE2		/* PCIE controler 2 (slot 2) */ +#define CONFIG_PCIE3		/* PCIE controler 3 (slot 3) */ +#define CONFIG_FSL_PCI_INIT	/* Use common FSL init code */ +#define CONFIG_FSL_PCIE_RESET	/* need PCIe reset errata */ +#define CONFIG_SYS_PCI_64BIT	/* enable 64-bit PCI resources */ +#define CONFIG_FSL_LAW		/* Use common FSL init code */ + +#ifndef __ASSEMBLY__ +extern unsigned long get_clock_freq(void); +#endif + +#define CONFIG_SYS_CLK_FREQ	66666666 +#define CONFIG_DDR_CLK_FREQ	CONFIG_SYS_CLK_FREQ + +/* + * These can be toggled for performance analysis, otherwise use default. + */ +#define CONFIG_L2_CACHE			/* toggle L2 cache */ +#define CONFIG_BTB			/* toggle branch predition */ +#define CONFIG_HWCONFIG + +#define CONFIG_ENABLE_36BIT_PHYS + +#define CONFIG_SYS_MEMTEST_START	0x01000000	/* memtest works on */ +#define CONFIG_SYS_MEMTEST_END		0x02000000 + +#define CONFIG_PANIC_HANG	/* do not reset board on panic */ + +/* Implement conversion of addresses in the LBC */ +#define CONFIG_SYS_LBC_LBCR		0x00000000 +#define CONFIG_SYS_LBC_LCRR		LCRR_CLKDIV_8 + +/* DDR Setup */ +#define CONFIG_VERY_BIG_RAM +#define CONFIG_SYS_DDR_SDRAM_BASE	0x00000000 +#define CONFIG_SYS_SDRAM_BASE		CONFIG_SYS_DDR_SDRAM_BASE + +#define CONFIG_DIMM_SLOTS_PER_CTLR	1 +#define CONFIG_CHIP_SELECTS_PER_CTRL	1 + +#define CONFIG_DDR_SPD +#define CONFIG_FSL_DDR3 +#define CONFIG_FSL_DDR_INTERACTIVE +#define CONFIG_SYS_SDRAM_SIZE		512u	/* DDR is 512M */ +#define CONFIG_SYS_SPD_BUS_NUM          0 +#define SPD_EEPROM_ADDRESS              0x50 +#define CONFIG_SYS_DDR_RAW_TIMING + +/* + * Memory map + * + * 0x0000_0000	0x1fff_ffff	DDR			512M cacheable + * 0x8000_0000	0xbfff_ffff	PCI Express Mem		1G non-cacheable + * 0xc000_0000	0xdfff_ffff	PCI			512M non-cacheable + * 0xe100_0000	0xe3ff_ffff	PCI IO range		4M non-cacheable + * 0xff00_0000	0xff3f_ffff	DPAA_QBMAN		4M cacheable + * 0xff60_0000	0xff7f_ffff	CCSR			2M non-cacheable + * 0xffd0_0000	0xffd0_3fff	L1 for stack		16K cacheable TLB0 + * + * Localbus non-cacheable + * + * 0xec00_0000	0xefff_ffff	NOR flash		64M non-cacheable + * 0xffa0_0000	0xffaf_ffff	NAND			1M non-cacheable + */ + +/* + * Local Bus Definitions + */ +#define CONFIG_SYS_FLASH_BASE		0xec000000 /* start of FLASH 64M */ +#define CONFIG_SYS_FLASH_BASE_PHYS	CONFIG_SYS_FLASH_BASE + +#define CONFIG_FLASH_BR_PRELIM  (BR_PHYS_ADDR(CONFIG_SYS_FLASH_BASE_PHYS) \ +				| BR_PS_16 | BR_V) +#define CONFIG_FLASH_OR_PRELIM	0xfc000ff7 + +#define CONFIG_FLASH_CFI_DRIVER +#define CONFIG_SYS_FLASH_CFI +#define CONFIG_SYS_FLASH_EMPTY_INFO +#define CONFIG_SYS_MAX_FLASH_BANKS	1	/* number of banks */ +#define CONFIG_SYS_MAX_FLASH_SECT	512	/* sectors per device */ +#define CONFIG_SYS_FLASH_ERASE_TOUT	60000	/* Flash Erase Timeout (ms) */ +#define CONFIG_SYS_FLASH_WRITE_TOUT	500	/* Flash Write Timeout (ms) */ + +#define CONFIG_BOARD_EARLY_INIT_F	/* call board_early_init_f function */ +#define CONFIG_BOARD_EARLY_INIT_R	/* call board_early_init_r function */ + +#define CONFIG_SYS_INIT_RAM_LOCK +#define CONFIG_SYS_INIT_RAM_ADDR	0xffd00000	/* Initial L1 address */ +#define CONFIG_SYS_INIT_RAM_SIZE	0x00004000/* Size of used area in RAM */ +#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_LEN	(512 * 1024)	  /* Reserve 512 kB for Mon */ +#define CONFIG_SYS_MALLOC_LEN	(6 * 1024 * 1024) /* Reserved for malloc */ + +#define CONFIG_SYS_NAND_BASE		0xffa00000 +#define CONFIG_SYS_NAND_BASE_PHYS	CONFIG_SYS_NAND_BASE + +#define CONFIG_SYS_NAND_BASE_LIST	{ CONFIG_SYS_NAND_BASE } +#define CONFIG_SYS_MAX_NAND_DEVICE	1 +#define CONFIG_MTD_NAND_VERIFY_WRITE +#define CONFIG_CMD_NAND +#define CONFIG_NAND_FSL_ELBC +#define CONFIG_SYS_NAND_BLOCK_SIZE	(128 * 1024) + +/* NAND flash config */ +#define CONFIG_SYS_NAND_BR_PRELIM  (BR_PHYS_ADDR(CONFIG_SYS_NAND_BASE_PHYS) \ +				| (2<<BR_DECC_SHIFT)	/* Use HW ECC */ \ +				| BR_PS_8		/* Port Size = 8bit */ \ +				| BR_MS_FCM		/* MSEL = FCM */ \ +				| BR_V)			/* valid */ +#define CONFIG_SYS_NAND_OR_PRELIM  (OR_AM_256KB		/* length 256K */ \ +				| OR_FCM_PGS \ +				| OR_FCM_CSCT \ +				| OR_FCM_CST \ +				| OR_FCM_CHT \ +				| OR_FCM_SCY_1 \ +				| OR_FCM_TRLX \ +				| OR_FCM_EHTR) + +#define CONFIG_SYS_BR0_PRELIM	CONFIG_FLASH_BR_PRELIM	/* NOR Base Address */ +#define CONFIG_SYS_OR0_PRELIM	CONFIG_FLASH_OR_PRELIM	/* NOR Options */ +#define CONFIG_SYS_BR1_PRELIM	CONFIG_SYS_NAND_BR_PRELIM +#define CONFIG_SYS_OR1_PRELIM	CONFIG_SYS_NAND_OR_PRELIM /* NAND Options */ + +/* Serial Port */ +#define CONFIG_CONS_INDEX		1 +#undef	CONFIG_SERIAL_SOFTWARE_FIFO +#define CONFIG_SYS_NS16550 +#define CONFIG_SYS_NS16550_SERIAL +#define CONFIG_SYS_NS16550_REG_SIZE	1 +#define CONFIG_SYS_NS16550_CLK		get_bus_freq(0) + +#define CONFIG_SYS_BAUDRATE_TABLE	\ +	{300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200} + +#define CONFIG_SYS_NS16550_COM1	(CONFIG_SYS_CCSRBAR + 0x4500) +#define CONFIG_SYS_NS16550_COM2	(CONFIG_SYS_CCSRBAR + 0x4600) + +/* Use the HUSH parser */ +#define CONFIG_SYS_HUSH_PARSER + +/* + * Pass open firmware flat tree + */ +#define CONFIG_OF_LIBFDT +#define CONFIG_OF_BOARD_SETUP +#define CONFIG_OF_STDOUT_VIA_ALIAS + +/* new uImage format support */ +#define CONFIG_FIT +#define CONFIG_FIT_VERBOSE	/* enable fit_format_{error,warning}() */ + +/* I2C */ +#define CONFIG_FSL_I2C		/* Use FSL common I2C driver */ +#define CONFIG_HARD_I2C		/* I2C with hardware support */ +#define CONFIG_I2C_MULTI_BUS +#define CONFIG_SYS_I2C_SPEED	400000	/* I2C speed and slave address */ +#define CONFIG_SYS_I2C_SLAVE		0x7F +#define CONFIG_SYS_I2C_OFFSET		0x3000 +#define CONFIG_SYS_I2C2_OFFSET		0x3100 + +/* + * I2C2 EEPROM + */ +#define CONFIG_ID_EEPROM +#ifdef CONFIG_ID_EEPROM +#define CONFIG_SYS_I2C_EEPROM_NXID +#endif +#define CONFIG_SYS_I2C_EEPROM_ADDR		0x50 +#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN		1 +#define CONFIG_SYS_EEPROM_BUS_NUM		0 + +#define CONFIG_CMD_I2C + +/* + * General PCI + * Memory space is mapped 1-1, but I/O space must start from 0. + */ + +/* controller 3, Slot 1, tgtid 3, Base address b000 */ +#define CONFIG_SYS_PCIE3_NAME		"Slot 3" +#define CONFIG_SYS_PCIE3_MEM_VIRT	0x80000000 +#define CONFIG_SYS_PCIE3_MEM_BUS	0x80000000 +#define CONFIG_SYS_PCIE3_MEM_PHYS	0x80000000 +#define CONFIG_SYS_PCIE3_MEM_SIZE	0x20000000	/* 512M */ +#define CONFIG_SYS_PCIE3_IO_VIRT	0xffc00000 +#define CONFIG_SYS_PCIE3_IO_BUS		0x00000000 +#define CONFIG_SYS_PCIE3_IO_PHYS	0xffc00000 +#define CONFIG_SYS_PCIE3_IO_SIZE	0x00010000	/* 64k */ + +/* controller 2, direct to uli, tgtid 2, Base address 9000 */ +#define CONFIG_SYS_PCIE2_NAME		"Slot 2" +#define CONFIG_SYS_PCIE2_MEM_VIRT	0xa0000000 +#define CONFIG_SYS_PCIE2_MEM_BUS	0xa0000000 +#define CONFIG_SYS_PCIE2_MEM_PHYS	0xa0000000 +#define CONFIG_SYS_PCIE2_MEM_SIZE	0x20000000	/* 512M */ +#define CONFIG_SYS_PCIE2_IO_VIRT	0xffc10000 +#define CONFIG_SYS_PCIE2_IO_BUS		0x00000000 +#define CONFIG_SYS_PCIE2_IO_PHYS	0xffc10000 +#define CONFIG_SYS_PCIE2_IO_SIZE	0x00010000	/* 64k */ + +/* controller 1, Slot 2, tgtid 1, Base address a000 */ +#define CONFIG_SYS_PCIE1_NAME		"Slot 1" +#define CONFIG_SYS_PCIE1_MEM_VIRT	0xc0000000 +#define CONFIG_SYS_PCIE1_MEM_BUS	0xc0000000 +#define CONFIG_SYS_PCIE1_MEM_PHYS	0xc0000000 +#define CONFIG_SYS_PCIE1_MEM_SIZE	0x20000000	/* 512M */ +#define CONFIG_SYS_PCIE1_IO_VIRT	0xffc20000 +#define CONFIG_SYS_PCIE1_IO_BUS		0x00000000 +#define CONFIG_SYS_PCIE1_IO_PHYS	0xffc20000 +#define CONFIG_SYS_PCIE1_IO_SIZE	0x00010000	/* 64k */ + +#if defined(CONFIG_PCI) +#define CONFIG_E1000		/* Defind e1000 pci Ethernet card */ +#define CONFIG_PCI_PNP		/* do pci plug-and-play */ +#define CONFIG_PCI_SCAN_SHOW	/* show pci devices on startup */ +#endif	/* CONFIG_PCI */ + +/* + * Environment + */ +#define CONFIG_ENV_OVERWRITE + +#define CONFIG_ENV_IS_IN_FLASH +#if CONFIG_SYS_MONITOR_BASE > 0xfff80000 +#define CONFIG_ENV_ADDR		0xfff80000 +#else +#define CONFIG_ENV_ADDR		(CONFIG_SYS_MONITOR_BASE - CONFIG_ENV_SECT_SIZE) +#endif +#define CONFIG_ENV_SIZE		0x2000 +#define CONFIG_ENV_SECT_SIZE	0x20000 /* 128K (one sector) */ + +#define CONFIG_LOADS_ECHO		/* echo on for serial download */ +#define CONFIG_SYS_LOADS_BAUD_CHANGE	/* allow baudrate change */ + +/* + * Command line configuration. + */ +#include <config_cmd_default.h> + +#define CONFIG_CMD_IRQ +#define CONFIG_CMD_PING +#define CONFIG_CMD_MII +#define CONFIG_CMD_SETEXPR +#define CONFIG_CMD_REGINFO + +#if defined(CONFIG_PCI) +#define CONFIG_CMD_PCI +#define CONFIG_CMD_NET +#endif + +/* + * USB + */ +#define CONFIG_HAS_FSL_DR_USB +#ifdef CONFIG_HAS_FSL_DR_USB +#define CONFIG_USB_EHCI + +#ifdef CONFIG_USB_EHCI +#define CONFIG_CMD_USB +#define CONFIG_EHCI_HCD_INIT_AFTER_RESET +#define CONFIG_USB_EHCI_FSL +#define CONFIG_USB_STORAGE +#define CONFIG_CMD_FAT +#define CONFIG_CMD_EXT2 +#define CONFIG_CMD_FAT +#define CONFIG_DOS_PARTITION +#endif +#endif + +/* + * Miscellaneous configurable options + */ +#define CONFIG_SYS_LONGHELP			/* undef to save memory	*/ +#define CONFIG_CMDLINE_EDITING		/* Command-line editing */ +#define CONFIG_SYS_LOAD_ADDR	0x2000000	/* default load address */ +#define CONFIG_SYS_PROMPT	"=> "		/* Monitor Command Prompt */ +#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 +/* Print Buffer Size */ +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT)+16) +#define CONFIG_SYS_MAXARGS	16		/* max number of command args */ +/* Boot Argument Buffer Size */ +#define CONFIG_SYS_BARGSIZE	CONFIG_SYS_CBSIZE +#define CONFIG_SYS_HZ	1000		/* decrementer freq: 1ms ticks */ + +/* + * For booting Linux, the board info and command line data + * have to be in the first 64 MB of memory, since this is + * the maximum mapped by the Linux kernel during initialization. + */ +#define CONFIG_SYS_BOOTMAPSZ	(64 << 20)   /* Initial Memory map for Linux*/ +#define CONFIG_SYS_BOOTM_LEN	(64 << 20)   /* Increase max gunzip size */ + +/* + * Environment Configuration + */ +#define CONFIG_BOOTFILE		"uImage" +#define CONFIG_UBOOTPATH	(u-boot.bin) /* U-Boot image on TFTP server */ + +/* default location for tftp and bootm */ +#define CONFIG_LOADADDR		1000000 + +#define CONFIG_BOOTDELAY -1	/* -1 disables auto-boot */ + +#define CONFIG_BAUDRATE	115200 + +/* Qman/Bman */ +#define CONFIG_SYS_DPAA_QBMAN		/* support Q/Bman */ +#define CONFIG_SYS_QMAN_MEM_BASE	0xff000000 +#define CONFIG_SYS_QMAN_MEM_PHYS	CONFIG_SYS_QMAN_MEM_BASE +#define CONFIG_SYS_QMAN_MEM_SIZE	0x00200000 +#define CONFIG_SYS_BMAN_MEM_BASE	0xff200000 +#define CONFIG_SYS_BMAN_MEM_PHYS	CONFIG_SYS_BMAN_MEM_BASE +#define CONFIG_SYS_BMAN_MEM_SIZE	0x00200000 + +/* For FM */ +#define CONFIG_SYS_DPAA_FMAN +#define CONFIG_PHY_GIGE		/* Include GbE speed/duplex detection */ + +#ifdef CONFIG_SYS_DPAA_FMAN +#define CONFIG_FMAN_ENET +#define CONFIG_PHY_ATHEROS +#endif + +/* Default address of microcode for the Linux Fman driver */ +/* QE microcode/firmware address */ +#define CONFIG_SYS_QE_FMAN_FW_IN_NOR +#define CONFIG_SYS_QE_FMAN_FW_ADDR	0xeff40000 +#define CONFIG_SYS_QE_FMAN_FW_LENGTH	0x10000 +#define CONFIG_SYS_FDT_PAD		(0x3000 + CONFIG_SYS_QE_FMAN_FW_LENGTH) + +#ifdef CONFIG_FMAN_ENET +#define CONFIG_SYS_FM1_DTSEC1_PHY_ADDR	0x1 +#define CONFIG_SYS_FM1_DTSEC2_PHY_ADDR	0x2 + +#define CONFIG_SYS_TBIPA_VALUE	8 +#define CONFIG_MII		/* MII PHY management */ +#define CONFIG_ETHPRIME		"FM1@DTSEC1" +#endif + +#define CONFIG_EXTRA_ENV_SETTINGS	\ +	"hwconfig=usb1:dr_mode=host,phy_type=ulpi\0" + +#endif	/* __CONFIG_H */ diff --git a/include/configs/P1023RDS.h b/include/configs/P1023RDS.h index 878bd5fa5..4943d7c8f 100644 --- a/include/configs/P1023RDS.h +++ b/include/configs/P1023RDS.h @@ -73,6 +73,7 @@  #define CONFIG_PCIE2		/* PCIE controler 2 (slot 2) */  #define CONFIG_PCIE3		/* PCIE controler 3 (slot 3) */  #define CONFIG_FSL_PCI_INIT	/* Use common FSL init code */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_FSL_PCIE_RESET	/* need PCIe reset errata */  #define CONFIG_SYS_PCI_64BIT	/* enable 64-bit PCI resources */  #define CONFIG_FSL_LAW		/* Use common FSL init code */ diff --git a/include/configs/P1_P2_RDB.h b/include/configs/P1_P2_RDB.h index a57d9dd26..6ce4cbef9 100644 --- a/include/configs/P1_P2_RDB.h +++ b/include/configs/P1_P2_RDB.h @@ -94,6 +94,7 @@  #define CONFIG_PCIE1		1	/* PCIE controler 1 (slot 1) */  #define CONFIG_PCIE2		1	/* PCIE controler 2 (slot 2) */  #define CONFIG_FSL_PCI_INIT	1	/* Use common FSL init code */ +#define CONFIG_PCI_INDIRECT_BRIDGE 1	/* indirect PCI bridge support */  #define CONFIG_FSL_PCIE_RESET	1	/* need PCIe reset errata */  #define CONFIG_SYS_PCI_64BIT	1	/* enable 64-bit PCI resources */  #endif /* #if defined(CONFIG_PCI) */ diff --git a/include/configs/P2020COME.h b/include/configs/P2020COME.h index c75f86cb8..05a75d8a7 100644 --- a/include/configs/P2020COME.h +++ b/include/configs/P2020COME.h @@ -58,6 +58,7 @@  #define CONFIG_PCIE3		1	/* PCIE controller 3 (slot 3) */  #define CONFIG_FSL_PCI_INIT	1	/* Use common FSL init code */ +#define CONFIG_PCI_INDIRECT_BRIDGE 1	/* indirect PCI bridge support */  #define CONFIG_FSL_PCIE_RESET	1	/* need PCIe reset errata */  #define CONFIG_SYS_PCI_64BIT	1	/* enable 64-bit PCI resources */  #endif /* #if defined(CONFIG_PCI) */ diff --git a/include/configs/P2020DS.h b/include/configs/P2020DS.h index a975ee10e..229117c18 100644 --- a/include/configs/P2020DS.h +++ b/include/configs/P2020DS.h @@ -73,6 +73,7 @@  #define CONFIG_PCIE2		1	/* PCIE controler 2 (slot 2) */  #define CONFIG_PCIE3		1	/* PCIE controler 3 (ULI bridge) */  #define CONFIG_FSL_PCI_INIT	1	/* Use common FSL init code */ +#define CONFIG_PCI_INDIRECT_BRIDGE 1	/* indirect PCI bridge support */  #define CONFIG_FSL_PCIE_RESET	1	/* need PCIe reset errata */  #define CONFIG_SYS_PCI_64BIT	1	/* enable 64-bit PCI resources */ diff --git a/include/configs/P2041RDB.h b/include/configs/P2041RDB.h index bbc53ceaf..4ea871736 100644 --- a/include/configs/P2041RDB.h +++ b/include/configs/P2041RDB.h @@ -77,6 +77,7 @@  #define CONFIG_SYS_SRIO  #define CONFIG_SRIO1			/* SRIO port 1 */  #define CONFIG_SRIO2			/* SRIO port 2 */ +#define CONFIG_SRIO_PCIE_BOOT_MASTER  #define CONFIG_SYS_DPAA_RMAN		/* RMan */  #define CONFIG_FSL_LAW			/* Use common FSL init code */ @@ -560,6 +561,7 @@ unsigned long get_board_sys_clk(unsigned long dummy);  #endif  #ifdef CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_PCI_PNP			/* do pci plug-and-play */  #define CONFIG_E1000 diff --git a/include/configs/P3041DS.h b/include/configs/P3041DS.h index ce8f9b0b2..dd2b9c34e 100644 --- a/include/configs/P3041DS.h +++ b/include/configs/P3041DS.h @@ -40,7 +40,7 @@  #define CONFIG_SYS_SRIO  #define CONFIG_SRIO1			/* SRIO port 1 */  #define CONFIG_SRIO2			/* SRIO port 2 */ - +#define CONFIG_SRIO_PCIE_BOOT_MASTER  #define CONFIG_ICS307_REFCLK_HZ		25000000  /* ICS307 ref clk freq */  #include "corenet_ds.h" diff --git a/include/configs/P4080DS.h b/include/configs/P4080DS.h index 53979dddf..48acee499 100644 --- a/include/configs/P4080DS.h +++ b/include/configs/P4080DS.h @@ -36,7 +36,7 @@  #define CONFIG_SYS_SRIO  #define CONFIG_SRIO1			/* SRIO port 1 */  #define CONFIG_SRIO2			/* SRIO port 2 */ - +#define CONFIG_SRIO_PCIE_BOOT_MASTER  #define CONFIG_ICS307_REFCLK_HZ		33333000  /* ICS307 ref clk freq */  #include "corenet_ds.h" diff --git a/include/configs/P5020DS.h b/include/configs/P5020DS.h index 778230d33..d1e27c42d 100644 --- a/include/configs/P5020DS.h +++ b/include/configs/P5020DS.h @@ -41,7 +41,7 @@  #define CONFIG_SYS_SRIO  #define CONFIG_SRIO1			/* SRIO port 1 */  #define CONFIG_SRIO2			/* SRIO port 2 */ - +#define CONFIG_SRIO_PCIE_BOOT_MASTER  #define CONFIG_ICS307_REFCLK_HZ		25000000  /* ICS307 ref clk freq */  #include "corenet_ds.h" diff --git a/include/configs/PCI405.h b/include/configs/PCI405.h index 119819e37..c3cacefed 100644 --- a/include/configs/PCI405.h +++ b/include/configs/PCI405.h @@ -141,6 +141,7 @@  #define PCI_HOST_AUTO	2		/* detected via arbiter enable	*/  #define CONFIG_PCI			/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_HOST PCI_HOST_ADAPTER /* select pci host function	*/  #undef	CONFIG_PCI_PNP			/* no pci plug-and-play		*/  					/* resource configuration	*/ diff --git a/include/configs/PIP405.h b/include/configs/PIP405.h index 713ea12ee..3757af07a 100644 --- a/include/configs/PIP405.h +++ b/include/configs/PIP405.h @@ -199,6 +199,7 @@  #define PCI_HOST_AUTO   2               /* detected via arbiter enable  */  #define CONFIG_PCI			/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_HOST PCI_HOST_FORCE	/* configure as pci-host	*/  #define CONFIG_PCI_PNP			/* pci plug-and-play		*/  					/* resource configuration	*/ diff --git a/include/configs/PLU405.h b/include/configs/PLU405.h index 1ee0c48fa..1745eb39f 100644 --- a/include/configs/PLU405.h +++ b/include/configs/PLU405.h @@ -192,6 +192,7 @@  #define PCI_HOST_AUTO   2               /* detected via arbiter enable  */  #define CONFIG_PCI			/* include pci support	        */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_HOST	PCI_HOST_FORCE  /* select pci host function     */  #define CONFIG_PCI_PNP			/* do pci plug-and-play         */  					/* resource configuration       */ diff --git a/include/configs/PM826.h b/include/configs/PM826.h index fbcf8e5e2..faadfe43c 100644 --- a/include/configs/PM826.h +++ b/include/configs/PM826.h @@ -176,6 +176,7 @@  #define CONFIG_CMD_SNTP  #ifdef CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_CMD_PCI  #endif diff --git a/include/configs/PM828.h b/include/configs/PM828.h index c37aafdd4..f563fbe33 100644 --- a/include/configs/PM828.h +++ b/include/configs/PM828.h @@ -176,6 +176,7 @@  #define CONFIG_CMD_SNTP  #ifdef CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_CMD_PCI  #endif diff --git a/include/configs/PMC405.h b/include/configs/PMC405.h index 8235b857d..d97acecc4 100644 --- a/include/configs/PMC405.h +++ b/include/configs/PMC405.h @@ -163,6 +163,7 @@  #define PCI_HOST_AUTO		2	/* detected via arbiter enable	*/  #define CONFIG_PCI			/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_HOST	PCI_HOST_AUTO   /* select pci host function	*/  #define CONFIG_PCI_PNP			/* do pci plug-and-play		*/  					/* resource configuration	*/ diff --git a/include/configs/PMC405DE.h b/include/configs/PMC405DE.h index 992443a8e..a42755128 100644 --- a/include/configs/PMC405DE.h +++ b/include/configs/PMC405DE.h @@ -142,6 +142,7 @@  #define PCI_HOST_AUTO		2	/* detected via arbiter enable	*/  #define CONFIG_PCI		/* include pci support			*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_HOST	PCI_HOST_AUTO  /* select pci host function	*/  #define CONFIG_PCI_PNP		/* do (not) pci plug-and-play		*/ diff --git a/include/configs/PMC440.h b/include/configs/PMC440.h index 3837b8f13..40c18274f 100644 --- a/include/configs/PMC440.h +++ b/include/configs/PMC440.h @@ -419,6 +419,7 @@   *----------------------------------------------------------------------*/  /* General PCI */  #define CONFIG_PCI		/* include pci support          */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_PNP		/* do (not) pci plug-and-play   */  #define CONFIG_SYS_PCI_CACHE_LINE_SIZE	0	/* to avoid problems with PNP   */  #define CONFIG_PCI_SCAN_SHOW	/* show pci devices on startup  */ diff --git a/include/configs/PN62.h b/include/configs/PN62.h index 93876b131..e2f96aa4a 100644 --- a/include/configs/PN62.h +++ b/include/configs/PN62.h @@ -122,6 +122,7 @@   * PCI stuff   */  #define CONFIG_PCI				/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_PNP				/* we need Plug 'n Play		*/  #if 0  #define CONFIG_PCI_SCAN_SHOW			/* show PCI auto-scan at boot	*/ diff --git a/include/configs/PPChameleonEVB.h b/include/configs/PPChameleonEVB.h index 27a12b310..210bc30ca 100644 --- a/include/configs/PPChameleonEVB.h +++ b/include/configs/PPChameleonEVB.h @@ -324,6 +324,7 @@  #define PCI_HOST_AUTO	2		/* detected via arbiter enable	*/  #define CONFIG_PCI			/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_HOST PCI_HOST_FORCE	 /* select pci host function	 */  #undef	CONFIG_PCI_PNP			/* do pci plug-and-play		*/  					/* resource configuration	*/ diff --git a/include/configs/SIMPC8313.h b/include/configs/SIMPC8313.h index c0ffb3312..318c4c5d5 100644 --- a/include/configs/SIMPC8313.h +++ b/include/configs/SIMPC8313.h @@ -52,6 +52,7 @@  #endif  #define CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_FSL_ELBC			1  #define CONFIG_MISC_INIT_R diff --git a/include/configs/Sandpoint8240.h b/include/configs/Sandpoint8240.h index f54fcb33e..fa456ed79 100644 --- a/include/configs/Sandpoint8240.h +++ b/include/configs/Sandpoint8240.h @@ -127,6 +127,7 @@   *-----------------------------------------------------------------------   */  #define CONFIG_PCI				/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #undef CONFIG_PCI_PNP diff --git a/include/configs/Sandpoint8245.h b/include/configs/Sandpoint8245.h index 84e4891dc..cdc51a501 100644 --- a/include/configs/Sandpoint8245.h +++ b/include/configs/Sandpoint8245.h @@ -95,6 +95,7 @@   *-----------------------------------------------------------------------   */  #define CONFIG_PCI				/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #undef CONFIG_PCI_PNP diff --git a/include/configs/TQM8272.h b/include/configs/TQM8272.h index be977f1d7..3b3f9e630 100644 --- a/include/configs/TQM8272.h +++ b/include/configs/TQM8272.h @@ -443,6 +443,7 @@  #define	CONFIG_PCI  #ifdef CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_BOARD_EARLY_INIT_F 1	/* Call board_early_init_f	*/  #define CONFIG_PCI_PNP  #define CONFIG_EEPRO100 diff --git a/include/configs/TQM834x.h b/include/configs/TQM834x.h index 07384234c..966a6e3da 100644 --- a/include/configs/TQM834x.h +++ b/include/configs/TQM834x.h @@ -442,6 +442,7 @@  /* PCI */  #ifdef CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_SYS_IBAT3L	(CONFIG_SYS_PCI1_MEM_BASE \  				| BATL_PP_RW \  				| BATL_MEMCOHERENCE) diff --git a/include/configs/VOH405.h b/include/configs/VOH405.h index f1032f0f3..8f0c4b624 100644 --- a/include/configs/VOH405.h +++ b/include/configs/VOH405.h @@ -181,6 +181,7 @@  #define PCI_HOST_AUTO   2               /* detected via arbiter enable  */  #define CONFIG_PCI			/* include pci support	        */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_HOST	PCI_HOST_HOST   /* select pci host function     */  #define CONFIG_PCI_PNP			/* do pci plug-and-play         */  					/* resource configuration       */ diff --git a/include/configs/W7OLMC.h b/include/configs/W7OLMC.h index 462b155a3..710812fc9 100644 --- a/include/configs/W7OLMC.h +++ b/include/configs/W7OLMC.h @@ -154,6 +154,7 @@  #define CONFIG_PCI				/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_HOST		PCI_HOST_AUTO	/* select pci host function	*/  #define CONFIG_PCI_PNP				/* pci plug-and-play		*/  /* resource configuration	*/ diff --git a/include/configs/W7OLMG.h b/include/configs/W7OLMG.h index f28f3e4f9..f88dfe4cd 100644 --- a/include/configs/W7OLMG.h +++ b/include/configs/W7OLMG.h @@ -161,6 +161,7 @@  #define PCI_HOST_AUTO		2		/* detected via arbiter enable	*/  #define CONFIG_PCI				/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_HOST		PCI_HOST_AUTO	/* select pci host function	*/  #define CONFIG_PCI_PNP				/* pci plug-and-play		*/  /* resource configuration	*/ diff --git a/include/configs/WUH405.h b/include/configs/WUH405.h index 5def36ad0..0c78acac8 100644 --- a/include/configs/WUH405.h +++ b/include/configs/WUH405.h @@ -169,6 +169,7 @@  #define PCI_HOST_AUTO	2		/* detected via arbiter enable	*/  #define CONFIG_PCI			/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_HOST PCI_HOST_HOST	/* select pci host function	*/  #undef	CONFIG_PCI_PNP			/* do pci plug-and-play		*/  					/* resource configuration	*/ diff --git a/include/configs/a3m071.h b/include/configs/a3m071.h index e9af82566..8f29229cd 100644 --- a/include/configs/a3m071.h +++ b/include/configs/a3m071.h @@ -426,6 +426,7 @@  #define CONFIG_SPL_BSS_MAX_SIZE		(64 << 10)  #define CONFIG_SPL_OS_BOOT +#define CONFIG_SPL_ENV_SUPPORT  /* Place patched DT blob (fdt) at this address */  #define CONFIG_SYS_SPL_ARGS_ADDR	0x01800000 diff --git a/include/configs/ac14xx.h b/include/configs/ac14xx.h index 7cb10fb01..381bcdda0 100644 --- a/include/configs/ac14xx.h +++ b/include/configs/ac14xx.h @@ -72,7 +72,7 @@  #define CONFIG_SYS_MAX_RAM_SIZE		0x20000000  /* - * DDR Controller Configuration XXX TODO + * DDR Controller Configuration   *   * SYS_CFG:   *	[31:31]	MDDRC Soft Reset:	Diabled @@ -265,7 +265,6 @@  /*   * CS related parameters - * TODO document these   */  /* CS0 Flash */  #define CONFIG_SYS_CS0_CFG		0x00031110 @@ -331,8 +330,6 @@  #endif  #define CONFIG_BAUDRATE			115200	/* ... at 115200 bps */ -#define CONFIG_SYS_BAUDRATE_TABLE  \ -	{300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 115200}  #define CONSOLE_FIFO_TX_SIZE		FIFOC_PSC3_TX_SIZE  #define CONSOLE_FIFO_TX_ADDR		FIFOC_PSC3_TX_ADDR @@ -497,30 +494,26 @@  #define CONFIG_ENV_OVERWRITE  #define CONFIG_TIMESTAMP -#define CONFIG_HOSTNAME		ac14xx -#define CONFIG_BOOTFILE		"ac14xx/uImage" -#define CONFIG_ROOTPATH		"/opt/eldk/ppc_6xx" -  /* default load addr for tftp and bootm */  #define CONFIG_LOADADDR		400000  #define CONFIG_BOOTDELAY	2	/* -1 disables auto-boot */ -/* XXX TODO need to specify the builtin environment */ +/* the builtin environment and standard greeting */  #define CONFIG_PREBOOT	"echo;"	\  	"echo Type \\\"run flash_nfs\\\" to mount root filesystem over NFS;" \  	"echo"  #define CONFIG_EXTRA_ENV_SETTINGS_DEVEL					\ -	"muster_nr=00\0"						\ +	"muster_nr=-00\0"						\  	"fromram=run ramargs addip addtty; "				\ -		"tftp ${fdt_addr_r} k6m2/ac14xx.dtb-${muster_nr}; "	\ -		"tftp ${kernel_addr_r} k6m2/uImage-${muster_nr}; "	\ -		"tftp ${ramdisk_addr_r} k6m2/uFS-${muster_nr}; "	\ +		"tftp ${fdt_addr_r} ac14xx/ac14xx.dtb${muster_nr}; "	\ +		"tftp ${kernel_addr_r} ac14xx/uImage${muster_nr}; "	\ +		"tftp ${ramdisk_addr_r} ac14xx/uFS${muster_nr}; "	\  		"bootm ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}\0" \  	"fromnfs=run nfsargs addip addtty; "				\ -		"tftp ${fdt_addr_r} k6m2/ac14xx.dtb-${muster_nr}; "	\ -		"tftp ${kernel_addr_r} k6m2/uImage-${muster_nr}; "	\ +		"tftp ${fdt_addr_r} ac14xx/ac14xx.dtb${muster_nr}; "	\ +		"tftp ${kernel_addr_r} ac14xx/uImage${muster_nr}; "	\  		"bootm ${kernel_addr_r} - ${fdt_addr_r}\0"		\  	"fromflash=run nfsargs addip addtty; "				\  		"bootm fc020000 - fc000000\0"				\ @@ -548,12 +541,11 @@  	"u-boot=ac14xx/u-boot.bin\0"					\  	"bootfile=ac14xx/uImage\0"					\  	"fdtfile=ac14xx/ac14xx.dtb\0"					\ -	"rootpath=/opt/eldk/ppc_6xx\n"					\  	"netdev=eth0\0"							\  	"consdev=ttyPSC0\0"						\  	"hostname=ac14xx\0"						\  	"nfsargs=setenv bootargs root=/dev/nfs rw "			\ -		"nfsroot=${serverip}:${rootpath}-${muster_nr}\0"	\ +		"nfsroot=${serverip}:${rootpath}${muster_nr}\0"	\  	"ramargs=setenv bootargs root=/dev/ram rw\0"			\  	"addip=setenv bootargs ${bootargs} "				\  		"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}"	\ @@ -583,6 +575,8 @@  #define CONFIG_BOOTCOMMAND	"run production" +#define CONFIG_ARP_TIMEOUT	200UL +  #define CONFIG_FIT		1  #define CONFIG_OF_LIBFDT	1  #define CONFIG_OF_BOARD_SETUP	1 diff --git a/include/configs/adp-ag102.h b/include/configs/adp-ag102.h index eea44db35..a6e184961 100644 --- a/include/configs/adp-ag102.h +++ b/include/configs/adp-ag102.h @@ -143,6 +143,7 @@   */  #define CONFIG_PCI  #define CONFIG_FTPCI100 +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_FTPCI100_MEM_BASE        0xa0000000  #define CONFIG_FTPCI100_IO_SIZE         FTPCI100_BASE_IO_SIZE(256) /* 256M */  #define CONFIG_FTPCI100_MEM_SIZE        FTPCI100_MEM_SIZE(128)  /* 128M */ diff --git a/include/configs/alpr.h b/include/configs/alpr.h index 0d53e51b9..d93d5e204 100644 --- a/include/configs/alpr.h +++ b/include/configs/alpr.h @@ -287,6 +287,7 @@   */  /* General PCI */  #define CONFIG_PCI			/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_PNP			/* do pci plug-and-play		*/  #define CONFIG_PCI_SCAN_SHOW		/* show pci devices on startup	*/  #define CONFIG_SYS_PCI_TARGBASE    0x80000000	/* PCIaddr mapped to CONFIG_SYS_PCI_MEMBASE */ diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h index 7cc3ef24a..c5a6d4b31 100644 --- a/include/configs/am335x_evm.h +++ b/include/configs/am335x_evm.h @@ -145,7 +145,7 @@  		"if test $board_name = A33515BB; then " \  			"setenv fdtfile am335x-evm.dtb; fi; " \  		"if test $board_name = A335X_SK; then " \ -			"setenv fdtfile am335x-evmsk.dtb; fi " \ +			"setenv fdtfile am335x-evmsk.dtb; fi; " \  		"if test $fdtfile = undefined; then " \  			"echo WARNING: Could not determine device tree to use; fi; \0"  #endif @@ -307,22 +307,44 @@  #define CONFIG_SPL  #define CONFIG_SPL_FRAMEWORK  /* - * Place the image at the start of the ROM defined image space and leave - * space for SRAM scratch entries (see arch/arm/include/omap_common.h). + * Place the image at the start of the ROM defined image space.   * We limit our size to the ROM-defined downloaded image area, and use the   * rest of the space for stack.   */ -#define CONFIG_SPL_TEXT_BASE		0x402F0500 +#define CONFIG_SPL_TEXT_BASE		0x402F0400  #define CONFIG_SPL_MAX_SIZE		(0x4030C000 - CONFIG_SPL_TEXT_BASE)  #define CONFIG_SPL_STACK		CONFIG_SYS_INIT_SP_ADDR -#define CONFIG_SPL_BSS_START_ADDR	0x80000000 +#define CONFIG_SPL_OS_BOOT + +#define CONFIG_SPL_BSS_START_ADDR	0x80a00000  #define CONFIG_SPL_BSS_MAX_SIZE		0x80000		/* 512 KB */  #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR	0x300 /* address 0x60000 */  #define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS	0x200 /* 256 KB */  #define CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION	1  #define CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME	"u-boot.img" + +#ifdef CONFIG_SPL_OS_BOOT +/* fat */ +#define CONFIG_SPL_FAT_LOAD_KERNEL_NAME		"uImage" +#define CONFIG_SPL_FAT_LOAD_ARGS_NAME		"args" +#define CONFIG_SYS_SPL_ARGS_ADDR		(PHYS_DRAM_1 + 0x100) + +/* raw mmc */ +#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR	0x500 /* address 0xa0000 */ +#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR	0x8   /* address 0x1000 */ +#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS	8     /* 4KB */ + +/* nand */ +#define CONFIG_CMD_SPL_NAND_OFS			0x240000 /* end of u-boot */ +#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS		0x280000 +#define CONFIG_CMD_SPL_WRITE_SIZE		0x1000 + +/* spl export command */ +#define CONFIG_CMD_SPL +#endif +  #define CONFIG_SPL_MMC_SUPPORT  #define CONFIG_SPL_FAT_SUPPORT  #define CONFIG_SPL_I2C_SUPPORT @@ -334,6 +356,7 @@  #define CONFIG_SPL_GPIO_SUPPORT  #define CONFIG_SPL_YMODEM_SUPPORT  #define CONFIG_SPL_NET_SUPPORT +#define CONFIG_SPL_ENV_SUPPORT  #define CONFIG_SPL_NET_VCI_STRING	"AM335x U-Boot SPL"  #define CONFIG_SPL_ETH_SUPPORT  #define CONFIG_SPL_SPI_SUPPORT @@ -380,7 +403,7 @@   * other needs.   */  #define CONFIG_SYS_TEXT_BASE		0x80800000 -#define CONFIG_SYS_SPL_MALLOC_START	0x80208000 +#define CONFIG_SYS_SPL_MALLOC_START	0x80a08000  #define CONFIG_SYS_SPL_MALLOC_SIZE	0x100000  /* Since SPL did pll and ddr initialization for us, @@ -476,7 +499,8 @@  #define MTDPARTS_DEFAULT		"mtdparts=omap2-nand.0:128k(SPL)," \  					"128k(SPL.backup1)," \  					"128k(SPL.backup2)," \ -					"128k(SPL.backup3),1920k(u-boot)," \ +					"128k(SPL.backup3),1792k(u-boot)," \ +					"128k(u-boot-spl-os)," \  					"128k(u-boot-env),5m(kernel),-(rootfs)"  #define CONFIG_NAND_OMAP_GPMC  #define GPMC_NAND_ECC_LP_x16_LAYOUT	1 diff --git a/include/configs/aria.h b/include/configs/aria.h index 5318aaf99..bd8105387 100644 --- a/include/configs/aria.h +++ b/include/configs/aria.h @@ -350,6 +350,7 @@   * PCI   */  #ifdef CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_SYS_PCI_MEM_BASE		0xA0000000  #define CONFIG_SYS_PCI_MEM_PHYS		CONFIG_SYS_PCI_MEM_BASE diff --git a/include/configs/at91sam9n12ek.h b/include/configs/at91sam9n12ek.h index 8d2673dac..b4b1c3196 100644 --- a/include/configs/at91sam9n12ek.h +++ b/include/configs/at91sam9n12ek.h @@ -167,6 +167,10 @@  #define CONFIG_DOS_PARTITION  #endif +/* Ethernet */ +#define CONFIG_KS8851_MLL +#define CONFIG_KS8851_MLL_BASEADDR	0x30000000 /* use NCS2 */ +  #define CONFIG_SYS_LOAD_ADDR		0x22000000 /* load address */  #define CONFIG_SYS_MEMTEST_START	CONFIG_SYS_SDRAM_BASE diff --git a/include/configs/atc.h b/include/configs/atc.h index 538a16752..57c4b33f1 100644 --- a/include/configs/atc.h +++ b/include/configs/atc.h @@ -263,6 +263,7 @@  #endif  #define	CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define	CONFIG_PCI_PNP  #define	CONFIG_SYS_PCI_MSTR_IO_BUS	0x00000000	/* PCI base   */ diff --git a/include/configs/bamboo.h b/include/configs/bamboo.h index 506a558f1..d36984df2 100644 --- a/include/configs/bamboo.h +++ b/include/configs/bamboo.h @@ -293,6 +293,7 @@   */  /* General PCI */  #define CONFIG_PCI			/* include pci support	        */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #undef  CONFIG_PCI_PNP			/* do (not) pci plug-and-play   */  #define CONFIG_PCI_SCAN_SHOW            /* show pci devices on startup  */  #define CONFIG_SYS_PCI_TARGBASE        0x80000000 /* PCIaddr mapped to CONFIG_SYS_PCI_MEMBASE*/ diff --git a/include/configs/beaver.h b/include/configs/beaver.h index 165de1375..628d5d3db 100644 --- a/include/configs/beaver.h +++ b/include/configs/beaver.h @@ -56,7 +56,7 @@  /* Environment in eMMC, at the end of 2nd "boot sector" */  #define CONFIG_ENV_IS_IN_MMC -#define CONFIG_ENV_OFFSET		((1024 * 1024) - CONFIG_ENV_SIZE) +#define CONFIG_ENV_OFFSET		(-CONFIG_ENV_SIZE)  #define CONFIG_SYS_MMC_ENV_DEV		0  #define CONFIG_SYS_MMC_ENV_PART		2 diff --git a/include/configs/bubinga.h b/include/configs/bubinga.h index da67ae3b5..35a473a42 100644 --- a/include/configs/bubinga.h +++ b/include/configs/bubinga.h @@ -153,6 +153,7 @@  #define PCI_HOST_AUTO   2               /* detected via arbiter enable  */  #define CONFIG_PCI			/* include pci support	        */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_HOST	PCI_HOST_FORCE  /* select pci host function     */  #define CONFIG_PCI_PNP			/* do pci plug-and-play         */  					/* resource configuration       */ diff --git a/include/configs/canyonlands.h b/include/configs/canyonlands.h index acb127c1d..92106d762 100644 --- a/include/configs/canyonlands.h +++ b/include/configs/canyonlands.h @@ -496,6 +496,7 @@   *----------------------------------------------------------------------*/  /* General PCI */  #define CONFIG_PCI			/* include pci support	        */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_PNP			/* do pci plug-and-play   */  #define CONFIG_PCI_SCAN_SHOW		/* show pci devices on startup  */  #define CONFIG_PCI_CONFIG_HOST_BRIDGE diff --git a/include/configs/cardhu.h b/include/configs/cardhu.h index fd4608358..142d20b5c 100644 --- a/include/configs/cardhu.h +++ b/include/configs/cardhu.h @@ -55,7 +55,7 @@  /* Environment in eMMC, at the end of 2nd "boot sector" */  #define CONFIG_ENV_IS_IN_MMC -#define CONFIG_ENV_OFFSET		((512 * 1024) - CONFIG_ENV_SIZE) +#define CONFIG_ENV_OFFSET		(-CONFIG_ENV_SIZE)  #define CONFIG_SYS_MMC_ENV_DEV		0  #define CONFIG_SYS_MMC_ENV_PART		2 diff --git a/include/configs/cm_t35.h b/include/configs/cm_t35.h index c6e357a8c..b258da9e9 100644 --- a/include/configs/cm_t35.h +++ b/include/configs/cm_t35.h @@ -339,6 +339,5 @@  #define CONFIG_SPLASH_SCREEN  #define CONFIG_CMD_BMP  #define CONFIG_BMP_16BPP -#define CONFIG_SPLASH_SCREEN_PREPARE  #endif /* __CONFIG_H */ diff --git a/include/configs/coreboot.h b/include/configs/coreboot.h index be04a7548..288ef8df7 100644 --- a/include/configs/coreboot.h +++ b/include/configs/coreboot.h @@ -90,7 +90,8 @@  #endif  /* Generic TPM interfaced through LPC bus */ -#define CONFIG_GENERIC_LPC_TPM +#define CONFIG_TPM +#define CONFIG_TPM_TIS_LPC  #define CONFIG_TPM_TIS_BASE_ADDRESS        0xfed40000  /*----------------------------------------------------------------------- @@ -167,6 +168,13 @@   */  #include <config_cmd_default.h> +#define CONFIG_TRACE +#define CONFIG_CMD_TRACE +#define CONFIG_TRACE_BUFFER_SIZE	(16 << 20) +#define CONFIG_TRACE_EARLY_SIZE		(8 << 20) +#define CONFIG_TRACE_EARLY +#define CONFIG_TRACE_EARLY_ADDR		0x01400000 +  #define CONFIG_CMD_BDI  #define CONFIG_CMD_BOOTD  #define CONFIG_CMD_CONSOLE diff --git a/include/configs/corenet_ds.h b/include/configs/corenet_ds.h index 2e2d43967..66c7b4f95 100644 --- a/include/configs/corenet_ds.h +++ b/include/configs/corenet_ds.h @@ -564,6 +564,7 @@  #endif  #ifdef CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_PCI_PNP			/* do pci plug-and-play */  #define CONFIG_E1000 diff --git a/include/configs/csb272.h b/include/configs/csb272.h index f21fa648b..eec087c0d 100644 --- a/include/configs/csb272.h +++ b/include/configs/csb272.h @@ -204,6 +204,7 @@   *   */  #define CONFIG_PCI			/* include pci support	        */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define PCI_HOST_ADAPTER	0	/* configure ar pci adapter     */  #define PCI_HOST_FORCE		1	/* configure as pci host        */  #define PCI_HOST_AUTO		2	/* detected via arbiter enable  */ diff --git a/include/configs/csb472.h b/include/configs/csb472.h index aed5fa6a4..f6a456c18 100644 --- a/include/configs/csb472.h +++ b/include/configs/csb472.h @@ -203,6 +203,7 @@   *   */  #define CONFIG_PCI			/* include pci support	        */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define PCI_HOST_ADAPTER	0	/* configure ar pci adapter     */  #define PCI_HOST_FORCE		1	/* configure as pci host        */  #define PCI_HOST_AUTO		2	/* detected via arbiter enable  */ diff --git a/include/configs/dalmore.h b/include/configs/dalmore.h index 272384343..b6e01617c 100644 --- a/include/configs/dalmore.h +++ b/include/configs/dalmore.h @@ -60,7 +60,7 @@  #define CONFIG_ENV_IS_IN_MMC  #define CONFIG_SYS_MMC_ENV_DEV		0  #define CONFIG_SYS_MMC_ENV_PART		2 -#define CONFIG_ENV_OFFSET		((4096 * 1024) - CONFIG_ENV_SIZE) +#define CONFIG_ENV_OFFSET		(-CONFIG_ENV_SIZE)  #define MACH_TYPE_DALMORE	4304	/* not yet in mach-types.h */ diff --git a/include/configs/debris.h b/include/configs/debris.h index 32aa4e506..c40fbd9f8 100644 --- a/include/configs/debris.h +++ b/include/configs/debris.h @@ -172,6 +172,7 @@   *-----------------------------------------------------------------------   */  #define CONFIG_PCI				/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_PNP  #define CONFIG_EEPRO100 diff --git a/include/configs/devkit8000.h b/include/configs/devkit8000.h index 788227d79..3b74d7c31 100644 --- a/include/configs/devkit8000.h +++ b/include/configs/devkit8000.h @@ -360,6 +360,14 @@  #define CONFIG_CMD_SPL_NAND_OFS (CONFIG_SYS_NAND_SPL_KERNEL_OFFS+\  					0x400000)  #define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x280000 + +#define CONFIG_SPL_FAT_LOAD_KERNEL_NAME		"uImage" +#define CONFIG_SPL_FAT_LOAD_ARGS_NAME		"args" + +#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR	0x500 /* address 0xa0000 */ +#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR	0x8   /* address 0x1000 */ +#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS	8     /* 4KB */ +  #define CONFIG_SYS_SPL_ARGS_ADDR        (PHYS_SDRAM_1 + 0x100)  #endif /* __CONFIG_H */ diff --git a/include/configs/eXalion.h b/include/configs/eXalion.h index 3238ac732..a6a0f8bb5 100644 --- a/include/configs/eXalion.h +++ b/include/configs/eXalion.h @@ -180,6 +180,7 @@   * PCI stuff   */  #define CONFIG_PCI		1	/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE 1	/* indirect PCI bridge support */  #undef	CONFIG_PCI_PNP diff --git a/include/configs/ebony.h b/include/configs/ebony.h index d6b655122..b05ba08af 100644 --- a/include/configs/ebony.h +++ b/include/configs/ebony.h @@ -177,6 +177,7 @@   */  /* General PCI */  #define CONFIG_PCI			            /* include pci support	        */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_PNP			        /* do pci plug-and-play         */  #define CONFIG_PCI_SCAN_SHOW            /* show pci devices on startup  */  #define CONFIG_SYS_PCI_TARGBASE    0x80000000  /* PCIaddr mapped to CONFIG_SYS_PCI_MEMBASE */ diff --git a/include/configs/ep82xxm.h b/include/configs/ep82xxm.h index 8d78921f6..7393f289a 100644 --- a/include/configs/ep82xxm.h +++ b/include/configs/ep82xxm.h @@ -254,6 +254,7 @@   */  /* General PCI */  #define CONFIG_PCI			/* include pci support	        */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_PNP			/* do pci plug-and-play   */  #define CONFIG_PCI_SCAN_SHOW            /* show pci devices on startup  */  #define CONFIG_PCI_BOOTDELAY	0 diff --git a/include/configs/exynos5250-dt.h b/include/configs/exynos5250-dt.h index b32d1bdb9..582c584ae 100644 --- a/include/configs/exynos5250-dt.h +++ b/include/configs/exynos5250-dt.h @@ -43,6 +43,14 @@  #define CONFIG_OF_CONTROL  #define CONFIG_OF_SEPARATE +/* Allow tracing to be enabled */ +#define CONFIG_TRACE +#define CONFIG_CMD_TRACE +#define CONFIG_TRACE_BUFFER_SIZE	(16 << 20) +#define CONFIG_TRACE_EARLY_SIZE		(8 << 20) +#define CONFIG_TRACE_EARLY +#define CONFIG_TRACE_EARLY_ADDR		0x50000000 +  /* Keep L2 Cache Disabled */  #define CONFIG_SYS_DCACHE_OFF @@ -82,11 +90,19 @@  #define EXYNOS5_DEFAULT_UART_OFFSET	0x010000  #define CONFIG_SILENT_CONSOLE +/* Enable keyboard */ +#define CONFIG_CROS_EC		/* CROS_EC protocol */ +#define CONFIG_CROS_EC_SPI		/* Support CROS_EC over SPI */ +#define CONFIG_CROS_EC_I2C		/* Support CROS_EC over I2C */ +#define CONFIG_CROS_EC_KEYB	/* CROS_EC keyboard input */ +#define CONFIG_CMD_CROS_EC +#define CONFIG_KEYBOARD +  /* Console configuration */  #define CONFIG_CONSOLE_MUX  #define CONFIG_SYS_CONSOLE_IS_IN_ENV  #define EXYNOS_DEVICE_SETTINGS \ -		"stdin=serial\0" \ +		"stdin=serial,cros-ec-keyb\0" \  		"stdout=serial,lcd\0" \  		"stderr=serial,lcd\0" @@ -146,9 +162,9 @@  /* TPM */  #define CONFIG_TPM  #define CONFIG_CMD_TPM -#define CONFIG_INFINEON_TPM_I2C -#define CONFIG_INFINEON_TPM_I2C_BUS 3 -#define CONFIG_INFINEON_TPM_I2C_ADDR 0x20 +#define CONFIG_TPM_TIS_I2C +#define CONFIG_TPM_TIS_I2C_BUS_NUMBER	3 +#define CONFIG_TPM_TIS_I2C_SLAVE_ADDR	0x20  /* MMC SPL */  #define CONFIG_SPL diff --git a/include/configs/gdppc440etx.h b/include/configs/gdppc440etx.h index 9efbb8e34..7b8bac48e 100644 --- a/include/configs/gdppc440etx.h +++ b/include/configs/gdppc440etx.h @@ -178,6 +178,7 @@  /* General PCI */  #define CONFIG_PCI				/* include pci support        */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #undef  CONFIG_PCI_PNP				/* do (not) pci plug-and-play */  #define CONFIG_PCI_SCAN_SHOW			/* show pci devices on startup*/  #define CONFIG_SYS_PCI_TARGBASE		0x80000000	/* PCIaddr mapped to \ diff --git a/include/configs/icon.h b/include/configs/icon.h index 2fac0efe1..c2da4cec9 100644 --- a/include/configs/icon.h +++ b/include/configs/icon.h @@ -234,6 +234,7 @@   */  /* General PCI */  #define CONFIG_PCI			/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_PNP			/* do pci plug-and-play		*/  #define CONFIG_PCI_SCAN_SHOW		/* show pci devices on startup	*/  #define CONFIG_PCI_CONFIG_HOST_BRIDGE diff --git a/include/configs/igep0033.h b/include/configs/igep0033.h index afbd54999..12f28f82a 100644 --- a/include/configs/igep0033.h +++ b/include/configs/igep0033.h @@ -215,12 +215,11 @@  #define CONFIG_SPL  #define CONFIG_SPL_FRAMEWORK  /* - * Place the image at the start of the ROM defined image space and leave - * space for SRAM scratch entries (see arch/arm/include/omap_common.h). + * Place the image at the start of the ROM defined image space.   * We limit our size to the ROM-defined downloaded image area, and use the   * rest of the space for stack.   */ -#define CONFIG_SPL_TEXT_BASE		0x402F0500 +#define CONFIG_SPL_TEXT_BASE		0x402F0400  #define CONFIG_SPL_MAX_SIZE		(0x4030C000 - CONFIG_SPL_TEXT_BASE)  #define CONFIG_SPL_STACK		CONFIG_SYS_INIT_SP_ADDR diff --git a/include/configs/intip.h b/include/configs/intip.h index 33364a843..ed96b1b3c 100644 --- a/include/configs/intip.h +++ b/include/configs/intip.h @@ -316,6 +316,7 @@   */  /* General PCI */  #define CONFIG_PCI			/* include pci support	        */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_PNP			/* do pci plug-and-play   */  #define CONFIG_PCI_SCAN_SHOW		/* show pci devices on startup  */  #define CONFIG_PCI_CONFIG_HOST_BRIDGE diff --git a/include/configs/katmai.h b/include/configs/katmai.h index 3ed8dc7f3..c6f712c93 100644 --- a/include/configs/katmai.h +++ b/include/configs/katmai.h @@ -238,6 +238,7 @@   */  /* General PCI */  #define CONFIG_PCI			/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_PNP		1	/* do pci plug-and-play		*/  #define CONFIG_PCI_SCAN_SHOW	1	/* show pci devices on startup	*/  #define CONFIG_PCI_CONFIG_HOST_BRIDGE diff --git a/include/configs/kilauea.h b/include/configs/kilauea.h index d505a41de..aec4a584e 100644 --- a/include/configs/kilauea.h +++ b/include/configs/kilauea.h @@ -483,6 +483,7 @@   * PCI stuff   *----------------------------------------------------------------------*/  #define CONFIG_PCI			/* include pci support	        */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_PNP		1	/* do pci plug-and-play		*/  #define CONFIG_PCI_SCAN_SHOW	1	/* show pci devices on startup	*/  #define CONFIG_PCI_CONFIG_HOST_BRIDGE diff --git a/include/configs/korat.h b/include/configs/korat.h index b919aec35..d7c1f8508 100644 --- a/include/configs/korat.h +++ b/include/configs/korat.h @@ -355,6 +355,7 @@   */  /* General PCI */  #define CONFIG_PCI			/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_PNP			/* do pci plug-and-play		*/  #define CONFIG_SYS_PCI_CACHE_LINE_SIZE	0	/* to avoid problems with PNP	*/  #define CONFIG_PCI_SCAN_SHOW		/* show pci devices on startup	*/ diff --git a/include/configs/kvme080.h b/include/configs/kvme080.h index e49dc2877..87a5056af 100644 --- a/include/configs/kvme080.h +++ b/include/configs/kvme080.h @@ -169,6 +169,7 @@  #define CONFIG_SYS_NS16550_CLK		14745600  #define CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_PCI_PNP  #define CONFIG_EEPRO100 diff --git a/include/configs/linkstation.h b/include/configs/linkstation.h index eec79619c..20f0a18f8 100644 --- a/include/configs/linkstation.h +++ b/include/configs/linkstation.h @@ -185,6 +185,7 @@   * PCI stuff   */  #define CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  /* Verified: CONFIG_PCI_PNP doesn't work */  #undef CONFIG_PCI_PNP  #define CONFIG_PCI_SCAN_SHOW diff --git a/include/configs/luan.h b/include/configs/luan.h index 3b4761bd0..f0e568af8 100644 --- a/include/configs/luan.h +++ b/include/configs/luan.h @@ -178,6 +178,7 @@  /* General PCI */  #define CONFIG_PCI			/* include pci support	        */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_PNP			/* do (not) pci plug-and-play   */  #define CONFIG_PCI_SCAN_SHOW            /* show pci devices on startup  */ diff --git a/include/configs/makalu.h b/include/configs/makalu.h index 6c1b13665..f71f28bb8 100644 --- a/include/configs/makalu.h +++ b/include/configs/makalu.h @@ -276,6 +276,7 @@   * PCI stuff   *----------------------------------------------------------------------*/  #define CONFIG_PCI			/* include pci support	        */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_PNP		1	/* do pci plug-and-play		*/  #define CONFIG_PCI_SCAN_SHOW	1	/* show pci devices on startup	*/  #define CONFIG_PCI_CONFIG_HOST_BRIDGE diff --git a/include/configs/mpc5121ads.h b/include/configs/mpc5121ads.h index 64ce52dee..6f003aa03 100644 --- a/include/configs/mpc5121ads.h +++ b/include/configs/mpc5121ads.h @@ -336,6 +336,7 @@   * PCI   */  #ifdef CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  /*   * General PCI diff --git a/include/configs/mpc8308_p1m.h b/include/configs/mpc8308_p1m.h index aa681f062..3c7a85e35 100644 --- a/include/configs/mpc8308_p1m.h +++ b/include/configs/mpc8308_p1m.h @@ -353,6 +353,7 @@  #define CONFIG_SYS_SCCR_PCIEXP1CM	1  #define CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_PCIE  #define CONFIG_PCI_PNP		/* do pci plug-and-play */ diff --git a/include/configs/ocotea.h b/include/configs/ocotea.h index d0fe9dadf..3e64c7405 100644 --- a/include/configs/ocotea.h +++ b/include/configs/ocotea.h @@ -197,6 +197,7 @@   */  /* General PCI */  #define CONFIG_PCI			/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_PNP			/* do pci plug-and-play		*/  #define CONFIG_PCI_SCAN_SHOW		/* show pci devices on startup	*/  #define CONFIG_SYS_PCI_TARGBASE    0x80000000	/* PCIaddr mapped to CONFIG_SYS_PCI_MEMBASE */ diff --git a/include/configs/p1_p2_rdb_pc.h b/include/configs/p1_p2_rdb_pc.h index 7ed634b70..2fa537291 100644 --- a/include/configs/p1_p2_rdb_pc.h +++ b/include/configs/p1_p2_rdb_pc.h @@ -217,6 +217,7 @@  #define CONFIG_PCIE1	/* PCIE controler 1 (slot 1) */  #define CONFIG_PCIE2	/* PCIE controler 2 (slot 2) */  #define CONFIG_FSL_PCI_INIT	/* Use common FSL init code */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_FSL_PCIE_RESET	/* need PCIe reset errata */  #define CONFIG_SYS_PCI_64BIT	/* enable 64-bit PCI resources */ diff --git a/include/configs/p3p440.h b/include/configs/p3p440.h index d7b1ca203..a19de079b 100644 --- a/include/configs/p3p440.h +++ b/include/configs/p3p440.h @@ -241,6 +241,7 @@   *----------------------------------------------------------------------*/  /* General PCI */  #define CONFIG_PCI			            /* include pci support	        */ +#define	CONFIG_PCI_INDIRECT_BRIDGE 1	/* indirect PCI bridge support */  #define CONFIG_PCI_PNP			        /* do pci plug-and-play         */  #define CONFIG_PCI_SCAN_SHOW            /* show pci devices on startup  */  #define CONFIG_SYS_PCI_TARGBASE    0x80000000  /* PCIaddr mapped to CONFIG_SYS_PCI_MEMBASE */ diff --git a/include/configs/paz00.h b/include/configs/paz00.h index eac1ef9e0..9e2686ac4 100644 --- a/include/configs/paz00.h +++ b/include/configs/paz00.h @@ -46,7 +46,7 @@  /* Environment in eMMC, at the end of 2nd "boot sector" */  #define CONFIG_ENV_IS_IN_MMC -#define CONFIG_ENV_OFFSET ((1024 * 1024) - CONFIG_ENV_SIZE) +#define CONFIG_ENV_OFFSET (-CONFIG_ENV_SIZE)  #define CONFIG_SYS_MMC_ENV_DEV 0  #define CONFIG_SYS_MMC_ENV_PART 2 diff --git a/include/configs/pcm051.h b/include/configs/pcm051.h index 348030227..9b16c4782 100644 --- a/include/configs/pcm051.h +++ b/include/configs/pcm051.h @@ -205,12 +205,11 @@  #define CONFIG_SPL  #define CONFIG_SPL_FRAMEWORK  /* - * Place the image at the start of the ROM defined image space and leave - * space for SRAM scratch entries (see arch/arm/include/omap_common.h). + * Place the image at the start of the ROM defined image space.   * We limit our size to the ROM-defined downloaded image area, and use the   * rest of the space for stack.   */ -#define CONFIG_SPL_TEXT_BASE		0x402F0500 +#define CONFIG_SPL_TEXT_BASE		0x402F0400  #define CONFIG_SPL_MAX_SIZE		(0x4030C000 - CONFIG_SPL_TEXT_BASE)  #define CONFIG_SPL_STACK		CONFIG_SYS_INIT_SP_ADDR @@ -232,6 +231,7 @@  #define CONFIG_SPL_GPIO_SUPPORT  #define CONFIG_SPL_YMODEM_SUPPORT  #define CONFIG_SPL_NET_SUPPORT +#define CONFIG_SPL_ENV_SUPPORT  #define CONFIG_SPL_NET_VCI_STRING	"pcm051 U-Boot SPL"  #define CONFIG_SPL_ETH_SUPPORT  #define CONFIG_SPL_SPI_SUPPORT diff --git a/include/configs/pcs440ep.h b/include/configs/pcs440ep.h index 351ff5a22..189761905 100644 --- a/include/configs/pcs440ep.h +++ b/include/configs/pcs440ep.h @@ -317,6 +317,7 @@   */  /* General PCI */  #define CONFIG_PCI			/* include pci support	        */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #undef  CONFIG_PCI_PNP			/* do (not) pci plug-and-play   */  #define CONFIG_PCI_SCAN_SHOW            /* show pci devices on startup  */  #define CONFIG_SYS_PCI_TARGBASE        0x80000000 /* PCIaddr mapped to CONFIG_SYS_PCI_MEMBASE*/ diff --git a/include/configs/pm9263.h b/include/configs/pm9263.h index b60a9ade1..6f6ddfa20 100644 --- a/include/configs/pm9263.h +++ b/include/configs/pm9263.h @@ -355,7 +355,7 @@  #define CONFIG_BOOTCOMMAND		"run flashboot"  #define CONFIG_ROOTPATH			"/ronetix/rootfs" -#define CONFIG_AUTOBOOT_PROMPT		"autoboot in %d seconds\n" +#define CONFIG_AUTOBOOT_PROMPT		"autoboot in %d seconds\n", bootdelay  #define CONFIG_CON_ROT			"fbcon=rotate:3 "  #define CONFIG_BOOTARGS			"root=/dev/mtdblock4 rootfstype=jffs2 "\ diff --git a/include/configs/ppmc7xx.h b/include/configs/ppmc7xx.h index 5cd660927..3f9fdd444 100644 --- a/include/configs/ppmc7xx.h +++ b/include/configs/ppmc7xx.h @@ -118,6 +118,7 @@   */  #define	CONFIG_PCI +#define	CONFIG_PCI_INDIRECT_BRIDGE  #define	CONFIG_PCI_PNP  #undef	CONFIG_PCI_SCAN_SHOW @@ -233,7 +234,7 @@  #define CONFIG_SYS_FLASH_ERASE_TOUT	250000  #define CONFIG_SYS_FLASH_WRITE_TOUT	5000  #define CONFIG_SYS_MAX_FLASH_BANKS	1 -#define CONFIG_SYS_MAX_FLASH_SECT	19 +#define CONFIG_SYS_MAX_FLASH_SECT	128  /* diff --git a/include/configs/rpi_b.h b/include/configs/rpi_b.h index c18b35b05..216c6cb70 100644 --- a/include/configs/rpi_b.h +++ b/include/configs/rpi_b.h @@ -61,6 +61,7 @@  #define CONFIG_BCM2835_GPIO  /* LCD */  #define CONFIG_LCD +#define CONFIG_LCD_DT_SIMPLEFB  #define LCD_BPP				LCD_COLOR16  /*   * Prevent allocation of RAM for FB; the real FB address is queried @@ -175,6 +176,7 @@  /* Device tree support for bootm/bootz */  #define CONFIG_OF_LIBFDT +#define CONFIG_OF_BOARD_SETUP  /* ATAGs support for bootm/bootz */  #define CONFIG_SETUP_MEMORY_TAGS  #define CONFIG_CMDLINE_TAG diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h index 788207d00..98dd08330 100644 --- a/include/configs/sandbox.h +++ b/include/configs/sandbox.h @@ -22,6 +22,19 @@  #ifndef __CONFIG_H  #define __CONFIG_H +#ifdef FTRACE +#define CONFIG_TRACE +#define CONFIG_CMD_TRACE +#define CONFIG_TRACE_BUFFER_SIZE	(16 << 20) +#define CONFIG_TRACE_EARLY_SIZE		(8 << 20) +#define CONFIG_TRACE_EARLY +#define CONFIG_TRACE_EARLY_ADDR		0x00100000 + +#endif + +#define CONFIG_BOOTSTAGE +#define CONFIG_BOOTSTAGE_REPORT +  /* Number of bits in a C 'long' on this architecture */  #define CONFIG_SANDBOX_BITS_PER_LONG	64 @@ -30,6 +43,8 @@  #define CONFIG_OF_LIBFDT  #define CONFIG_LMB  #define CONFIG_FIT +#define CONFIG_FIT_SIGNATURE +#define CONFIG_RSA  #define CONFIG_CMD_FDT  #define CONFIG_FS_FAT diff --git a/include/configs/sbc405.h b/include/configs/sbc405.h index 5abcda3c3..6e53bc2ee 100644 --- a/include/configs/sbc405.h +++ b/include/configs/sbc405.h @@ -183,6 +183,7 @@  #define PCI_HOST_AUTO		2	/* detected via arbiter enable	*/  #define CONFIG_PCI			/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_HOST	PCI_HOST_FORCE	/* select pci host function	*/  #define CONFIG_PCI_PNP			/* do pci plug-and-play		*/  					/* resource configuration	*/ diff --git a/include/configs/sbc8349.h b/include/configs/sbc8349.h index 478d0d8f9..fdc1b95e2 100644 --- a/include/configs/sbc8349.h +++ b/include/configs/sbc8349.h @@ -573,6 +573,7 @@  /* PCI @ 0x80000000 */  #ifdef CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_SYS_IBAT1L	(CONFIG_SYS_PCI1_MEM_BASE \  				| BATL_PP_RW \  				| BATL_MEMCOHERENCE) diff --git a/include/configs/sbc8548.h b/include/configs/sbc8548.h index 2209ddf82..148ade356 100644 --- a/include/configs/sbc8548.h +++ b/include/configs/sbc8548.h @@ -33,6 +33,7 @@   * Top level Makefile configuration choices   */  #ifdef CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_PCI1  #endif diff --git a/include/configs/sbc8641d.h b/include/configs/sbc8641d.h index 9040ec609..0e2d17deb 100644 --- a/include/configs/sbc8641d.h +++ b/include/configs/sbc8641d.h @@ -64,6 +64,7 @@  #define CONFIG_PCIE1		1	/* PCIE controler 1 (slot 1) */  #define CONFIG_PCIE2		1	/* PCIE controler 2 (slot 2) */  #define CONFIG_FSL_PCI_INIT	1	/* Use common FSL init code */ +#define CONFIG_PCI_INDIRECT_BRIDGE 1	/* indirect PCI bridge support */  #define CONFIG_FSL_LAW		1	/* Use common FSL init code */  #define CONFIG_TSEC_ENET		/* tsec ethernet support */ diff --git a/include/configs/sc3.h b/include/configs/sc3.h index fb74608bb..9dec21de6 100644 --- a/include/configs/sc3.h +++ b/include/configs/sc3.h @@ -269,6 +269,7 @@  #define PCI_HOST_AUTO	2		/* detected via arbiter enable	*/  #define CONFIG_PCI			/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_HOST	PCI_HOST_FORCE	/* select pci host function	*/  #define CONFIG_PCI_PNP			/* do pci plug-and-play		*/  					/* resource configuration	*/ diff --git a/include/configs/seaboard.h b/include/configs/seaboard.h index f66173e0f..f0da1fcf1 100644 --- a/include/configs/seaboard.h +++ b/include/configs/seaboard.h @@ -72,7 +72,7 @@  /* Environment in eMMC, at the end of 2nd "boot sector" */  #define CONFIG_ENV_IS_IN_MMC -#define CONFIG_ENV_OFFSET ((512 * 1024) - CONFIG_ENV_SIZE) +#define CONFIG_ENV_OFFSET (-CONFIG_ENV_SIZE)  #define CONFIG_SYS_MMC_ENV_DEV 0  #define CONFIG_SYS_MMC_ENV_PART 2 diff --git a/include/configs/sequoia.h b/include/configs/sequoia.h index dd5d7cd26..11fce53c0 100644 --- a/include/configs/sequoia.h +++ b/include/configs/sequoia.h @@ -363,6 +363,7 @@   */  /* General PCI */  #define CONFIG_PCI			/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_PNP			/* do pci plug-and-play		*/  #define CONFIG_SYS_PCI_CACHE_LINE_SIZE	0	/* to avoid problems with PNP	*/  #define CONFIG_PCI_SCAN_SHOW		/* show pci devices on startup	*/ diff --git a/include/configs/socrates.h b/include/configs/socrates.h index 25f15f2c3..7a0b48193 100644 --- a/include/configs/socrates.h +++ b/include/configs/socrates.h @@ -48,6 +48,7 @@  #define	CONFIG_SYS_TEXT_BASE	0xfff80000  #define CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_TSEC_ENET		/* tsec ethernet support	*/ diff --git a/include/configs/stxssa.h b/include/configs/stxssa.h index c1a90a704..96d7128d0 100644 --- a/include/configs/stxssa.h +++ b/include/configs/stxssa.h @@ -46,6 +46,7 @@  #define	CONFIG_SYS_TEXT_BASE	0xFFF80000  #define CONFIG_PCI			/* PCI ethernet support	*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_TSEC_ENET		/* tsec ethernet support*/  #undef CONFIG_ETHER_ON_FCC		/* cpm FCC ethernet support */  #define CONFIG_ENV_OVERWRITE diff --git a/include/configs/t3corp.h b/include/configs/t3corp.h index 2a731a637..ff2189c2f 100644 --- a/include/configs/t3corp.h +++ b/include/configs/t3corp.h @@ -376,6 +376,7 @@   */  /* General PCI */  #define CONFIG_PCI			/* include pci support	        */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_PNP			/* do pci plug-and-play   */  #define CONFIG_PCI_SCAN_SHOW		/* show pci devices on startup  */  #define CONFIG_PCI_CONFIG_HOST_BRIDGE diff --git a/include/configs/t4qds.h b/include/configs/t4qds.h index fa1dcc352..92b2179ca 100644 --- a/include/configs/t4qds.h +++ b/include/configs/t4qds.h @@ -33,6 +33,15 @@  #define CONFIG_PBLRCW_CONFIG $(SRCTREE)/board/freescale/t4qds/t4_rcw.cfg  #endif +#ifdef CONFIG_SRIO_PCIE_BOOT_SLAVE +/* Set 1M boot space */ +#define CONFIG_SYS_SRIO_PCIE_BOOT_SLAVE_ADDR (CONFIG_SYS_TEXT_BASE & 0xfff00000) +#define CONFIG_SYS_SRIO_PCIE_BOOT_SLAVE_ADDR_PHYS \ +		(0x300000000ull | CONFIG_SYS_SRIO_PCIE_BOOT_SLAVE_ADDR) +#define CONFIG_RESET_VECTOR_ADDRESS 0xfffffffc +#define CONFIG_SYS_NO_FLASH +#endif +  #define CONFIG_CMD_REGINFO  /* High Level Configuration Options */ @@ -65,20 +74,22 @@  #define CONFIG_SYS_SRIO  #define CONFIG_SRIO1			/* SRIO port 1 */  #define CONFIG_SRIO2			/* SRIO port 2 */ +#define CONFIG_SRIO_PCIE_BOOT_MASTER  #define CONFIG_FSL_LAW			/* Use common FSL init code */  #define CONFIG_ENV_OVERWRITE  #ifdef CONFIG_SYS_NO_FLASH +#if !defined(CONFIG_SRIO_PCIE_BOOT_SLAVE) && !defined(CONFIG_RAMBOOT_PBL)  #define CONFIG_ENV_IS_NOWHERE +#endif  #else  #define CONFIG_FLASH_CFI_DRIVER  #define CONFIG_SYS_FLASH_CFI  #define CONFIG_SYS_FLASH_USE_BUFFER_WRITE  #endif -#ifndef CONFIG_SYS_NO_FLASH  #if defined(CONFIG_SPIFLASH)  #define CONFIG_SYS_EXTRA_ENV_RELOC  #define CONFIG_ENV_IS_IN_SPI_FLASH @@ -100,18 +111,18 @@  #define CONFIG_ENV_IS_IN_NAND  #define CONFIG_ENV_SIZE			CONFIG_SYS_NAND_BLOCK_SIZE  #define CONFIG_ENV_OFFSET		(5 * CONFIG_SYS_NAND_BLOCK_SIZE) +#elif defined(CONFIG_SRIO_PCIE_BOOT_SLAVE) +#define CONFIG_ENV_IS_IN_REMOTE +#define CONFIG_ENV_ADDR		0xffe20000 +#define CONFIG_ENV_SIZE		0x2000 +#elif defined(CONFIG_ENV_IS_NOWHERE) +#define CONFIG_ENV_SIZE		0x2000  #else  #define CONFIG_ENV_IS_IN_FLASH  #define CONFIG_ENV_ADDR		(CONFIG_SYS_MONITOR_BASE - CONFIG_ENV_SECT_SIZE)  #define CONFIG_ENV_SIZE		0x2000  #define CONFIG_ENV_SECT_SIZE	0x20000 /* 128K (one sector) */  #endif -#else /* CONFIG_SYS_NO_FLASH */ -#define CONFIG_ENV_SIZE                0x2000 -#define CONFIG_ENV_SECT_SIZE   0x20000 /* 128K (one sector) */ -#endif - -  #define CONFIG_SYS_CLK_FREQ	get_board_sys_clk()  #define CONFIG_DDR_CLK_FREQ	get_board_ddr_clk() @@ -633,6 +644,16 @@ unsigned long get_board_ddr_clk(void);  #elif defined(CONFIG_NAND)  #define CONFIG_SYS_QE_FMAN_FW_IN_NAND  #define CONFIG_SYS_QE_FMAN_FW_ADDR	(6 * CONFIG_SYS_NAND_BLOCK_SIZE) +#elif defined(CONFIG_SRIO_PCIE_BOOT_SLAVE) +/* + * Slave has no ucode locally, it can fetch this from remote. When implementing + * in two corenet boards, slave's ucode could be stored in master's memory + * space, the address can be mapped from slave TLB->slave LAW-> + * slave SRIO or PCIE outbound window->master inbound window-> + * master LAW->the ucode address in master's memory space. + */ +#define CONFIG_SYS_QE_FMAN_FW_IN_REMOTE +#define CONFIG_SYS_QE_FMAN_FW_ADDR	0xFFE00000  #else  #define CONFIG_SYS_QE_FMAN_FW_IN_NOR  #define CONFIG_SYS_QE_FMAN_FW_ADDR		0xEFF40000 @@ -657,6 +678,7 @@ unsigned long get_board_ddr_clk(void);  #endif  #ifdef CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_NET_MULTI  #define CONFIG_PCI_PNP			/* do pci plug-and-play */  #define CONFIG_E1000 diff --git a/include/configs/taihu.h b/include/configs/taihu.h index a3738b7b1..a43c3da4a 100644 --- a/include/configs/taihu.h +++ b/include/configs/taihu.h @@ -171,6 +171,7 @@ unsigned char spi_read(void);  #define PCI_HOST_AUTO    2		/* detected via arbiter enable */  #define CONFIG_PCI			/* include pci support	       */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_HOST	PCI_HOST_FORCE  /* select pci host function    */  #define CONFIG_PCI_PNP			/* do pci plug-and-play        */  					/* resource configuration      */ diff --git a/include/configs/taishan.h b/include/configs/taishan.h index 3046081c5..c9f1a9fa2 100644 --- a/include/configs/taishan.h +++ b/include/configs/taishan.h @@ -192,6 +192,7 @@   */  /* General PCI */  #define CONFIG_PCI			/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_PNP			/* do pci plug-and-play		*/  #define CONFIG_EEPRO100       1		/* include PCI EEPRO100		*/  #define CONFIG_PCI_SCAN_SHOW		/* show pci devices on startup	*/ diff --git a/include/configs/utx8245.h b/include/configs/utx8245.h index 66568c8d0..60d1503bc 100644 --- a/include/configs/utx8245.h +++ b/include/configs/utx8245.h @@ -139,6 +139,7 @@ protect on ${u-boot_startaddr} ${u-boot_endaddr}"   *-----------------------------------------------------------------------   */  #define CONFIG_PCI				/* include pci support		*/ +#define	CONFIG_PCI_INDIRECT_BRIDGE 1	/* indirect PCI bridge support */  #undef CONFIG_PCI_PNP  #define CONFIG_PCI_SCAN_SHOW  #define CONFIG_EEPRO100 diff --git a/include/configs/ve8313.h b/include/configs/ve8313.h index d3b837918..7b1130a48 100644 --- a/include/configs/ve8313.h +++ b/include/configs/ve8313.h @@ -43,6 +43,7 @@  #endif  #define CONFIG_PCI		1 +#define CONFIG_PCI_INDIRECT_BRIDGE 1  #define CONFIG_FSL_ELBC		1  #define CONFIG_BOARD_EARLY_INIT_F	1 diff --git a/include/configs/ventana.h b/include/configs/ventana.h index 64e78751a..05e682c4e 100644 --- a/include/configs/ventana.h +++ b/include/configs/ventana.h @@ -53,7 +53,7 @@  /* Environment in eMMC, at the end of 2nd "boot sector" */  #define CONFIG_ENV_IS_IN_MMC -#define CONFIG_ENV_OFFSET ((1024 * 1024) - CONFIG_ENV_SIZE) +#define CONFIG_ENV_OFFSET (-CONFIG_ENV_SIZE)  #define CONFIG_SYS_MMC_ENV_DEV 0  #define CONFIG_SYS_MMC_ENV_PART 2 diff --git a/include/configs/vme8349.h b/include/configs/vme8349.h index 61e02e607..f97de5490 100644 --- a/include/configs/vme8349.h +++ b/include/configs/vme8349.h @@ -489,6 +489,7 @@  /* PCI @ 0x80000000 */  #ifdef CONFIG_PCI +#define CONFIG_PCI_INDIRECT_BRIDGE  #define CONFIG_SYS_IBAT1L	(CONFIG_SYS_PCI1_MEM_BASE | BATL_PP_RW | \  				 BATL_MEMCOHERENCE)  #define CONFIG_SYS_IBAT1U	(CONFIG_SYS_PCI1_MEM_BASE | BATU_BL_256M | \ diff --git a/include/configs/walnut.h b/include/configs/walnut.h index d10f74843..219f276a4 100644 --- a/include/configs/walnut.h +++ b/include/configs/walnut.h @@ -112,6 +112,7 @@  #define PCI_HOST_AUTO	2		/* detected via arbiter enable	*/  #define CONFIG_PCI			/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_HOST PCI_HOST_FORCE	/* select pci host function	*/  #define CONFIG_PCI_PNP			/* do pci plug-and-play		*/  					/* resource configuration	*/ diff --git a/include/configs/whistler.h b/include/configs/whistler.h index 9542c7e21..994edecaa 100644 --- a/include/configs/whistler.h +++ b/include/configs/whistler.h @@ -61,12 +61,12 @@  /*   * Environment in eMMC, at the end of 2nd "boot sector". Note: This assumes - * the user plugged the standard 8MB MoviNAND card into J29/HSMMC/POP. If + * the user plugged the standard 8GB MoviNAND card into J29/HSMMC/POP. If   * they didn't, the boot sector layout may be different. However, use of that   * particular card is standard practice as far as I know.   */  #define CONFIG_ENV_IS_IN_MMC -#define CONFIG_ENV_OFFSET ((512 * 1024) - CONFIG_ENV_SIZE) +#define CONFIG_ENV_OFFSET (-CONFIG_ENV_SIZE)  #define CONFIG_SYS_MMC_ENV_DEV 0  #define CONFIG_SYS_MMC_ENV_PART 2 diff --git a/include/configs/xpedite1000.h b/include/configs/xpedite1000.h index 506d646fe..1f48cc577 100644 --- a/include/configs/xpedite1000.h +++ b/include/configs/xpedite1000.h @@ -167,6 +167,7 @@ extern void out32(unsigned int, unsigned long);   */  /* General PCI */  #define CONFIG_PCI				/* include pci support */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_PNP				/* do pci plug-and-play */  #define CONFIG_PCI_SCAN_SHOW			/* show pci devices on startup */  #define CONFIG_SYS_PCI_TARGBASE	0x80000000	/* PCIaddr mapped to CONFIG_SYS_PCI_MEMBASE */ diff --git a/include/configs/xpedite517x.h b/include/configs/xpedite517x.h index 1851a00c1..f28f443fe 100644 --- a/include/configs/xpedite517x.h +++ b/include/configs/xpedite517x.h @@ -49,6 +49,7 @@  #define CONFIG_PCIE1		1	/* PCIE controler 1 */  #define CONFIG_PCIE2		1	/* PCIE controler 2 */  #define CONFIG_FSL_PCI_INIT	1	/* Use common FSL init code */ +#define CONFIG_PCI_INDIRECT_BRIDGE 1	/* indirect PCI bridge support */  #define CONFIG_SYS_PCI_64BIT	1	/* enable 64-bit PCI resources */  #define CONFIG_FSL_LAW		1	/* Use common FSL init code */ diff --git a/include/configs/xpedite520x.h b/include/configs/xpedite520x.h index ff99481b2..3034a3c9a 100644 --- a/include/configs/xpedite520x.h +++ b/include/configs/xpedite520x.h @@ -48,6 +48,7 @@  #define CONFIG_PCI_SCAN_SHOW	1	/* show pci devices on startup */  #define CONFIG_PCI1		1	/* PCI controller 1 */  #define CONFIG_FSL_PCI_INIT	1	/* Use common FSL init code */ +#define CONFIG_PCI_INDIRECT_BRIDGE 1	/* indirect PCI bridge support */  #define CONFIG_SYS_PCI_64BIT	1	/* enable 64-bit PCI resources */  #define CONFIG_FSL_LAW		1	/* Use common FSL init code */ diff --git a/include/configs/xpedite537x.h b/include/configs/xpedite537x.h index 46f1c903f..43359a2ee 100644 --- a/include/configs/xpedite537x.h +++ b/include/configs/xpedite537x.h @@ -49,6 +49,7 @@  #define CONFIG_PCIE1		1	/* PCIE controler 1 */  #define CONFIG_PCIE2		1	/* PCIE controler 2 */  #define CONFIG_FSL_PCI_INIT	1	/* Use common FSL init code */ +#define CONFIG_PCI_INDIRECT_BRIDGE 1	/* indirect PCI bridge support */  #define CONFIG_SYS_PCI_64BIT	1	/* enable 64-bit PCI resources */  #define CONFIG_FSL_PCIE_RESET	1	/* need PCIe reset errata */  #define CONFIG_FSL_LAW		1	/* Use common FSL init code */ diff --git a/include/configs/xpedite550x.h b/include/configs/xpedite550x.h index 2acf6c80a..a17108535 100644 --- a/include/configs/xpedite550x.h +++ b/include/configs/xpedite550x.h @@ -48,6 +48,7 @@  #define CONFIG_PCI_SCAN_SHOW	1	/* show pci devices on startup */  #define CONFIG_PCIE1		1	/* PCIE controler 1 (PEX8112 or XMC) */  #define CONFIG_FSL_PCI_INIT	1	/* Use common FSL init code */ +#define CONFIG_PCI_INDIRECT_BRIDGE 1	/* indirect PCI bridge support */  #define CONFIG_SYS_PCI_64BIT	1	/* enable 64-bit PCI resources */  #define CONFIG_FSL_PCIE_RESET	1	/* need PCIe reset errata */  #define CONFIG_FSL_LAW		1	/* Use common FSL init code */ diff --git a/include/configs/yosemite.h b/include/configs/yosemite.h index 0cbef6f85..cde0df1a0 100644 --- a/include/configs/yosemite.h +++ b/include/configs/yosemite.h @@ -222,6 +222,7 @@   */  /* General PCI */  #define CONFIG_PCI			/* include pci support	        */ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #undef  CONFIG_PCI_PNP			/* do (not) pci plug-and-play   */  #define CONFIG_PCI_SCAN_SHOW            /* show pci devices on startup  */  #define CONFIG_SYS_PCI_TARGBASE        0x80000000 /* PCIaddr mapped to CONFIG_SYS_PCI_MEMBASE*/ diff --git a/include/configs/yucca.h b/include/configs/yucca.h index fb684b5e1..3282d378d 100644 --- a/include/configs/yucca.h +++ b/include/configs/yucca.h @@ -199,6 +199,7 @@   */  /* General PCI */  #define CONFIG_PCI			/* include pci support		*/ +#define CONFIG_PCI_INDIRECT_BRIDGE	/* indirect PCI bridge support */  #define CONFIG_PCI_PNP		1	/* do pci plug-and-play		*/  #define CONFIG_PCI_SCAN_SHOW	1	/* show pci devices on startup	*/  #define CONFIG_PCI_CONFIG_HOST_BRIDGE diff --git a/include/cros_ec.h b/include/cros_ec.h new file mode 100644 index 000000000..335d5b4e6 --- /dev/null +++ b/include/cros_ec.h @@ -0,0 +1,449 @@ +/* + * Chromium OS cros_ec driver + * + * Copyright (c) 2012 The Chromium OS Authors. + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef _CROS_EC_H +#define _CROS_EC_H + +#include <linux/compiler.h> +#include <ec_commands.h> +#include <fdtdec.h> +#include <cros_ec_message.h> + +/* Which interface is the device on? */ +enum cros_ec_interface_t { +	CROS_EC_IF_NONE, +	CROS_EC_IF_SPI, +	CROS_EC_IF_I2C, +	CROS_EC_IF_LPC,	/* Intel Low Pin Count interface */ +}; + +/* Our configuration information */ +struct cros_ec_dev { +	enum cros_ec_interface_t interface; +	struct spi_slave *spi;		/* Our SPI slave, if using SPI */ +	int node;                       /* Our node */ +	int parent_node;		/* Our parent node (interface) */ +	unsigned int cs;		/* Our chip select */ +	unsigned int addr;		/* Device address (for I2C) */ +	unsigned int bus_num;		/* Bus number (for I2C) */ +	unsigned int max_frequency;	/* Maximum interface frequency */ +	struct fdt_gpio_state ec_int;	/* GPIO used as EC interrupt line */ +	int cmd_version_is_supported;   /* Device supports command versions */ +	int optimise_flash_write;	/* Don't write erased flash blocks */ + +	/* +	 * These two buffers will always be dword-aligned and include enough +	 * space for up to 7 word-alignment bytes also, so we can ensure that +	 * the body of the message is always dword-aligned (64-bit). +	 * +	 * We use this alignment to keep ARM and x86 happy. Probably word +	 * alignment would be OK, there might be a small performance advantage +	 * to using dword. +	 */ +	uint8_t din[ALIGN(MSG_BYTES + sizeof(int64_t), sizeof(int64_t))] +		__aligned(sizeof(int64_t)); +	uint8_t dout[ALIGN(MSG_BYTES + sizeof(int64_t), sizeof(int64_t))] +		__aligned(sizeof(int64_t)); +}; + +/* + * Hard-code the number of columns we happen to know we have right now.  It + * would be more correct to call cros_ec_info() at startup and determine the + * actual number of keyboard cols from there. + */ +#define CROS_EC_KEYSCAN_COLS 13 + +/* Information returned by a key scan */ +struct mbkp_keyscan { +	uint8_t data[CROS_EC_KEYSCAN_COLS]; +}; + +/** + * Read the ID of the CROS-EC device + * + * The ID is a string identifying the CROS-EC device. + * + * @param dev		CROS-EC device + * @param id		Place to put the ID + * @param maxlen	Maximum length of the ID field + * @return 0 if ok, -1 on error + */ +int cros_ec_read_id(struct cros_ec_dev *dev, char *id, int maxlen); + +/** + * Read a keyboard scan from the CROS-EC device + * + * Send a message requesting a keyboard scan and return the result + * + * @param dev		CROS-EC device + * @param scan		Place to put the scan results + * @return 0 if ok, -1 on error + */ +int cros_ec_scan_keyboard(struct cros_ec_dev *dev, struct mbkp_keyscan *scan); + +/** + * Read which image is currently running on the CROS-EC device. + * + * @param dev		CROS-EC device + * @param image		Destination for image identifier + * @return 0 if ok, <0 on error + */ +int cros_ec_read_current_image(struct cros_ec_dev *dev, +		enum ec_current_image *image); + +/** + * Read the hash of the CROS-EC device firmware. + * + * @param dev		CROS-EC device + * @param hash		Destination for hash information + * @return 0 if ok, <0 on error + */ +int cros_ec_read_hash(struct cros_ec_dev *dev, +		struct ec_response_vboot_hash *hash); + +/** + * Send a reboot command to the CROS-EC device. + * + * Note that some reboot commands (such as EC_REBOOT_COLD) also reboot the AP. + * + * @param dev		CROS-EC device + * @param cmd		Reboot command + * @param flags         Flags for reboot command (EC_REBOOT_FLAG_*) + * @return 0 if ok, <0 on error + */ +int cros_ec_reboot(struct cros_ec_dev *dev, enum ec_reboot_cmd cmd, +		uint8_t flags); + +/** + * Check if the CROS-EC device has an interrupt pending. + * + * Read the status of the external interrupt connected to the CROS-EC device. + * If no external interrupt is configured, this always returns 1. + * + * @param dev		CROS-EC device + * @return 0 if no interrupt is pending + */ +int cros_ec_interrupt_pending(struct cros_ec_dev *dev); + +enum { +	CROS_EC_OK, +	CROS_EC_ERR = 1, +	CROS_EC_ERR_FDT_DECODE, +	CROS_EC_ERR_CHECK_VERSION, +	CROS_EC_ERR_READ_ID, +	CROS_EC_ERR_DEV_INIT, +}; + +/** + * Set up the Chromium OS matrix keyboard protocol + * + * @param blob		Device tree blob containing setup information + * @param cros_ecp        Returns pointer to the cros_ec device, or NULL if none + * @return 0 if we got an cros_ec device and all is well (or no cros_ec is + *	expected), -ve if we should have an cros_ec device but failed to find + *	one, or init failed (-CROS_EC_ERR_...). + */ +int cros_ec_init(const void *blob, struct cros_ec_dev **cros_ecp); + +/** + * Read information about the keyboard matrix + * + * @param dev		CROS-EC device + * @param info		Place to put the info structure + */ +int cros_ec_info(struct cros_ec_dev *dev, +		struct ec_response_cros_ec_info *info); + +/** + * Read the host event flags + * + * @param dev		CROS-EC device + * @param events_ptr	Destination for event flags.  Not changed on error. + * @return 0 if ok, <0 on error + */ +int cros_ec_get_host_events(struct cros_ec_dev *dev, uint32_t *events_ptr); + +/** + * Clear the specified host event flags + * + * @param dev		CROS-EC device + * @param events	Event flags to clear + * @return 0 if ok, <0 on error + */ +int cros_ec_clear_host_events(struct cros_ec_dev *dev, uint32_t events); + +/** + * Get/set flash protection + * + * @param dev		CROS-EC device + * @param set_mask	Mask of flags to set; if 0, just retrieves existing + *                      protection state without changing it. + * @param set_flags	New flag values; only bits in set_mask are applied; + *                      ignored if set_mask=0. + * @param prot          Destination for updated protection state from EC. + * @return 0 if ok, <0 on error + */ +int cros_ec_flash_protect(struct cros_ec_dev *dev, +		       uint32_t set_mask, uint32_t set_flags, +		       struct ec_response_flash_protect *resp); + + +/** + * Run internal tests on the cros_ec interface. + * + * @param dev		CROS-EC device + * @return 0 if ok, <0 if the test failed + */ +int cros_ec_test(struct cros_ec_dev *dev); + +/** + * Update the EC RW copy. + * + * @param dev		CROS-EC device + * @param image		the content to write + * @param imafge_size	content length + * @return 0 if ok, <0 if the test failed + */ +int cros_ec_flash_update_rw(struct cros_ec_dev *dev, +			 const uint8_t  *image, int image_size); + +/** + * Return a pointer to the board's CROS-EC device + * + * This should be implemented by board files. + * + * @return pointer to CROS-EC device, or NULL if none is available + */ +struct cros_ec_dev *board_get_cros_ec_dev(void); + + +/* Internal interfaces */ +int cros_ec_i2c_init(struct cros_ec_dev *dev, const void *blob); +int cros_ec_spi_init(struct cros_ec_dev *dev, const void *blob); +int cros_ec_lpc_init(struct cros_ec_dev *dev, const void *blob); + +/** + * Read information from the fdt for the i2c cros_ec interface + * + * @param dev		CROS-EC device + * @param blob		Device tree blob + * @return 0 if ok, -1 if we failed to read all required information + */ +int cros_ec_i2c_decode_fdt(struct cros_ec_dev *dev, const void *blob); + +/** + * Read information from the fdt for the spi cros_ec interface + * + * @param dev		CROS-EC device + * @param blob		Device tree blob + * @return 0 if ok, -1 if we failed to read all required information + */ +int cros_ec_spi_decode_fdt(struct cros_ec_dev *dev, const void *blob); + +/** + * Check whether the LPC interface supports new-style commands. + * + * LPC has its own way of doing this, which involves checking LPC values + * visible to the host. Do this, and update dev->cmd_version_is_supported + * accordingly. + * + * @param dev		CROS-EC device to check + */ +int cros_ec_lpc_check_version(struct cros_ec_dev *dev); + +/** + * Send a command to an I2C CROS-EC device and return the reply. + * + * This rather complicated function deals with sending both old-style and + * new-style commands. The old ones have just a command byte and arguments. + * The new ones have version, command, arg-len, [args], chksum so are 3 bytes + * longer. + * + * The device's internal input/output buffers are used. + * + * @param dev		CROS-EC device + * @param cmd		Command to send (EC_CMD_...) + * @param cmd_version	Version of command to send (EC_VER_...) + * @param dout          Output data (may be NULL If dout_len=0) + * @param dout_len      Size of output data in bytes + * @param dinp          Returns pointer to response data + * @param din_len       Maximum size of response in bytes + * @return number of bytes in response, or -1 on error + */ +int cros_ec_i2c_command(struct cros_ec_dev *dev, uint8_t cmd, int cmd_version, +		     const uint8_t *dout, int dout_len, +		     uint8_t **dinp, int din_len); + +/** + * Send a command to a LPC CROS-EC device and return the reply. + * + * The device's internal input/output buffers are used. + * + * @param dev		CROS-EC device + * @param cmd		Command to send (EC_CMD_...) + * @param cmd_version	Version of command to send (EC_VER_...) + * @param dout          Output data (may be NULL If dout_len=0) + * @param dout_len      Size of output data in bytes + * @param dinp          Returns pointer to response data + * @param din_len       Maximum size of response in bytes + * @return number of bytes in response, or -1 on error + */ +int cros_ec_lpc_command(struct cros_ec_dev *dev, uint8_t cmd, int cmd_version, +		     const uint8_t *dout, int dout_len, +		     uint8_t **dinp, int din_len); + +int cros_ec_spi_command(struct cros_ec_dev *dev, uint8_t cmd, int cmd_version, +		     const uint8_t *dout, int dout_len, +		     uint8_t **dinp, int din_len); + +/** + * Dump a block of data for a command. + * + * @param name	Name for data (e.g. 'in', 'out') + * @param cmd	Command number associated with data, or -1 for none + * @param data	Data block to dump + * @param len	Length of data block to dump + */ +void cros_ec_dump_data(const char *name, int cmd, const uint8_t *data, int len); + +/** + * Calculate a simple 8-bit checksum of a data block + * + * @param data	Data block to checksum + * @param size	Size of data block in bytes + * @return checksum value (0 to 255) + */ +int cros_ec_calc_checksum(const uint8_t *data, int size); + +/** + * Decode a flash region parameter + * + * @param argc	Number of params remaining + * @param argv	List of remaining parameters + * @return flash region (EC_FLASH_REGION_...) or -1 on error + */ +int cros_ec_decode_region(int argc, char * const argv[]); + +int cros_ec_flash_erase(struct cros_ec_dev *dev, uint32_t offset, +		uint32_t size); + +/** + * Read data from the flash + * + * Read an arbitrary amount of data from the EC flash, by repeatedly reading + * small blocks. + * + * The offset starts at 0. You can obtain the region information from + * cros_ec_flash_offset() to find out where to read for a particular region. + * + * @param dev		CROS-EC device + * @param data		Pointer to data buffer to read into + * @param offset	Offset within flash to read from + * @param size		Number of bytes to read + * @return 0 if ok, -1 on error + */ +int cros_ec_flash_read(struct cros_ec_dev *dev, uint8_t *data, uint32_t offset, +		    uint32_t size); + +/** + * Write data to the flash + * + * Write an arbitrary amount of data to the EC flash, by repeatedly writing + * small blocks. + * + * The offset starts at 0. You can obtain the region information from + * cros_ec_flash_offset() to find out where to write for a particular region. + * + * Attempting to write to the region where the EC is currently running from + * will result in an error. + * + * @param dev		CROS-EC device + * @param data		Pointer to data buffer to write + * @param offset	Offset within flash to write to. + * @param size		Number of bytes to write + * @return 0 if ok, -1 on error + */ +int cros_ec_flash_write(struct cros_ec_dev *dev, const uint8_t *data, +		     uint32_t offset, uint32_t size); + +/** + * Obtain position and size of a flash region + * + * @param dev		CROS-EC device + * @param region	Flash region to query + * @param offset	Returns offset of flash region in EC flash + * @param size		Returns size of flash region + * @return 0 if ok, -1 on error + */ +int cros_ec_flash_offset(struct cros_ec_dev *dev, enum ec_flash_region region, +		      uint32_t *offset, uint32_t *size); + +/** + * Read/write VbNvContext from/to a CROS-EC device. + * + * @param dev		CROS-EC device + * @param block		Buffer of VbNvContext to be read/write + * @return 0 if ok, -1 on error + */ +int cros_ec_read_vbnvcontext(struct cros_ec_dev *dev, uint8_t *block); +int cros_ec_write_vbnvcontext(struct cros_ec_dev *dev, const uint8_t *block); + +/** + * Read the version information for the EC images + * + * @param dev		CROS-EC device + * @param versionp	This is set to point to the version information + * @return 0 if ok, -1 on error + */ +int cros_ec_read_version(struct cros_ec_dev *dev, +		       struct ec_response_get_version **versionp); + +/** + * Read the build information for the EC + * + * @param dev		CROS-EC device + * @param versionp	This is set to point to the build string + * @return 0 if ok, -1 on error + */ +int cros_ec_read_build_info(struct cros_ec_dev *dev, char **strp); + +/** + * Switch on/off a LDO / FET. + * + * @param dev		CROS-EC device + * @param index		index of the LDO/FET to switch + * @param state		new state of the LDO/FET : EC_LDO_STATE_ON|OFF + * @return 0 if ok, -1 on error + */ +int cros_ec_set_ldo(struct cros_ec_dev *dev, uint8_t index, uint8_t state); + +/** + * Read back a LDO / FET current state. + * + * @param dev		CROS-EC device + * @param index		index of the LDO/FET to switch + * @param state		current state of the LDO/FET : EC_LDO_STATE_ON|OFF + * @return 0 if ok, -1 on error + */ +int cros_ec_get_ldo(struct cros_ec_dev *dev, uint8_t index, uint8_t *state); +#endif diff --git a/include/cros_ec_message.h b/include/cros_ec_message.h new file mode 100644 index 000000000..a2421c7ba --- /dev/null +++ b/include/cros_ec_message.h @@ -0,0 +1,44 @@ +/* + * Chromium OS Matrix Keyboard Message Protocol definitions + * + * Copyright (c) 2012 The Chromium OS Authors. + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef _CROS_MESSAGE_H +#define _CROS_MESSAGE_H + +/* + * Command interface between EC and AP, for LPC, I2C and SPI interfaces. + * + * This is copied from the Chromium OS Open Source Embedded Controller code. + */ +enum { +	/* The header byte, which follows the preamble */ +	MSG_HEADER	= 0xec, + +	MSG_HEADER_BYTES	= 3, +	MSG_TRAILER_BYTES	= 2, +	MSG_PROTO_BYTES		= MSG_HEADER_BYTES + MSG_TRAILER_BYTES, + +	/* Max length of messages */ +	MSG_BYTES		= EC_HOST_PARAM_SIZE + MSG_PROTO_BYTES, +}; + +#endif diff --git a/include/dfu.h b/include/dfu.h index a107f4b13..124653c81 100644 --- a/include/dfu.h +++ b/include/dfu.h @@ -68,7 +68,9 @@ static inline unsigned int get_mmc_blk_size(int dev)  #define DFU_NAME_SIZE			32  #define DFU_CMD_BUF_SIZE		128 -#define DFU_DATA_BUF_SIZE		(1024*1024*8)	/* 8 MiB */ +#ifndef CONFIG_SYS_DFU_DATA_BUF_SIZE +#define CONFIG_SYS_DFU_DATA_BUF_SIZE		(1024*1024*8)	/* 8 MiB */ +#endif  #ifndef CONFIG_SYS_DFU_MAX_FILE_SIZE  #define CONFIG_SYS_DFU_MAX_FILE_SIZE	(4 << 20)	/* 4 MiB */  #endif diff --git a/include/ec_commands.h b/include/ec_commands.h new file mode 100644 index 000000000..12811cc07 --- /dev/null +++ b/include/ec_commands.h @@ -0,0 +1,1440 @@ +/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* Host communication command constants for Chrome EC */ + +#ifndef __CROS_EC_COMMANDS_H +#define __CROS_EC_COMMANDS_H + +/* + * Protocol overview + * + * request:  CMD [ P0 P1 P2 ... Pn S ] + * response: ERR [ P0 P1 P2 ... Pn S ] + * + * where the bytes are defined as follow : + *      - CMD is the command code. (defined by EC_CMD_ constants) + *      - ERR is the error code. (defined by EC_RES_ constants) + *      - Px is the optional payload. + *        it is not sent if the error code is not success. + *        (defined by ec_params_ and ec_response_ structures) + *      - S is the checksum which is the sum of all payload bytes. + * + * On LPC, CMD and ERR are sent/received at EC_LPC_ADDR_KERNEL|USER_CMD + * and the payloads are sent/received at EC_LPC_ADDR_KERNEL|USER_PARAM. + * On I2C, all bytes are sent serially in the same message. + */ + +/* Current version of this protocol */ +#define EC_PROTO_VERSION          0x00000002 + +/* Command version mask */ +#define EC_VER_MASK(version) (1UL << (version)) + +/* I/O addresses for ACPI commands */ +#define EC_LPC_ADDR_ACPI_DATA  0x62 +#define EC_LPC_ADDR_ACPI_CMD   0x66 + +/* I/O addresses for host command */ +#define EC_LPC_ADDR_HOST_DATA  0x200 +#define EC_LPC_ADDR_HOST_CMD   0x204 + +/* I/O addresses for host command args and params */ +#define EC_LPC_ADDR_HOST_ARGS  0x800 +#define EC_LPC_ADDR_HOST_PARAM 0x804 +#define EC_HOST_PARAM_SIZE     0x0fc  /* Size of param area in bytes */ + +/* I/O addresses for host command params, old interface */ +#define EC_LPC_ADDR_OLD_PARAM  0x880 +#define EC_OLD_PARAM_SIZE      0x080  /* Size of param area in bytes */ + +/* EC command register bit functions */ +#define EC_LPC_CMDR_DATA	(1 << 0)  /* Data ready for host to read */ +#define EC_LPC_CMDR_PENDING	(1 << 1)  /* Write pending to EC */ +#define EC_LPC_CMDR_BUSY	(1 << 2)  /* EC is busy processing a command */ +#define EC_LPC_CMDR_CMD		(1 << 3)  /* Last host write was a command */ +#define EC_LPC_CMDR_ACPI_BRST	(1 << 4)  /* Burst mode (not used) */ +#define EC_LPC_CMDR_SCI		(1 << 5)  /* SCI event is pending */ +#define EC_LPC_CMDR_SMI		(1 << 6)  /* SMI event is pending */ + +#define EC_LPC_ADDR_MEMMAP       0x900 +#define EC_MEMMAP_SIZE         255 /* ACPI IO buffer max is 255 bytes */ +#define EC_MEMMAP_TEXT_MAX     8   /* Size of a string in the memory map */ + +/* The offset address of each type of data in mapped memory. */ +#define EC_MEMMAP_TEMP_SENSOR      0x00 /* Temp sensors */ +#define EC_MEMMAP_FAN              0x10 /* Fan speeds */ +#define EC_MEMMAP_TEMP_SENSOR_B    0x18 /* Temp sensors (second set) */ +#define EC_MEMMAP_ID               0x20 /* 'E' 'C' */ +#define EC_MEMMAP_ID_VERSION       0x22 /* Version of data in 0x20 - 0x2f */ +#define EC_MEMMAP_THERMAL_VERSION  0x23 /* Version of data in 0x00 - 0x1f */ +#define EC_MEMMAP_BATTERY_VERSION  0x24 /* Version of data in 0x40 - 0x7f */ +#define EC_MEMMAP_SWITCHES_VERSION 0x25 /* Version of data in 0x30 - 0x33 */ +#define EC_MEMMAP_EVENTS_VERSION   0x26 /* Version of data in 0x34 - 0x3f */ +#define EC_MEMMAP_HOST_CMD_FLAGS   0x27 /* Host command interface flags */ +#define EC_MEMMAP_SWITCHES         0x30 +#define EC_MEMMAP_HOST_EVENTS      0x34 +#define EC_MEMMAP_BATT_VOLT        0x40 /* Battery Present Voltage */ +#define EC_MEMMAP_BATT_RATE        0x44 /* Battery Present Rate */ +#define EC_MEMMAP_BATT_CAP         0x48 /* Battery Remaining Capacity */ +#define EC_MEMMAP_BATT_FLAG        0x4c /* Battery State, defined below */ +#define EC_MEMMAP_BATT_DCAP        0x50 /* Battery Design Capacity */ +#define EC_MEMMAP_BATT_DVLT        0x54 /* Battery Design Voltage */ +#define EC_MEMMAP_BATT_LFCC        0x58 /* Battery Last Full Charge Capacity */ +#define EC_MEMMAP_BATT_CCNT        0x5c /* Battery Cycle Count */ +#define EC_MEMMAP_BATT_MFGR        0x60 /* Battery Manufacturer String */ +#define EC_MEMMAP_BATT_MODEL       0x68 /* Battery Model Number String */ +#define EC_MEMMAP_BATT_SERIAL      0x70 /* Battery Serial Number String */ +#define EC_MEMMAP_BATT_TYPE        0x78 /* Battery Type String */ + +/* Number of temp sensors at EC_MEMMAP_TEMP_SENSOR */ +#define EC_TEMP_SENSOR_ENTRIES     16 +/* + * Number of temp sensors at EC_MEMMAP_TEMP_SENSOR_B. + * + * Valid only if EC_MEMMAP_THERMAL_VERSION returns >= 2. + */ +#define EC_TEMP_SENSOR_B_ENTRIES      8 +#define EC_TEMP_SENSOR_NOT_PRESENT    0xff +#define EC_TEMP_SENSOR_ERROR          0xfe +#define EC_TEMP_SENSOR_NOT_POWERED    0xfd +#define EC_TEMP_SENSOR_NOT_CALIBRATED 0xfc +/* + * The offset of temperature value stored in mapped memory.  This allows + * reporting a temperature range of 200K to 454K = -73C to 181C. + */ +#define EC_TEMP_SENSOR_OFFSET      200 + +#define EC_FAN_SPEED_ENTRIES       4       /* Number of fans at EC_MEMMAP_FAN */ +#define EC_FAN_SPEED_NOT_PRESENT   0xffff  /* Entry not present */ +#define EC_FAN_SPEED_STALLED       0xfffe  /* Fan stalled */ + +/* Battery bit flags at EC_MEMMAP_BATT_FLAG. */ +#define EC_BATT_FLAG_AC_PRESENT   0x01 +#define EC_BATT_FLAG_BATT_PRESENT 0x02 +#define EC_BATT_FLAG_DISCHARGING  0x04 +#define EC_BATT_FLAG_CHARGING     0x08 +#define EC_BATT_FLAG_LEVEL_CRITICAL 0x10 + +/* Switch flags at EC_MEMMAP_SWITCHES */ +#define EC_SWITCH_LID_OPEN               0x01 +#define EC_SWITCH_POWER_BUTTON_PRESSED   0x02 +#define EC_SWITCH_WRITE_PROTECT_DISABLED 0x04 +/* Recovery requested via keyboard */ +#define EC_SWITCH_KEYBOARD_RECOVERY      0x08 +/* Recovery requested via dedicated signal (from servo board) */ +#define EC_SWITCH_DEDICATED_RECOVERY     0x10 +/* Was fake developer mode switch; now unused.  Remove in next refactor. */ +#define EC_SWITCH_IGNORE0                0x20 + +/* Host command interface flags */ +/* Host command interface supports LPC args (LPC interface only) */ +#define EC_HOST_CMD_FLAG_LPC_ARGS_SUPPORTED  0x01 + +/* Wireless switch flags */ +#define EC_WIRELESS_SWITCH_WLAN      0x01 +#define EC_WIRELESS_SWITCH_BLUETOOTH 0x02 + +/* + * This header file is used in coreboot both in C and ACPI code.  The ACPI code + * is pre-processed to handle constants but the ASL compiler is unable to + * handle actual C code so keep it separate. + */ +#ifndef __ACPI__ + +/* + * Define __packed if someone hasn't beat us to it.  Linux kernel style + * checking prefers __packed over __attribute__((packed)). + */ +#ifndef __packed +#define __packed __attribute__((packed)) +#endif + +/* LPC command status byte masks */ +/* EC has written a byte in the data register and host hasn't read it yet */ +#define EC_LPC_STATUS_TO_HOST     0x01 +/* Host has written a command/data byte and the EC hasn't read it yet */ +#define EC_LPC_STATUS_FROM_HOST   0x02 +/* EC is processing a command */ +#define EC_LPC_STATUS_PROCESSING  0x04 +/* Last write to EC was a command, not data */ +#define EC_LPC_STATUS_LAST_CMD    0x08 +/* EC is in burst mode.  Unsupported by Chrome EC, so this bit is never set */ +#define EC_LPC_STATUS_BURST_MODE  0x10 +/* SCI event is pending (requesting SCI query) */ +#define EC_LPC_STATUS_SCI_PENDING 0x20 +/* SMI event is pending (requesting SMI query) */ +#define EC_LPC_STATUS_SMI_PENDING 0x40 +/* (reserved) */ +#define EC_LPC_STATUS_RESERVED    0x80 + +/* + * EC is busy.  This covers both the EC processing a command, and the host has + * written a new command but the EC hasn't picked it up yet. + */ +#define EC_LPC_STATUS_BUSY_MASK \ +	(EC_LPC_STATUS_FROM_HOST | EC_LPC_STATUS_PROCESSING) + +/* Host command response codes */ +enum ec_status { +	EC_RES_SUCCESS = 0, +	EC_RES_INVALID_COMMAND = 1, +	EC_RES_ERROR = 2, +	EC_RES_INVALID_PARAM = 3, +	EC_RES_ACCESS_DENIED = 4, +	EC_RES_INVALID_RESPONSE = 5, +	EC_RES_INVALID_VERSION = 6, +	EC_RES_INVALID_CHECKSUM = 7, +	EC_RES_IN_PROGRESS = 8,		/* Accepted, command in progress */ +	EC_RES_UNAVAILABLE = 9,		/* No response available */ +	EC_RES_TIMEOUT = 10,		/* We got a timeout */ +	EC_RES_OVERFLOW = 11,		/* Table / data overflow */ +}; + +/* + * Host event codes.  Note these are 1-based, not 0-based, because ACPI query + * EC command uses code 0 to mean "no event pending".  We explicitly specify + * each value in the enum listing so they won't change if we delete/insert an + * item or rearrange the list (it needs to be stable across platforms, not + * just within a single compiled instance). + */ +enum host_event_code { +	EC_HOST_EVENT_LID_CLOSED = 1, +	EC_HOST_EVENT_LID_OPEN = 2, +	EC_HOST_EVENT_POWER_BUTTON = 3, +	EC_HOST_EVENT_AC_CONNECTED = 4, +	EC_HOST_EVENT_AC_DISCONNECTED = 5, +	EC_HOST_EVENT_BATTERY_LOW = 6, +	EC_HOST_EVENT_BATTERY_CRITICAL = 7, +	EC_HOST_EVENT_BATTERY = 8, +	EC_HOST_EVENT_THERMAL_THRESHOLD = 9, +	EC_HOST_EVENT_THERMAL_OVERLOAD = 10, +	EC_HOST_EVENT_THERMAL = 11, +	EC_HOST_EVENT_USB_CHARGER = 12, +	EC_HOST_EVENT_KEY_PRESSED = 13, +	/* +	 * EC has finished initializing the host interface.  The host can check +	 * for this event following sending a EC_CMD_REBOOT_EC command to +	 * determine when the EC is ready to accept subsequent commands. +	 */ +	EC_HOST_EVENT_INTERFACE_READY = 14, +	/* Keyboard recovery combo has been pressed */ +	EC_HOST_EVENT_KEYBOARD_RECOVERY = 15, + +	/* Shutdown due to thermal overload */ +	EC_HOST_EVENT_THERMAL_SHUTDOWN = 16, +	/* Shutdown due to battery level too low */ +	EC_HOST_EVENT_BATTERY_SHUTDOWN = 17, + +	/* +	 * The high bit of the event mask is not used as a host event code.  If +	 * it reads back as set, then the entire event mask should be +	 * considered invalid by the host.  This can happen when reading the +	 * raw event status via EC_MEMMAP_HOST_EVENTS but the LPC interface is +	 * not initialized on the EC, or improperly configured on the host. +	 */ +	EC_HOST_EVENT_INVALID = 32 +}; +/* Host event mask */ +#define EC_HOST_EVENT_MASK(event_code) (1UL << ((event_code) - 1)) + +/* Arguments at EC_LPC_ADDR_HOST_ARGS */ +struct ec_lpc_host_args { +	uint8_t flags; +	uint8_t command_version; +	uint8_t data_size; +	/* +	 * Checksum; sum of command + flags + command_version + data_size + +	 * all params/response data bytes. +	 */ +	uint8_t checksum; +} __packed; + +/* Flags for ec_lpc_host_args.flags */ +/* + * Args are from host.  Data area at EC_LPC_ADDR_HOST_PARAM contains command + * params. + * + * If EC gets a command and this flag is not set, this is an old-style command. + * Command version is 0 and params from host are at EC_LPC_ADDR_OLD_PARAM with + * unknown length.  EC must respond with an old-style response (that is, + * withouth setting EC_HOST_ARGS_FLAG_TO_HOST). + */ +#define EC_HOST_ARGS_FLAG_FROM_HOST 0x01 +/* + * Args are from EC.  Data area at EC_LPC_ADDR_HOST_PARAM contains response. + * + * If EC responds to a command and this flag is not set, this is an old-style + * response.  Command version is 0 and response data from EC is at + * EC_LPC_ADDR_OLD_PARAM with unknown length. + */ +#define EC_HOST_ARGS_FLAG_TO_HOST   0x02 + +/* + * Notes on commands: + * + * Each command is an 8-byte command value.  Commands which take params or + * return response data specify structs for that data.  If no struct is + * specified, the command does not input or output data, respectively. + * Parameter/response length is implicit in the structs.  Some underlying + * communication protocols (I2C, SPI) may add length or checksum headers, but + * those are implementation-dependent and not defined here. + */ + +/*****************************************************************************/ +/* General / test commands */ + +/* + * Get protocol version, used to deal with non-backward compatible protocol + * changes. + */ +#define EC_CMD_PROTO_VERSION 0x00 + +struct ec_response_proto_version { +	uint32_t version; +} __packed; + +/* + * Hello.  This is a simple command to test the EC is responsive to + * commands. + */ +#define EC_CMD_HELLO 0x01 + +struct ec_params_hello { +	uint32_t in_data;  /* Pass anything here */ +} __packed; + +struct ec_response_hello { +	uint32_t out_data;  /* Output will be in_data + 0x01020304 */ +} __packed; + +/* Get version number */ +#define EC_CMD_GET_VERSION 0x02 + +enum ec_current_image { +	EC_IMAGE_UNKNOWN = 0, +	EC_IMAGE_RO, +	EC_IMAGE_RW +}; + +struct ec_response_get_version { +	/* Null-terminated version strings for RO, RW */ +	char version_string_ro[32]; +	char version_string_rw[32]; +	char reserved[32];       /* Was previously RW-B string */ +	uint32_t current_image;  /* One of ec_current_image */ +} __packed; + +/* Read test */ +#define EC_CMD_READ_TEST 0x03 + +struct ec_params_read_test { +	uint32_t offset;   /* Starting value for read buffer */ +	uint32_t size;     /* Size to read in bytes */ +} __packed; + +struct ec_response_read_test { +	uint32_t data[32]; +} __packed; + +/* + * Get build information + * + * Response is null-terminated string. + */ +#define EC_CMD_GET_BUILD_INFO 0x04 + +/* Get chip info */ +#define EC_CMD_GET_CHIP_INFO 0x05 + +struct ec_response_get_chip_info { +	/* Null-terminated strings */ +	char vendor[32]; +	char name[32]; +	char revision[32];  /* Mask version */ +} __packed; + +/* Get board HW version */ +#define EC_CMD_GET_BOARD_VERSION 0x06 + +struct ec_response_board_version { +	uint16_t board_version;  /* A monotonously incrementing number. */ +} __packed; + +/* + * Read memory-mapped data. + * + * This is an alternate interface to memory-mapped data for bus protocols + * which don't support direct-mapped memory - I2C, SPI, etc. + * + * Response is params.size bytes of data. + */ +#define EC_CMD_READ_MEMMAP 0x07 + +struct ec_params_read_memmap { +	uint8_t offset;   /* Offset in memmap (EC_MEMMAP_*) */ +	uint8_t size;     /* Size to read in bytes */ +} __packed; + +/* Read versions supported for a command */ +#define EC_CMD_GET_CMD_VERSIONS 0x08 + +struct ec_params_get_cmd_versions { +	uint8_t cmd;      /* Command to check */ +} __packed; + +struct ec_response_get_cmd_versions { +	/* +	 * Mask of supported versions; use EC_VER_MASK() to compare with a +	 * desired version. +	 */ +	uint32_t version_mask; +} __packed; + +/* + * Check EC communcations status (busy). This is needed on i2c/spi but not + * on lpc since it has its own out-of-band busy indicator. + * + * lpc must read the status from the command register. Attempting this on + * lpc will overwrite the args/parameter space and corrupt its data. + */ +#define EC_CMD_GET_COMMS_STATUS		0x09 + +/* Avoid using ec_status which is for return values */ +enum ec_comms_status { +	EC_COMMS_STATUS_PROCESSING	= 1 << 0,	/* Processing cmd */ +}; + +struct ec_response_get_comms_status { +	uint32_t flags;		/* Mask of enum ec_comms_status */ +} __packed; + + +/*****************************************************************************/ +/* Flash commands */ + +/* Get flash info */ +#define EC_CMD_FLASH_INFO 0x10 + +struct ec_response_flash_info { +	/* Usable flash size, in bytes */ +	uint32_t flash_size; +	/* +	 * Write block size.  Write offset and size must be a multiple +	 * of this. +	 */ +	uint32_t write_block_size; +	/* +	 * Erase block size.  Erase offset and size must be a multiple +	 * of this. +	 */ +	uint32_t erase_block_size; +	/* +	 * Protection block size.  Protection offset and size must be a +	 * multiple of this. +	 */ +	uint32_t protect_block_size; +} __packed; + +/* + * Read flash + * + * Response is params.size bytes of data. + */ +#define EC_CMD_FLASH_READ 0x11 + +struct ec_params_flash_read { +	uint32_t offset;   /* Byte offset to read */ +	uint32_t size;     /* Size to read in bytes */ +} __packed; + +/* Write flash */ +#define EC_CMD_FLASH_WRITE 0x12 + +struct ec_params_flash_write { +	uint32_t offset;   /* Byte offset to write */ +	uint32_t size;     /* Size to write in bytes */ +	/* +	 * Data to write.  Could really use EC_PARAM_SIZE - 8, but tidiest to +	 * use a power of 2 so writes stay aligned. +	 */ +	uint8_t data[64]; +} __packed; + +/* Erase flash */ +#define EC_CMD_FLASH_ERASE 0x13 + +struct ec_params_flash_erase { +	uint32_t offset;   /* Byte offset to erase */ +	uint32_t size;     /* Size to erase in bytes */ +} __packed; + +/* + * Get/set flash protection. + * + * If mask!=0, sets/clear the requested bits of flags.  Depending on the + * firmware write protect GPIO, not all flags will take effect immediately; + * some flags require a subsequent hard reset to take effect.  Check the + * returned flags bits to see what actually happened. + * + * If mask=0, simply returns the current flags state. + */ +#define EC_CMD_FLASH_PROTECT 0x15 +#define EC_VER_FLASH_PROTECT 1  /* Command version 1 */ + +/* Flags for flash protection */ +/* RO flash code protected when the EC boots */ +#define EC_FLASH_PROTECT_RO_AT_BOOT         (1 << 0) +/* + * RO flash code protected now.  If this bit is set, at-boot status cannot + * be changed. + */ +#define EC_FLASH_PROTECT_RO_NOW             (1 << 1) +/* Entire flash code protected now, until reboot. */ +#define EC_FLASH_PROTECT_ALL_NOW            (1 << 2) +/* Flash write protect GPIO is asserted now */ +#define EC_FLASH_PROTECT_GPIO_ASSERTED      (1 << 3) +/* Error - at least one bank of flash is stuck locked, and cannot be unlocked */ +#define EC_FLASH_PROTECT_ERROR_STUCK        (1 << 4) +/* + * Error - flash protection is in inconsistent state.  At least one bank of + * flash which should be protected is not protected.  Usually fixed by + * re-requesting the desired flags, or by a hard reset if that fails. + */ +#define EC_FLASH_PROTECT_ERROR_INCONSISTENT (1 << 5) +/* Entile flash code protected when the EC boots */ +#define EC_FLASH_PROTECT_ALL_AT_BOOT        (1 << 6) + +struct ec_params_flash_protect { +	uint32_t mask;   /* Bits in flags to apply */ +	uint32_t flags;  /* New flags to apply */ +} __packed; + +struct ec_response_flash_protect { +	/* Current value of flash protect flags */ +	uint32_t flags; +	/* +	 * Flags which are valid on this platform.  This allows the caller +	 * to distinguish between flags which aren't set vs. flags which can't +	 * be set on this platform. +	 */ +	uint32_t valid_flags; +	/* Flags which can be changed given the current protection state */ +	uint32_t writable_flags; +} __packed; + +/* + * Note: commands 0x14 - 0x19 version 0 were old commands to get/set flash + * write protect.  These commands may be reused with version > 0. + */ + +/* Get the region offset/size */ +#define EC_CMD_FLASH_REGION_INFO 0x16 +#define EC_VER_FLASH_REGION_INFO 1 + +enum ec_flash_region { +	/* Region which holds read-only EC image */ +	EC_FLASH_REGION_RO, +	/* Region which holds rewritable EC image */ +	EC_FLASH_REGION_RW, +	/* +	 * Region which should be write-protected in the factory (a superset of +	 * EC_FLASH_REGION_RO) +	 */ +	EC_FLASH_REGION_WP_RO, +}; + +struct ec_params_flash_region_info { +	uint32_t region;  /* enum ec_flash_region */ +} __packed; + +struct ec_response_flash_region_info { +	uint32_t offset; +	uint32_t size; +} __packed; + +/* Read/write VbNvContext */ +#define EC_CMD_VBNV_CONTEXT 0x17 +#define EC_VER_VBNV_CONTEXT 1 +#define EC_VBNV_BLOCK_SIZE 16 + +enum ec_vbnvcontext_op { +	EC_VBNV_CONTEXT_OP_READ, +	EC_VBNV_CONTEXT_OP_WRITE, +}; + +struct ec_params_vbnvcontext { +	uint32_t op; +	uint8_t block[EC_VBNV_BLOCK_SIZE]; +} __packed; + +struct ec_response_vbnvcontext { +	uint8_t block[EC_VBNV_BLOCK_SIZE]; +} __packed; + +/*****************************************************************************/ +/* PWM commands */ + +/* Get fan target RPM */ +#define EC_CMD_PWM_GET_FAN_TARGET_RPM 0x20 + +struct ec_response_pwm_get_fan_rpm { +	uint32_t rpm; +} __packed; + +/* Set target fan RPM */ +#define EC_CMD_PWM_SET_FAN_TARGET_RPM 0x21 + +struct ec_params_pwm_set_fan_target_rpm { +	uint32_t rpm; +} __packed; + +/* Get keyboard backlight */ +#define EC_CMD_PWM_GET_KEYBOARD_BACKLIGHT 0x22 + +struct ec_response_pwm_get_keyboard_backlight { +	uint8_t percent; +	uint8_t enabled; +} __packed; + +/* Set keyboard backlight */ +#define EC_CMD_PWM_SET_KEYBOARD_BACKLIGHT 0x23 + +struct ec_params_pwm_set_keyboard_backlight { +	uint8_t percent; +} __packed; + +/* Set target fan PWM duty cycle */ +#define EC_CMD_PWM_SET_FAN_DUTY 0x24 + +struct ec_params_pwm_set_fan_duty { +	uint32_t percent; +} __packed; + +/*****************************************************************************/ +/* + * Lightbar commands. This looks worse than it is. Since we only use one HOST + * command to say "talk to the lightbar", we put the "and tell it to do X" part + * into a subcommand. We'll make separate structs for subcommands with + * different input args, so that we know how much to expect. + */ +#define EC_CMD_LIGHTBAR_CMD 0x28 + +struct rgb_s { +	uint8_t r, g, b; +}; + +#define LB_BATTERY_LEVELS 4 +/* List of tweakable parameters. NOTE: It's __packed so it can be sent in a + * host command, but the alignment is the same regardless. Keep it that way. + */ +struct lightbar_params { +	/* Timing */ +	int google_ramp_up; +	int google_ramp_down; +	int s3s0_ramp_up; +	int s0_tick_delay[2];			/* AC=0/1 */ +	int s0a_tick_delay[2];			/* AC=0/1 */ +	int s0s3_ramp_down; +	int s3_sleep_for; +	int s3_ramp_up; +	int s3_ramp_down; + +	/* Oscillation */ +	uint8_t new_s0; +	uint8_t osc_min[2];			/* AC=0/1 */ +	uint8_t osc_max[2];			/* AC=0/1 */ +	uint8_t w_ofs[2];			/* AC=0/1 */ + +	/* Brightness limits based on the backlight and AC. */ +	uint8_t bright_bl_off_fixed[2];		/* AC=0/1 */ +	uint8_t bright_bl_on_min[2];		/* AC=0/1 */ +	uint8_t bright_bl_on_max[2];		/* AC=0/1 */ + +	/* Battery level thresholds */ +	uint8_t battery_threshold[LB_BATTERY_LEVELS - 1]; + +	/* Map [AC][battery_level] to color index */ +	uint8_t s0_idx[2][LB_BATTERY_LEVELS];	/* AP is running */ +	uint8_t s3_idx[2][LB_BATTERY_LEVELS];	/* AP is sleeping */ + +	/* Color palette */ +	struct rgb_s color[8];			/* 0-3 are Google colors */ +} __packed; + +struct ec_params_lightbar { +	uint8_t cmd;		      /* Command (see enum lightbar_command) */ +	union { +		struct { +			/* no args */ +		} dump, off, on, init, get_seq, get_params; + +		struct num { +			uint8_t num; +		} brightness, seq, demo; + +		struct reg { +			uint8_t ctrl, reg, value; +		} reg; + +		struct rgb { +			uint8_t led, red, green, blue; +		} rgb; + +		struct lightbar_params set_params; +	}; +} __packed; + +struct ec_response_lightbar { +	union { +		struct dump { +			struct { +				uint8_t reg; +				uint8_t ic0; +				uint8_t ic1; +			} vals[23]; +		} dump; + +		struct get_seq { +			uint8_t num; +		} get_seq; + +		struct lightbar_params get_params; + +		struct { +			/* no return params */ +		} off, on, init, brightness, seq, reg, rgb, demo, set_params; +	}; +} __packed; + +/* Lightbar commands */ +enum lightbar_command { +	LIGHTBAR_CMD_DUMP = 0, +	LIGHTBAR_CMD_OFF = 1, +	LIGHTBAR_CMD_ON = 2, +	LIGHTBAR_CMD_INIT = 3, +	LIGHTBAR_CMD_BRIGHTNESS = 4, +	LIGHTBAR_CMD_SEQ = 5, +	LIGHTBAR_CMD_REG = 6, +	LIGHTBAR_CMD_RGB = 7, +	LIGHTBAR_CMD_GET_SEQ = 8, +	LIGHTBAR_CMD_DEMO = 9, +	LIGHTBAR_CMD_GET_PARAMS = 10, +	LIGHTBAR_CMD_SET_PARAMS = 11, +	LIGHTBAR_NUM_CMDS +}; + +/*****************************************************************************/ +/* Verified boot commands */ + +/* + * Note: command code 0x29 version 0 was VBOOT_CMD in Link EVT; it may be + * reused for other purposes with version > 0. + */ + +/* Verified boot hash command */ +#define EC_CMD_VBOOT_HASH 0x2A + +struct ec_params_vboot_hash { +	uint8_t cmd;             /* enum ec_vboot_hash_cmd */ +	uint8_t hash_type;       /* enum ec_vboot_hash_type */ +	uint8_t nonce_size;      /* Nonce size; may be 0 */ +	uint8_t reserved0;       /* Reserved; set 0 */ +	uint32_t offset;         /* Offset in flash to hash */ +	uint32_t size;           /* Number of bytes to hash */ +	uint8_t nonce_data[64];  /* Nonce data; ignored if nonce_size=0 */ +} __packed; + +struct ec_response_vboot_hash { +	uint8_t status;          /* enum ec_vboot_hash_status */ +	uint8_t hash_type;       /* enum ec_vboot_hash_type */ +	uint8_t digest_size;     /* Size of hash digest in bytes */ +	uint8_t reserved0;       /* Ignore; will be 0 */ +	uint32_t offset;         /* Offset in flash which was hashed */ +	uint32_t size;           /* Number of bytes hashed */ +	uint8_t hash_digest[64]; /* Hash digest data */ +} __packed; + +enum ec_vboot_hash_cmd { +	EC_VBOOT_HASH_GET = 0,       /* Get current hash status */ +	EC_VBOOT_HASH_ABORT = 1,     /* Abort calculating current hash */ +	EC_VBOOT_HASH_START = 2,     /* Start computing a new hash */ +	EC_VBOOT_HASH_RECALC = 3,    /* Synchronously compute a new hash */ +}; + +enum ec_vboot_hash_type { +	EC_VBOOT_HASH_TYPE_SHA256 = 0, /* SHA-256 */ +}; + +enum ec_vboot_hash_status { +	EC_VBOOT_HASH_STATUS_NONE = 0, /* No hash (not started, or aborted) */ +	EC_VBOOT_HASH_STATUS_DONE = 1, /* Finished computing a hash */ +	EC_VBOOT_HASH_STATUS_BUSY = 2, /* Busy computing a hash */ +}; + +/* + * Special values for offset for EC_VBOOT_HASH_START and EC_VBOOT_HASH_RECALC. + * If one of these is specified, the EC will automatically update offset and + * size to the correct values for the specified image (RO or RW). + */ +#define EC_VBOOT_HASH_OFFSET_RO 0xfffffffe +#define EC_VBOOT_HASH_OFFSET_RW 0xfffffffd + +/*****************************************************************************/ +/* USB charging control commands */ + +/* Set USB port charging mode */ +#define EC_CMD_USB_CHARGE_SET_MODE 0x30 + +struct ec_params_usb_charge_set_mode { +	uint8_t usb_port_id; +	uint8_t mode; +} __packed; + +/*****************************************************************************/ +/* Persistent storage for host */ + +/* Maximum bytes that can be read/written in a single command */ +#define EC_PSTORE_SIZE_MAX 64 + +/* Get persistent storage info */ +#define EC_CMD_PSTORE_INFO 0x40 + +struct ec_response_pstore_info { +	/* Persistent storage size, in bytes */ +	uint32_t pstore_size; +	/* Access size; read/write offset and size must be a multiple of this */ +	uint32_t access_size; +} __packed; + +/* + * Read persistent storage + * + * Response is params.size bytes of data. + */ +#define EC_CMD_PSTORE_READ 0x41 + +struct ec_params_pstore_read { +	uint32_t offset;   /* Byte offset to read */ +	uint32_t size;     /* Size to read in bytes */ +} __packed; + +/* Write persistent storage */ +#define EC_CMD_PSTORE_WRITE 0x42 + +struct ec_params_pstore_write { +	uint32_t offset;   /* Byte offset to write */ +	uint32_t size;     /* Size to write in bytes */ +	uint8_t data[EC_PSTORE_SIZE_MAX]; +} __packed; + +/*****************************************************************************/ +/* Real-time clock */ + +/* RTC params and response structures */ +struct ec_params_rtc { +	uint32_t time; +} __packed; + +struct ec_response_rtc { +	uint32_t time; +} __packed; + +/* These use ec_response_rtc */ +#define EC_CMD_RTC_GET_VALUE 0x44 +#define EC_CMD_RTC_GET_ALARM 0x45 + +/* These all use ec_params_rtc */ +#define EC_CMD_RTC_SET_VALUE 0x46 +#define EC_CMD_RTC_SET_ALARM 0x47 + +/*****************************************************************************/ +/* Port80 log access */ + +/* Get last port80 code from previous boot */ +#define EC_CMD_PORT80_LAST_BOOT 0x48 + +struct ec_response_port80_last_boot { +	uint16_t code; +} __packed; + +/*****************************************************************************/ +/* Thermal engine commands */ + +/* Set thershold value */ +#define EC_CMD_THERMAL_SET_THRESHOLD 0x50 + +struct ec_params_thermal_set_threshold { +	uint8_t sensor_type; +	uint8_t threshold_id; +	uint16_t value; +} __packed; + +/* Get threshold value */ +#define EC_CMD_THERMAL_GET_THRESHOLD 0x51 + +struct ec_params_thermal_get_threshold { +	uint8_t sensor_type; +	uint8_t threshold_id; +} __packed; + +struct ec_response_thermal_get_threshold { +	uint16_t value; +} __packed; + +/* Toggle automatic fan control */ +#define EC_CMD_THERMAL_AUTO_FAN_CTRL 0x52 + +/* Get TMP006 calibration data */ +#define EC_CMD_TMP006_GET_CALIBRATION 0x53 + +struct ec_params_tmp006_get_calibration { +	uint8_t index; +} __packed; + +struct ec_response_tmp006_get_calibration { +	float s0; +	float b0; +	float b1; +	float b2; +} __packed; + +/* Set TMP006 calibration data */ +#define EC_CMD_TMP006_SET_CALIBRATION 0x54 + +struct ec_params_tmp006_set_calibration { +	uint8_t index; +	uint8_t reserved[3];  /* Reserved; set 0 */ +	float s0; +	float b0; +	float b1; +	float b2; +} __packed; + +/*****************************************************************************/ +/* CROS_EC - Matrix KeyBoard Protocol */ + +/* + * Read key state + * + * Returns raw data for keyboard cols; see ec_response_cros_ec_info.cols for + * expected response size. + */ +#define EC_CMD_CROS_EC_STATE 0x60 + +/* Provide information about the matrix : number of rows and columns */ +#define EC_CMD_CROS_EC_INFO 0x61 + +struct ec_response_cros_ec_info { +	uint32_t rows; +	uint32_t cols; +	uint8_t switches; +} __packed; + +/* Simulate key press */ +#define EC_CMD_CROS_EC_SIMULATE_KEY 0x62 + +struct ec_params_cros_ec_simulate_key { +	uint8_t col; +	uint8_t row; +	uint8_t pressed; +} __packed; + +/* Configure keyboard scanning */ +#define EC_CMD_CROS_EC_SET_CONFIG 0x64 +#define EC_CMD_CROS_EC_GET_CONFIG 0x65 + +/* flags */ +enum cros_ec_config_flags { +	EC_CROS_EC_FLAGS_ENABLE = 1,	/* Enable keyboard scanning */ +}; + +enum cros_ec_config_valid { +	EC_CROS_EC_VALID_SCAN_PERIOD		= 1 << 0, +	EC_CROS_EC_VALID_POLL_TIMEOUT		= 1 << 1, +	EC_CROS_EC_VALID_MIN_POST_SCAN_DELAY	= 1 << 3, +	EC_CROS_EC_VALID_OUTPUT_SETTLE		= 1 << 4, +	EC_CROS_EC_VALID_DEBOUNCE_DOWN		= 1 << 5, +	EC_CROS_EC_VALID_DEBOUNCE_UP		= 1 << 6, +	EC_CROS_EC_VALID_FIFO_MAX_DEPTH		= 1 << 7, +}; + +/* Configuration for our key scanning algorithm */ +struct ec_cros_ec_config { +	uint32_t valid_mask;		/* valid fields */ +	uint8_t flags;		/* some flags (enum cros_ec_config_flags) */ +	uint8_t valid_flags;		/* which flags are valid */ +	uint16_t scan_period_us;	/* period between start of scans */ +	/* revert to interrupt mode after no activity for this long */ +	uint32_t poll_timeout_us; +	/* +	 * minimum post-scan relax time. Once we finish a scan we check +	 * the time until we are due to start the next one. If this time is +	 * shorter this field, we use this instead. +	 */ +	uint16_t min_post_scan_delay_us; +	/* delay between setting up output and waiting for it to settle */ +	uint16_t output_settle_us; +	uint16_t debounce_down_us;	/* time for debounce on key down */ +	uint16_t debounce_up_us;	/* time for debounce on key up */ +	/* maximum depth to allow for fifo (0 = no keyscan output) */ +	uint8_t fifo_max_depth; +} __packed; + +struct ec_params_cros_ec_set_config { +	struct ec_cros_ec_config config; +} __packed; + +struct ec_response_cros_ec_get_config { +	struct ec_cros_ec_config config; +} __packed; + +/* Run the key scan emulation */ +#define EC_CMD_KEYSCAN_SEQ_CTRL 0x66 + +enum ec_keyscan_seq_cmd { +	EC_KEYSCAN_SEQ_STATUS = 0,	/* Get status information */ +	EC_KEYSCAN_SEQ_CLEAR = 1,	/* Clear sequence */ +	EC_KEYSCAN_SEQ_ADD = 2,		/* Add item to sequence */ +	EC_KEYSCAN_SEQ_START = 3,	/* Start running sequence */ +	EC_KEYSCAN_SEQ_COLLECT = 4,	/* Collect sequence summary data */ +}; + +enum ec_collect_flags { +	/* +	 * Indicates this scan was processed by the EC. Due to timing, some +	 * scans may be skipped. +	 */ +	EC_KEYSCAN_SEQ_FLAG_DONE	= 1 << 0, +}; + +struct ec_collect_item { +	uint8_t flags;		/* some flags (enum ec_collect_flags) */ +}; + +struct ec_params_keyscan_seq_ctrl { +	uint8_t cmd;	/* Command to send (enum ec_keyscan_seq_cmd) */ +	union { +		struct { +			uint8_t active;		/* still active */ +			uint8_t num_items;	/* number of items */ +			/* Current item being presented */ +			uint8_t cur_item; +		} status; +		struct { +			/* +			 * Absolute time for this scan, measured from the +			 * start of the sequence. +			 */ +			uint32_t time_us; +			uint8_t scan[0];	/* keyscan data */ +		} add; +		struct { +			uint8_t start_item;	/* First item to return */ +			uint8_t num_items;	/* Number of items to return */ +		} collect; +	}; +} __packed; + +struct ec_result_keyscan_seq_ctrl { +	union { +		struct { +			uint8_t num_items;	/* Number of items */ +			/* Data for each item */ +			struct ec_collect_item item[0]; +		} collect; +	}; +} __packed; + +/*****************************************************************************/ +/* Temperature sensor commands */ + +/* Read temperature sensor info */ +#define EC_CMD_TEMP_SENSOR_GET_INFO 0x70 + +struct ec_params_temp_sensor_get_info { +	uint8_t id; +} __packed; + +struct ec_response_temp_sensor_get_info { +	char sensor_name[32]; +	uint8_t sensor_type; +} __packed; + +/*****************************************************************************/ + +/* + * Note: host commands 0x80 - 0x87 are reserved to avoid conflict with ACPI + * commands accidentally sent to the wrong interface.  See the ACPI section + * below. + */ + +/*****************************************************************************/ +/* Host event commands */ + +/* + * Host event mask params and response structures, shared by all of the host + * event commands below. + */ +struct ec_params_host_event_mask { +	uint32_t mask; +} __packed; + +struct ec_response_host_event_mask { +	uint32_t mask; +} __packed; + +/* These all use ec_response_host_event_mask */ +#define EC_CMD_HOST_EVENT_GET_B         0x87 +#define EC_CMD_HOST_EVENT_GET_SMI_MASK  0x88 +#define EC_CMD_HOST_EVENT_GET_SCI_MASK  0x89 +#define EC_CMD_HOST_EVENT_GET_WAKE_MASK 0x8d + +/* These all use ec_params_host_event_mask */ +#define EC_CMD_HOST_EVENT_SET_SMI_MASK  0x8a +#define EC_CMD_HOST_EVENT_SET_SCI_MASK  0x8b +#define EC_CMD_HOST_EVENT_CLEAR         0x8c +#define EC_CMD_HOST_EVENT_SET_WAKE_MASK 0x8e +#define EC_CMD_HOST_EVENT_CLEAR_B       0x8f + +/*****************************************************************************/ +/* Switch commands */ + +/* Enable/disable LCD backlight */ +#define EC_CMD_SWITCH_ENABLE_BKLIGHT 0x90 + +struct ec_params_switch_enable_backlight { +	uint8_t enabled; +} __packed; + +/* Enable/disable WLAN/Bluetooth */ +#define EC_CMD_SWITCH_ENABLE_WIRELESS 0x91 + +struct ec_params_switch_enable_wireless { +	uint8_t enabled; +} __packed; + +/*****************************************************************************/ +/* GPIO commands. Only available on EC if write protect has been disabled. */ + +/* Set GPIO output value */ +#define EC_CMD_GPIO_SET 0x92 + +struct ec_params_gpio_set { +	char name[32]; +	uint8_t val; +} __packed; + +/* Get GPIO value */ +#define EC_CMD_GPIO_GET 0x93 + +struct ec_params_gpio_get { +	char name[32]; +} __packed; +struct ec_response_gpio_get { +	uint8_t val; +} __packed; + +/*****************************************************************************/ +/* I2C commands. Only available when flash write protect is unlocked. */ + +/* Read I2C bus */ +#define EC_CMD_I2C_READ 0x94 + +struct ec_params_i2c_read { +	uint16_t addr; +	uint8_t read_size; /* Either 8 or 16. */ +	uint8_t port; +	uint8_t offset; +} __packed; +struct ec_response_i2c_read { +	uint16_t data; +} __packed; + +/* Write I2C bus */ +#define EC_CMD_I2C_WRITE 0x95 + +struct ec_params_i2c_write { +	uint16_t data; +	uint16_t addr; +	uint8_t write_size; /* Either 8 or 16. */ +	uint8_t port; +	uint8_t offset; +} __packed; + +/*****************************************************************************/ +/* Charge state commands. Only available when flash write protect unlocked. */ + +/* Force charge state machine to stop in idle mode */ +#define EC_CMD_CHARGE_FORCE_IDLE 0x96 + +struct ec_params_force_idle { +	uint8_t enabled; +} __packed; + +/*****************************************************************************/ +/* Console commands. Only available when flash write protect is unlocked. */ + +/* Snapshot console output buffer for use by EC_CMD_CONSOLE_READ. */ +#define EC_CMD_CONSOLE_SNAPSHOT 0x97 + +/* + * Read next chunk of data from saved snapshot. + * + * Response is null-terminated string.  Empty string, if there is no more + * remaining output. + */ +#define EC_CMD_CONSOLE_READ 0x98 + +/*****************************************************************************/ + +/* + * Cut off battery power output if the battery supports. + * + * For unsupported battery, just don't implement this command and lets EC + * return EC_RES_INVALID_COMMAND. + */ +#define EC_CMD_BATTERY_CUT_OFF 0x99 + +/*****************************************************************************/ +/* USB port mux control. */ + +/* + * Switch USB mux or return to automatic switching. + */ +#define EC_CMD_USB_MUX 0x9a + +struct ec_params_usb_mux { +	uint8_t mux; +} __packed; + +/*****************************************************************************/ +/* LDOs / FETs control. */ + +enum ec_ldo_state { +	EC_LDO_STATE_OFF = 0,	/* the LDO / FET is shut down */ +	EC_LDO_STATE_ON = 1,	/* the LDO / FET is ON / providing power */ +}; + +/* + * Switch on/off a LDO. + */ +#define EC_CMD_LDO_SET 0x9b + +struct ec_params_ldo_set { +	uint8_t index; +	uint8_t state; +} __packed; + +/* + * Get LDO state. + */ +#define EC_CMD_LDO_GET 0x9c + +struct ec_params_ldo_get { +	uint8_t index; +} __packed; + +struct ec_response_ldo_get { +	uint8_t state; +} __packed; + +/*****************************************************************************/ +/* Temporary debug commands. TODO: remove this crosbug.com/p/13849 */ + +/* + * Dump charge state machine context. + * + * Response is a binary dump of charge state machine context. + */ +#define EC_CMD_CHARGE_DUMP 0xa0 + +/* + * Set maximum battery charging current. + */ +#define EC_CMD_CHARGE_CURRENT_LIMIT 0xa1 + +struct ec_params_current_limit { +	uint32_t limit; +} __packed; + +/*****************************************************************************/ +/* Smart battery pass-through */ + +/* Get / Set 16-bit smart battery registers */ +#define EC_CMD_SB_READ_WORD   0xb0 +#define EC_CMD_SB_WRITE_WORD  0xb1 + +/* Get / Set string smart battery parameters + * formatted as SMBUS "block". + */ +#define EC_CMD_SB_READ_BLOCK  0xb2 +#define EC_CMD_SB_WRITE_BLOCK 0xb3 + +struct ec_params_sb_rd { +	uint8_t reg; +} __packed; + +struct ec_response_sb_rd_word { +	uint16_t value; +} __packed; + +struct ec_params_sb_wr_word { +	uint8_t reg; +	uint16_t value; +} __packed; + +struct ec_response_sb_rd_block { +	uint8_t data[32]; +} __packed; + +struct ec_params_sb_wr_block { +	uint8_t reg; +	uint16_t data[32]; +} __packed; + +/*****************************************************************************/ +/* System commands */ + +/* + * TODO: this is a confusing name, since it doesn't necessarily reboot the EC. + * Rename to "set image" or something similar. + */ +#define EC_CMD_REBOOT_EC 0xd2 + +/* Command */ +enum ec_reboot_cmd { +	EC_REBOOT_CANCEL = 0,        /* Cancel a pending reboot */ +	EC_REBOOT_JUMP_RO = 1,       /* Jump to RO without rebooting */ +	EC_REBOOT_JUMP_RW = 2,       /* Jump to RW without rebooting */ +	/* (command 3 was jump to RW-B) */ +	EC_REBOOT_COLD = 4,          /* Cold-reboot */ +	EC_REBOOT_DISABLE_JUMP = 5,  /* Disable jump until next reboot */ +	EC_REBOOT_HIBERNATE = 6      /* Hibernate EC */ +}; + +/* Flags for ec_params_reboot_ec.reboot_flags */ +#define EC_REBOOT_FLAG_RESERVED0      (1 << 0)  /* Was recovery request */ +#define EC_REBOOT_FLAG_ON_AP_SHUTDOWN (1 << 1)  /* Reboot after AP shutdown */ + +struct ec_params_reboot_ec { +	uint8_t cmd;           /* enum ec_reboot_cmd */ +	uint8_t flags;         /* See EC_REBOOT_FLAG_* */ +} __packed; + +/* + * Get information on last EC panic. + * + * Returns variable-length platform-dependent panic information.  See panic.h + * for details. + */ +#define EC_CMD_GET_PANIC_INFO 0xd3 + +/*****************************************************************************/ +/* + * ACPI commands + * + * These are valid ONLY on the ACPI command/data port. + */ + +/* + * ACPI Read Embedded Controller + * + * This reads from ACPI memory space on the EC (EC_ACPI_MEM_*). + * + * Use the following sequence: + * + *    - Write EC_CMD_ACPI_READ to EC_LPC_ADDR_ACPI_CMD + *    - Wait for EC_LPC_CMDR_PENDING bit to clear + *    - Write address to EC_LPC_ADDR_ACPI_DATA + *    - Wait for EC_LPC_CMDR_DATA bit to set + *    - Read value from EC_LPC_ADDR_ACPI_DATA + */ +#define EC_CMD_ACPI_READ 0x80 + +/* + * ACPI Write Embedded Controller + * + * This reads from ACPI memory space on the EC (EC_ACPI_MEM_*). + * + * Use the following sequence: + * + *    - Write EC_CMD_ACPI_WRITE to EC_LPC_ADDR_ACPI_CMD + *    - Wait for EC_LPC_CMDR_PENDING bit to clear + *    - Write address to EC_LPC_ADDR_ACPI_DATA + *    - Wait for EC_LPC_CMDR_PENDING bit to clear + *    - Write value to EC_LPC_ADDR_ACPI_DATA + */ +#define EC_CMD_ACPI_WRITE 0x81 + +/* + * ACPI Query Embedded Controller + * + * This clears the lowest-order bit in the currently pending host events, and + * sets the result code to the 1-based index of the bit (event 0x00000001 = 1, + * event 0x80000000 = 32), or 0 if no event was pending. + */ +#define EC_CMD_ACPI_QUERY_EVENT 0x84 + +/* Valid addresses in ACPI memory space, for read/write commands */ +/* Memory space version; set to EC_ACPI_MEM_VERSION_CURRENT */ +#define EC_ACPI_MEM_VERSION            0x00 +/* + * Test location; writing value here updates test compliment byte to (0xff - + * value). + */ +#define EC_ACPI_MEM_TEST               0x01 +/* Test compliment; writes here are ignored. */ +#define EC_ACPI_MEM_TEST_COMPLIMENT    0x02 +/* Keyboard backlight brightness percent (0 - 100) */ +#define EC_ACPI_MEM_KEYBOARD_BACKLIGHT 0x03 + +/* Current version of ACPI memory address space */ +#define EC_ACPI_MEM_VERSION_CURRENT 1 + + +/*****************************************************************************/ +/* + * Special commands + * + * These do not follow the normal rules for commands.  See each command for + * details. + */ + +/* + * Reboot NOW + * + * This command will work even when the EC LPC interface is busy, because the + * reboot command is processed at interrupt level.  Note that when the EC + * reboots, the host will reboot too, so there is no response to this command. + * + * Use EC_CMD_REBOOT_EC to reboot the EC more politely. + */ +#define EC_CMD_REBOOT 0xd1  /* Think "die" */ + +/* + * Resend last response (not supported on LPC). + * + * Returns EC_RES_UNAVAILABLE if there is no response available - for example, + * there was no previous command, or the previous command's response was too + * big to save. + */ +#define EC_CMD_RESEND_RESPONSE 0xdb + +/* + * This header byte on a command indicate version 0. Any header byte less + * than this means that we are talking to an old EC which doesn't support + * versioning. In that case, we assume version 0. + * + * Header bytes greater than this indicate a later version. For example, + * EC_CMD_VERSION0 + 1 means we are using version 1. + * + * The old EC interface must not use commands 0dc or higher. + */ +#define EC_CMD_VERSION0 0xdc + +#endif  /* !__ACPI__ */ + +#endif  /* __CROS_EC_COMMANDS_H */ diff --git a/include/environment.h b/include/environment.h index 4c6a37b11..460ccb42a 100644 --- a/include/environment.h +++ b/include/environment.h @@ -75,6 +75,12 @@  # endif  #endif	/* CONFIG_ENV_IS_IN_FLASH */ +#if defined(CONFIG_ENV_IS_IN_MMC) +# ifdef CONFIG_ENV_OFFSET_REDUND +#  define CONFIG_SYS_REDUNDAND_ENVIRONMENT +# endif +#endif +  #if defined(CONFIG_ENV_IS_IN_NAND)  # if defined(CONFIG_ENV_OFFSET_OOB)  #  ifdef CONFIG_ENV_OFFSET_REDUND diff --git a/include/fdtdec.h b/include/fdtdec.h index 818ddde36..bdefda495 100644 --- a/include/fdtdec.h +++ b/include/fdtdec.h @@ -86,6 +86,8 @@ enum fdt_compat_id {  	COMPAT_SAMSUNG_EXYNOS5_SOUND,	/* Exynos Sound */  	COMPAT_WOLFSON_WM8994_CODEC,	/* Wolfson WM8994 Sound Codec */  	COMPAT_SAMSUNG_EXYNOS_SPI,	/* Exynos SPI */ +	COMPAT_GOOGLE_CROS_EC,		/* Google CROS_EC Protocol */ +	COMPAT_GOOGLE_CROS_EC_KEYB,	/* Google CROS_EC Keyboard */  	COMPAT_SAMSUNG_EXYNOS_EHCI,	/* Exynos EHCI controller */  	COMPAT_SAMSUNG_EXYNOS_USB_PHY,	/* Exynos phy controller for usb2.0 */  	COMPAT_SAMSUNG_EXYNOS_TMU,	/* Exynos TMU */ @@ -97,6 +99,7 @@ enum fdt_compat_id {  	COMPAT_GENERIC_SPI_FLASH,	/* Generic SPI Flash chip */  	COMPAT_MAXIM_98095_CODEC,	/* MAX98095 Codec */  	COMPAT_INFINEON_SLB9635_TPM,	/* Infineon SLB9635 TPM */ +	COMPAT_INFINEON_SLB9645_TPM,	/* Infineon SLB9645 TPM */  	COMPAT_COUNT,  }; diff --git a/include/g_dnl.h b/include/g_dnl.h index f47395f35..f8affd8d9 100644 --- a/include/g_dnl.h +++ b/include/g_dnl.h @@ -23,7 +23,7 @@  #include <linux/usb/ch9.h>  #include <linux/usb/gadget.h> - +int g_dnl_bind_fixup(struct usb_device_descriptor *);  int g_dnl_register(const char *s);  void g_dnl_unregister(void); diff --git a/include/ide.h b/include/ide.h index afea85cdc..f691a74ab 100644 --- a/include/ide.h +++ b/include/ide.h @@ -54,8 +54,9 @@ typedef ulong lbaint_t;   */  void ide_init(void); -ulong ide_read(int device, ulong blknr, lbaint_t blkcnt, void *buffer); -ulong ide_write(int device, ulong blknr, lbaint_t blkcnt, const void *buffer); +ulong ide_read(int device, lbaint_t blknr, lbaint_t blkcnt, void *buffer); +ulong ide_write(int device, lbaint_t blknr, lbaint_t blkcnt, +		const void *buffer);  #ifdef CONFIG_IDE_PREINIT  int ide_preinit(void); diff --git a/include/image.h b/include/image.h index b8cc5236a..7b0108f32 100644 --- a/include/image.h +++ b/include/image.h @@ -320,13 +320,16 @@ typedef struct bootm_headers {  	int		verify;		/* getenv("verify")[0] != 'n' */  #define	BOOTM_STATE_START	(0x00000001) -#define	BOOTM_STATE_LOADOS	(0x00000002) -#define	BOOTM_STATE_RAMDISK	(0x00000004) -#define	BOOTM_STATE_FDT		(0x00000008) -#define	BOOTM_STATE_OS_CMDLINE	(0x00000010) -#define	BOOTM_STATE_OS_BD_T	(0x00000020) -#define	BOOTM_STATE_OS_PREP	(0x00000040) -#define	BOOTM_STATE_OS_GO	(0x00000080) +#define	BOOTM_STATE_FINDOS	(0x00000002) +#define	BOOTM_STATE_FINDOTHER	(0x00000004) +#define	BOOTM_STATE_LOADOS	(0x00000008) +#define	BOOTM_STATE_RAMDISK	(0x00000010) +#define	BOOTM_STATE_FDT		(0x00000020) +#define	BOOTM_STATE_OS_CMDLINE	(0x00000040) +#define	BOOTM_STATE_OS_BD_T	(0x00000080) +#define	BOOTM_STATE_OS_PREP	(0x00000100) +#define	BOOTM_STATE_OS_FAKE_GO	(0x00000200)	/* 'Almost' run the OS */ +#define	BOOTM_STATE_OS_GO	(0x00000400)  	int		state;  #ifdef CONFIG_LMB @@ -402,6 +405,13 @@ void genimg_print_size(uint32_t size);  #endif  void genimg_print_time(time_t timestamp); +/* What to do with a image load address ('load = <> 'in the FIT) */ +enum fit_load_op { +	FIT_LOAD_IGNORED,	/* Ignore load address */ +	FIT_LOAD_OPTIONAL,	/* Can be provided, but optional */ +	FIT_LOAD_REQUIRED,	/* Must be provided */ +}; +  #ifndef USE_HOSTCC  /* Image format types, returned by _get_format() routine */  #define IMAGE_FORMAT_INVALID	0x00 @@ -415,8 +425,72 @@ ulong genimg_get_image(ulong img_addr);  int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,  		uint8_t arch, ulong *rd_start, ulong *rd_end); -int boot_get_fdt(int flag, int argc, char * const argv[], -		bootm_headers_t *images, char **of_flat_tree, ulong *of_size); +/** + * fit_image_load() - load an image from a FIT + * + * This deals with all aspects of loading an image from a FIT, including + * selecting the right image based on configuration, verifying it, printing + * out progress messages, checking the type/arch/os and optionally copying it + * to the right load address. + * + * @param images	Boot images structure + * @param prop_name	Property name to look up (FIT_..._PROP) + * @param addr		Address of FIT in memory + * @param fit_unamep	On entry this is the requested image name + *			(e.g. "kernel@1") or NULL to use the default. On exit + *			points to the selected image name + * @param fit_uname_configp	On entry this is the requested configuration + *			name (e.g. "conf@1") or NULL to use the default. On + *			exit points to the selected configuration name. + * @param arch		Expected architecture (IH_ARCH_...) + * @param image_type	Required image type (IH_TYPE_...). If this is + *			IH_TYPE_KERNEL then we allow IH_TYPE_KERNEL_NOLOAD + *			also. + * @param bootstage_id	ID of starting bootstage to use for progress updates. + *			This will be added to the BOOTSTAGE_SUB values when + *			calling bootstage_mark() + * @param load_op	Decribes what to do with the load address + * @param datap		Returns address of loaded image + * @param lenp		Returns length of loaded image + */ +int fit_image_load(bootm_headers_t *images, const char *prop_name, ulong addr, +		   const char **fit_unamep, const char **fit_uname_configp, +		   int arch, int image_type, int bootstage_id, +		   enum fit_load_op load_op, ulong *datap, ulong *lenp); + +/** + * fit_get_node_from_config() - Look up an image a FIT by type + * + * This looks in the selected conf@ node (images->fit_uname_cfg) for a + * particular image type (e.g. "kernel") and then finds the image that is + * referred to. + * + * For example, for something like: + * + * images { + *	kernel@1 { + *		... + *	}; + * }; + * configurations { + *	conf@1 { + *		kernel = "kernel@1"; + *	}; + * }; + * + * the function will return the node offset of the kernel@1 node, assuming + * that conf@1 is the chosen configuration. + * + * @param images	Boot images structure + * @param prop_name	Property name to look up (FIT_..._PROP) + * @param addr		Address of FIT in memory + */ +int fit_get_node_from_config(bootm_headers_t *images, const char *prop_name, +			ulong addr); + +int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch, +		 bootm_headers_t *images, +		 char **of_flat_tree, ulong *of_size);  void boot_fdt_add_mem_rsv_regions(struct lmb *lmb, void *fdt_blob);  int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size); @@ -589,6 +663,17 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob,   */  int image_setup_linux(bootm_headers_t *images); +/** + * bootz_setup() - Extract stat and size of a Linux xImage + * + * @image: Address of image + * @start: Returns start address of image + * @end : Returns end address of image + * @return 0 if OK, 1 if the image was not recognised + */ +int bootz_setup(ulong image, ulong *start, ulong *end); + +  /*******************************************************************/  /* New uImage format specific code (prefixed with fit_) */  /*******************************************************************/ @@ -597,11 +682,12 @@ int image_setup_linux(bootm_headers_t *images);  #define FIT_IMAGES_PATH		"/images"  #define FIT_CONFS_PATH		"/configurations" -/* hash node */ +/* hash/signature node */  #define FIT_HASH_NODENAME	"hash"  #define FIT_ALGO_PROP		"algo"  #define FIT_VALUE_PROP		"value"  #define FIT_IGNORE_PROP		"uboot-ignore" +#define FIT_SIG_NODENAME	"signature"  /* image node */  #define FIT_DATA_PROP		"data" @@ -689,14 +775,29 @@ int fit_image_hash_get_value(const void *fit, int noffset, uint8_t **value,  int fit_set_timestamp(void *fit, int noffset, time_t timestamp);  /** - * fit_add_verification_data() - Calculate and add hashes to FIT + * fit_add_verification_data() - add verification data to FIT image nodes + * + * @keydir:	Directory containing keys + * @kwydest:	FDT blob to write public key information to + * @fit:	Pointer to the FIT format image header + * @comment:	Comment to add to signature nodes + * @require_keys: Mark all keys as 'required'   * - * @fit:	Fit image to process - * @return 0 if ok, <0 for error + * Adds hash values for all component images in the FIT blob. + * Hashes are calculated for all component images which have hash subnodes + * with algorithm property set to one of the supported hash algorithms. + * + * Also add signatures if signature nodes are present. + * + * returns + *     0, on success + *     libfdt error code, on failure   */ -int fit_add_verification_data(void *fit); +int fit_add_verification_data(const char *keydir, void *keydest, void *fit, +			      const char *comment, int require_keys);  int fit_image_verify(const void *fit, int noffset); +int fit_config_verify(const void *fit, int conf_noffset);  int fit_all_image_verify(const void *fit);  int fit_image_check_os(const void *fit, int noffset, uint8_t os);  int fit_image_check_arch(const void *fit, int noffset, uint8_t arch); @@ -706,9 +807,6 @@ int fit_check_format(const void *fit);  int fit_conf_find_compat(const void *fit, const void *fdt);  int fit_conf_get_node(const void *fit, const char *conf_uname); -int fit_conf_get_kernel_node(const void *fit, int noffset); -int fit_conf_get_ramdisk_node(const void *fit, int noffset); -int fit_conf_get_fdt_node(const void *fit, int noffset);  /**   * fit_conf_get_prop_node() - Get node refered to by a configuration @@ -732,12 +830,170 @@ int fit_check_ramdisk(const void *fit, int os_noffset,  int calculate_hash(const void *data, int data_len, const char *algo,  			uint8_t *value, int *value_len); -#ifndef USE_HOSTCC +/* + * At present we only support signing on the host, and verification on the + * device + */ +#if defined(CONFIG_FIT_SIGNATURE) +# ifdef USE_HOSTCC +#  define IMAGE_ENABLE_SIGN	1 +#  define IMAGE_ENABLE_VERIFY	0 +#else +#  define IMAGE_ENABLE_SIGN	0 +#  define IMAGE_ENABLE_VERIFY	1 +# endif +#else +# define IMAGE_ENABLE_SIGN	0 +# define IMAGE_ENABLE_VERIFY	0 +#endif + +#ifdef USE_HOSTCC +# define gd_fdt_blob()		NULL +#else +# define gd_fdt_blob()		(gd->fdt_blob) +#endif + +#ifdef CONFIG_FIT_BEST_MATCH +#define IMAGE_ENABLE_BEST_MATCH	1 +#else +#define IMAGE_ENABLE_BEST_MATCH	0 +#endif + +/* Information passed to the signing routines */ +struct image_sign_info { +	const char *keydir;		/* Directory conaining keys */ +	const char *keyname;		/* Name of key to use */ +	void *fit;			/* Pointer to FIT blob */ +	int node_offset;		/* Offset of signature node */ +	struct image_sig_algo *algo;	/* Algorithm information */ +	const void *fdt_blob;		/* FDT containing public keys */ +	int required_keynode;		/* Node offset of key to use: -1=any */ +	const char *require_keys;	/* Value for 'required' property */ +}; + +/* A part of an image, used for hashing */ +struct image_region { +	const void *data; +	int size; +}; + +struct image_sig_algo { +	const char *name;		/* Name of algorithm */ + +	/** +	 * sign() - calculate and return signature for given input data +	 * +	 * @info:	Specifies key and FIT information +	 * @data:	Pointer to the input data +	 * @data_len:	Data length +	 * @sigp:	Set to an allocated buffer holding the signature +	 * @sig_len:	Set to length of the calculated hash +	 * +	 * This computes input data signature according to selected algorithm. +	 * Resulting signature value is placed in an allocated buffer, the +	 * pointer is returned as *sigp. The length of the calculated +	 * signature is returned via the sig_len pointer argument. The caller +	 * should free *sigp. +	 * +	 * @return: 0, on success, -ve on error +	 */ +	int (*sign)(struct image_sign_info *info, +		    const struct image_region region[], +		    int region_count, uint8_t **sigp, uint *sig_len); + +	/** +	 * add_verify_data() - Add verification information to FDT +	 * +	 * Add public key information to the FDT node, suitable for +	 * verification at run-time. The information added depends on the +	 * algorithm being used. +	 * +	 * @info:	Specifies key and FIT information +	 * @keydest:	Destination FDT blob for public key data +	 * @return: 0, on success, -ve on error +	 */ +	int (*add_verify_data)(struct image_sign_info *info, void *keydest); + +	/** +	 * verify() - Verify a signature against some data +	 * +	 * @info:	Specifies key and FIT information +	 * @data:	Pointer to the input data +	 * @data_len:	Data length +	 * @sig:	Signature +	 * @sig_len:	Number of bytes in signature +	 * @return 0 if verified, -ve on error +	 */ +	int (*verify)(struct image_sign_info *info, +		      const struct image_region region[], int region_count, +		      uint8_t *sig, uint sig_len); +}; + +/** + * image_get_sig_algo() - Look up a signature algortihm + * + * @param name		Name of algorithm + * @return pointer to algorithm information, or NULL if not found + */ +struct image_sig_algo *image_get_sig_algo(const char *name); + +/** + * fit_image_verify_required_sigs() - Verify signatures marked as 'required' + * + * @fit:		FIT to check + * @image_noffset:	Offset of image node to check + * @data:		Image data to check + * @size:		Size of image data + * @sig_blob:		FDT containing public keys + * @no_sigsp:		Returns 1 if no signatures were required, and + *			therefore nothing was checked. The caller may wish + *			to fall back to other mechanisms, or refuse to + *			boot. + * @return 0 if all verified ok, <0 on error + */ +int fit_image_verify_required_sigs(const void *fit, int image_noffset, +		const char *data, size_t size, const void *sig_blob, +		int *no_sigsp); + +/** + * fit_image_check_sig() - Check a single image signature node + * + * @fit:		FIT to check + * @noffset:		Offset of signature node to check + * @data:		Image data to check + * @size:		Size of image data + * @required_keynode:	Offset in the control FDT of the required key node, + *			if any. If this is given, then the image wil not + *			pass verification unless that key is used. If this is + *			-1 then any signature will do. + * @err_msgp:		In the event of an error, this will be pointed to a + *			help error string to display to the user. + * @return 0 if all verified ok, <0 on error + */ +int fit_image_check_sig(const void *fit, int noffset, const void *data, +		size_t size, int required_keynode, char **err_msgp); + +/** + * fit_region_make_list() - Make a list of regions to hash + * + * Given a list of FIT regions (offset, size) provided by libfdt, create + * a list of regions (void *, size) for use by the signature creationg + * and verification code. + * + * @fit:		FIT image to process + * @fdt_regions:	Regions as returned by libfdt + * @count:		Number of regions returned by libfdt + * @region:		Place to put list of regions (NULL to allocate it) + * @return pointer to list of regions, or NULL if out of memory + */ +struct image_region *fit_region_make_list(const void *fit, +		struct fdt_region *fdt_regions, int count, +		struct image_region *region); +  static inline int fit_image_check_target_arch(const void *fdt, int node)  {  	return fit_image_check_arch(fdt, node, IH_ARCH_DEFAULT);  } -#endif /* USE_HOSTCC */  #ifdef CONFIG_FIT_VERBOSE  #define fit_unsupported(msg)	printf("! %s:%d " \ diff --git a/include/lcd.h b/include/lcd.h index c6e7fc521..8718a0190 100644 --- a/include/lcd.h +++ b/include/lcd.h @@ -37,7 +37,6 @@ extern struct vidinfo panel_info;  void lcd_ctrl_init(void *lcdbase);  void lcd_enable(void); -int board_splash_screen_prepare(void);  /* setcolreg used in 8bpp/16bpp; initcolregs used in monochrome */  void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue); @@ -46,7 +45,8 @@ void lcd_initcolregs(void);  int lcd_getfgcolor(void);  /* gunzip_bmp used if CONFIG_VIDEO_BMP_GZIP */ -struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp); +struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp, +			     void **alloc_addr);  int bmp_display(ulong addr, int x, int y);  /** @@ -324,6 +324,9 @@ void lcd_show_board_info(void);  /* Return the size of the LCD frame buffer, and the line length */  int lcd_get_size(int *line_length); +int lcd_dt_simplefb_add_node(void *blob); +int lcd_dt_simplefb_enable_existing_node(void *blob); +  /************************************************************************/  /* ** BITMAP DISPLAY SUPPORT						*/  /************************************************************************/ diff --git a/include/libfdt.h b/include/libfdt.h index c5ec2acfd..765d84f5e 100644 --- a/include/libfdt.h +++ b/include/libfdt.h @@ -1511,4 +1511,68 @@ int fdt_del_node(void *fdt, int nodeoffset);  const char *fdt_strerror(int errval); +struct fdt_region { +	int offset; +	int size; +}; + +/** + * fdt_find_regions() - find regions in device tree + * + * Given a list of nodes to include and properties to exclude, find + * the regions of the device tree which describe those included parts. + * + * The intent is to get a list of regions which will be invariant provided + * those parts are invariant. For example, if you request a list of regions + * for all nodes but exclude the property "data", then you will get the + * same region contents regardless of any change to "data" properties. + * + * This function can be used to produce a byte-stream to send to a hashing + * function to verify that critical parts of the FDT have not changed. + * + * Nodes which are given in 'inc' are included in the region list, as + * are the names of the immediate subnodes nodes (but not the properties + * or subnodes of those subnodes). + * + * For eaxample "/" means to include the root node, all root properties + * and the FDT_BEGIN_NODE and FDT_END_NODE of all subnodes of /. The latter + * ensures that we capture the names of the subnodes. In a hashing situation + * it prevents the root node from changing at all Any change to non-excluded + * properties, names of subnodes or number of subnodes would be detected. + * + * When used with FITs this provides the ability to hash and sign parts of + * the FIT based on different configurations in the FIT. Then it is + * impossible to change anything about that configuration (include images + * attached to the configuration), but it may be possible to add new + * configurations, new images or new signatures within the existing + * framework. + * + * Adding new properties to a device tree may result in the string table + * being extended (if the new property names are different from those + * already added). This function can optionally include a region for + * the string table so that this can be part of the hash too. + * + * The device tree header is not included in the list. + * + * @fdt:	Device tree to check + * @inc:	List of node paths to included + * @inc_count:	Number of node paths in list + * @exc_prop:	List of properties names to exclude + * @exc_prop_count:	Number of properties in exclude list + * @region:	Returns list of regions + * @max_region:	Maximum length of region list + * @path:	Pointer to a temporary string for the function to use for + *		building path names + * @path_len:	Length of path, must be large enough to hold the longest + *		path in the tree + * @add_string_tab:	1 to add a region for the string table + * @return number of regions in list. If this is >max_regions then the + * region array was exhausted. You should increase max_regions and try + * the call again. + */ +int fdt_find_regions(const void *fdt, char * const inc[], int inc_count, +		     char * const exc_prop[], int exc_prop_count, +		     struct fdt_region region[], int max_regions, +		     char *path, int path_len, int add_string_tab); +  #endif /* _LIBFDT_H */ diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index fcb20fe10..f6dbdb096 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h @@ -580,6 +580,8 @@ enum ethtool_sfeatures_retval_bits {  #define SUPPORTED_10000baseKX4_Full	(1 << 18)  #define SUPPORTED_10000baseKR_Full	(1 << 19)  #define SUPPORTED_10000baseR_FEC	(1 << 20) +#define SUPPORTED_1000baseX_Half	(1 << 21) +#define SUPPORTED_1000baseX_Full	(1 << 22)  /* Indicates what features are advertised by the interface. */  #define ADVERTISED_10baseT_Half		(1 << 0) @@ -603,6 +605,8 @@ enum ethtool_sfeatures_retval_bits {  #define ADVERTISED_10000baseKX4_Full	(1 << 18)  #define ADVERTISED_10000baseKR_Full	(1 << 19)  #define ADVERTISED_10000baseR_FEC	(1 << 20) +#define ADVERTISED_1000baseX_Half	(1 << 21) +#define ADVERTISED_1000baseX_Full	(1 << 22)  /* The following are all involved in forcing a particular link   * mode for the device for setting things.  When getting the diff --git a/include/linux/mii.h b/include/linux/mii.h index 8b9269214..66b83d83d 100644 --- a/include/linux/mii.h +++ b/include/linux/mii.h @@ -115,6 +115,8 @@  #define EXPANSION_MFAULTS	0x0010	/* Multiple faults detected    */  #define EXPANSION_RESV		0xffe0	/* Unused...		       */ +#define ESTATUS_1000_XFULL	0x8000	/* Can do 1000BX Full */ +#define ESTATUS_1000_XHALF	0x4000	/* Can do 1000BX Half */  #define ESTATUS_1000_TFULL	0x2000	/* Can do 1000BT Full */  #define ESTATUS_1000_THALF	0x1000	/* Can do 1000BT Half */ diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h index 8cbcdae11..71292b1a8 100644 --- a/include/linux/mtd/bbm.h +++ b/include/linux/mtd/bbm.h @@ -81,32 +81,53 @@ struct nand_bbt_descr {  #define NAND_BBT_LASTBLOCK	0x00000010  /* The bbt is at the given page, else we must scan for the bbt */  #define NAND_BBT_ABSPAGE	0x00000020 -/* The bbt is at the given page, else we must scan for the bbt */ -#define NAND_BBT_SEARCH		0x00000040  /* bbt is stored per chip on multichip devices */  #define NAND_BBT_PERCHIP	0x00000080  /* bbt has a version counter at offset veroffs */  #define NAND_BBT_VERSION	0x00000100  /* Create a bbt if none exists */  #define NAND_BBT_CREATE		0x00000200 +/* + * Create an empty BBT with no vendor information. Vendor's information may be + * unavailable, for example, if the NAND controller has a different data and OOB + * layout or if this information is already purged. Must be used in conjunction + * with NAND_BBT_CREATE. + */ +#define NAND_BBT_CREATE_EMPTY	0x00000400  /* Search good / bad pattern through all pages of a block */ -#define NAND_BBT_SCANALLPAGES	0x00000400 +#define NAND_BBT_SCANALLPAGES	0x00000800  /* Scan block empty during good / bad block scan */ -#define NAND_BBT_SCANEMPTY	0x00000800 +#define NAND_BBT_SCANEMPTY	0x00001000  /* Write bbt if neccecary */ -#define NAND_BBT_WRITE		0x00001000 +#define NAND_BBT_WRITE		0x00002000  /* Read and write back block contents when writing bbt */ -#define NAND_BBT_SAVECONTENT	0x00002000 +#define NAND_BBT_SAVECONTENT	0x00004000  /* Search good / bad pattern on the first and the second page */ -#define NAND_BBT_SCAN2NDPAGE	0x00004000 +#define NAND_BBT_SCAN2NDPAGE	0x00008000  /* Search good / bad pattern on the last page of the eraseblock */ -#define NAND_BBT_SCANLASTPAGE	0x00008000 -/* Chip stores bad block marker on BOTH 1st and 6th bytes of OOB */ -#define NAND_BBT_SCANBYTE1AND6 0x00100000 -/* The nand_bbt_descr was created dynamicaly and must be freed */ -#define NAND_BBT_DYNAMICSTRUCT 0x00200000 -/* The bad block table does not OOB for marker */ -#define NAND_BBT_NO_OOB		0x00400000 +#define NAND_BBT_SCANLASTPAGE	0x00010000 +/* + * Use a flash based bad block table. By default, OOB identifier is saved in + * OOB area. This option is passed to the default bad block table function. + */ +#define NAND_BBT_USE_FLASH	0x00020000 +/* + * Do not store flash based bad block table marker in the OOB area; store it + * in-band. + */ +#define NAND_BBT_NO_OOB		0x00040000 +/* + * Do not write new bad block markers to OOB; useful, e.g., when ECC covers + * entire spare area. Must be used with NAND_BBT_USE_FLASH. + */ +#define NAND_BBT_NO_OOB_BBM	0x00080000 + +/* + * Flag set by nand_create_default_bbt_descr(), marking that the nand_bbt_descr + * was allocated dynamicaly and must be freed in nand_release(). Has no meaning + * in nand_chip.bbt_options. + */ +#define NAND_BBT_DYNAMICSTRUCT	0x80000000  /* The maximum number of blocks to scan for a bbt */  #define NAND_BBT_SCAN_MAXBLOCKS	4 diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 141c96024..6f44abdc1 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -9,7 +9,8 @@  #include <linux/types.h>  #include <div64.h> -#include <linux/mtd/mtd-abi.h> +#include <mtd/mtd-abi.h> +#include <asm/errno.h>  #define MTD_CHAR_MAJOR 90  #define MTD_BLOCK_MAJOR 31 @@ -65,22 +66,6 @@ struct mtd_erase_region_info {  	unsigned long *lockmap;		/* If keeping bitmap of locks */  }; -/* - * oob operation modes - * - * MTD_OOB_PLACE:	oob data are placed at the given offset - * MTD_OOB_AUTO:	oob data are automatically placed at the free areas - *			which are defined by the ecclayout - * MTD_OOB_RAW:		mode to read raw data+oob in one chunk. The oob data - *			is inserted into the data. Thats a raw image of the - *			flash contents. - */ -typedef enum { -	MTD_OOB_PLACE, -	MTD_OOB_AUTO, -	MTD_OOB_RAW, -} mtd_oob_mode_t; -  /**   * struct mtd_oob_ops - oob operation operands   * @mode:	operation mode @@ -92,7 +77,7 @@ typedef enum {   * @ooblen:	number of oob bytes to write/read   * @oobretlen:	number of oob bytes written/read   * @ooboffs:	offset of oob data in the oob area (only relevant when - *		mode = MTD_OOB_PLACE) + *		mode = MTD_OPS_PLACE_OOB or MTD_OPS_RAW)   * @datbuf:	data buffer - if NULL only oob data are read/written   * @oobbuf:	oob data buffer   * @@ -101,7 +86,7 @@ typedef enum {   * OOB area.   */  struct mtd_oob_ops { -	mtd_oob_mode_t	mode; +	unsigned int	mode;  	size_t		len;  	size_t		retlen;  	size_t		ooblen; @@ -133,13 +118,25 @@ struct mtd_info {  	u_int32_t oobsize;   /* Amount of OOB data per block (e.g. 16) */  	u_int32_t oobavail;  /* Available OOB bytes per block */ +	/* +	 * read ops return -EUCLEAN if max number of bitflips corrected on any +	 * one region comprising an ecc step equals or exceeds this value. +	 * Settable by driver, else defaults to ecc_strength.  User can override +	 * in sysfs.  N.B. The meaning of the -EUCLEAN return code has changed; +	 * see Documentation/ABI/testing/sysfs-class-mtd for more detail. +	 */ +	unsigned int bitflip_threshold; +  	/* Kernel-only stuff starts here. */  	const char *name;  	int index; -	/* ecc layout structure pointer - read only ! */ +	/* ECC layout structure pointer - read only! */  	struct nand_ecclayout *ecclayout; +	/* max number of correctible bit errors per ecc step */ +	unsigned int ecc_strength; +  	/* Data for variable erase regions. If numeraseregions is zero,  	 * it means that the whole device has erasesize as given above.  	 */ @@ -147,25 +144,17 @@ struct mtd_info {  	struct mtd_erase_region_info *eraseregions;  	/* -	 * Erase is an asynchronous operation.  Device drivers are supposed -	 * to call instr->callback() whenever the operation completes, even -	 * if it completes with a failure. -	 * Callers are supposed to pass a callback function and wait for it -	 * to be called before writing to the block. +	 * Do not call via these pointers, use corresponding mtd_*() +	 * wrappers instead.  	 */ -	int (*erase) (struct mtd_info *mtd, struct erase_info *instr); - -	/* This stuff for eXecute-In-Place */ -	/* phys is optional and may be set to NULL */ -	int (*point) (struct mtd_info *mtd, loff_t from, size_t len, +	int (*_erase) (struct mtd_info *mtd, struct erase_info *instr); +	int (*_point) (struct mtd_info *mtd, loff_t from, size_t len,  			size_t *retlen, void **virt, phys_addr_t *phys); - -	/* We probably shouldn't allow XIP if the unpoint isn't a NULL */ -	void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len); - - -	int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); -	int (*write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf); +	void (*_unpoint) (struct mtd_info *mtd, loff_t from, size_t len); +	int (*_read) (struct mtd_info *mtd, loff_t from, size_t len, +		     size_t *retlen, u_char *buf); +	int (*_write) (struct mtd_info *mtd, loff_t to, size_t len, +		      size_t *retlen, const u_char *buf);  	/* In blackbox flight recorder like scenarios we want to make successful  	   writes in interrupt context. panic_write() is only intended to be @@ -174,24 +163,35 @@ struct mtd_info {  	   longer, this function can break locks and delay to ensure the write  	   succeeds (but not sleep). */ -	int (*panic_write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf); +	int (*_panic_write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf); -	int (*read_oob) (struct mtd_info *mtd, loff_t from, +	int (*_read_oob) (struct mtd_info *mtd, loff_t from,  			 struct mtd_oob_ops *ops); -	int (*write_oob) (struct mtd_info *mtd, loff_t to, +	int (*_write_oob) (struct mtd_info *mtd, loff_t to,  			 struct mtd_oob_ops *ops); - +	int (*_get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf, +				   size_t len); +	int (*_read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, +				   size_t len, size_t *retlen, u_char *buf); +	int (*_get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf, +				   size_t len); +	int (*_read_user_prot_reg) (struct mtd_info *mtd, loff_t from, +				   size_t len, size_t *retlen, u_char *buf); +	int (*_write_user_prot_reg) (struct mtd_info *mtd, loff_t to, size_t len, +				    size_t *retlen, u_char *buf); +	int (*_lock_user_prot_reg) (struct mtd_info *mtd, loff_t from, +				   size_t len); +	void (*_sync) (struct mtd_info *mtd); +	int (*_lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); +	int (*_unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); +	int (*_block_isbad) (struct mtd_info *mtd, loff_t ofs); +	int (*_block_markbad) (struct mtd_info *mtd, loff_t ofs);  	/* -	 * Methods to access the protection register area, present in some -	 * flash devices. The user data is one time programmable but the -	 * factory data is read only. +	 * If the driver is something smart, like UBI, it may need to maintain +	 * its own reference counting. The below functions are only for driver.  	 */ -	int (*get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf, size_t len); -	int (*read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); -	int (*get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf, size_t len); -	int (*read_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); -	int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); -	int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len); +	int (*_get_device) (struct mtd_info *mtd); +	void (*_put_device) (struct mtd_info *mtd);  /* XXX U-BOOT XXX */  #if 0 @@ -201,18 +201,6 @@ struct mtd_info {  	*/  	int (*writev) (struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, loff_t to, size_t *retlen);  #endif - -	/* Sync */ -	void (*sync) (struct mtd_info *mtd); - -	/* Chip-supported device locking */ -	int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); -	int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); - -	/* Bad block management functions */ -	int (*block_isbad) (struct mtd_info *mtd, loff_t ofs); -	int (*block_markbad) (struct mtd_info *mtd, loff_t ofs); -  /* XXX U-BOOT XXX */  #if 0  	struct notifier_block reboot_notifier;  /* default mode before reboot */ @@ -227,15 +215,59 @@ struct mtd_info {  	struct module *owner;  	int usecount; - -	/* If the driver is something smart, like UBI, it may need to maintain -	 * its own reference counting. The below functions are only for driver. -	 * The driver may register its callbacks. These callbacks are not -	 * supposed to be called by MTD users */ -	int (*get_device) (struct mtd_info *mtd); -	void (*put_device) (struct mtd_info *mtd);  }; +int mtd_erase(struct mtd_info *mtd, struct erase_info *instr); +int mtd_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, +	     u_char *buf); +int mtd_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, +	      const u_char *buf); +int mtd_panic_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, +		    const u_char *buf); + +int mtd_read_oob(struct mtd_info *mtd, loff_t from, struct mtd_oob_ops *ops); + +static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to, +				struct mtd_oob_ops *ops) +{ +	ops->retlen = ops->oobretlen = 0; +	if (!mtd->_write_oob) +		return -EOPNOTSUPP; +	if (!(mtd->flags & MTD_WRITEABLE)) +		return -EROFS; +	return mtd->_write_oob(mtd, to, ops); +} + +int mtd_get_fact_prot_info(struct mtd_info *mtd, struct otp_info *buf, +			   size_t len); +int mtd_read_fact_prot_reg(struct mtd_info *mtd, loff_t from, size_t len, +			   size_t *retlen, u_char *buf); +int mtd_get_user_prot_info(struct mtd_info *mtd, struct otp_info *buf, +			   size_t len); +int mtd_read_user_prot_reg(struct mtd_info *mtd, loff_t from, size_t len, +			   size_t *retlen, u_char *buf); +int mtd_write_user_prot_reg(struct mtd_info *mtd, loff_t to, size_t len, +			    size_t *retlen, u_char *buf); +int mtd_lock_user_prot_reg(struct mtd_info *mtd, loff_t from, size_t len); + +/* XXX U-BOOT XXX */ +#if 0 +int mtd_writev(struct mtd_info *mtd, const struct kvec *vecs, +	       unsigned long count, loff_t to, size_t *retlen); +#endif + +static inline void mtd_sync(struct mtd_info *mtd) +{ +	if (mtd->_sync) +		mtd->_sync(mtd); +} + +int mtd_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len); +int mtd_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len); +int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len); +int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs); +int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs); +  static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd)  {  	do_div(sz, mtd->erasesize); @@ -247,6 +279,16 @@ static inline uint32_t mtd_mod_by_eb(uint64_t sz, struct mtd_info *mtd)  	return do_div(sz, mtd->erasesize);  } +static inline int mtd_has_oob(const struct mtd_info *mtd) +{ +	return mtd->_read_oob && mtd->_write_oob; +} + +static inline int mtd_can_have_bb(const struct mtd_info *mtd) +{ +	return !!mtd->_block_isbad; +} +  	/* Kernel-side ioctl definitions */  extern int add_mtd_device(struct mtd_info *mtd); @@ -269,12 +311,6 @@ struct mtd_notifier {  extern void register_mtd_user (struct mtd_notifier *new);  extern int unregister_mtd_user (struct mtd_notifier *old); - -int default_mtd_writev(struct mtd_info *mtd, const struct kvec *vecs, -		       unsigned long count, loff_t to, size_t *retlen); - -int default_mtd_readv(struct mtd_info *mtd, struct kvec *vecs, -		      unsigned long count, loff_t from, size_t *retlen);  #endif  #ifdef CONFIG_MTD_PARTITIONS @@ -296,17 +332,34 @@ static inline void mtd_erase_callback(struct erase_info *instr)  #define MTD_DEBUG_LEVEL3	(3)	/* Noisy   */  #ifdef CONFIG_MTD_DEBUG +#define pr_debug(args...)	MTDDEBUG(MTD_DEBUG_LEVEL0, args)  #define MTDDEBUG(n, args...)				\  	do {						\  		if (n <= CONFIG_MTD_DEBUG_VERBOSE)	\  			printk(KERN_INFO args);		\  	} while(0)  #else /* CONFIG_MTD_DEBUG */ +#define pr_debug(args...)  #define MTDDEBUG(n, args...)				\  	do {						\  		if (0)					\  			printk(KERN_INFO args);		\  	} while(0)  #endif /* CONFIG_MTD_DEBUG */ +#define pr_info(args...)	MTDDEBUG(MTD_DEBUG_LEVEL0, args) +#define pr_warn(args...)	MTDDEBUG(MTD_DEBUG_LEVEL0, args) +#define pr_err(args...)		MTDDEBUG(MTD_DEBUG_LEVEL0, args) + +static inline int mtd_is_bitflip(int err) { +	return err == -EUCLEAN; +} + +static inline int mtd_is_eccerr(int err) { +	return err == -EBADMSG; +} + +static inline int mtd_is_bitflip_or_eccerr(int err) { +	return mtd_is_bitflip(err) || mtd_is_eccerr(err); +}  #endif /* __MTD_MTD_H__ */ diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 98bf255bb..205558437 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h @@ -46,7 +46,7 @@ extern void nand_wait_ready(struct mtd_info *mtd);   * is supported now. If you add a chip with bigger oobsize/page   * adjust this accordingly.   */ -#define NAND_MAX_OOBSIZE	576 +#define NAND_MAX_OOBSIZE	640  #define NAND_MAX_PAGESIZE	8192  /* @@ -82,6 +82,8 @@ extern void nand_wait_ready(struct mtd_info *mtd);  #define NAND_CMD_READID		0x90  #define NAND_CMD_ERASE2		0xd0  #define NAND_CMD_PARAM		0xec +#define NAND_CMD_GET_FEATURES	0xee +#define NAND_CMD_SET_FEATURES	0xef  #define NAND_CMD_RESET		0xff  #define NAND_CMD_LOCK		0x2a @@ -142,7 +144,7 @@ typedef enum {  #define NAND_ECC_READ		0  /* Reset Hardware ECC for write */  #define NAND_ECC_WRITE		1 -/* Enable Hardware ECC before syndrom is read back from flash */ +/* Enable Hardware ECC before syndrome is read back from flash */  #define NAND_ECC_READSYN	2  /* Bit mask for flags passed to do_nand_read_ecc */ @@ -153,9 +155,7 @@ typedef enum {   * Option constants for bizarre disfunctionality and real   * features.   */ -/* Chip can not auto increment pages */ -#define NAND_NO_AUTOINCR	0x00000001 -/* Buswitdh is 16 bit */ +/* Buswidth is 16 bit */  #define NAND_BUSWIDTH_16	0x00000002  /* Device supports partial programming without padding */  #define NAND_NO_PADDING		0x00000004 @@ -179,12 +179,6 @@ typedef enum {   * This happens with the Renesas AG-AND chips, possibly others.   */  #define BBT_AUTO_REFRESH	0x00000080 -/* - * Chip does not require ready check on read. true - * for all large page devices, as they do not support - * autoincrement. - */ -#define NAND_NO_READRDY		0x00000100  /* Chip does not allow subpage writes */  #define NAND_NO_SUBPAGE_WRITE	0x00000200 @@ -202,34 +196,21 @@ typedef enum {  	(NAND_NO_PADDING | NAND_CACHEPRG | NAND_COPYBACK)  /* Macros to identify the above */ -#define NAND_CANAUTOINCR(chip) (!(chip->options & NAND_NO_AUTOINCR))  #define NAND_MUST_PAD(chip) (!(chip->options & NAND_NO_PADDING))  #define NAND_HAS_CACHEPROG(chip) ((chip->options & NAND_CACHEPRG))  #define NAND_HAS_COPYBACK(chip) ((chip->options & NAND_COPYBACK))  #define NAND_HAS_SUBPAGE_READ(chip) ((chip->options & NAND_SUBPAGE_READ))  /* Non chip related options */ -/* - * Use a flash based bad block table. OOB identifier is saved in OOB area. - * This option is passed to the default bad block table function. - */ -#define NAND_USE_FLASH_BBT	0x00010000  /* This option skips the bbt scan during initialization. */ -#define NAND_SKIP_BBTSCAN	0x00020000 +#define NAND_SKIP_BBTSCAN	0x00010000  /*   * This option is defined if the board driver allocates its own buffers   * (e.g. because it needs them DMA-coherent).   */ -#define NAND_OWN_BUFFERS	0x00040000 +#define NAND_OWN_BUFFERS	0x00020000  /* Chip may not exist, so silence any errors in scan */ -#define NAND_SCAN_SILENT_NODEV	0x00080000 -/* - * If passed additionally to NAND_USE_FLASH_BBT then BBT code will not touch - * the OOB area. - */ -#define NAND_USE_FLASH_BBT_NO_OOB	0x00800000 -/* Create an empty BBT with no vendor information if the BBT is available */ -#define NAND_CREATE_EMPTY_BBT		0x01000000 +#define NAND_SCAN_SILENT_NODEV	0x00040000  /* Options set by nand scan */  /* bbt has already been read */ @@ -244,6 +225,21 @@ typedef enum {  /* Keep gcc happy */  struct nand_chip; +/* ONFI timing mode, used in both asynchronous and synchronous mode */ +#define ONFI_TIMING_MODE_0		(1 << 0) +#define ONFI_TIMING_MODE_1		(1 << 1) +#define ONFI_TIMING_MODE_2		(1 << 2) +#define ONFI_TIMING_MODE_3		(1 << 3) +#define ONFI_TIMING_MODE_4		(1 << 4) +#define ONFI_TIMING_MODE_5		(1 << 5) +#define ONFI_TIMING_MODE_UNKNOWN	(1 << 6) + +/* ONFI feature address */ +#define ONFI_FEATURE_ADDR_TIMING_MODE	0x1 + +/* ONFI subfeature parameters length */ +#define ONFI_SUBFEATURE_PARAM_LEN	4 +  struct nand_onfi_params {  	/* rev info and features block */  	/* 'O' 'N' 'F' 'I'  */ @@ -326,27 +322,32 @@ struct nand_hw_control {  };  /** - * struct nand_ecc_ctrl - Control structure for ecc - * @mode:	ecc mode - * @steps:	number of ecc steps per page - * @size:	data bytes per ecc step - * @bytes:	ecc bytes per step - * @total:	total number of ecc bytes per page - * @prepad:	padding information for syndrome based ecc generators - * @postpad:	padding information for syndrome based ecc generators + * struct nand_ecc_ctrl - Control structure for ECC + * @mode:	ECC mode + * @steps:	number of ECC steps per page + * @size:	data bytes per ECC step + * @bytes:	ECC bytes per step + * @strength:	max number of correctible bits per ECC step + * @total:	total number of ECC bytes per page + * @prepad:	padding information for syndrome based ECC generators + * @postpad:	padding information for syndrome based ECC generators   * @layout:	ECC layout control struct pointer - * @priv:	pointer to private ecc control data - * @hwctl:	function to control hardware ecc generator. Must only + * @priv:	pointer to private ECC control data + * @hwctl:	function to control hardware ECC generator. Must only   *		be provided if an hardware ECC is available - * @calculate:	function for ecc calculation or readback from ecc hardware - * @correct:	function for ecc correction, matching to ecc generator (sw/hw) + * @calculate:	function for ECC calculation or readback from ECC hardware + * @correct:	function for ECC correction, matching to ECC generator (sw/hw)   * @read_page_raw:	function to read a raw page without ECC   * @write_page_raw:	function to write a raw page without ECC - * @read_page:	function to read a page according to the ecc generator - *		requirements. - * @read_subpage:	function to read parts of the page covered by ECC. - * @write_page:	function to write a page according to the ecc generator + * @read_page:	function to read a page according to the ECC generator + *		requirements; returns maximum number of bitflips corrected in + *		any single ECC step, 0 if bitflips uncorrectable, -EIO hw error + * @read_subpage:	function to read parts of the page covered by ECC; + *			returns same as read_page() + * @write_page:	function to write a page according to the ECC generator   *		requirements. + * @write_oob_raw:	function to write chip OOB data without ECC + * @read_oob_raw:	function to read chip OOB data without ECC   * @read_oob:	function to read chip OOB data   * @write_oob:	function to write chip OOB data   */ @@ -356,6 +357,7 @@ struct nand_ecc_ctrl {  	int size;  	int bytes;  	int total; +	int strength;  	int prepad;  	int postpad;  	struct nand_ecclayout	*layout; @@ -366,25 +368,28 @@ struct nand_ecc_ctrl {  	int (*correct)(struct mtd_info *mtd, uint8_t *dat, uint8_t *read_ecc,  			uint8_t *calc_ecc);  	int (*read_page_raw)(struct mtd_info *mtd, struct nand_chip *chip, -			uint8_t *buf, int page); -	void (*write_page_raw)(struct mtd_info *mtd, struct nand_chip *chip, -			const uint8_t *buf); +			uint8_t *buf, int oob_required, int page); +	int (*write_page_raw)(struct mtd_info *mtd, struct nand_chip *chip, +			const uint8_t *buf, int oob_required);  	int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip, -			uint8_t *buf, int page); +			uint8_t *buf, int oob_required, int page);  	int (*read_subpage)(struct mtd_info *mtd, struct nand_chip *chip,  			uint32_t offs, uint32_t len, uint8_t *buf); -	void (*write_page)(struct mtd_info *mtd, struct nand_chip *chip, -			const uint8_t *buf); -	int (*read_oob)(struct mtd_info *mtd, struct nand_chip *chip, int page, -			int sndcmd); +	int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip, +			const uint8_t *buf, int oob_required); +	int (*write_oob_raw)(struct mtd_info *mtd, struct nand_chip *chip, +			int page); +	int (*read_oob_raw)(struct mtd_info *mtd, struct nand_chip *chip, +			int page); +	int (*read_oob)(struct mtd_info *mtd, struct nand_chip *chip, int page);  	int (*write_oob)(struct mtd_info *mtd, struct nand_chip *chip,  			int page);  };  /**   * struct nand_buffers - buffer structure for read/write - * @ecccalc:	buffer for calculated ecc - * @ecccode:	buffer for ecc read from flash + * @ecccalc:	buffer for calculated ECC + * @ecccode:	buffer for ECC read from flash   * @databuf:	buffer for data - dynamically sized   *   * Do not change the order of buffers. databuf and oobrbuf must be in @@ -418,7 +423,7 @@ struct nand_buffers {   *			mtd->oobsize, mtd->writesize and so on.   *			@id_data contains the 8 bytes values of NAND_CMD_READID.   *			Return with the bus width. - * @dev_ready:		[BOARDSPECIFIC] hardwarespecific function for accesing + * @dev_ready:		[BOARDSPECIFIC] hardwarespecific function for accessing   *			device ready/busy line. If set to NULL no access to   *			ready/busy is available and the ready/busy information   *			is read from the chip status register. @@ -426,17 +431,17 @@ struct nand_buffers {   *			commands to the chip.   * @waitfunc:		[REPLACEABLE] hardwarespecific function for wait on   *			ready. - * @ecc:		[BOARDSPECIFIC] ecc control ctructure + * @ecc:		[BOARDSPECIFIC] ECC control structure   * @buffers:		buffer structure for read/write   * @hwcontrol:		platform-specific hardware control structure - * @ops:		oob operation operands   * @erase_cmd:		[INTERN] erase command write function, selectable due   *			to AND support.   * @scan_bbt:		[REPLACEABLE] function to scan bad block table   * @chip_delay:		[BOARDSPECIFIC] chip dependent delay for transferring   *			data from array to read regs (tR).   * @state:		[INTERN] the current state of the NAND device - * @oob_poi:		poison value buffer + * @oob_poi:		"poison value buffer," used for laying out OOB data + *			before writing   * @page_shift:		[INTERN] number of address bits in a page (column   *			address bits).   * @phys_erase_shift:	[INTERN] number of address bits in a physical eraseblock @@ -445,10 +450,14 @@ struct nand_buffers {   * @options:		[BOARDSPECIFIC] various chip options. They can partly   *			be set to inform nand_scan about special functionality.   *			See the defines for further explanation. + * @bbt_options:	[INTERN] bad block specific options. All options used + *			here must come from bbm.h. By default, these options + *			will be copied to the appropriate nand_bbt_descr's.   * @badblockpos:	[INTERN] position of the bad block marker in the oob   *			area. - * @badblockbits:	[INTERN] number of bits to left-shift the bad block - *			number + * @badblockbits:	[INTERN] minimum number of set bits in a good block's + *			bad block marker position; i.e., BBM == 11110111b is + *			not bad when badblockbits == 7   * @cellinfo:		[INTERN] MLC/multichip data from chip ident   * @numchips:		[INTERN] number of physical chips   * @chipsize:		[INTERN] the size of one chip for multichip arrays @@ -460,7 +469,9 @@ struct nand_buffers {   *			non 0 if ONFI supported.   * @onfi_params:	[INTERN] holds the ONFI page parameter when ONFI is   *			supported, 0 otherwise. - * @ecclayout:		[REPLACEABLE] the default ecc placement scheme + * @onfi_set_features	[REPLACEABLE] set the features for ONFI nand + * @onfi_get_features	[REPLACEABLE] get the features for ONFI nand + * @ecclayout:		[REPLACEABLE] the default ECC placement scheme   * @bbt:		[INTERN] bad block table pointer   * @bbt_td:		[REPLACEABLE] bad block table descriptor for flash   *			lookup. @@ -468,9 +479,9 @@ struct nand_buffers {   * @badblock_pattern:	[REPLACEABLE] bad block scan pattern used for initial   *			bad block scan.   * @controller:		[REPLACEABLE] a pointer to a hardware controller - *			structure which is shared among multiple independend + *			structure which is shared among multiple independent   *			devices. - * @priv:		[OPTIONAL] pointer to private chip date + * @priv:		[OPTIONAL] pointer to private chip data   * @errstat:		[OPTIONAL] hardware specific function to perform   *			additional error status checks (determine if errors are   *			correctable). @@ -501,10 +512,16 @@ struct nand_chip {  	int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state,  			int status, int page);  	int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip, -			const uint8_t *buf, int page, int cached, int raw); +			const uint8_t *buf, int oob_required, int page, +			int cached, int raw); +	int (*onfi_set_features)(struct mtd_info *mtd, struct nand_chip *chip, +			int feature_addr, uint8_t *subfeature_para); +	int (*onfi_get_features)(struct mtd_info *mtd, struct nand_chip *chip, +			int feature_addr, uint8_t *subfeature_para);  	int chip_delay;  	unsigned int options; +	unsigned int bbt_options;  	int page_shift;  	int phys_erase_shift; @@ -534,8 +551,6 @@ struct nand_chip {  	struct nand_buffers *buffers;  	struct nand_hw_control hwcontrol; -	struct mtd_oob_ops ops; -  	uint8_t *bbt;  	struct nand_bbt_descr *bbt_td;  	struct nand_bbt_descr *bbt_md; @@ -557,6 +572,8 @@ struct nand_chip {  #define NAND_MFR_HYNIX		0xad  #define NAND_MFR_MICRON		0x2c  #define NAND_MFR_AMD		0x01 +#define NAND_MFR_MACRONIX	0xc2 +#define NAND_MFR_EON		0x92  /**   * struct nand_flash_dev - NAND Flash Device ID Structure @@ -615,9 +632,9 @@ extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len,   * @partitions:		mtd partition list   * @chip_delay:		R/B delay value in us   * @options:		Option flags, e.g. 16bit buswidth - * @ecclayout:		ecc layout info structure + * @bbt_options:	BBT option flags, e.g. NAND_BBT_USE_FLASH + * @ecclayout:		ECC layout info structure   * @part_probe_types:	NULL-terminated array of probe types - * @priv:		hardware controller specific settings   */  struct platform_nand_chip {  	int nr_chips; @@ -627,8 +644,8 @@ struct platform_nand_chip {  	struct nand_ecclayout *ecclayout;  	int chip_delay;  	unsigned int options; +	unsigned int bbt_options;  	const char **part_probe_types; -	void *priv;  };  /* Keep gcc happy */ @@ -650,6 +667,7 @@ struct platform_nand_ctrl {  	int (*dev_ready)(struct mtd_info *mtd);  	void (*select_chip)(struct mtd_info *mtd, int chip);  	void (*cmd_ctrl)(struct mtd_info *mtd, int dat, unsigned int ctrl); +	unsigned char (*read_byte)(struct mtd_info *mtd);  	void *priv;  }; @@ -679,4 +697,23 @@ void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len);  void nand_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len);  uint8_t nand_read_byte(struct mtd_info *mtd); +/* return the supported asynchronous timing mode. */ + +#ifdef CONFIG_SYS_NAND_ONFI_DETECTION +static inline int onfi_get_async_timing_mode(struct nand_chip *chip) +{ +	if (!chip->onfi_version) +		return ONFI_TIMING_MODE_UNKNOWN; +	return le16_to_cpu(chip->onfi_params.async_timing_mode); +} + +/* return the supported synchronous timing mode. */ +static inline int onfi_get_sync_timing_mode(struct nand_chip *chip) +{ +	if (!chip->onfi_version) +		return ONFI_TIMING_MODE_UNKNOWN; +	return le16_to_cpu(chip->onfi_params.src_sync_timing_mode); +} +#endif +  #endif /* __LINUX_MTD_NAND_H */ diff --git a/include/linux/string.h b/include/linux/string.h index e9b134d14..8e4485571 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -85,6 +85,9 @@ extern int memcmp(const void *,const void *,__kernel_size_t);  #ifndef __HAVE_ARCH_MEMCHR  extern void * memchr(const void *,int,__kernel_size_t);  #endif +#ifndef __HAVE_ARCH_MEMCHR_INV +void *memchr_inv(const void *, int, size_t); +#endif  #ifdef __cplusplus  } diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index d1d732c28..bd48704c8 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h @@ -35,6 +35,7 @@  #include <linux/types.h>	/* __u8 etc */  #include <asm/byteorder.h>	/* le16_to_cpu */ +#include <asm/unaligned.h>	/* get_unaligned() */  /*-------------------------------------------------------------------------*/ @@ -596,7 +597,7 @@ static inline int usb_endpoint_is_isoc_out(   */  static inline int usb_endpoint_maxp(const struct usb_endpoint_descriptor *epd)  { -	return __le16_to_cpu(epd->wMaxPacketSize); +	return __le16_to_cpu(get_unaligned(&epd->wMaxPacketSize));  }  static inline int usb_endpoint_interrupt_type( diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index 53cb09550..4f76f88d6 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h @@ -331,7 +331,7 @@ struct usb_composite_dev {  	/* private: */  	/* internals */  	unsigned int			suspended:1; -	struct usb_device_descriptor	desc; +	struct usb_device_descriptor __aligned(CONFIG_SYS_CACHELINE_SIZE) desc;  	struct list_head		configs;  	struct usb_composite_driver	*driver;  	u8				next_string_id; diff --git a/include/micrel.h b/include/micrel.h index 25e8a4624..e1c62d83c 100644 --- a/include/micrel.h +++ b/include/micrel.h @@ -8,9 +8,20 @@  #define MII_KSZ9021_EXT_RGMII_RX_DATA_SKEW	0x105  #define MII_KSZ9021_EXT_RGMII_TX_DATA_SKEW	0x106  #define MII_KSZ9021_EXT_ANALOG_TEST		0x107 +/* Register operations */ +#define MII_KSZ9031_MOD_REG			0x0000 +/* Data operations */ +#define MII_KSZ9031_MOD_DATA_NO_POST_INC	0x4000 +#define MII_KSZ9031_MOD_DATA_POST_INC_RW	0x8000 +#define MII_KSZ9031_MOD_DATA_POST_INC_W		0xC000  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); +int ksz9031_phy_extended_write(struct phy_device *phydev, int devaddr, +			       int regnum, u16 mode, u16 val); +int ksz9031_phy_extended_read(struct phy_device *phydev, int devaddr, +			      int regnum, u16 mode); +  #endif diff --git a/include/mmc.h b/include/mmc.h index f88f672f1..583c30e27 100644 --- a/include/mmc.h +++ b/include/mmc.h @@ -163,7 +163,9 @@  /*   * EXT_CSD fields   */ +#define EXT_CSD_GP_SIZE_MULT		143	/* R/W */  #define EXT_CSD_PARTITIONING_SUPPORT	160	/* RO */ +#define EXT_CSD_RPMB_MULT		168	/* RO */  #define EXT_CSD_ERASE_GROUP_DEF		175	/* R/W */  #define EXT_CSD_BOOT_BUS_WIDTH		177  #define EXT_CSD_PART_CONF		179	/* R/W */ @@ -172,6 +174,7 @@  #define EXT_CSD_REV			192	/* RO */  #define EXT_CSD_CARD_TYPE		196	/* RO */  #define EXT_CSD_SEC_CNT			212	/* RO, 4 bytes */ +#define EXT_CSD_HC_WP_GRP_SIZE		221	/* RO */  #define EXT_CSD_HC_ERASE_GRP_SIZE	224	/* RO */  #define EXT_CSD_BOOT_MULT		226	/* RO */ @@ -284,6 +287,10 @@ struct mmc {  	uint write_bl_len;  	uint erase_grp_size;  	u64 capacity; +	u64 capacity_user; +	u64 capacity_boot; +	u64 capacity_rpmb; +	u64 capacity_gp[4];  	block_dev_desc_t block_dev;  	int (*send_cmd)(struct mmc *mmc,  			struct mmc_cmd *cmd, struct mmc_data *data); diff --git a/include/linux/mtd/mtd-abi.h b/include/mtd/mtd-abi.h index 8bdd23112..d51c1abd1 100644 --- a/include/linux/mtd/mtd-abi.h +++ b/include/mtd/mtd-abi.h @@ -24,6 +24,25 @@ struct mtd_oob_buf {  	unsigned char __user *ptr;  }; +/* + * MTD operation modes + * + * @MTD_OPS_PLACE_OOB:	OOB data are placed at the given offset (default) + * @MTD_OPS_AUTO_OOB:	OOB data are automatically placed at the free areas + *			which are defined by the internal ecclayout + * @MTD_OPS_RAW:	data are transferred as-is, with no error correction; + *			this mode implies %MTD_OPS_PLACE_OOB + * + * These modes can be passed to ioctl(MEMWRITE) and are also used internally. + * See notes on "MTD file modes" for discussion on %MTD_OPS_RAW vs. + * %MTD_FILE_MODE_RAW. + */ +enum { +	MTD_OPS_PLACE_OOB = 0, +	MTD_OPS_AUTO_OOB = 1, +	MTD_OPS_RAW = 2, +}; +  #define MTD_ABSENT		0  #define MTD_RAM			1  #define MTD_ROM			2 @@ -82,24 +101,42 @@ struct otp_info {  	uint32_t locked;  }; +/* Get basic MTD characteristics info (better to use sysfs) */  #define MEMGETINFO		_IOR('M', 1, struct mtd_info_user) +/* Erase segment of MTD */  #define MEMERASE		_IOW('M', 2, struct erase_info_user) +/* Write out-of-band data from MTD */  #define MEMWRITEOOB		_IOWR('M', 3, struct mtd_oob_buf) +/* Read out-of-band data from MTD */  #define MEMREADOOB		_IOWR('M', 4, struct mtd_oob_buf) +/* Lock a chip (for MTD that supports it) */  #define MEMLOCK			_IOW('M', 5, struct erase_info_user) +/* Unlock a chip (for MTD that supports it) */  #define MEMUNLOCK		_IOW('M', 6, struct erase_info_user) +/* Get the number of different erase regions */  #define MEMGETREGIONCOUNT	_IOR('M', 7, int) +/* Get information about the erase region for a specific index */  #define MEMGETREGIONINFO	_IOWR('M', 8, struct region_info_user) +/* Get info about OOB modes (e.g., RAW, PLACE, AUTO) - legacy interface */  #define MEMSETOOBSEL		_IOW('M', 9, struct nand_oobinfo)  #define MEMGETOOBSEL		_IOR('M', 10, struct nand_oobinfo) +/* Check if an eraseblock is bad */  #define MEMGETBADBLOCK		_IOW('M', 11, loff_t) +/* Mark an eraseblock as bad */  #define MEMSETBADBLOCK		_IOW('M', 12, loff_t) +/* Set OTP (One-Time Programmable) mode (factory vs. user) */  #define OTPSELECT		_IOR('M', 13, int) +/* Get number of OTP (One-Time Programmable) regions */  #define OTPGETREGIONCOUNT	_IOW('M', 14, int) +/* Get all OTP (One-Time Programmable) info about MTD */  #define OTPGETREGIONINFO	_IOW('M', 15, struct otp_info) +/* Lock a given range of user data (must be in mode %MTD_FILE_MODE_OTP_USER) */  #define OTPLOCK			_IOR('M', 16, struct otp_info) +/* Get ECC layout (deprecated) */  #define ECCGETLAYOUT		_IOR('M', 17, struct nand_ecclayout) +/* Get statistics about corrected/uncorrected errors */  #define ECCGETSTATS		_IOR('M', 18, struct mtd_ecc_stats) +/* Set MTD mode on a per-file-descriptor basis (see "MTD file modes") */  #define MTDFILEMODE		_IO('M', 19)  /* @@ -146,7 +183,21 @@ struct mtd_ecc_stats {  };  /* - * Read/write file modes for access to MTD + * MTD file modes - for read/write access to MTD + * + * @MTD_FILE_MODE_NORMAL:	OTP disabled, ECC enabled + * @MTD_FILE_MODE_OTP_FACTORY:	OTP enabled in factory mode + * @MTD_FILE_MODE_OTP_USER:	OTP enabled in user mode + * @MTD_FILE_MODE_RAW:		OTP disabled, ECC disabled + * + * These modes can be set via ioctl(MTDFILEMODE). The mode mode will be retained + * separately for each open file descriptor. + * + * Note: %MTD_FILE_MODE_RAW provides the same functionality as %MTD_OPS_RAW - + * raw access to the flash, without error correction or autoplacement schemes. + * Wherever possible, the MTD_OPS_* mode will override the MTD_FILE_MODE_* mode + * (e.g., when using ioctl(MEMWRITE)), but in some cases, the MTD_FILE_MODE is + * used out of necessity (e.g., `write()', ioctl(MEMWRITEOOB64)).   */  enum mtd_file_modes {  	MTD_MODE_NORMAL = MTD_OTP_OFF, diff --git a/include/nand.h b/include/nand.h index f0f3bf94b..228d87127 100644 --- a/include/nand.h +++ b/include/nand.h @@ -31,7 +31,8 @@   * at the same time, so do it here.  When all drivers are   * converted, this will go away.   */ -#if defined(CONFIG_NAND_FSL_ELBC) || defined(CONFIG_NAND_ATMEL) +#if defined(CONFIG_NAND_FSL_ELBC) || defined(CONFIG_NAND_ATMEL)\ +	|| defined(CONFIG_NAND_FSL_IFC)  #define CONFIG_SYS_NAND_SELF_INIT  #endif @@ -55,17 +56,17 @@ extern nand_info_t nand_info[];  static inline int nand_read(nand_info_t *info, loff_t ofs, size_t *len, u_char *buf)  { -	return info->read(info, ofs, *len, (size_t *)len, buf); +	return mtd_read(info, ofs, *len, (size_t *)len, buf);  }  static inline int nand_write(nand_info_t *info, loff_t ofs, size_t *len, u_char *buf)  { -	return info->write(info, ofs, *len, (size_t *)len, buf); +	return mtd_write(info, ofs, *len, (size_t *)len, buf);  }  static inline int nand_block_isbad(nand_info_t *info, loff_t ofs)  { -	return info->block_isbad(info, ofs); +	return mtd_block_isbad(info, ofs);  }  static inline int nand_erase(nand_info_t *info, loff_t off, size_t size) @@ -77,7 +78,7 @@ static inline int nand_erase(nand_info_t *info, loff_t off, size_t size)  	instr.len = size;  	instr.callback = 0; -	return info->erase(info, &instr); +	return mtd_erase(info, &instr);  } @@ -124,6 +125,8 @@ struct nand_erase_options {  	/* Don't include skipped bad blocks in size to be erased */  	int spread; +	/* maximum size that actual may be in order to not exceed the buf */ +	loff_t lim;  };  typedef struct nand_erase_options nand_erase_options_t; diff --git a/include/net.h b/include/net.h index 970d4d1fa..767347004 100644 --- a/include/net.h +++ b/include/net.h @@ -39,7 +39,7 @@  #define PKTALIGN	ARCH_DMA_MINALIGN  /* IPv4 addresses are always 32 bits in size */ -typedef u32		IPaddr_t; +typedef __be32		IPaddr_t;  /** @@ -695,6 +695,9 @@ extern void copy_filename(char *dst, const char *src, int size);  /* get a random source port */  extern unsigned int random_port(void); +/* Update U-Boot over TFTP */ +extern int update_tftp(ulong addr); +  /**********************************************************************/  #endif /* __NET_H__ */ diff --git a/include/netdev.h b/include/netdev.h index df454b50c..917d8746f 100644 --- a/include/netdev.h +++ b/include/netdev.h @@ -67,10 +67,12 @@ int fecmxc_initialize(bd_t *bis);  int fecmxc_initialize_multi(bd_t *bis, int dev_id, int phy_id, uint32_t addr);  int ftgmac100_initialize(bd_t *bits);  int ftmac100_initialize(bd_t *bits); +int ftmac110_initialize(bd_t *bits);  int greth_initialize(bd_t *bis);  void gt6426x_eth_initialize(bd_t *bis);  int inca_switch_initialize(bd_t *bis);  int ks8695_eth_initialize(void); +int ks8851_mll_initialize(u8 dev_num, int base_addr);  int lan91c96_initialize(u8 dev_num, int base_addr);  int macb_eth_initialize(int id, void *regs, unsigned int phy_addr);  int mcdmafec_initialize(bd_t *bis); @@ -93,6 +95,7 @@ int sh_eth_initialize(bd_t *bis);  int skge_initialize(bd_t *bis);  int smc91111_initialize(u8 dev_num, int base_addr);  int smc911x_initialize(u8 dev_num, int base_addr); +int sunxi_wemac_initialize(bd_t *bis);  int tsi108_eth_initialize(bd_t *bis);  int uec_standard_init(bd_t *bis);  int uli526x_initialize(bd_t *bis); diff --git a/include/part.h b/include/part.h index f7c7cc59f..35c1c5b5f 100644 --- a/include/part.h +++ b/include/part.h @@ -43,15 +43,15 @@ typedef struct block_dev_desc {  	char		product[20+1];	/* IDE Serial no, SCSI product */  	char		revision[8+1];	/* firmware revision */  	unsigned long	(*block_read)(int dev, -				      unsigned long start, +				      lbaint_t start,  				      lbaint_t blkcnt,  				      void *buffer);  	unsigned long	(*block_write)(int dev, -				       unsigned long start, +				       lbaint_t start,  				       lbaint_t blkcnt,  				       const void *buffer);  	unsigned long   (*block_erase)(int dev, -				       unsigned long start, +				       lbaint_t start,  				       lbaint_t blkcnt);  	void		*priv;		/* driver private struct pointer */  }block_dev_desc_t; diff --git a/include/pci.h b/include/pci.h index 15f583f06..98ba151f9 100644 --- a/include/pci.h +++ b/include/pci.h @@ -462,7 +462,7 @@ struct pci_region {  #define PCI_REGION_SYS_MEMORY	0x00000100	/* System memory */  #define PCI_REGION_RO		0x00000200	/* Read-only memory */ -extern __inline__ void pci_set_region(struct pci_region *reg, +static inline void pci_set_region(struct pci_region *reg,  				      pci_addr_t bus_start,  				      phys_addr_t phys_start,  				      pci_size_t size, @@ -548,7 +548,7 @@ struct pci_controller {  	void *priv_data;  }; -extern __inline__ void pci_set_ops(struct pci_controller *hose, +static inline void pci_set_ops(struct pci_controller *hose,  				   int (*read_byte)(struct pci_controller*,  						    pci_dev_t, int where, u8 *),  				   int (*read_word)(struct pci_controller*, @@ -569,7 +569,9 @@ extern __inline__ void pci_set_ops(struct pci_controller *hose,  	hose->write_dword = write_dword;  } +#ifdef CONFIG_PCI_INDIRECT_BRIDGE  extern void pci_setup_indirect(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data); +#endif  extern phys_addr_t pci_hose_bus_to_phys(struct pci_controller* hose,  					pci_addr_t addr, unsigned long flags); diff --git a/include/phy.h b/include/phy.h index 75bf3b472..dbf32740b 100644 --- a/include/phy.h +++ b/include/phy.h @@ -214,6 +214,7 @@ int phy_register(struct phy_driver *drv);  int genphy_config_aneg(struct phy_device *phydev);  int genphy_restart_aneg(struct phy_device *phydev);  int genphy_update_link(struct phy_device *phydev); +int genphy_parse_link(struct phy_device *phydev);  int genphy_config(struct phy_device *phydev);  int genphy_startup(struct phy_device *phydev);  int genphy_shutdown(struct phy_device *phydev); diff --git a/include/rsa.h b/include/rsa.h new file mode 100644 index 000000000..a5dd676b6 --- /dev/null +++ b/include/rsa.h @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2013, Google Inc. + * + * (C) Copyright 2008 Semihalf + * + * (C) Copyright 2000-2006 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef _RSA_H +#define _RSA_H + +#include <errno.h> +#include <image.h> + +#if IMAGE_ENABLE_SIGN +/** + * sign() - calculate and return signature for given input data + * + * @info:	Specifies key and FIT information + * @data:	Pointer to the input data + * @data_len:	Data length + * @sigp:	Set to an allocated buffer holding the signature + * @sig_len:	Set to length of the calculated hash + * + * This computes input data signature according to selected algorithm. + * Resulting signature value is placed in an allocated buffer, the + * pointer is returned as *sigp. The length of the calculated + * signature is returned via the sig_len pointer argument. The caller + * should free *sigp. + * + * @return: 0, on success, -ve on error + */ +int rsa_sign(struct image_sign_info *info, +	     const struct image_region region[], +	     int region_count, uint8_t **sigp, uint *sig_len); + +/** + * add_verify_data() - Add verification information to FDT + * + * Add public key information to the FDT node, suitable for + * verification at run-time. The information added depends on the + * algorithm being used. + * + * @info:	Specifies key and FIT information + * @keydest:	Destination FDT blob for public key data + * @return: 0, on success, -ve on error +*/ +int rsa_add_verify_data(struct image_sign_info *info, void *keydest); +#else +static inline int rsa_sign(struct image_sign_info *info, +		const struct image_region region[], int region_count, +		uint8_t **sigp, uint *sig_len) +{ +	return -ENXIO; +} + +static inline int rsa_add_verify_data(struct image_sign_info *info, +				      void *keydest) +{ +	return -ENXIO; +} +#endif + +#if IMAGE_ENABLE_VERIFY +/** + * rsa_verify() - Verify a signature against some data + * + * Verify a RSA PKCS1.5 signature against an expected hash. + * + * @info:	Specifies key and FIT information + * @data:	Pointer to the input data + * @data_len:	Data length + * @sig:	Signature + * @sig_len:	Number of bytes in signature + * @return 0 if verified, -ve on error + */ +int rsa_verify(struct image_sign_info *info, +	       const struct image_region region[], int region_count, +	       uint8_t *sig, uint sig_len); +#else +static inline int rsa_verify(struct image_sign_info *info, +		const struct image_region region[], int region_count, +		uint8_t *sig, uint sig_len) +{ +	return -ENXIO; +} +#endif + +#endif diff --git a/include/spi.h b/include/spi.h index 3fe2e1eab..e8e654467 100644 --- a/include/spi.h +++ b/include/spi.h @@ -37,11 +37,16 @@  #define	SPI_LSB_FIRST	0x08			/* per-word bits-on-wire */  #define	SPI_3WIRE	0x10			/* SI/SO signals shared */  #define	SPI_LOOP	0x20			/* loopback mode */ +#define	SPI_SLAVE	0x40			/* slave mode */ +#define	SPI_PREAMBLE	0x80			/* Skip preamble bytes */  /* SPI transfer flags */  #define SPI_XFER_BEGIN	0x01			/* Assert CS before transfer */  #define SPI_XFER_END	0x02			/* Deassert CS after transfer */ +/* Header byte that marks the start of the message */ +#define SPI_PREAMBLE_END_BYTE	0xec +  /*-----------------------------------------------------------------------   * Representation of a SPI slave, i.e. what we're communicating with.   * @@ -242,4 +247,20 @@ static inline int spi_w8r8(struct spi_slave *slave, unsigned char byte)  	return ret < 0 ? ret : din[1];  } +/** + * Set up a SPI slave for a particular device tree node + * + * This calls spi_setup_slave() with the correct bus number. Call + * spi_free_slave() to free it later. + * + * @param blob		Device tree blob + * @param node		SPI peripheral node to use + * @param cs		Chip select to use + * @param max_hz	Maximum SCK rate in Hz (0 for default) + * @param mode		Clock polarity, clock phase and other parameters + * @return pointer to new spi_slave structure + */ +struct spi_slave *spi_setup_slave_fdt(const void *blob, int node, +		unsigned int cs, unsigned int max_hz, unsigned int mode); +  #endif	/* _SPI_H_ */ diff --git a/include/spi_flash.h b/include/spi_flash.h index 3b6a44edc..e80785f55 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -38,6 +38,16 @@ struct spi_flash {  	u32		page_size;  	/* Erase (sector) size */  	u32		sector_size; +#ifdef CONFIG_SPI_FLASH_BAR +	/* Bank read cmd */ +	u8		bank_read_cmd; +	/* Bank write cmd */ +	u8		bank_write_cmd; +	/* Current flash bank */ +	u8		bank_curr; +#endif +	/* Poll cmd - for flash erase/program */ +	u8		poll_cmd;  	void *memory_map;	/* Address of read-only SPI flash access */  	int		(*read)(struct spi_flash *flash, u32 offset, diff --git a/include/splash.h b/include/splash.h new file mode 100644 index 000000000..89ee7b22e --- /dev/null +++ b/include/splash.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2013, Boundary Devices <info@boundarydevices.com> + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., http://www.fsf.org/about/contact/ + */ + +#ifndef _SPLASH_H_ +#define _SPLASH_H_ + + +int splash_screen_prepare(void); + +#ifdef CONFIG_SPLASH_SCREEN_ALIGN +void splash_get_pos(int *x, int *y); +#else +static inline void splash_get_pos(int *x, int *y) { } +#endif + +#define BMP_ALIGN_CENTER	0x7FFF + +#endif diff --git a/include/trace.h b/include/trace.h new file mode 100644 index 000000000..8082466f5 --- /dev/null +++ b/include/trace.h @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2012 The Chromium OS Authors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef __TRACE_H +#define __TRACE_H + +enum { +	/* +	 * This affects the granularity of our trace. We can bin function +	 * entry points into groups on the basis that functions typically +	 * have a minimum size, so entry points can't appear any closer +	 * than this to each other. +	 * +	 * The value here assumes a minimum instruction size of 4 bytes, +	 * or that instructions are 2 bytes but there are at least 2 of +	 * them in every function. +	 * +	 * Increasing this value reduces the number of functions we can +	 * resolve, but reduces the size of the uintptr_t array used for +	 * our function list, which is the length of the code divided by +	 * this value. +	 */ +	FUNC_SITE_SIZE	= 4,	/* distance between function sites */ +}; + +enum trace_chunk_type { +	TRACE_CHUNK_FUNCS, +	TRACE_CHUNK_CALLS, +}; + +/* A trace record for a function, as written to the profile output file */ +struct trace_output_func { +	uint32_t offset;		/* Function offset into code */ +	uint32_t call_count;		/* Number of times called */ +}; + +/* A header at the start of the trace output buffer */ +struct trace_output_hdr { +	enum trace_chunk_type type;	/* Record type */ +	uint32_t rec_count;		/* Number of records */ +}; + +/* Print statistics about traced function calls */ +void trace_print_stats(void); + +/** + * Dump a list of functions and call counts into a buffer + * + * Each record in the buffer is a struct trace_func_stats. The 'needed' + * parameter returns the number of bytes needed to complete the operation, + * which may be more than buff_size if your buffer is too small. + * + * @param buff		Buffer in which to place data, or NULL to count size + * @param buff_size	Size of buffer + * @param needed	Returns number of bytes used / needed + * @return 0 if ok, -1 on error (buffer exhausted) + */ +int trace_list_functions(void *buff, int buff_size, unsigned *needed); + +/* Flags for ftrace_record */ +enum ftrace_flags { +	FUNCF_EXIT		= 0UL << 30, +	FUNCF_ENTRY		= 1UL << 30, +	FUNCF_TEXTBASE		= 2UL << 30, + +	FUNCF_TIMESTAMP_MASK	= 0x3fffffff, +}; + +#define TRACE_CALL_TYPE(call)	((call)->flags & 0xc0000000UL) + +/* Information about a single function entry/exit */ +struct trace_call { +	uint32_t func;		/* Function offset */ +	uint32_t caller;	/* Caller function offset */ +	uint32_t flags;		/* Flags and timestamp */ +}; + +int trace_list_calls(void *buff, int buff_size, unsigned int *needed); + +/** + * Turn function tracing on and off + * + * Don't enable trace if it has not been initialised. + * + * @param enabled	1 to enable trace, 0 to disable + */ +void trace_set_enabled(int enabled); + +#ifdef CONFIG_TRACE_EARLY +int trace_early_init(void); +#else +static inline int trace_early_init(void) +{ +	return 0; +} +#endif + +/** + * Init the trace system + * + * This should be called after relocation with a suitably large buffer + * (typically as large as the U-Boot text area) + * + * @param buff		Pointer to trace buffer + * @param buff_size	Size of trace buffer + */ +int trace_init(void *buff, size_t buff_size); + +#endif diff --git a/include/usb/fotg210.h b/include/usb/fotg210.h new file mode 100644 index 000000000..2d2d2431b --- /dev/null +++ b/include/usb/fotg210.h @@ -0,0 +1,364 @@ +/* + * Faraday USB 2.0 OTG Controller + * + * (C) Copyright 2010 Faraday Technology + * Dante Su <dantesu@faraday-tech.com> + * + * This file is released under the terms of GPL v2 and any later version. + * See the file COPYING in the root directory of the source tree for details. + */ + +#ifndef _FOTG210_H +#define _FOTG210_H + +struct fotg210_regs { +	/* USB Host Controller */ +	struct { +		uint32_t data[4]; +	} hccr;			/* 0x00 - 0x0f: hccr */ +	struct { +		uint32_t data[9]; +	} hcor;			/* 0x10 - 0x33: hcor */ +	uint32_t rsvd1[3]; +	uint32_t miscr;	/* 0x40: Miscellaneous Register */ +	uint32_t rsvd2[15]; +	/* USB OTG Controller */ +	uint32_t otgcsr;/* 0x80: OTG Control Status Register */ +	uint32_t otgisr;/* 0x84: OTG Interrupt Status Register */ +	uint32_t otgier;/* 0x88: OTG Interrupt Enable Register */ +	uint32_t rsvd3[13]; +	uint32_t isr;	/* 0xC0: Global Interrupt Status Register */ +	uint32_t imr;	/* 0xC4: Global Interrupt Mask Register */ +	uint32_t rsvd4[14]; +	/* USB Device Controller */ +	uint32_t dev_ctrl;/* 0x100: Device Control Register */ +	uint32_t dev_addr;/* 0x104: Device Address Register */ +	uint32_t dev_test;/* 0x108: Device Test Register */ +	uint32_t sof_fnr; /* 0x10c: SOF Frame Number Register */ +	uint32_t sof_mtr; /* 0x110: SOF Mask Timer Register */ +	uint32_t phy_tmsr;/* 0x114: PHY Test Mode Selector Register */ +	uint32_t rsvd5[2]; +	uint32_t cxfifo;/* 0x120: CX FIFO Register */ +	uint32_t idle;	/* 0x124: IDLE Counter Register */ +	uint32_t rsvd6[2]; +	uint32_t gimr;	/* 0x130: Group Interrupt Mask Register */ +	uint32_t gimr0; /* 0x134: Group Interrupt Mask Register 0 */ +	uint32_t gimr1; /* 0x138: Group Interrupt Mask Register 1 */ +	uint32_t gimr2; /* 0x13c: Group Interrupt Mask Register 2 */ +	uint32_t gisr;	/* 0x140: Group Interrupt Status Register */ +	uint32_t gisr0; /* 0x144: Group Interrupt Status Register 0 */ +	uint32_t gisr1; /* 0x148: Group Interrupt Status Register 1 */ +	uint32_t gisr2; /* 0x14c: Group Interrupt Status Register 2 */ +	uint32_t rxzlp; /* 0x150: Receive Zero-Length-Packet Register */ +	uint32_t txzlp; /* 0x154: Transfer Zero-Length-Packet Register */ +	uint32_t isoeasr;/* 0x158: ISOC Error/Abort Status Register */ +	uint32_t rsvd7[1]; +	uint32_t iep[8]; /* 0x160 - 0x17f: IN Endpoint Register */ +	uint32_t oep[8]; /* 0x180 - 0x19f: OUT Endpoint Register */ +	uint32_t epmap14;/* 0x1a0: Endpoint Map Register (EP1 ~ 4) */ +	uint32_t epmap58;/* 0x1a4: Endpoint Map Register (EP5 ~ 8) */ +	uint32_t fifomap;/* 0x1a8: FIFO Map Register */ +	uint32_t fifocfg; /* 0x1ac: FIFO Configuration Register */ +	uint32_t fifocsr[4];/* 0x1b0 - 0x1bf: FIFO Control Status Register */ +	uint32_t dma_fifo; /* 0x1c0: DMA Target FIFO Register */ +	uint32_t rsvd8[1]; +	uint32_t dma_ctrl; /* 0x1c8: DMA Control Register */ +	uint32_t dma_addr; /* 0x1cc: DMA Address Register */ +	uint32_t ep0_data; /* 0x1d0: EP0 Setup Packet PIO Register */ +}; + +/* Miscellaneous Register */ +#define MISCR_SUSPEND  (1 << 6) /* Put transceiver in suspend mode */ +#define MISCR_EOF2(x)  (((x) & 0x3) << 4) /* EOF 2 Timing */ +#define MISCR_EOF1(x)  (((x) & 0x3) << 2) /* EOF 1 Timing */ +#define MISCR_ASST(x)  (((x) & 0x3) << 0) /* Async. Sched. Sleep Timer */ + +/* OTG Control Status Register */ +#define OTGCSR_SPD_HIGH     (2 << 22) /* Speed of the attached device (host) */ +#define OTGCSR_SPD_LOW      (1 << 22) +#define OTGCSR_SPD_FULL     (0 << 22) +#define OTGCSR_SPD_MASK     (3 << 22) +#define OTGCSR_SPD_SHIFT    22 +#define OTGCSR_SPD(x)       (((x) >> 22) & 0x03) +#define OTGCSR_DEV_A        (0 << 21) /* Acts as A-device */ +#define OTGCSR_DEV_B        (1 << 21) /* Acts as B-device */ +#define OTGCSR_ROLE_H       (0 << 20) /* Acts as Host */ +#define OTGCSR_ROLE_D       (1 << 20) /* Acts as Device */ +#define OTGCSR_A_VBUS_VLD   (1 << 19) /* A-device VBUS Valid */ +#define OTGCSR_A_SESS_VLD   (1 << 18) /* A-device Session Valid */ +#define OTGCSR_B_SESS_VLD   (1 << 17) /* B-device Session Valid */ +#define OTGCSR_B_SESS_END   (1 << 16) /* B-device Session End */ +#define OTGCSR_HFT_LONG     (1 << 11) /* HDISCON noise filter = 270 us*/ +#define OTGCSR_HFT          (0 << 11) /* HDISCON noise filter = 135 us*/ +#define OTGCSR_VFT_LONG     (1 << 10) /* VBUS noise filter = 472 us*/ +#define OTGCSR_VFT          (0 << 10) /* VBUS noise filter = 135 us*/ +#define OTGCSR_IDFT_LONG    (1 << 9)  /* ID noise filter = 4 ms*/ +#define OTGCSR_IDFT         (0 << 9)  /* ID noise filter = 3 ms*/ +#define OTGCSR_A_SRPR_VBUS  (0 << 8)  /* A-device: SRP responds to VBUS */ +#define OTGCSR_A_SRPR_DATA  (1 << 8)  /* A-device: SRP responds to DATA-LINE */ +#define OTGCSR_A_SRP_EN     (1 << 7)  /* A-device SRP detection enabled */ +#define OTGCSR_A_HNP        (1 << 6)  /* Set role=A-device with HNP enabled */ +#define OTGCSR_A_BUSDROP    (1 << 5)  /* A-device drop bus (power-down) */ +#define OTGCSR_A_BUSREQ     (1 << 4)  /* A-device request bus */ +#define OTGCSR_B_VBUS_DISC  (1 << 2)  /* B-device discharges VBUS */ +#define OTGCSR_B_HNP        (1 << 1)  /* B-device enable HNP */ +#define OTGCSR_B_BUSREQ     (1 << 0)  /* B-device request bus */ + +/* OTG Interrupt Status Register */ +#define OTGISR_APRM         (1 << 12) /* Mini-A plug removed */ +#define OTGISR_BPRM         (1 << 11) /* Mini-B plug removed */ +#define OTGISR_OVD          (1 << 10) /* over-current detected */ +#define OTGISR_IDCHG        (1 << 9)  /* ID(A/B) changed */ +#define OTGISR_RLCHG        (1 << 8)  /* Role(Host/Device) changed */ +#define OTGISR_BSESSEND     (1 << 6)  /* B-device Session End */ +#define OTGISR_AVBUSERR     (1 << 5)  /* A-device VBUS Error */ +#define OTGISR_ASRP         (1 << 4)  /* A-device SRP detected */ +#define OTGISR_BSRP         (1 << 0)  /* B-device SRP complete */ + +/* OTG Interrupt Enable Register */ +#define OTGIER_APRM         (1 << 12) /* Mini-A plug removed */ +#define OTGIER_BPRM         (1 << 11) /* Mini-B plug removed */ +#define OTGIER_OVD          (1 << 10) /* over-current detected */ +#define OTGIER_IDCHG        (1 << 9)  /* ID(A/B) changed */ +#define OTGIER_RLCHG        (1 << 8)  /* Role(Host/Device) changed */ +#define OTGIER_BSESSEND     (1 << 6)  /* B-device Session End */ +#define OTGIER_AVBUSERR     (1 << 5)  /* A-device VBUS Error */ +#define OTGIER_ASRP         (1 << 4)  /* A-device SRP detected */ +#define OTGIER_BSRP         (1 << 0)  /* B-device SRP complete */ + +/* Global Interrupt Status Register (W1C) */ +#define ISR_HOST            (1 << 2)  /* USB Host interrupt */ +#define ISR_OTG             (1 << 1)  /* USB OTG interrupt */ +#define ISR_DEV             (1 << 0)  /* USB Device interrupt */ +#define ISR_MASK            0x07 + +/* Global Interrupt Mask Register */ +#define IMR_IRQLH           (1 << 3)  /* Interrupt triggered at level-high */ +#define IMR_IRQLL           (0 << 3)  /* Interrupt triggered at level-low */ +#define IMR_HOST            (1 << 2)  /* USB Host interrupt */ +#define IMR_OTG             (1 << 1)  /* USB OTG interrupt */ +#define IMR_DEV             (1 << 0)  /* USB Device interrupt */ +#define IMR_MASK            0x0f + +/* Device Control Register */ +#define DEVCTRL_FS_FORCED   (1 << 9)  /* Forced to be Full-Speed Mode */ +#define DEVCTRL_HS          (1 << 6)  /* High Speed Mode */ +#define DEVCTRL_FS          (0 << 6)  /* Full Speed Mode */ +#define DEVCTRL_EN          (1 << 5)  /* Chip Enable */ +#define DEVCTRL_RESET       (1 << 4)  /* Chip Software Reset */ +#define DEVCTRL_SUSPEND     (1 << 3)  /* Enter Suspend Mode */ +#define DEVCTRL_GIRQ_EN     (1 << 2)  /* Global Interrupt Enabled */ +#define DEVCTRL_HALFSPD     (1 << 1)  /* Half speed mode for FPGA test */ +#define DEVCTRL_RWAKEUP     (1 << 0)  /* Enable remote wake-up */ + +/* Device Address Register */ +#define DEVADDR_CONF        (1 << 7)  /* SET_CONFIGURATION has been executed */ +#define DEVADDR_ADDR(x)     ((x) & 0x7f) +#define DEVADDR_ADDR_MASK   0x7f + +/* Device Test Register */ +#define DEVTEST_NOSOF       (1 << 6)  /* Do not generate SOF */ +#define DEVTEST_TST_MODE    (1 << 5)  /* Enter Test Mode */ +#define DEVTEST_TST_NOTS    (1 << 4)  /* Do not toggle sequence */ +#define DEVTEST_TST_NOCRC   (1 << 3)  /* Do not append CRC */ +#define DEVTEST_TST_CLREA   (1 << 2)  /* Clear External Side Address */ +#define DEVTEST_TST_CXLP    (1 << 1)  /* EP0 loopback test */ +#define DEVTEST_TST_CLRFF   (1 << 0)  /* Clear FIFO */ + +/* SOF Frame Number Register */ +#define SOFFNR_UFN(x)       (((x) >> 11) & 0x7) /* SOF Micro-Frame Number */ +#define SOFFNR_FNR(x)       ((x) & 0x7ff) /* SOF Frame Number */ + +/* SOF Mask Timer Register */ +#define SOFMTR_TMR(x)       ((x) & 0xffff) + +/* PHY Test Mode Selector Register */ +#define PHYTMSR_TST_PKT     (1 << 4) /* Packet send test */ +#define PHYTMSR_TST_SE0NAK  (1 << 3) /* High-Speed quiescent state */ +#define PHYTMSR_TST_KSTA    (1 << 2) /* High-Speed K state */ +#define PHYTMSR_TST_JSTA    (1 << 1) /* High-Speed J state */ +#define PHYTMSR_UNPLUG      (1 << 0) /* Enable soft-detachment */ + +/* CX FIFO Register */ +#define CXFIFO_BYTES(x)     (((x) >> 24) & 0x7f) /* CX/EP0 FIFO byte count */ +#define CXFIFO_FIFOE(x)     (1 << (((x) & 0x03) + 8)) /* EPx FIFO empty */ +#define CXFIFO_FIFOE_FIFO0  (1 << 8) +#define CXFIFO_FIFOE_FIFO1  (1 << 9) +#define CXFIFO_FIFOE_FIFO2  (1 << 10) +#define CXFIFO_FIFOE_FIFO3  (1 << 11) +#define CXFIFO_FIFOE_MASK   (0x0f << 8) +#define CXFIFO_CXFIFOE      (1 << 5) /* CX FIFO empty */ +#define CXFIFO_CXFIFOF      (1 << 4) /* CX FIFO full */ +#define CXFIFO_CXFIFOCLR    (1 << 3) /* CX FIFO clear */ +#define CXFIFO_CXSTALL      (1 << 2) /* CX Stall */ +#define CXFIFO_TSTPKTFIN    (1 << 1) /* Test packet data transfer finished */ +#define CXFIFO_CXFIN        (1 << 0) /* CX data transfer finished */ + +/* IDLE Counter Register */ +#define IDLE_MS(x)          ((x) & 0x07) /* PHY suspend delay = x ms */ + +/* Group Interrupt Mask(Disable) Register */ +#define GIMR_GRP2           (1 << 2) /* Disable interrupt group 2 */ +#define GIMR_GRP1           (1 << 1) /* Disable interrupt group 1 */ +#define GIMR_GRP0           (1 << 0) /* Disable interrupt group 0 */ +#define GIMR_MASK           0x07 + +/* Group Interrupt Mask(Disable) Register 0 (CX) */ +#define GIMR0_CXABORT       (1 << 5) /* CX command abort interrupt */ +#define GIMR0_CXERR         (1 << 4) /* CX command error interrupt */ +#define GIMR0_CXEND         (1 << 3) /* CX command end interrupt */ +#define GIMR0_CXOUT         (1 << 2) /* EP0-OUT packet interrupt */ +#define GIMR0_CXIN          (1 << 1) /* EP0-IN packet interrupt */ +#define GIMR0_CXSETUP       (1 << 0) /* EP0-SETUP packet interrupt */ +#define GIMR0_MASK          0x3f + +/* Group Interrupt Mask(Disable) Register 1 (FIFO) */ +#define GIMR1_FIFO_IN(x)    (1 << (((x) & 3) + 16))    /* FIFOx IN */ +#define GIMR1_FIFO_TX(x)    GIMR1_FIFO_IN(x) +#define GIMR1_FIFO_OUT(x)   (1 << (((x) & 3) * 2))     /* FIFOx OUT */ +#define GIMR1_FIFO_SPK(x)   (1 << (((x) & 3) * 2 + 1)) /* FIFOx SHORT PACKET */ +#define GIMR1_FIFO_RX(x)    (GIMR1_FIFO_OUT(x) | GIMR1_FIFO_SPK(x)) +#define GIMR1_MASK          0xf00ff + +/* Group Interrupt Mask(Disable) Register 2 (Device) */ +#define GIMR2_WAKEUP        (1 << 10) /* Device waked up */ +#define GIMR2_IDLE          (1 << 9)  /* Device idle */ +#define GIMR2_DMAERR        (1 << 8)  /* DMA error */ +#define GIMR2_DMAFIN        (1 << 7)  /* DMA finished */ +#define GIMR2_ZLPRX         (1 << 6)  /* Zero-Length-Packet Rx Interrupt */ +#define GIMR2_ZLPTX         (1 << 5)  /* Zero-Length-Packet Tx Interrupt */ +#define GIMR2_ISOCABT       (1 << 4)  /* ISOC Abort Interrupt */ +#define GIMR2_ISOCERR       (1 << 3)  /* ISOC Error Interrupt */ +#define GIMR2_RESUME        (1 << 2)  /* Resume state change Interrupt */ +#define GIMR2_SUSPEND       (1 << 1)  /* Suspend state change Interrupt */ +#define GIMR2_RESET         (1 << 0)  /* Reset Interrupt */ +#define GIMR2_MASK          0x7ff + +/* Group Interrupt Status Register */ +#define GISR_GRP2           (1 << 2) /* Interrupt group 2 */ +#define GISR_GRP1           (1 << 1) /* Interrupt group 1 */ +#define GISR_GRP0           (1 << 0) /* Interrupt group 0 */ + +/* Group Interrupt Status Register 0 (CX) */ +#define GISR0_CXABORT       (1 << 5) /* CX command abort interrupt */ +#define GISR0_CXERR         (1 << 4) /* CX command error interrupt */ +#define GISR0_CXEND         (1 << 3) /* CX command end interrupt */ +#define GISR0_CXOUT         (1 << 2) /* EP0-OUT packet interrupt */ +#define GISR0_CXIN          (1 << 1) /* EP0-IN packet interrupt */ +#define GISR0_CXSETUP       (1 << 0) /* EP0-SETUP packet interrupt */ + +/* Group Interrupt Status Register 1 (FIFO) */ +#define GISR1_IN_FIFO(x)    (1 << (((x) & 0x03) + 16))    /* FIFOx IN */ +#define GISR1_OUT_FIFO(x)   (1 << (((x) & 0x03) * 2))     /* FIFOx OUT */ +#define GISR1_SPK_FIFO(x)   (1 << (((x) & 0x03) * 2 + 1)) /* FIFOx SPK */ +#define GISR1_RX_FIFO(x)    (3 << (((x) & 0x03) * 2))     /* FIFOx OUT/SPK */ + +/* Group Interrupt Status Register 2 (Device) */ +#define GISR2_WAKEUP        (1 << 10) /* Device waked up */ +#define GISR2_IDLE          (1 << 9)  /* Device idle */ +#define GISR2_DMAERR        (1 << 8)  /* DMA error */ +#define GISR2_DMAFIN        (1 << 7)  /* DMA finished */ +#define GISR2_ZLPRX         (1 << 6)  /* Zero-Length-Packet Rx Interrupt */ +#define GISR2_ZLPTX         (1 << 5)  /* Zero-Length-Packet Tx Interrupt */ +#define GISR2_ISOCABT       (1 << 4)  /* ISOC Abort Interrupt */ +#define GISR2_ISOCERR       (1 << 3)  /* ISOC Error Interrupt */ +#define GISR2_RESUME        (1 << 2)  /* Resume state change Interrupt */ +#define GISR2_SUSPEND       (1 << 1)  /* Suspend state change Interrupt */ +#define GISR2_RESET         (1 << 0)  /* Reset Interrupt */ + +/* Receive Zero-Length-Packet Register */ +#define RXZLP_EP(x)         (1 << ((x) - 1)) /* EPx ZLP rx interrupt */ + +/* Transfer Zero-Length-Packet Register */ +#define TXZLP_EP(x)         (1 << ((x) - 1)) /* EPx ZLP tx interrupt */ + +/* ISOC Error/Abort Status Register */ +#define ISOEASR_EP(x)       (0x10001 << ((x) - 1)) /* EPx ISOC Error/Abort */ + +/* IN Endpoint Register */ +#define IEP_SENDZLP         (1 << 15)     /* Send Zero-Length-Packet */ +#define IEP_TNRHB(x)        (((x) & 0x03) << 13) \ +	/* Transaction Number for High-Bandwidth EP(ISOC) */ +#define IEP_RESET           (1 << 12)     /* Reset Toggle Sequence */ +#define IEP_STALL           (1 << 11)     /* Stall */ +#define IEP_MAXPS(x)        ((x) & 0x7ff) /* Max. packet size */ + +/* OUT Endpoint Register */ +#define OEP_RESET           (1 << 12)     /* Reset Toggle Sequence */ +#define OEP_STALL           (1 << 11)     /* Stall */ +#define OEP_MAXPS(x)        ((x) & 0x7ff) /* Max. packet size */ + +/* Endpoint Map Register (EP1 ~ EP4) */ +#define EPMAP14_SET_IN(ep, fifo) \ +	((fifo) & 3) << (((ep) - 1) << 3 + 0) +#define EPMAP14_SET_OUT(ep, fifo) \ +	((fifo) & 3) << (((ep) - 1) << 3 + 4) +#define EPMAP14_SET(ep, in, out) \ +	do { \ +		EPMAP14_SET_IN(ep, in); \ +		EPMAP14_SET_OUT(ep, out); \ +	} while (0) + +#define EPMAP14_DEFAULT     0x33221100 /* EP1->FIFO0, EP2->FIFO1... */ + +/* Endpoint Map Register (EP5 ~ EP8) */ +#define EPMAP58_SET_IN(ep, fifo) \ +	((fifo) & 3) << (((ep) - 5) << 3 + 0) +#define EPMAP58_SET_OUT(ep, fifo) \ +	((fifo) & 3) << (((ep) - 5) << 3 + 4) +#define EPMAP58_SET(ep, in, out) \ +	do { \ +		EPMAP58_SET_IN(ep, in); \ +		EPMAP58_SET_OUT(ep, out); \ +	} while (0) + +#define EPMAP58_DEFAULT     0x00000000 /* All EPx->FIFO0 */ + +/* FIFO Map Register */ +#define FIFOMAP_BIDIR       (2 << 4) +#define FIFOMAP_IN          (1 << 4) +#define FIFOMAP_OUT         (0 << 4) +#define FIFOMAP_DIR_MASK    0x30 +#define FIFOMAP_EP(x)       ((x) & 0x0f) +#define FIFOMAP_EP_MASK     0x0f +#define FIFOMAP_CFG_MASK    0x3f +#define FIFOMAP_DEFAULT     0x04030201 /* FIFO0->EP1, FIFO1->EP2... */ +#define FIFOMAP(fifo, cfg)  (((cfg) & 0x3f) << (((fifo) & 3) << 3)) + +/* FIFO Configuration Register */ +#define FIFOCFG_EN          (1 << 5) +#define FIFOCFG_BLKSZ_1024  (1 << 4) +#define FIFOCFG_BLKSZ_512   (0 << 4) +#define FIFOCFG_3BLK        (2 << 2) +#define FIFOCFG_2BLK        (1 << 2) +#define FIFOCFG_1BLK        (0 << 2) +#define FIFOCFG_NBLK_MASK   3 +#define FIFOCFG_NBLK_SHIFT  2 +#define FIFOCFG_INTR        (3 << 0) +#define FIFOCFG_BULK        (2 << 0) +#define FIFOCFG_ISOC        (1 << 0) +#define FIFOCFG_RSVD        (0 << 0)  /* Reserved */ +#define FIFOCFG_TYPE_MASK   3 +#define FIFOCFG_TYPE_SHIFT  0 +#define FIFOCFG_CFG_MASK    0x3f +#define FIFOCFG(fifo, cfg)  (((cfg) & 0x3f) << (((fifo) & 3) << 3)) + +/* FIFO Control Status Register */ +#define FIFOCSR_RESET       (1 << 12) /* FIFO Reset */ +#define FIFOCSR_BYTES(x)    ((x) & 0x7ff) /* Length(bytes) for OUT-EP/FIFO */ + +/* DMA Target FIFO Register */ +#define DMAFIFO_CX          (1 << 4) /* DMA FIFO = CX FIFO */ +#define DMAFIFO_FIFO(x)     (1 << ((x) & 0x3)) /* DMA FIFO = FIFOx */ + +/* DMA Control Register */ +#define DMACTRL_LEN(x)      (((x) & 0x1ffff) << 8) /* DMA length (Bytes) */ +#define DMACTRL_LEN_SHIFT   8 +#define DMACTRL_CLRFF       (1 << 4) /* Clear FIFO upon DMA abort */ +#define DMACTRL_ABORT       (1 << 3) /* DMA abort */ +#define DMACTRL_IO2IO       (1 << 2) /* IO to IO */ +#define DMACTRL_FIFO2MEM    (0 << 1) /* FIFO to Memory */ +#define DMACTRL_MEM2FIFO    (1 << 1) /* Memory to FIFO */ +#define DMACTRL_START       (1 << 0) /* DMA start */ + +#endif diff --git a/include/usb/fusbh200.h b/include/usb/fusbh200.h new file mode 100644 index 000000000..8a9c488cb --- /dev/null +++ b/include/usb/fusbh200.h @@ -0,0 +1,61 @@ +/* + * Faraday USB 2.0 EHCI Controller + * + * (C) Copyright 2010 Faraday Technology + * Dante Su <dantesu@faraday-tech.com> + * + * This file is released under the terms of GPL v2 and any later version. + * See the file COPYING in the root directory of the source tree for details. + */ + +#ifndef _FUSBH200_H +#define _FUSBH200_H + +struct fusbh200_regs { +	struct { +		uint32_t data[4]; +	} hccr;			/* 0x00 - 0x0f: hccr */ +	struct { +		uint32_t data[9]; +	} hcor;			/* 0x10 - 0x33: hcor */ +	uint32_t easstr;/* 0x34: EOF&Async. Sched. Sleep Timer Register */ +	uint32_t rsvd[2]; +	uint32_t bmcsr;	/* 0x40: Bus Monitor Control Status Register */ +	uint32_t bmisr;	/* 0x44: Bus Monitor Interrupt Status Register */ +	uint32_t bmier; /* 0x48: Bus Monitor Interrupt Enable Register */ +}; + +/* EOF & Async. Schedule Sleep Timer Register */ +#define EASSTR_RUNNING  (1 << 6) /* Put transceiver in running/resume mode */ +#define EASSTR_SUSPEND  (0 << 6) /* Put transceiver in suspend mode */ +#define EASSTR_EOF2(x)  (((x) & 0x3) << 4) /* EOF 2 Timing */ +#define EASSTR_EOF1(x)  (((x) & 0x3) << 2) /* EOF 1 Timing */ +#define EASSTR_ASST(x)  (((x) & 0x3) << 0) /* Async. Sched. Sleep Timer */ + +/* Bus Monitor Control Status Register */ +#define BMCSR_SPD_HIGH  (2 << 9) /* Speed of the attached device */ +#define BMCSR_SPD_LOW   (1 << 9) +#define BMCSR_SPD_FULL  (0 << 9) +#define BMCSR_SPD_MASK  (3 << 9) +#define BMCSR_SPD_SHIFT 9 +#define BMCSR_SPD(x)    ((x >> 9) & 0x03) +#define BMCSR_VBUS      (1 << 8) /* VBUS Valid */ +#define BMCSR_VBUS_OFF  (1 << 4) /* VBUS Off */ +#define BMCSR_VBUS_ON   (0 << 4) /* VBUS On */ +#define BMCSR_IRQLH     (1 << 3) /* IRQ triggered at level-high */ +#define BMCSR_IRQLL     (0 << 3) /* IRQ triggered at level-low */ +#define BMCSR_HALFSPD   (1 << 2) /* Half speed mode for FPGA test */ +#define BMCSR_HFT_LONG  (1 << 1) /* HDISCON noise filter = 270 us*/ +#define BMCSR_HFT       (0 << 1) /* HDISCON noise filter = 135 us*/ +#define BMCSR_VFT_LONG  (1 << 1) /* VBUS noise filter = 472 us*/ +#define BMCSR_VFT       (0 << 1) /* VBUS noise filter = 135 us*/ + +/* Bus Monitor Interrupt Status Register */ +/* Bus Monitor Interrupt Enable Register */ +#define BMISR_DMAERR    (1 << 4) /* DMA error */ +#define BMISR_DMA       (1 << 3) /* DMA complete */ +#define BMISR_DEVRM     (1 << 2) /* device removed */ +#define BMISR_OVD       (1 << 1) /* over-current detected */ +#define BMISR_VBUSERR   (1 << 0) /* VBUS error */ + +#endif diff --git a/include/vsprintf.h b/include/vsprintf.h index 651077ca4..6568854fb 100644 --- a/include/vsprintf.h +++ b/include/vsprintf.h @@ -178,4 +178,15 @@ int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);  #define vscnprintf(buf, size, fmt, args...) vsprintf(buf, fmt, ##args)  #endif /* CONFIG_SYS_VSNPRINTF */ +/** + * print_grouped_ull() - print a value with digits grouped by ',' + * + * This prints a value with grouped digits, like 12,345,678 to make it easier + * to read. + * + * @val:	Value to print + * @digits:	Number of digiits to print + */ +void print_grouped_ull(unsigned long long int_val, int digits); +  #endif |