diff options
Diffstat (limited to 'include')
64 files changed, 1636 insertions, 145 deletions
| diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 23c964940..bfedbe445 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -42,10 +42,11 @@   */  /** - * Request ownership of a GPIO. + * Request a gpio. This should be called before any of the other functions + * are used on this gpio.   * - * @param gpio	GPIO number - * @param label	Name given to the GPIO + * @param gp	GPIO number + * @param label	User label for this GPIO   * @return 0 if ok, -1 on error   */  int gpio_request(unsigned gpio, const char *label); @@ -93,14 +94,4 @@ int gpio_get_value(unsigned gpio);   * @return 0 if ok, -1 on error   */  int gpio_set_value(unsigned gpio, int value); - -/** - * Request a gpio. This should be called before any of the other functions - * are used on this gpio. - * - * @param gp	GPIO number - * @param label	User label for this GPIO - * @return 0 if ok, -1 on error - */ -int gpio_request(unsigned gpio, const char *label);  #endif	/* _ASM_GENERIC_GPIO_H_ */ diff --git a/include/command.h b/include/command.h index 10bc2606c..476e7cffc 100644 --- a/include/command.h +++ b/include/command.h @@ -89,10 +89,10 @@ extern int cmd_auto_complete(const char *const prompt, char *buf, int *np, int *   */  #if defined(CONFIG_CMD_MEMORY)		\ -    || defined(CONFIG_CMD_I2C)		\ -    || defined(CONFIG_CMD_ITEST)	\ -    || defined(CONFIG_CMD_PCI)		\ -    || defined(CONFIG_CMD_PORTIO) +	|| defined(CONFIG_CMD_I2C)	\ +	|| defined(CONFIG_CMD_ITEST)	\ +	|| defined(CONFIG_CMD_PCI)	\ +	|| defined(CONFIG_CMD_PORTIO)  #define CMD_DATA_SIZE  extern int cmd_get_data_size(char* arg, int default_size);  #endif diff --git a/include/common.h b/include/common.h index 5e3c5eeee..d0bf1e8ab 100644 --- a/include/common.h +++ b/include/common.h @@ -340,6 +340,11 @@ int	envmatch     (uchar *, int);  char	*getenv	     (const char *);  int	getenv_f     (const char *name, char *buf, unsigned len);  ulong getenv_ulong(const char *name, int base, ulong default_val); +/* + * Read an environment variable as a boolean + * Return -1 if variable does not exist (default to true) + */ +int getenv_yesno(const char *var);  int	saveenv	     (void);  int	setenv	     (const char *, const char *);  int setenv_ulong(const char *varname, ulong value); diff --git a/include/config_cmd_all.h b/include/config_cmd_all.h index f434cd089..e82f6421c 100644 --- a/include/config_cmd_all.h +++ b/include/config_cmd_all.h @@ -40,12 +40,15 @@  #define CONFIG_CMD_FDOS		/* Floppy DOS support		*/  #define CONFIG_CMD_FLASH	/* flinfo, erase, protect	*/  #define CONFIG_CMD_FPGA		/* FPGA configuration Support	*/ +#define CONFIG_CMD_GETTIME	/* Get time since boot         */ +#define CONFIG_CMD_HASH		/* calculate hash / digest	*/  #define CONFIG_CMD_HWFLOW	/* RTS/CTS hw flow control	*/  #define CONFIG_CMD_I2C		/* I2C serial bus support	*/  #define CONFIG_CMD_IDE		/* IDE harddisk support		*/  #define CONFIG_CMD_IMI		/* iminfo			*/  #define CONFIG_CMD_IMLS		/* List all found images	*/  #define CONFIG_CMD_IMMAP	/* IMMR dump support		*/ +#define CONFIG_CMD_IO		/* Access to X86 IO space	*/  #define CONFIG_CMD_IRQ		/* irqinfo			*/  #define CONFIG_CMD_ITEST	/* Integer (and string) test	*/  #define CONFIG_CMD_JFFS2	/* JFFS2 Support		*/ @@ -70,6 +73,7 @@  #define CONFIG_CMD_REGINFO	/* Register dump		*/  #define CONFIG_CMD_REISER	/* Reiserfs support		*/  #define CONFIG_CMD_RARP		/* rarpboot support		*/ +#define CONFIG_CMD_READ		/* Read data from partition	*/  #define CONFIG_CMD_RUN		/* run command in env variable	*/  #define CONFIG_CMD_SAVEENV	/* saveenv			*/  #define CONFIG_CMD_SAVES	/* save S record dump		*/ diff --git a/include/configs/CRAYL1.h b/include/configs/CRAYL1.h index 1daec6967..6bceccbc1 100644 --- a/include/configs/CRAYL1.h +++ b/include/configs/CRAYL1.h @@ -153,7 +153,6 @@  #define CONFIG_SYS_LOAD_ADDR		0x100000	/* where to load what we get from TFTP */ -#define CONFIG_SYS_TFTP_LOADADDR	CONFIG_SYS_LOAD_ADDR  #define CONFIG_SYS_EXTBDINFO		1		/* To use extended board_into (bd_t) */  #define CONFIG_SYS_DRAM_TEST		1 diff --git a/include/configs/GEN860T.h b/include/configs/GEN860T.h index b98caccb8..9a649ca12 100644 --- a/include/configs/GEN860T.h +++ b/include/configs/GEN860T.h @@ -96,11 +96,6 @@  #define	CONFIG_SYS_LOADS_BAUD_CHANGE  /* - * Set default load address for tftp network downloads - */ -#define	CONFIG_SYS_TFTP_LOADADDR				0x01000000 - -/*   * Turn off the watchdog timer   */  #undef	CONFIG_WATCHDOG diff --git a/include/configs/TOP860.h b/include/configs/TOP860.h index 36921ca8b..4849f94c9 100644 --- a/include/configs/TOP860.h +++ b/include/configs/TOP860.h @@ -416,7 +416,6 @@  #define CONFIG_IPADDR					10.0.4.111  #define CONFIG_SYS_LOAD_ADDR		0x00100000	/* default load address */ -#define	CONFIG_SYS_TFTP_LOADADDR	0x00100000  /*   * For booting Linux, the board info and command line data diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h index ab9549b93..72459d859 100644 --- a/include/configs/am335x_evm.h +++ b/include/configs/am335x_evm.h @@ -240,6 +240,38 @@  #define CONFIG_SYS_SPI_U_BOOT_SIZE	0x40000  #define CONFIG_SPL_LDSCRIPT		"$(CPUDIR)/omap-common/u-boot-spl.lds" +#define CONFIG_SPL_BOARD_INIT +#define CONFIG_SPL_NAND_AM33XX_BCH +#define CONFIG_SPL_NAND_SUPPORT +#define CONFIG_SPL_NAND_BASE +#define CONFIG_SPL_NAND_DRIVERS +#define CONFIG_SPL_NAND_ECC +#define CONFIG_SYS_NAND_5_ADDR_CYCLE +#define CONFIG_SYS_NAND_PAGE_COUNT	(CONFIG_SYS_NAND_BLOCK_SIZE / \ +					 CONFIG_SYS_NAND_PAGE_SIZE) +#define CONFIG_SYS_NAND_PAGE_SIZE	2048 +#define CONFIG_SYS_NAND_OOBSIZE		64 +#define CONFIG_SYS_NAND_BLOCK_SIZE	(128*1024) +#define CONFIG_SYS_NAND_BAD_BLOCK_POS	NAND_LARGE_BADBLOCK_POS +#define CONFIG_SYS_NAND_ECCPOS		{ 2, 3, 4, 5, 6, 7, 8, 9, \ +					 10, 11, 12, 13, 14, 15, 16, 17, \ +					 18, 19, 20, 21, 22, 23, 24, 25, \ +					 26, 27, 28, 29, 30, 31, 32, 33, \ +					 34, 35, 36, 37, 38, 39, 40, 41, \ +					 42, 43, 44, 45, 46, 47, 48, 49, \ +					 50, 51, 52, 53, 54, 55, 56, 57, } + +#define CONFIG_SYS_NAND_ECCSIZE		512 +#define CONFIG_SYS_NAND_ECCBYTES	14 + +#define CONFIG_SYS_NAND_ECCSTEPS	4 +#define	CONFIG_SYS_NAND_ECCTOTAL	(CONFIG_SYS_NAND_ECCBYTES * \ +						CONFIG_SYS_NAND_ECCSTEPS) + +#define	CONFIG_SYS_NAND_U_BOOT_START	CONFIG_SYS_TEXT_BASE + +#define CONFIG_SYS_NAND_U_BOOT_OFFS	0x80000 +  /*   * 1MB into the SDRAM to allow for SPL's bss at the beginning of SDRAM   * 64 bytes before this address should be set aside for u-boot.img's @@ -299,6 +331,24 @@  #define CONFIG_NET_MULTI  #define CONFIG_PHY_GIGE  #define CONFIG_PHYLIB +#define CONFIG_PHY_ADDR			0  #define CONFIG_PHY_SMSC +#define CONFIG_NAND +/* NAND support */ +#ifdef CONFIG_NAND +#define CONFIG_CMD_NAND +#define CONFIG_NAND_OMAP_GPMC +#define GPMC_NAND_ECC_LP_x16_LAYOUT	1 +#define CONFIG_SYS_NAND_BASE		(0x08000000)	/* physical address */ +							/* to access nand at */ +							/* CS0 */ +#define CONFIG_SYS_MAX_NAND_DEVICE	1		/* Max number of NAND +							   devices */ +#undef CONFIG_ENV_IS_NOWHERE +#define CONFIG_ENV_IS_IN_NAND +#define CONFIG_ENV_OFFSET		0x260000 /* environment starts here */ +#define CONFIG_SYS_ENV_SECT_SIZE	(128 << 10)	/* 128 KiB */ +#endif +  #endif	/* ! __CONFIG_AM335X_EVM_H */ diff --git a/include/configs/cm_t35.h b/include/configs/cm_t35.h index 568ae8e09..433b447ff 100644 --- a/include/configs/cm_t35.h +++ b/include/configs/cm_t35.h @@ -188,6 +188,7 @@  /* Environment information */  #define CONFIG_BOOTDELAY		10 +#define CONFIG_ZERO_BOOTDELAY_CHECK  #define CONFIG_EXTRA_ENV_SETTINGS \  	"loadaddr=0x82000000\0" \ @@ -282,7 +283,6 @@   */  #define CONFIG_NR_DRAM_BANKS	1	/* CS1 is never populated */  #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0 -#define PHYS_SDRAM_1_SIZE	(32 << 20)	/* at least 32 MiB */  /*-----------------------------------------------------------------------   * FLASH and environment organization diff --git a/include/configs/dig297.h b/include/configs/dig297.h index dda758269..721b91c4d 100644 --- a/include/configs/dig297.h +++ b/include/configs/dig297.h @@ -263,7 +263,6 @@   */  #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */  #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0 -#define PHYS_SDRAM_1_SIZE	(32 << 20)	/* at least 32 MiB */  #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1  /*----------------------------------------------------------------------- diff --git a/include/configs/ep8260.h b/include/configs/ep8260.h index ccfe032ca..5a87cc5d3 100644 --- a/include/configs/ep8260.h +++ b/include/configs/ep8260.h @@ -371,7 +371,6 @@  #define	CONFIG_CLOCKS_IN_MHZ	1      /* clocks passsed to Linux in MHz */  #define CONFIG_SYS_LOAD_ADDR     0x00100000   /* default load address */ -#define CONFIG_SYS_TFTP_LOADADDR 0x00100000   /* default load address for network file downloads */  #define CONFIG_SYS_HZ            1000         /* decrementer freq: 1 ms ticks */ diff --git a/include/configs/harmony.h b/include/configs/harmony.h index 040bfe48e..8d1fd47af 100644 --- a/include/configs/harmony.h +++ b/include/configs/harmony.h @@ -58,14 +58,16 @@  #define CONFIG_DOS_PARTITION  #define CONFIG_EFI_PARTITION +#define CONFIG_FS_EXT4 +#define CONFIG_FS_FAT  #define CONFIG_CMD_EXT2  #define CONFIG_CMD_FAT +#define CONFIG_CMD_FS_GENERIC  /* NAND support */  #define CONFIG_CMD_NAND  #define CONFIG_TEGRA_NAND  #define CONFIG_SYS_MAX_NAND_DEVICE	1 -#define CONFIG_SYS_NAND_BASE	NV_PA_NAND_BASE  /* Environment in NAND (which is 512M), aligned to start of last sector */  #define CONFIG_ENV_IS_IN_NAND diff --git a/include/configs/igep00x0.h b/include/configs/igep00x0.h index be7937d70..43dd06e24 100644 --- a/include/configs/igep00x0.h +++ b/include/configs/igep00x0.h @@ -236,7 +236,6 @@   */  #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */  #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0 -#define PHYS_SDRAM_1_SIZE	(32 << 20)	/* at least 32 meg */  #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1  /* diff --git a/include/configs/m28evk.h b/include/configs/m28evk.h index 36ce67236..688717158 100644 --- a/include/configs/m28evk.h +++ b/include/configs/m28evk.h @@ -299,7 +299,7 @@  		"if tftp ${update_nand_full_filename} ; then "		\  		"run update_nand_get_fcb_size ; "			\  		"nand scrub -y 0x0 ${filesize} ; "			\ -		"nand write.raw ${loadaddr} 0x0 ${update_nand_fcb} ; "	\ +		"nand write.raw ${loadaddr} 0x0 ${fcb_sz} ; "	\  		"setexpr update_off ${loadaddr} + ${update_nand_fcb} ; " \  		"setexpr update_sz ${filesize} - ${update_nand_fcb} ; " \  		"nand write ${update_off} ${update_nand_fcb} ${update_sz} ; " \ diff --git a/include/configs/mcx.h b/include/configs/mcx.h index e304c9941..185faa7ef 100644 --- a/include/configs/mcx.h +++ b/include/configs/mcx.h @@ -322,7 +322,6 @@   */  #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */  #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0 -#define PHYS_SDRAM_1_SIZE	(32 << 20)	/* at least 32 MiB */  #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1  /* diff --git a/include/configs/mx28evk.h b/include/configs/mx28evk.h index 8b89b25f7..cdf3e1508 100644 --- a/include/configs/mx28evk.h +++ b/include/configs/mx28evk.h @@ -263,7 +263,7 @@  		"if tftp ${update_nand_full_filename} ; then " \  		"run update_nand_get_fcb_size ; " \  		"nand scrub -y 0x0 ${filesize} ; " \ -		"nand write.raw ${loadaddr} 0x0 ${update_nand_fcb} ; " \ +		"nand write.raw ${loadaddr} 0x0 ${fcb_sz} ; " \  		"setexpr update_off ${loadaddr} + ${update_nand_fcb} ; " \  		"setexpr update_sz ${filesize} - ${update_nand_fcb} ; " \  		"nand write ${update_off} ${update_nand_fcb} ${update_sz} ; " \ diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h index 12d65f2c4..d0daa455e 100644 --- a/include/configs/omap3_beagle.h +++ b/include/configs/omap3_beagle.h @@ -285,7 +285,7 @@  		"else run userbutton_nonxm; fi;\0" \  	"userbutton_xm=gpio input 4;\0" \  	"userbutton_nonxm=gpio input 7;\0" -/* "run userbutton" will return 1 (false) if is pressed and 0 (false) if not */ +/* "run userbutton" will return 1 (false) if pressed and 0 (true) if not */  #define CONFIG_BOOTCOMMAND \  	"mmc dev ${mmcdev}; if mmc rescan; then " \  		"if run userbutton; then " \ diff --git a/include/configs/omap3_evm.h b/include/configs/omap3_evm.h index b4d925ed9..fc6e78208 100644 --- a/include/configs/omap3_evm.h +++ b/include/configs/omap3_evm.h @@ -95,10 +95,7 @@  #define CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME	"u-boot.img"  /* Partition tables */ -/* Only need DOS partition support for SPL, currently */ -#ifndef CONFIG_SPL_BUILD  #define CONFIG_EFI_PARTITION -#endif  #define CONFIG_DOS_PARTITION  /* USB diff --git a/include/configs/omap3_mvblx.h b/include/configs/omap3_mvblx.h index 67af31465..09a0b2f71 100644 --- a/include/configs/omap3_mvblx.h +++ b/include/configs/omap3_mvblx.h @@ -251,7 +251,6 @@   */  #define CONFIG_NR_DRAM_BANKS	1  #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0 -#define PHYS_SDRAM_1_SIZE	(32 << 20)	/* at least 32 MiB */  #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1  #define CONFIG_ENV_IS_NOWHERE	1 diff --git a/include/configs/omap3_pandora.h b/include/configs/omap3_pandora.h index 8a8a5d1cc..217f306c0 100644 --- a/include/configs/omap3_pandora.h +++ b/include/configs/omap3_pandora.h @@ -221,7 +221,6 @@   */  #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */  #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0 -#define PHYS_SDRAM_1_SIZE	(32 << 20)	/* at least 32 MiB */  #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1  #define CONFIG_SYS_TEXT_BASE		0x80008000 diff --git a/include/configs/omap3_sdp3430.h b/include/configs/omap3_sdp3430.h index 2a890c9c7..b02ec850b 100644 --- a/include/configs/omap3_sdp3430.h +++ b/include/configs/omap3_sdp3430.h @@ -303,7 +303,6 @@   */  #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */  #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0 -#define PHYS_SDRAM_1_SIZE	(32 << 20) /* at least 32 meg */  #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1  /*--------------------------------------------------------------------------*/ diff --git a/include/configs/omap3_zoom1.h b/include/configs/omap3_zoom1.h index e152055a6..ee4cbd75c 100644 --- a/include/configs/omap3_zoom1.h +++ b/include/configs/omap3_zoom1.h @@ -252,7 +252,6 @@   */  #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */  #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0 -#define PHYS_SDRAM_1_SIZE	(32 << 20)	/* at least 32 MiB */  #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1  /*----------------------------------------------------------------------- diff --git a/include/configs/omap3_zoom2.h b/include/configs/omap3_zoom2.h index d6814248e..a6b48a80c 100644 --- a/include/configs/omap3_zoom2.h +++ b/include/configs/omap3_zoom2.h @@ -221,7 +221,6 @@   */  #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */  #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0 -#define PHYS_SDRAM_1_SIZE	(32 << 20)	/* at least 32 MiB */  #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1  /*----------------------------------------------------------------------- diff --git a/include/configs/palmld.h b/include/configs/palmld.h index c5dd49405..3f9802ca0 100644 --- a/include/configs/palmld.h +++ b/include/configs/palmld.h @@ -28,6 +28,9 @@  #define	CONFIG_CPU_PXA27X		1	/* Marvell PXA270 CPU */  #define	CONFIG_PALMLD		1	/* Palm LifeDrive board */ +/* we will never enable dcache, because we have to setup MMU first */ +#define CONFIG_SYS_DCACHE_OFF +  /*   * Environment settings   */ diff --git a/include/configs/palmtc.h b/include/configs/palmtc.h index 9c948c547..64771e7e8 100644 --- a/include/configs/palmtc.h +++ b/include/configs/palmtc.h @@ -30,6 +30,9 @@  #define	CONFIG_CPU_PXA25X			1	/* Intel PXA255 CPU */  #define	CONFIG_PALMTC			1	/* Palm Tungsten|C board */ +/* we will never enable dcache, because we have to setup MMU first */ +#define CONFIG_SYS_DCACHE_OFF +  /*   * Environment settings   */ diff --git a/include/configs/paz00.h b/include/configs/paz00.h index 5603de962..38c79cfc2 100644 --- a/include/configs/paz00.h +++ b/include/configs/paz00.h @@ -45,8 +45,11 @@  #define CONFIG_DOS_PARTITION  #define CONFIG_EFI_PARTITION +#define CONFIG_FS_EXT4 +#define CONFIG_FS_FAT  #define CONFIG_CMD_EXT2  #define CONFIG_CMD_FAT +#define CONFIG_CMD_FS_GENERIC  /* Environment in eMMC, at the end of 2nd "boot sector" */  #define CONFIG_ENV_IS_IN_MMC diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h index 894f38bd7..eb13bb3a6 100644 --- a/include/configs/s5pc210_universal.h +++ b/include/configs/s5pc210_universal.h @@ -34,6 +34,7 @@  #define CONFIG_S5P		1	/* which is in a S5P Family */  #define CONFIG_EXYNOS4210	1	/* which is in a EXYNOS4210 */  #define CONFIG_UNIVERSAL	1	/* working with Universal */ +#define CONFIG_TIZEN		1	/* TIZEN lib */  #include <asm/arch/cpu.h>		/* get chip and board defs */ @@ -56,6 +57,8 @@  #define CONFIG_INITRD_TAG  #define CONFIG_REVISION_TAG  #define CONFIG_CMDLINE_EDITING +#define CONFIG_SKIP_LOWLEVEL_INIT +#define CONFIG_BOARD_EARLY_INIT_F  /* Size of malloc() pool */  #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (1 << 20)) @@ -261,4 +264,37 @@  #define CONFIG_USB_GADGET_S3C_UDC_OTG  #define CONFIG_USB_GADGET_DUALSPEED +/* + * SPI Settings + */ +#define CONFIG_SOFT_SPI +#define CONFIG_SOFT_SPI_MODE SPI_MODE_3 +#define CONFIG_SOFT_SPI_GPIO_SCLK exynos4_gpio_part2_get_nr(y3, 1) +#define CONFIG_SOFT_SPI_GPIO_MOSI exynos4_gpio_part2_get_nr(y3, 3) +#define CONFIG_SOFT_SPI_GPIO_MISO exynos4_gpio_part2_get_nr(y3, 0) +#define CONFIG_SOFT_SPI_GPIO_CS exynos4_gpio_part2_get_nr(y4, 3) + +#define SPI_DELAY udelay(1) +#undef SPI_INIT +#define SPI_SCL(bit) universal_spi_scl(bit) +#define SPI_SDA(bit) universal_spi_sda(bit) +#define SPI_READ universal_spi_read() +#ifndef	__ASSEMBLY__ +void universal_spi_scl(int bit); +void universal_spi_sda(int bit); +int universal_spi_read(void); +#endif + +/* + * LCD Settings + */ +#define CONFIG_EXYNOS_FB +#define CONFIG_LCD +#define CONFIG_CMD_BMP +#define CONFIG_BMP_32BPP +#define CONFIG_LD9040 +#define CONFIG_EXYNOS_MIPI_DSIM +#define CONFIG_VIDEO_BMP_GZIP +#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE ((520 * 120 * 4) + (1 << 12)) +  #endif	/* __CONFIG_H */ diff --git a/include/configs/seaboard.h b/include/configs/seaboard.h index ab10bd0ab..de0c77781 100644 --- a/include/configs/seaboard.h +++ b/include/configs/seaboard.h @@ -54,6 +54,7 @@  #define CONFIG_MACH_TYPE		MACH_TYPE_SEABOARD  #define CONFIG_BOARD_EARLY_INIT_F +#define CONFIG_BOARD_LATE_INIT		/* Make sure LCD init is complete */  /* I2C */  #define CONFIG_TEGRA_I2C @@ -71,8 +72,11 @@  #define CONFIG_DOS_PARTITION  #define CONFIG_EFI_PARTITION +#define CONFIG_FS_EXT4 +#define CONFIG_FS_FAT  #define CONFIG_CMD_EXT2  #define CONFIG_CMD_FAT +#define CONFIG_CMD_FS_GENERIC  /* Environment in eMMC, at the end of 2nd "boot sector" */  #define CONFIG_ENV_IS_IN_MMC @@ -102,7 +106,13 @@  /* USB keyboard */  #define CONFIG_USB_KEYBOARD -#include "tegra-common-post.h" +/* LCD support */ +#define CONFIG_LCD +#define CONFIG_PWM_TEGRA +#define CONFIG_VIDEO_TEGRA +#define LCD_BPP				LCD_COLOR16 +#define CONFIG_SYS_WHITE_ON_BLACK +#define CONFIG_CONSOLE_SCROLL_LINES	10  /* NAND support */  #define CONFIG_CMD_NAND @@ -111,6 +121,6 @@  /* Max number of NAND devices */  #define CONFIG_SYS_MAX_NAND_DEVICE	1 -/* Somewhat oddly, the NAND base address must be a config option */ -#define CONFIG_SYS_NAND_BASE	NV_PA_NAND_BASE +#include "tegra-common-post.h" +  #endif /* __CONFIG_H */ diff --git a/include/configs/smdk5250.h b/include/configs/smdk5250.h index c0f86228b..75c25c003 100644 --- a/include/configs/smdk5250.h +++ b/include/configs/smdk5250.h @@ -65,7 +65,7 @@  #define INFORM1_OFFSET			0x804  /* Size of malloc() pool */ -#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (1 << 20)) +#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (4 << 20))  /* select serial console configuration */  #define CONFIG_SERIAL3			/* use SERIAL 3 */ @@ -163,7 +163,6 @@  #undef CONFIG_CMD_IMLS  #define CONFIG_IDENT_STRING		" for SMDK5250" -#define CONFIG_ENV_IS_IN_MMC  #define CONFIG_SYS_MMC_ENV_DEV		0  #define CONFIG_SECURE_BL1_ONLY @@ -188,6 +187,11 @@  /* U-boot copy size from boot Media to DRAM.*/  #define BL2_START_OFFSET	(CONFIG_BL2_OFFSET/512)  #define BL2_SIZE_BLOC_COUNT	(CONFIG_BL2_SIZE/512) + +#define OM_STAT				(0x1f << 1) +#define EXYNOS_COPY_SPI_FNPTR_ADDR	0x02020058 +#define SPI_FLASH_UBOOT_POS		(CONFIG_SEC_FW_SIZE + CONFIG_BL1_SIZE) +  #define CONFIG_DOS_PARTITION  #define CONFIG_IRAM_STACK	0x02050000 @@ -203,6 +207,59 @@  #define CONFIG_I2C_MULTI_BUS  #define CONFIG_MAX_I2C_NUM	8  #define CONFIG_SYS_I2C_SLAVE    0x0 +#define CONFIG_I2C_EDID + +/* PMIC */ +#define CONFIG_PMIC +#define CONFIG_PMIC_I2C +#define CONFIG_PMIC_MAX77686 + +/* SPI */ +#define CONFIG_ENV_IS_IN_SPI_FLASH +#define CONFIG_SPI_FLASH + +#ifdef CONFIG_SPI_FLASH +#define CONFIG_EXYNOS_SPI +#define CONFIG_CMD_SF +#define CONFIG_CMD_SPI +#define CONFIG_SPI_FLASH_WINBOND +#define CONFIG_SF_DEFAULT_MODE		SPI_MODE_0 +#define CONFIG_SF_DEFAULT_SPEED		50000000 +#define EXYNOS5_SPI_NUM_CONTROLLERS	5 +#endif + +#ifdef CONFIG_ENV_IS_IN_SPI_FLASH +#define CONFIG_ENV_SPI_MODE	SPI_MODE_0 +#define CONFIG_ENV_SECT_SIZE	CONFIG_ENV_SIZE +#define CONFIG_ENV_SPI_BUS	1 +#define CONFIG_ENV_SPI_MAX_HZ	50000000 +#endif + +/* PMIC */ +#define CONFIG_POWER +#define CONFIG_POWER_I2C +#define CONFIG_POWER_MAX77686 + +/* SPI */ +#define CONFIG_ENV_IS_IN_SPI_FLASH +#define CONFIG_SPI_FLASH + +#ifdef CONFIG_SPI_FLASH +#define CONFIG_EXYNOS_SPI +#define CONFIG_CMD_SF +#define CONFIG_CMD_SPI +#define CONFIG_SPI_FLASH_WINBOND +#define CONFIG_SF_DEFAULT_MODE		SPI_MODE_0 +#define CONFIG_SF_DEFAULT_SPEED		50000000 +#define EXYNOS5_SPI_NUM_CONTROLLERS	5 +#endif + +#ifdef CONFIG_ENV_IS_IN_SPI_FLASH +#define CONFIG_ENV_SPI_MODE	SPI_MODE_0 +#define CONFIG_ENV_SECT_SIZE	CONFIG_ENV_SIZE +#define CONFIG_ENV_SPI_BUS	1 +#define CONFIG_ENV_SPI_MAX_HZ	50000000 +#endif  /* Ethernet Controllor Driver */  #ifdef CONFIG_CMD_NET @@ -212,7 +269,27 @@  #define CONFIG_ENV_SROM_BANK		1  #endif /*CONFIG_CMD_NET*/ +/* Enable PXE Support */ +#ifdef CONFIG_CMD_NET +#define CONFIG_CMD_PXE +#define CONFIG_MENU +#endif + +/* Sound */ +#define CONFIG_CMD_SOUND +#ifdef CONFIG_CMD_SOUND +#define CONFIG_SOUND +#define CONFIG_I2S +#define CONFIG_SOUND_WM8994 +#endif +  /* Enable devicetree support */  #define CONFIG_OF_LIBFDT +/* SHA hashing */ +#define CONFIG_CMD_HASH +#define CONFIG_HASH_VERIFY +#define CONFIG_SHA1 +#define CONFIG_SHA256 +  #endif	/* __CONFIG_H */ diff --git a/include/configs/tam3517-common.h b/include/configs/tam3517-common.h index ee73c277b..9f1fb9fee 100644 --- a/include/configs/tam3517-common.h +++ b/include/configs/tam3517-common.h @@ -189,7 +189,6 @@   */  #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */  #define PHYS_SDRAM_1		OMAP34XX_SDRC_CS0 -#define PHYS_SDRAM_1_SIZE	(32 << 20)	/* at least 32 MiB */  #define PHYS_SDRAM_2		OMAP34XX_SDRC_CS1  /* @@ -358,7 +357,6 @@   * I2C EEPROM   */  #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__)) -  /*   * The I2C EEPROM on the TAM3517 contains   * mac address and production data @@ -384,24 +382,29 @@ struct tam3517_module_info {  	unsigned char _rev[100];  }; -#define TAM3517_READ_MAC_FROM_EEPROM	\ -do {					\ -	struct tam3517_module_info info;\ -	char buf[80], ethname[20];	\ -	int i;				\ +#define TAM3517_READ_EEPROM(info, ret) \ +do {								\  	i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);	\  	if (eeprom_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0,		\ -			(void *)&info, sizeof(info)))		\ -		break;						\ +		(void *)info, sizeof(*info)))			\ +		ret = 1;					\ +	else							\ +		ret = 0;					\ +} while (0) + +#define TAM3517_READ_MAC_FROM_EEPROM(info)			\ +do {								\ +	char buf[80], ethname[20];				\ +	int i;							\  	memset(buf, 0, sizeof(buf));				\ -	for (i = 0 ; i < ARRAY_SIZE(info.eth_addr); i++) {	\ +	for (i = 0 ; i < ARRAY_SIZE((info)->eth_addr); i++) {	\  		sprintf(buf, "%02X:%02X:%02X:%02X:%02X:%02X",	\ -			info.eth_addr[i][5],			\ -			info.eth_addr[i][4],			\ -			info.eth_addr[i][3],			\ -			info.eth_addr[i][2],			\ -			info.eth_addr[i][1],			\ -			info.eth_addr[i][0]);			\ +			(info)->eth_addr[i][5],			\ +			(info)->eth_addr[i][4],			\ +			(info)->eth_addr[i][3],			\ +			(info)->eth_addr[i][2],			\ +			(info)->eth_addr[i][1],			\ +			(info)->eth_addr[i][0]);			\  								\  		if (i)						\  			sprintf(ethname, "eth%daddr", i);	\ @@ -411,6 +414,30 @@ do {					\  		setenv(ethname, buf);				\  	}							\  } while (0) + +/* The following macros are taken from Technexion's documentation */ +#define TAM3517_sequence_number(info) \ +	((info)->sequence_number % 0x1000000000000LL) +#define TAM3517_week_of_year(info) (((info)->sequence_number >> 48) % 0x100) +#define TAM3517_year(info) ((info)->sequence_number >> 56) +#define TAM3517_revision_fixed(info) ((info)->revision % 0x100) +#define TAM3517_revision_major(info) (((info)->revision >> 8) % 0x100) +#define TAM3517_revision_tn(info) ((info)->revision >> 16) + +#define TAM3517_PRINT_SOM_INFO(info)				\ +do {								\ +	printf("Vendor:%s\n", (info)->customer);		\ +	printf("SOM:   %s\n", (info)->product);			\ +	printf("SeqNr: %02llu%02llu%012llu\n",			\ +		TAM3517_year(info),				\ +		TAM3517_week_of_year(info),			\ +		TAM3517_sequence_number(info));			\ +	printf("Rev:   TN%u %u.%u\n",				\ +		TAM3517_revision_tn(info),			\ +		TAM3517_revision_major(info),			\ +		TAM3517_revision_fixed(info));			\ +} while (0) +  #endif  #endif /* __TAM3517_H */ diff --git a/include/configs/tec.h b/include/configs/tec.h index 140d2e663..200cf6664 100644 --- a/include/configs/tec.h +++ b/include/configs/tec.h @@ -54,7 +54,6 @@  #define CONFIG_CMD_NAND  #define CONFIG_TEGRA_NAND  #define CONFIG_SYS_MAX_NAND_DEVICE	1 -#define CONFIG_SYS_NAND_BASE		NV_PA_NAND_BASE  /* Environment in NAND, aligned to start of last sector */  #define CONFIG_ENV_IS_IN_NAND diff --git a/include/configs/tegra-common-post.h b/include/configs/tegra-common-post.h index 6f310bee6..ee40cc2a3 100644 --- a/include/configs/tegra-common-post.h +++ b/include/configs/tegra-common-post.h @@ -30,18 +30,6 @@  #else -#ifdef CONFIG_CMD_EXT2 -#define BOOT_FSTYPE_EXT2 "ext2 " -#else -#define BOOT_FSTYPE_EXT2 "" -#endif - -#ifdef CONFIG_CMD_FAT -#define BOOT_FSTYPE_FAT "fat" -#else -#define BOOT_FSTYPE_FAT "" -#endif -  #ifdef CONFIG_CMD_MMC  #define BOOTCMDS_MMC \  	"mmc_boot=" \ @@ -98,7 +86,7 @@  	"rootpart=1\0" \  	\  	"script_boot="                                                    \ -		"if ${fs}load ${devtype} ${devnum}:${rootpart} "          \ +		"if load ${devtype} ${devnum}:${rootpart} "               \  				"${scriptaddr} ${prefix}${script}; then " \  			"echo ${script} found! Executing ...;"            \  			"source ${scriptaddr};"                           \ @@ -106,11 +94,9 @@  	\  	"scan_boot="                                                      \  		"echo Scanning ${devtype} ${devnum}...; "                 \ -		"for fs in ${boot_fstypes}; do "                          \ -			"for prefix in ${boot_prefixes}; do "             \ -				"for script in ${boot_scripts}; do "      \ -					"run script_boot; "               \ -				"done; "                                  \ +		"for prefix in ${boot_prefixes}; do "                     \ +			"for script in ${boot_scripts}; do "              \ +				"run script_boot; "                       \  			"done; "                                          \  		"done;\0"                                                 \  	\ @@ -120,11 +106,6 @@  		BOOT_TARGETS_DHCP " " \  		"\0" \  	\ -	"boot_fstypes=" \ -		BOOT_FSTYPE_EXT2 " " \ -		BOOT_FSTYPE_FAT " " \ -		"\0" \ -	\  	"boot_prefixes=/ /boot/\0" \  	\  	"boot_scripts=boot.scr.uimg boot.scr\0" \ @@ -181,8 +162,8 @@  #define TEGRA_DEVICE_SETTINGS \  	"stdin=serial" STDIN_KBD_KBC STDIN_KBD_USB "\0" \ -	"stdout=serial\0" \ -	"stderr=serial\0" \ +	"stdout=serial,lcd\0" \ +	"stderr=serial,lcd\0" \  #define CONFIG_EXTRA_ENV_SETTINGS \  	TEGRA_DEVICE_SETTINGS \ @@ -226,12 +207,24 @@  #ifdef CONFIG_EFI_PARTITION  #undef CONFIG_EFI_PARTITION  #endif +#ifdef CONFIG_CMD_FS_GENERIC +#undef CONFIG_CMD_FS_GENERIC +#endif +#ifdef CONFIG_CMD_EXT4 +#undef CONFIG_CMD_EXT4 +#endif  #ifdef CONFIG_CMD_EXT2  #undef CONFIG_CMD_EXT2  #endif  #ifdef CONFIG_CMD_FAT  #undef CONFIG_CMD_FAT  #endif +#ifdef CONFIG_FS_EXT4 +#undef CONFIG_FS_EXT4 +#endif +#ifdef CONFIG_FS_FAT +#undef CONFIG_FS_FAT +#endif  /* remove USB */  #ifdef CONFIG_USB_EHCI diff --git a/include/configs/tegra20-common.h b/include/configs/tegra20-common.h index 5c0833a4d..fe07f7226 100644 --- a/include/configs/tegra20-common.h +++ b/include/configs/tegra20-common.h @@ -38,6 +38,9 @@  #include <asm/arch/tegra.h>		/* get chip and board defs */ +/* Align LCD to 1MB boundary */ +#define CONFIG_LCD_ALIGNMENT	MMU_SECTION_SIZE +  /*   * Display CPU and Board information   */ diff --git a/include/configs/trats.h b/include/configs/trats.h index 355029e8d..6efee5c47 100644 --- a/include/configs/trats.h +++ b/include/configs/trats.h @@ -98,6 +98,7 @@  #undef CONFIG_CMD_MTDPARTS  #define CONFIG_CMD_MMC  #define CONFIG_CMD_DFU +#define CONFIG_CMD_GPT  /* FAT */  #define CONFIG_CMD_FAT @@ -122,6 +123,26 @@  #define CONFIG_BOOTBLOCK		"10"  #define CONFIG_ENV_COMMON_BOOT		"${console} ${meminfo}" +/* Tizen - partitions definitions */ +#define PARTS_CSA		"csa-mmc" +#define PARTS_BOOTLOADER	"u-boot" +#define PARTS_BOOT		"boot" +#define PARTS_ROOT		"platform" +#define PARTS_DATA		"data" +#define PARTS_CSC		"csc" +#define PARTS_UMS		"ums" + +#define PARTS_DEFAULT \ +	"uuid_disk=${uuid_gpt_disk};" \ +	"name="PARTS_CSA",size=8MiB,uuid=${uuid_gpt_"PARTS_CSA"};" \ +	"name="PARTS_BOOTLOADER",size=60MiB," \ +		"uuid=${uuid_gpt_"PARTS_BOOTLOADER"};" \ +	"name="PARTS_BOOT",size=100MiB,uuid=${uuid_gpt_"PARTS_BOOT"};" \ +	"name="PARTS_ROOT",size=1GiB,uuid=${uuid_gpt_"PARTS_ROOT"};" \ +	"name="PARTS_DATA",size=3GiB,uuid=${uuid_gpt_"PARTS_DATA"};" \ +	"name="PARTS_CSC",size=150MiB,uuid=${uuid_gpt_"PARTS_CSC"};" \ +	"name="PARTS_UMS",size=-,uuid=${uuid_gpt_"PARTS_UMS"}\0" \ +  #define CONFIG_DFU_ALT \  	"dfu_alt_info=" \  	"u-boot mmc 80 400;" \ @@ -171,7 +192,8 @@  	"mmcbootpart=2\0" \  	"mmcrootpart=3\0" \  	"opts=always_resume=1\0" \ -	CONFIG_DFU_ALT +	"partitions=" PARTS_DEFAULT \ +	CONFIG_DFU_ALT \  /* Miscellaneous configurable options */  #define CONFIG_SYS_LONGHELP		/* undef to save memory */ @@ -189,12 +211,17 @@  #define CONFIG_SYS_HZ			1000 -/* TRATS has 2 banks of DRAM */ -#define CONFIG_NR_DRAM_BANKS	2 -#define PHYS_SDRAM_1		CONFIG_SYS_SDRAM_BASE	/* LDDDR2 DMC 0 */ -#define PHYS_SDRAM_1_SIZE	(512 << 20)		/* 512 MB in CS 0 */ -#define PHYS_SDRAM_2		0x50000000		/* LPDDR2 DMC 1 */ -#define PHYS_SDRAM_2_SIZE	(512 << 20)		/* 512 MB in CS 0 */ +/* TRATS has 4 banks of DRAM */ +#define CONFIG_NR_DRAM_BANKS	4 +#define SDRAM_BANK_SIZE		(256UL << 20UL)	/* 256 MB */ +#define PHYS_SDRAM_1		CONFIG_SYS_SDRAM_BASE +#define PHYS_SDRAM_1_SIZE	SDRAM_BANK_SIZE +#define PHYS_SDRAM_2		(CONFIG_SYS_SDRAM_BASE + SDRAM_BANK_SIZE) +#define PHYS_SDRAM_2_SIZE	SDRAM_BANK_SIZE +#define PHYS_SDRAM_3		(CONFIG_SYS_SDRAM_BASE + (2 * SDRAM_BANK_SIZE)) +#define PHYS_SDRAM_3_SIZE	SDRAM_BANK_SIZE +#define PHYS_SDRAM_4		(CONFIG_SYS_SDRAM_BASE + (3 * SDRAM_BANK_SIZE)) +#define PHYS_SDRAM_4_SIZE	SDRAM_BANK_SIZE  #define CONFIG_SYS_MEM_TOP_HIDE		(1 << 20)	/* ram console */ @@ -208,6 +235,10 @@  #define CONFIG_DOS_PARTITION +/* GPT */ +#define CONFIG_EFI_PARTITION +#define CONFIG_PARTITION_UUIDS +  #define CONFIG_SYS_INIT_SP_ADDR	(CONFIG_SYS_LOAD_ADDR - GENERATED_GBL_DATA_SIZE)  #define CONFIG_SYS_CACHELINE_SIZE       32 diff --git a/include/configs/tricorder.h b/include/configs/tricorder.h index be0d2ec3c..bcb0350b8 100644 --- a/include/configs/tricorder.h +++ b/include/configs/tricorder.h @@ -247,7 +247,6 @@  /*  Physical Memory Map  */  #define CONFIG_NR_DRAM_BANKS		2 /* CS1 may or may not be populated */  #define PHYS_SDRAM_1			OMAP34XX_SDRC_CS0 -#define PHYS_SDRAM_1_SIZE		(128 << 20)	/* at least 128 MiB */  #define PHYS_SDRAM_2			OMAP34XX_SDRC_CS1  /* NAND and environment organization  */ diff --git a/include/configs/trimslice.h b/include/configs/trimslice.h index eeb0dbe23..334d3a3b8 100644 --- a/include/configs/trimslice.h +++ b/include/configs/trimslice.h @@ -69,8 +69,11 @@  #define CONFIG_DOS_PARTITION  #define CONFIG_EFI_PARTITION +#define CONFIG_FS_EXT4 +#define CONFIG_FS_FAT  #define CONFIG_CMD_EXT2  #define CONFIG_CMD_FAT +#define CONFIG_CMD_FS_GENERIC  /* Environment in SPI */  #define CONFIG_ENV_IS_IN_SPI_FLASH @@ -80,6 +83,7 @@  #define CONFIG_ENV_OFFSET		(512 * 1024)  /* USB Host support */ +#define CONFIG_USB_MAX_CONTROLLER_COUNT 3  #define CONFIG_USB_EHCI  #define CONFIG_USB_EHCI_TEGRA  #define CONFIG_USB_STORAGE diff --git a/include/configs/utx8245.h b/include/configs/utx8245.h index d203bb4dd..66568c8d0 100644 --- a/include/configs/utx8245.h +++ b/include/configs/utx8245.h @@ -65,7 +65,6 @@  #define CONFIG_BOOTARGS		"root=/dev/ram console=ttyS0,57600" /* RAMdisk */  #define CONFIG_ETHADDR		00:AA:00:14:00:05	/* UTX5 */  #define CONFIG_SERVERIP		10.8.17.105	/* Spree */ -#define CONFIG_SYS_TFTP_LOADADDR	10000  #define CONFIG_EXTRA_ENV_SETTINGS \  	"kernel_addr=FFA00000\0" \ diff --git a/include/configs/ventana.h b/include/configs/ventana.h index 4c9b31cce..b55ebc9bf 100644 --- a/include/configs/ventana.h +++ b/include/configs/ventana.h @@ -52,8 +52,11 @@  #define CONFIG_DOS_PARTITION  #define CONFIG_EFI_PARTITION +#define CONFIG_FS_EXT4 +#define CONFIG_FS_FAT  #define CONFIG_CMD_EXT2  #define CONFIG_CMD_FAT +#define CONFIG_CMD_FS_GENERIC  /* Environment in eMMC, at the end of 2nd "boot sector" */  #define CONFIG_ENV_IS_IN_MMC diff --git a/include/configs/whistler.h b/include/configs/whistler.h index 1c7803b26..1e554d816 100644 --- a/include/configs/whistler.h +++ b/include/configs/whistler.h @@ -61,8 +61,11 @@  #define CONFIG_DOS_PARTITION  #define CONFIG_EFI_PARTITION +#define CONFIG_FS_EXT4 +#define CONFIG_FS_FAT  #define CONFIG_CMD_EXT2  #define CONFIG_CMD_FAT +#define CONFIG_CMD_FS_GENERIC  /*   * Environment in eMMC, at the end of 2nd "boot sector". Note: This assumes diff --git a/include/configs/zipitz2.h b/include/configs/zipitz2.h index bf6394a90..b92f70b53 100644 --- a/include/configs/zipitz2.h +++ b/include/configs/zipitz2.h @@ -41,6 +41,9 @@  #define CONFIG_ENV_ADDR			0x40000  #define CONFIG_ENV_SIZE			0x20000 +/* we will never enable dcache, because we have to setup MMU first */ +#define CONFIG_SYS_DCACHE_OFF +  #define	CONFIG_SYS_MALLOC_LEN		(128*1024)  #define	CONFIG_ARCH_CPU_INIT diff --git a/include/edid.h b/include/edid.h new file mode 100644 index 000000000..4788de939 --- /dev/null +++ b/include/edid.h @@ -0,0 +1,275 @@ +/* + * Copyright (c) 2012 The Chromium OS Authors. + * + * (C) Copyright 2010 + * Petr Stetiar <ynezz@true.cz> + * + * 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 + * + * Contains stolen code from ddcprobe project which is: + * Copyright (C) Nalin Dahyabhai <bigfun@pobox.com> + * + */ + +#ifndef __EDID_H_ +#define __EDID_H_ + +#include <linux/types.h> + +#define GET_BIT(_x, _pos) \ +	(((_x) >> (_pos)) & 1) +#define GET_BITS(_x, _pos_msb, _pos_lsb) \ +	(((_x) >> (_pos_lsb)) & ((1 << ((_pos_msb) - (_pos_lsb) + 1)) - 1)) + +/* Aspect ratios used in EDID info. */ +enum edid_aspect { +	ASPECT_625 = 0, +	ASPECT_75, +	ASPECT_8, +	ASPECT_5625, +}; + +/* Detailed timing information used in EDID v1.x */ +struct edid_detailed_timing { +	unsigned char pixel_clock[2]; +#define EDID_DETAILED_TIMING_PIXEL_CLOCK(_x) \ +	(((((uint32_t)(_x).pixel_clock[1]) << 8) + \ +	 (_x).pixel_clock[0]) * 10000) +	unsigned char horizontal_active; +	unsigned char horizontal_blanking; +	unsigned char horizontal_active_blanking_hi; +#define EDID_DETAILED_TIMING_HORIZONTAL_ACTIVE(_x) \ +	((GET_BITS((_x).horizontal_active_blanking_hi, 7, 4) << 8) + \ +	 (_x).horizontal_active) +#define EDID_DETAILED_TIMING_HORIZONTAL_BLANKING(_x) \ +	((GET_BITS((_x).horizontal_active_blanking_hi, 3, 0) << 8) + \ +	 (_x).horizontal_blanking) +	unsigned char vertical_active; +	unsigned char vertical_blanking; +	unsigned char vertical_active_blanking_hi; +#define EDID_DETAILED_TIMING_VERTICAL_ACTIVE(_x) \ +	((GET_BITS((_x).vertical_active_blanking_hi, 7, 4) << 8) + \ +	 (_x).vertical_active) +#define EDID_DETAILED_TIMING_VERTICAL_BLANKING(_x) \ +	((GET_BITS((_x).vertical_active_blanking_hi, 3, 0) << 8) + \ +	 (_x).vertical_blanking) +	unsigned char hsync_offset; +	unsigned char hsync_pulse_width; +	unsigned char sync_offset_pulse_width; +	unsigned char hsync_vsync_offset_pulse_width_hi; +#define EDID_DETAILED_TIMING_HSYNC_OFFSET(_x) \ +	((GET_BITS((_x).hsync_vsync_offset_pulse_width_hi, 7, 6) << 8) + \ +	 (_x).hsync_offset) +#define EDID_DETAILED_TIMING_HSYNC_PULSE_WIDTH(_x) \ +	((GET_BITS((_x).hsync_vsync_offset_pulse_width_hi, 5, 4) << 8) + \ +	 (_x).hsync_pulse_width) +#define EDID_DETAILED_TIMING_VSYNC_OFFSET(_x) \ +	((GET_BITS((_x).hsync_vsync_offset_pulse_width_hi, 3, 2) << 4) + \ +	 GET_BITS((_x).vsync_offset_pulse_width, 7, 4)) +#define EDID_DETAILED_TIMING_VSYNC_PULSE_WIDTH(_x) \ +	((GET_BITS((_x).hsync_vsync_offset_pulse_width_hi, 1, 0) << 4) + \ +	 GET_BITS((_x).vsync_offset_pulse_width, 3, 0)) +	unsigned char himage_size; +	unsigned char vimage_size; +	unsigned char himage_vimage_size_hi; +#define EDID_DETAILED_TIMING_HIMAGE_SIZE(_x) \ +	((GET_BITS((_x).himage_vimage_size_hi, 7, 4) << 8) + (_x).himage_size) +#define EDID_DETAILED_TIMING_VIMAGE_SIZE(_x) \ +	((GET_BITS((_x).himage_vimage_size_hi, 3, 0) << 8) + (_x).vimage_size) +	unsigned char hborder; +	unsigned char vborder; +	unsigned char flags; +#define EDID_DETAILED_TIMING_FLAG_INTERLACED(_x) \ +	GET_BIT((_x).flags, 7) +#define EDID_DETAILED_TIMING_FLAG_STEREO(_x) \ +	GET_BITS((_x).flags, 6, 5) +#define EDID_DETAILED_TIMING_FLAG_DIGITAL_COMPOSITE(_x) \ +	GET_BITS((_x).flags, 4, 3) +#define EDID_DETAILED_TIMING_FLAG_POLARITY(_x) \ +	GET_BITS((_x).flags, 2, 1) +#define EDID_DETAILED_TIMING_FLAG_INTERLEAVED(_x) \ +	GET_BIT((_x).flags, 0) +} __attribute__ ((__packed__)); + +enum edid_monitor_descriptor_types { +	EDID_MONITOR_DESCRIPTOR_SERIAL = 0xff, +	EDID_MONITOR_DESCRIPTOR_ASCII = 0xfe, +	EDID_MONITOR_DESCRIPTOR_RANGE = 0xfd, +	EDID_MONITOR_DESCRIPTOR_NAME = 0xfc, +}; + +struct edid_monitor_descriptor { +	uint16_t zero_flag_1; +	unsigned char zero_flag_2; +	unsigned char type; +	unsigned char zero_flag_3; +	union { +		char string[13]; +		struct { +			unsigned char vertical_min; +			unsigned char vertical_max; +			unsigned char horizontal_min; +			unsigned char horizontal_max; +			unsigned char pixel_clock_max; +			unsigned char gtf_data[8]; +		} range_data; +	} data; +} __attribute__ ((__packed__)); + +struct edid1_info { +	unsigned char header[8]; +	unsigned char manufacturer_name[2]; +#define EDID1_INFO_MANUFACTURER_NAME_ZERO(_x) \ +	GET_BIT(((_x).manufacturer_name[0]), 7) +#define EDID1_INFO_MANUFACTURER_NAME_CHAR1(_x) \ +	GET_BITS(((_x).manufacturer_name[0]), 6, 2) +#define EDID1_INFO_MANUFACTURER_NAME_CHAR2(_x) \ +	((GET_BITS(((_x).manufacturer_name[0]), 1, 0) << 3) + \ +	 GET_BITS(((_x).manufacturer_name[1]), 7, 5)) +#define EDID1_INFO_MANUFACTURER_NAME_CHAR3(_x) \ +	GET_BITS(((_x).manufacturer_name[1]), 4, 0) +	unsigned char product_code[2]; +#define EDID1_INFO_PRODUCT_CODE(_x) \ +	(((uint16_t)(_x).product_code[1] << 8) + (_x).product_code[0]) +	unsigned char serial_number[4]; +#define EDID1_INFO_SERIAL_NUMBER(_x) \ +	(((uint32_t)(_x).serial_number[3] << 24) + \ +	 ((_x).serial_number[2] << 16) + ((_x).serial_number[1] << 8) + \ +	 (_x).serial_number[0]) +	unsigned char week; +	unsigned char year; +	unsigned char version; +	unsigned char revision; +	unsigned char video_input_definition; +#define EDID1_INFO_VIDEO_INPUT_DIGITAL(_x) \ +	GET_BIT(((_x).video_input_definition), 7) +#define EDID1_INFO_VIDEO_INPUT_VOLTAGE_LEVEL(_x) \ +	GET_BITS(((_x).video_input_definition), 6, 5) +#define EDID1_INFO_VIDEO_INPUT_BLANK_TO_BLACK(_x) \ +	GET_BIT(((_x).video_input_definition), 4) +#define EDID1_INFO_VIDEO_INPUT_SEPARATE_SYNC(_x) \ +	GET_BIT(((_x).video_input_definition), 3) +#define EDID1_INFO_VIDEO_INPUT_COMPOSITE_SYNC(_x) \ +	GET_BIT(((_x).video_input_definition), 2) +#define EDID1_INFO_VIDEO_INPUT_SYNC_ON_GREEN(_x) \ +	GET_BIT(((_x).video_input_definition), 1) +#define EDID1_INFO_VIDEO_INPUT_SERRATION_V(_x) \ +	GET_BIT(((_x).video_input_definition), 0) +	unsigned char max_size_horizontal; +	unsigned char max_size_vertical; +	unsigned char gamma; +	unsigned char feature_support; +#define EDID1_INFO_FEATURE_STANDBY(_x) \ +	GET_BIT(((_x).feature_support), 7) +#define EDID1_INFO_FEATURE_SUSPEND(_x) \ +	GET_BIT(((_x).feature_support), 6) +#define EDID1_INFO_FEATURE_ACTIVE_OFF(_x) \ +	GET_BIT(((_x).feature_support), 5) +#define EDID1_INFO_FEATURE_DISPLAY_TYPE(_x) \ +	GET_BITS(((_x).feature_support), 4, 3) +#define EDID1_INFO_FEATURE_RGB(_x) \ +	GET_BIT(((_x).feature_support), 2) +#define EDID1_INFO_FEATURE_PREFERRED_TIMING_MODE(_x) \ +	GET_BIT(((_x).feature_support), 1) +#define EDID1_INFO_FEATURE_DEFAULT_GTF_SUPPORT(_x) \ +	GET_BIT(((_x).feature_support), 0) +	unsigned char color_characteristics[10]; +	unsigned char established_timings[3]; +#define EDID1_INFO_ESTABLISHED_TIMING_720X400_70(_x) \ +	GET_BIT(((_x).established_timings[0]), 7) +#define EDID1_INFO_ESTABLISHED_TIMING_720X400_88(_x) \ +	GET_BIT(((_x).established_timings[0]), 6) +#define EDID1_INFO_ESTABLISHED_TIMING_640X480_60(_x) \ +	GET_BIT(((_x).established_timings[0]), 5) +#define EDID1_INFO_ESTABLISHED_TIMING_640X480_67(_x) \ +	GET_BIT(((_x).established_timings[0]), 4) +#define EDID1_INFO_ESTABLISHED_TIMING_640X480_72(_x) \ +	GET_BIT(((_x).established_timings[0]), 3) +#define EDID1_INFO_ESTABLISHED_TIMING_640X480_75(_x) \ +	GET_BIT(((_x).established_timings[0]), 2) +#define EDID1_INFO_ESTABLISHED_TIMING_800X600_56(_x) \ +	GET_BIT(((_x).established_timings[0]), 1) +#define EDID1_INFO_ESTABLISHED_TIMING_800X600_60(_x) \ +	GET_BIT(((_x).established_timings[0]), 0) +#define EDID1_INFO_ESTABLISHED_TIMING_800X600_72(_x) \ +	GET_BIT(((_x).established_timings[1]), 7) +#define EDID1_INFO_ESTABLISHED_TIMING_800X600_75(_x) \ +	GET_BIT(((_x).established_timings[1]), 6) +#define EDID1_INFO_ESTABLISHED_TIMING_832X624_75(_x) \ +	GET_BIT(((_x).established_timings[1]), 5) +#define EDID1_INFO_ESTABLISHED_TIMING_1024X768_87I(_x) \ +	GET_BIT(((_x).established_timings[1]), 4) +#define EDID1_INFO_ESTABLISHED_TIMING_1024X768_60(_x) \ +	GET_BIT(((_x).established_timings[1]), 3) +#define EDID1_INFO_ESTABLISHED_TIMING_1024X768_70(_x) \ +	GET_BIT(((_x).established_timings[1]), 2) +#define EDID1_INFO_ESTABLISHED_TIMING_1024X768_75(_x) \ +	GET_BIT(((_x).established_timings[1]), 1) +#define EDID1_INFO_ESTABLISHED_TIMING_1280X1024_75(_x) \ +	GET_BIT(((_x).established_timings[1]), 0) +#define EDID1_INFO_ESTABLISHED_TIMING_1152X870_75(_x) \ +	GET_BIT(((_x).established_timings[2]), 7) +	struct { +		unsigned char xresolution; +		unsigned char aspect_vfreq; +	} __attribute__((__packed__)) standard_timings[8]; +#define EDID1_INFO_STANDARD_TIMING_XRESOLUTION(_x, _i) \ +	(((_x).standard_timings[_i]).xresolution) +#define EDID1_INFO_STANDARD_TIMING_ASPECT(_x, _i) \ +	GET_BITS(((_x).standard_timings[_i].aspect_vfreq), 7, 6) +#define EDID1_INFO_STANDARD_TIMING_VFREQ(_x, _i) \ +	GET_BITS(((_x).standard_timings[_i].aspect_vfreq), 5, 0) +	union { +		unsigned char timing[72]; +		struct edid_monitor_descriptor descriptor[4]; +	} monitor_details; +	unsigned char extension_flag; +	unsigned char checksum; +} __attribute__ ((__packed__)); + +/** + * Print the EDID info. + * + * @param edid_info	The EDID info to be printed + */ +void edid_print_info(struct edid1_info *edid_info); + +/** + * Check the EDID info. + * + * @param info  The EDID info to be checked + * @return 0 on valid, or -1 on invalid + */ +int edid_check_info(struct edid1_info *info); + +/** + * Get the horizontal and vertical rate ranges of the monitor. + * + * @param edid	The EDID info + * @param hmin	Returns the minimum horizontal rate + * @param hmax	Returns the maxium horizontal rate + * @param vmin	Returns the minimum vertical rate + * @param vmax	Returns the maxium vertical rate + * @return 0 on success, or -1 on error + */ +int edid_get_ranges(struct edid1_info *edid, unsigned int *hmin, +		    unsigned int *hmax, unsigned int *vmin, +		    unsigned int *vmax); + +#endif /* __EDID_H_ */ diff --git a/include/env_attr.h b/include/env_attr.h new file mode 100644 index 000000000..6ef114f5d --- /dev/null +++ b/include/env_attr.h @@ -0,0 +1,55 @@ +/* + * (C) Copyright 2012 + * Joe Hershberger, National Instruments, joe.hershberger@ni.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 __ENV_ATTR_H__ +#define __ENV_ATTR_H__ + +#define ENV_ATTR_LIST_DELIM	',' +#define ENV_ATTR_SEP		':' + +/* + * env_attr_walk takes as input an "attr_list" that takes the form: + *	attributes = [^,:\s]* + *	entry = name[:attributes] + *	list = entry[,list] + * It will call the "callback" function with the "name" and attribute as "value" + * The callback may return a non-0 to abort the list walk. + * This return value will be passed through to the caller. + * 0 is returned on success. + */ +extern int env_attr_walk(const char *attr_list, +	int (*callback)(const char *name, const char *value)); + +/* + * env_attr_lookup takes as input an "attr_list" with the same form as above. + * It also takes as input a "name" to look for. + * If the name is found in the list, it's value is copied into "attributes". + * There is no protection on attributes being too small for the value. + * It returns -1 if attributes is NULL, 1 if "name" is not found, 2 if + * "attr_list" is NULL. + * Returns 0 on success. + */ +extern int env_attr_lookup(const char *attr_list, const char *name, +	char *attributes); + +#endif /* __ENV_ATTR_H__ */ diff --git a/include/env_callback.h b/include/env_callback.h new file mode 100644 index 000000000..47fdc6fa9 --- /dev/null +++ b/include/env_callback.h @@ -0,0 +1,75 @@ +/* + * (C) Copyright 2012 + * Joe Hershberger, National Instruments, joe.hershberger@ni.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 __ENV_CALLBACK_H__ +#define __ENV_CALLBACK_H__ + +#include <env_flags.h> +#include <linker_lists.h> +#include <search.h> + +#define ENV_CALLBACK_VAR ".callbacks" + +/* Board configs can define additional static callback bindings */ +#ifndef CONFIG_ENV_CALLBACK_LIST_STATIC +#define CONFIG_ENV_CALLBACK_LIST_STATIC +#endif + +#ifdef CONFIG_SILENT_CONSOLE +#define SILENT_CALLBACK "silent:silent," +#else +#define SILENT_CALLBACK +#endif + +/* + * This list of callback bindings is static, but may be overridden by defining + * a new association in the ".callbacks" environment variable. + */ +#define ENV_CALLBACK_LIST_STATIC ENV_CALLBACK_VAR ":callbacks," \ +	ENV_FLAGS_VAR ":flags," \ +	"baudrate:baudrate," \ +	"bootfile:bootfile," \ +	"loadaddr:loadaddr," \ +	SILENT_CALLBACK \ +	"stdin:console,stdout:console,stderr:console," \ +	CONFIG_ENV_CALLBACK_LIST_STATIC + +struct env_clbk_tbl { +	const char *name;		/* Callback name */ +	int (*callback)(const char *name, const char *value, enum env_op op, +		int flags); +}; + +struct env_clbk_tbl *find_env_callback(const char *); +void env_callback_init(ENTRY *var_entry); + +/* + * Define a callback that can be associated with variables. + * when associated through the ".callbacks" environment variable, the callback + * will be executed any time the variable is inserted, overwritten, or deleted. + */ +#define U_BOOT_ENV_CALLBACK(name, callback) \ +	ll_entry_declare(struct env_clbk_tbl, name, env_clbk, env_clbk) = \ +	{#name, callback} + +#endif /* __ENV_CALLBACK_H__ */ diff --git a/include/env_default.h b/include/env_default.h index a1db73a2c..39c5b7c6a 100644 --- a/include/env_default.h +++ b/include/env_default.h @@ -24,6 +24,8 @@   * MA 02111-1307 USA   */ +#include <env_callback.h> +  #ifdef DEFAULT_ENV_INSTANCE_EMBEDDED  env_t environment __PPCENV__ = {  	ENV_CRC,	/* CRC Sum */ @@ -36,6 +38,12 @@ static char default_environment[] = {  #else  const uchar default_environment[] = {  #endif +#ifdef	CONFIG_ENV_CALLBACK_LIST_DEFAULT +	ENV_CALLBACK_VAR "=" CONFIG_ENV_CALLBACK_LIST_DEFAULT "\0" +#endif +#ifdef	CONFIG_ENV_FLAGS_LIST_DEFAULT +	ENV_FLAGS_VAR "=" CONFIG_ENV_FLAGS_LIST_DEFAULT "\0" +#endif  #ifdef	CONFIG_BOOTARGS  	"bootargs="	CONFIG_BOOTARGS			"\0"  #endif diff --git a/include/env_flags.h b/include/env_flags.h new file mode 100644 index 000000000..d1aa1440f --- /dev/null +++ b/include/env_flags.h @@ -0,0 +1,172 @@ +/* + * (C) Copyright 2012 + * Joe Hershberger, National Instruments, joe.hershberger@ni.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 __ENV_FLAGS_H__ +#define __ENV_FLAGS_H__ + +enum env_flags_vartype { +	env_flags_vartype_string, +	env_flags_vartype_decimal, +	env_flags_vartype_hex, +	env_flags_vartype_bool, +#ifdef CONFIG_CMD_NET +	env_flags_vartype_ipaddr, +	env_flags_vartype_macaddr, +#endif +	env_flags_vartype_end +}; + +enum env_flags_varaccess { +	env_flags_varaccess_any, +	env_flags_varaccess_readonly, +	env_flags_varaccess_writeonce, +	env_flags_varaccess_changedefault, +	env_flags_varaccess_end +}; + +#define ENV_FLAGS_VAR ".flags" +#define ENV_FLAGS_ATTR_MAX_LEN 2 +#define ENV_FLAGS_VARTYPE_LOC 0 +#define ENV_FLAGS_VARACCESS_LOC 1 + +#ifndef CONFIG_ENV_FLAGS_LIST_STATIC +#define CONFIG_ENV_FLAGS_LIST_STATIC "" +#endif + +#ifdef CONFIG_CMD_NET +#ifdef CONFIG_ENV_OVERWRITE +#define ETHADDR_FLAGS "ethaddr:ma," +#else +#ifdef CONFIG_OVERWRITE_ETHADDR_ONCE +#define ETHADDR_FLAGS "ethaddr:mc," +#else +#define ETHADDR_FLAGS "ethaddr:mo," +#endif +#endif +#else +#define ETHADDR_FLAGS "" +#endif + +#ifndef CONFIG_ENV_OVERWRITE +#define SERIAL_FLAGS "serial#:so," +#else +#define SERIAL_FLAGS "" +#endif + +#define ENV_FLAGS_LIST_STATIC \ +	ETHADDR_FLAGS \ +	SERIAL_FLAGS \ +	CONFIG_ENV_FLAGS_LIST_STATIC + +#ifdef CONFIG_CMD_ENV_FLAGS +/* + * Print the whole list of available type flags. + */ +void env_flags_print_vartypes(void); +/* + * Print the whole list of available access flags. + */ +void env_flags_print_varaccess(void); +/* + * Return the name of the type. + */ +const char *env_flags_get_vartype_name(enum env_flags_vartype type); +/* + * Return the name of the access. + */ +const char *env_flags_get_varaccess_name(enum env_flags_varaccess access); +#endif + +/* + * Parse the flags string from a .flags attribute list into the vartype enum. + */ +enum env_flags_vartype env_flags_parse_vartype(const char *flags); +/* + * Parse the flags string from a .flags attribute list into the varaccess enum. + */ +enum env_flags_varaccess env_flags_parse_varaccess(const char *flags); +/* + * Parse the binary flags from a hash table entry into the varaccess enum. + */ +enum env_flags_varaccess env_flags_parse_varaccess_from_binflags(int binflags); + +#ifdef USE_HOSTCC +/* + * Look up the type of a variable directly from the .flags var. + */ +enum env_flags_vartype env_flags_get_type(const char *name); +/* + * Look up the access of a variable directly from the .flags var. + */ +enum env_flags_varaccess env_flags_get_access(const char *name); +/* + * Validate the newval for its type to conform with the requirements defined by + * its flags (directly looked at the .flags var). + */ +int env_flags_validate_type(const char *name, const char *newval); +/* + * Validate the newval for its access to conform with the requirements defined + * by its flags (directly looked at the .flags var). + */ +int env_flags_validate_access(const char *name, int check_mask); +/* + * Validate that the proposed access to variable "name" is valid according to + * the defined flags for that variable, if any. + */ +int env_flags_validate_varaccess(const char *name, int check_mask); +/* + * Validate the parameters passed to "env set" for type compliance + */ +int env_flags_validate_env_set_params(int argc, char * const argv[]); + +#else /* !USE_HOSTCC */ + +#include <search.h> + +/* + * When adding a variable to the environment, initialize the flags for that + * variable. + */ +void env_flags_init(ENTRY *var_entry); + +/* + * Validate the newval for to conform with the requirements defined by its flags + */ +int env_flags_validate(const ENTRY *item, const char *newval, enum env_op op, +	int flag); + +#endif /* USE_HOSTCC */ + +/* + * These are the binary flags used in the environment entry->flags variable to + * decribe properties of veriables in the table + */ +#define ENV_FLAGS_VARTYPE_BIN_MASK			0x00000007 +/* The actual variable type values use the enum value (within the mask) */ +#define ENV_FLAGS_VARACCESS_PREVENT_DELETE		0x00000008 +#define ENV_FLAGS_VARACCESS_PREVENT_CREATE		0x00000010 +#define ENV_FLAGS_VARACCESS_PREVENT_OVERWR		0x00000020 +#define ENV_FLAGS_VARACCESS_PREVENT_NONDEF_OVERWR	0x00000040 +#define ENV_FLAGS_VARACCESS_BIN_MASK			0x00000078 + +#endif /* __ENV_FLAGS_H__ */ diff --git a/include/environment.h b/include/environment.h index e8ab7033b..e64b43d2d 100644 --- a/include/environment.h +++ b/include/environment.h @@ -164,6 +164,9 @@ extern void env_reloc(void);  #ifndef DO_DEPS_ONLY +#include <env_attr.h> +#include <env_callback.h> +#include <env_flags.h>  #include <search.h>  extern struct hsearch_data env_htab; @@ -178,6 +181,9 @@ unsigned char env_get_char_memory(int index);  /* Function that updates CRC of the enironment */  void env_crc_update(void); +/* Look up the variable from the default environment */ +char *getenv_default(const char *name); +  /* [re]set to the default environment */  void set_default_env(const char *s); @@ -187,15 +193,6 @@ int set_default_vars(int nvars, char * const vars[]);  /* Import from binary representation into hash table */  int env_import(const char *buf, int check); -/* - * Check if variable "name" can be changed from oldval to newval, - * and if so, apply the changes (e.g. baudrate). - * When (flag & H_FORCE) is set, it does not print out any error - * message and forces overwriting of write-once variables. - */ -int env_check_apply(const char *name, const char *oldval, -			const char *newval, int flag); -  #endif /* DO_DEPS_ONLY */  #endif /* _ENVIRONMENT_H_ */ diff --git a/include/exports.h b/include/exports.h index 63aa4b264..6cf31aa5e 100644 --- a/include/exports.h +++ b/include/exports.h @@ -23,7 +23,7 @@ char *getenv (const char *name);  int setenv (const char *varname, const char *varvalue);  long simple_strtol(const char *cp,char **endp,unsigned int base);  int strcmp(const char * cs,const char * ct); -int ustrtoul(const char *cp, char **endp, unsigned int base); +unsigned long ustrtoul(const char *cp, char **endp, unsigned int base);  #if defined(CONFIG_CMD_I2C)  int i2c_write (uchar, uint, int , uchar* , int);  int i2c_read (uchar, uint, int , uchar* , int); diff --git a/include/fdtdec.h b/include/fdtdec.h index 5164ce24e..70d0e979d 100644 --- a/include/fdtdec.h +++ b/include/fdtdec.h @@ -68,6 +68,8 @@ enum fdt_compat_id {  	COMPAT_NVIDIA_TEGRA20_EMC_TABLE, /* Tegra20 memory timing table */  	COMPAT_NVIDIA_TEGRA20_KBC,	/* Tegra20 Keyboard */  	COMPAT_NVIDIA_TEGRA20_NAND,	/* Tegra2 NAND controller */ +	COMPAT_NVIDIA_TEGRA20_PWM,	/* Tegra 2 PWM controller */ +	COMPAT_NVIDIA_TEGRA20_DC,	/* Tegra 2 Display controller */  	COMPAT_COUNT,  }; diff --git a/include/hash.h b/include/hash.h new file mode 100644 index 000000000..34ba558bd --- /dev/null +++ b/include/hash.h @@ -0,0 +1,69 @@ +/* + * 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 _HASH_H +#define _HASH_H + +#ifdef CONFIG_SHA1SUM_VERIFY +#define CONFIG_HASH_VERIFY +#endif + +struct hash_algo { +	const char *name;			/* Name of algorithm */ +	int digest_size;			/* Length of digest */ +	/** +	 * hash_func_ws: Generic hashing function +	 * +	 * This is the generic prototype for a hashing function. We only +	 * have the watchdog version at present. +	 * +	 * @input:	Input buffer +	 * @ilen:	Input buffer length +	 * @output:	Checksum result (length depends on algorithm) +	 * @chunk_sz:	Trigger watchdog after processing this many bytes +	 */ +	void (*hash_func_ws)(const unsigned char *input, unsigned int ilen, +		unsigned char *output, unsigned int chunk_sz); +	int chunk_size;				/* Watchdog chunk size */ +}; + +/* + * Maximum digest size for all algorithms we support. Having this value + * avoids a malloc() or C99 local declaration in common/cmd_hash.c. + */ +#define HASH_MAX_DIGEST_SIZE	32 + +/** + * hash_command: Process a hash command for a particular algorithm + * + * This common function is used to implement specific hash commands. + * + * @algo_name:		Hash algorithm being used + * @verify:		Non-zero to enable verify mode + * @cmdtp:		Pointer to command table entry + * @flag:		Some flags normally 0 (see CMD_FLAG_.. above) + * @argc:		Number of arguments (arg 0 must be the command text) + * @argv:		Arguments + */ +int hash_command(const char *algo_name, int verify, cmd_tbl_t *cmdtp, int flag, +		 int argc, char * const argv[]); + +#endif diff --git a/include/i2s.h b/include/i2s.h new file mode 100644 index 000000000..75ae75cf2 --- /dev/null +++ b/include/i2s.h @@ -0,0 +1,127 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * R. Chandrasekar <rcsekar@samsung.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 __I2S_H__ +#define __I2S_H__ + +/* + * DAI hardware audio formats. + * + * Describes the physical PCM data formating and clocking. Add new formats + * to the end. + */ +#define SND_SOC_DAIFMT_I2S		1 /* I2S mode */ +#define SND_SOC_DAIFMT_RIGHT_J		2 /* Right Justified mode */ +#define SND_SOC_DAIFMT_LEFT_J		3 /* Left Justified mode */ +#define SND_SOC_DAIFMT_DSP_A		4 /* L data MSB after FRM LRC */ +#define SND_SOC_DAIFMT_DSP_B		5 /* L data MSB during FRM LRC */ +#define SND_SOC_DAIFMT_AC97		6 /* AC97 */ +#define SND_SOC_DAIFMT_PDM		7 /* Pulse density modulation */ + +/* left and right justified also known as MSB and LSB respectively */ +#define SND_SOC_DAIFMT_MSB		SND_SOC_DAIFMT_LEFT_J +#define SND_SOC_DAIFMT_LSB		SND_SOC_DAIFMT_RIGHT_J + +/* + * DAI hardware signal inversions. + * + * Specifies whether the DAI can also support inverted clocks for the specified + * format. + */ +#define SND_SOC_DAIFMT_NB_NF	(1 << 8) /* normal bit clock + frame */ +#define SND_SOC_DAIFMT_NB_IF	(2 << 8) /* normal BCLK + inv FRM */ +#define SND_SOC_DAIFMT_IB_NF	(3 << 8) /* invert BCLK + nor FRM */ +#define SND_SOC_DAIFMT_IB_IF	(4 << 8) /* invert BCLK + FRM */ + +/* + * DAI hardware clock masters. + * + * This is wrt the codec, the inverse is true for the interface + * i.e. if the codec is clk and FRM master then the interface is + * clk and frame slave. + */ +#define SND_SOC_DAIFMT_CBM_CFM	(1 << 12) /* codec clk & FRM master */ +#define SND_SOC_DAIFMT_CBS_CFM	(2 << 12) /* codec clk slave & FRM master */ +#define SND_SOC_DAIFMT_CBM_CFS	(3 << 12) /* codec clk master & frame slave */ +#define SND_SOC_DAIFMT_CBS_CFS	(4 << 12) /* codec clk & FRM slave */ + +#define SND_SOC_DAIFMT_FORMAT_MASK	0x000f +#define SND_SOC_DAIFMT_CLOCK_MASK	0x00f0 +#define SND_SOC_DAIFMT_INV_MASK		0x0f00 +#define SND_SOC_DAIFMT_MASTER_MASK	0xf000 + +/* + * Master Clock Directions + */ +#define SND_SOC_CLOCK_IN		0 +#define SND_SOC_CLOCK_OUT		1 + +/* I2S Tx Control */ +#define I2S_TX_ON	1 +#define I2S_TX_OFF	0 + +#define FIFO_LENGTH	64 + +/* I2s Registers */ +struct i2s_reg { +	unsigned int con;	/* base + 0 , Control register */ +	unsigned int mod;	/* Mode register */ +	unsigned int fic;	/* FIFO control register */ +	unsigned int psr;	/* Reserved */ +	unsigned int txd;	/* Transmit data register */ +	unsigned int rxd;	/* Receive Data Register */ +}; + +/* This structure stores the i2s related information */ +struct i2stx_info { +	unsigned int rfs;		/* LR clock frame size */ +	unsigned int bfs;		/* Bit slock frame size */ +	unsigned int audio_pll_clk;	/* Audio pll frequency in Hz */ +	unsigned int samplingrate;	/* sampling rate */ +	unsigned int bitspersample;	/* bits per sample */ +	unsigned int channels;		/* audio channels */ +	unsigned int base_address;	/* I2S Register Base */ +}; + +/* + * Sends the given data through i2s tx + * + * @param pi2s_tx	pointer of i2s transmitter parameter structure. + * @param data		address of the data buffer + * @param data_size	array size of the int buffer (total size / size of int) + * + * @return		int value 0 for success, -1 in case of error + */ +int i2s_transfer_tx_data(struct i2stx_info *pi2s_tx, unsigned *data, +				unsigned long data_size); + +/* + * Initialise i2s transmiter + * + * @param pi2s_tx	pointer of i2s transmitter parameter structure. + * + * @return		int value 0 for success, -1 in case of error + */ +int i2s_tx_init(struct i2stx_info *pi2s_tx); + +#endif /* __I2S_H__ */ diff --git a/include/image.h b/include/image.h index 3a472c9b7..f5adc5035 100644 --- a/include/image.h +++ b/include/image.h @@ -463,7 +463,6 @@ static inline void image_set_name(image_header_t *hdr, const char *name)  int image_check_hcrc(const image_header_t *hdr);  int image_check_dcrc(const image_header_t *hdr);  #ifndef USE_HOSTCC -int getenv_yesno(char *var);  ulong getenv_bootm_low(void);  phys_size_t getenv_bootm_size(void);  phys_size_t getenv_bootm_mapsize(void); diff --git a/include/lcd.h b/include/lcd.h index 2517d39d4..c24164a9d 100644 --- a/include/lcd.h +++ b/include/lcd.h @@ -57,6 +57,14 @@ extern void lcd_initcolregs (void);  extern struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp);  extern int bmp_display(ulong addr, int x, int y); +/** + * Set whether we need to flush the dcache when changing the LCD image. This + * defaults to off. + * + * @param flush		non-zero to flush cache after update, 0 to skip + */ +void lcd_set_flush_dcache(int flush); +  #if defined CONFIG_MPC823  /*   * LCD controller stucture for MPC823 CPU @@ -333,6 +341,9 @@ void lcd_position_cursor(unsigned col, unsigned row);  /* Allow boards to customize the information displayed */  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); +  /************************************************************************/  /* ** BITMAP DISPLAY SUPPORT						*/  /************************************************************************/ diff --git a/include/ld9040.h b/include/ld9040.h new file mode 100644 index 000000000..fe99390e5 --- /dev/null +++ b/include/ld9040.h @@ -0,0 +1,32 @@ +/* + * ld9040 AMOLED LCD panel driver. + * + * Copyright (C) 2012 Samsung Electronics + * Donghwa Lee <dh09.lee@samsung.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 __LD9040_H_ +#define __LD9040_H_ + +void ld9040_cfg_ldo(void); +void ld9040_enable_ldo(unsigned int onoff); + +#endif /* __LD9040_H_ */ diff --git a/include/linux/linux_string.h b/include/linux/linux_string.h new file mode 100644 index 000000000..192b4c9be --- /dev/null +++ b/include/linux/linux_string.h @@ -0,0 +1,8 @@ +#ifndef _LINUX_LINUX_STRING_H_ +#define _LINUX_LINUX_STRING_H_ + +extern char * skip_spaces(const char *); + +extern char *strim(char *); + +#endif diff --git a/include/linux/string.h b/include/linux/string.h index 9a8cbc24c..e9b134d14 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -38,8 +38,11 @@ extern int strcmp(const char *,const char *);  #ifndef __HAVE_ARCH_STRNCMP  extern int strncmp(const char *,const char *,__kernel_size_t);  #endif -#if 0 /* not used - was: #ifndef __HAVE_ARCH_STRNICMP */ -extern int strnicmp(const char *, const char *, __kernel_size_t); +#ifndef __HAVE_ARCH_STRCASECMP +int strcasecmp(const char *s1, const char *s2); +#endif +#ifndef __HAVE_ARCH_STRNCASECMP +extern int strncasecmp(const char *s1, const char *s2, __kernel_size_t len);  #endif  #ifndef __HAVE_ARCH_STRCHR  extern char * strchr(const char *,int); @@ -47,10 +50,7 @@ extern char * strchr(const char *,int);  #ifndef __HAVE_ARCH_STRRCHR  extern char * strrchr(const char *,int);  #endif -extern char * skip_spaces(const char *); - -extern char *strim(char *); - +#include <linux/linux_string.h>  #ifndef __HAVE_ARCH_STRSTR  extern char * strstr(const char *,const char *);  #endif diff --git a/include/part.h b/include/part.h index 27ea283f1..c58a734ad 100644 --- a/include/part.h +++ b/include/part.h @@ -176,10 +176,62 @@ int   test_part_amiga (block_dev_desc_t *dev_desc);  #endif  #ifdef CONFIG_EFI_PARTITION +#include <part_efi.h>  /* disk/part_efi.c */  int get_partition_info_efi (block_dev_desc_t * dev_desc, int part, disk_partition_t *info);  void print_part_efi (block_dev_desc_t *dev_desc);  int   test_part_efi (block_dev_desc_t *dev_desc); + +/** + * write_gpt_table() - Write the GUID Partition Table to disk + * + * @param dev_desc - block device descriptor + * @param gpt_h - pointer to GPT header representation + * @param gpt_e - pointer to GPT partition table entries + * + * @return - zero on success, otherwise error + */ +int write_gpt_table(block_dev_desc_t *dev_desc, +		  gpt_header *gpt_h, gpt_entry *gpt_e); + +/** + * gpt_fill_pte(): Fill the GPT partition table entry + * + * @param gpt_h - GPT header representation + * @param gpt_e - GPT partition table entries + * @param partitions - list of partitions + * @param parts - number of partitions + * + * @return zero on success + */ +int gpt_fill_pte(gpt_header *gpt_h, gpt_entry *gpt_e, +		disk_partition_t *partitions, int parts); + +/** + * gpt_fill_header(): Fill the GPT header + * + * @param dev_desc - block device descriptor + * @param gpt_h - GPT header representation + * @param str_guid - disk guid string representation + * @param parts_count - number of partitions + * + * @return - error on str_guid conversion error + */ +int gpt_fill_header(block_dev_desc_t *dev_desc, gpt_header *gpt_h, +		char *str_guid, int parts_count); + +/** + * gpt_restore(): Restore GPT partition table + * + * @param dev_desc - block device descriptor + * @param str_disk_guid - disk GUID + * @param partitions - list of partitions + * @param parts - number of partitions + * + * @return zero on success + */ +int gpt_restore(block_dev_desc_t *dev_desc, char *str_disk_guid, +		disk_partition_t *partitions, const int parts_count);  #endif  #endif /* _PART_H */ diff --git a/include/part_efi.h b/include/part_efi.h new file mode 100644 index 000000000..6de0a3258 --- /dev/null +++ b/include/part_efi.h @@ -0,0 +1,147 @@ +/* + * Copyright (C) 2008 RuggedCom, Inc. + * Richard Retanubun <RichardRetanubun@RuggedCom.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 + */ + +/* + * See also linux/fs/partitions/efi.h + * + * EFI GUID Partition Table + * Per Intel EFI Specification v1.02 + * http://developer.intel.com/technology/efi/efi.htm +*/ + +#include <linux/compiler.h> + +#ifndef _DISK_PART_EFI_H +#define _DISK_PART_EFI_H + +#define MSDOS_MBR_SIGNATURE 0xAA55 +#define EFI_PMBR_OSTYPE_EFI 0xEF +#define EFI_PMBR_OSTYPE_EFI_GPT 0xEE + +#define GPT_BLOCK_SIZE 512 +#define GPT_HEADER_SIGNATURE 0x5452415020494645ULL +#define GPT_HEADER_REVISION_V1 0x00010000 +#define GPT_PRIMARY_PARTITION_TABLE_LBA 1ULL +#define GPT_ENTRY_NAME "gpt" +#define GPT_ENTRY_NUMBERS		128 +#define GPT_ENTRY_SIZE			128 + +#define EFI_GUID(a,b,c,d0,d1,d2,d3,d4,d5,d6,d7) \ +	((efi_guid_t) \ +	{{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \ +		(b) & 0xff, ((b) >> 8) & 0xff, \ +		(c) & 0xff, ((c) >> 8) & 0xff, \ +		(d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }}) + +#define PARTITION_SYSTEM_GUID \ +	EFI_GUID( 0xC12A7328, 0xF81F, 0x11d2, \ +		0xBA, 0x4B, 0x00, 0xA0, 0xC9, 0x3E, 0xC9, 0x3B) +#define LEGACY_MBR_PARTITION_GUID \ +	EFI_GUID( 0x024DEE41, 0x33E7, 0x11d3, \ +		0x9D, 0x69, 0x00, 0x08, 0xC7, 0x81, 0xF3, 0x9F) +#define PARTITION_MSFT_RESERVED_GUID \ +	EFI_GUID( 0xE3C9E316, 0x0B5C, 0x4DB8, \ +		0x81, 0x7D, 0xF9, 0x2D, 0xF0, 0x02, 0x15, 0xAE) +#define PARTITION_BASIC_DATA_GUID \ +	EFI_GUID( 0xEBD0A0A2, 0xB9E5, 0x4433, \ +		0x87, 0xC0, 0x68, 0xB6, 0xB7, 0x26, 0x99, 0xC7) +#define PARTITION_LINUX_RAID_GUID \ +	EFI_GUID( 0xa19d880f, 0x05fc, 0x4d3b, \ +		0xa0, 0x06, 0x74, 0x3f, 0x0f, 0x84, 0x91, 0x1e) +#define PARTITION_LINUX_SWAP_GUID \ +	EFI_GUID( 0x0657fd6d, 0xa4ab, 0x43c4, \ +		0x84, 0xe5, 0x09, 0x33, 0xc8, 0x4b, 0x4f, 0x4f) +#define PARTITION_LINUX_LVM_GUID \ +	EFI_GUID( 0xe6d6d379, 0xf507, 0x44c2, \ +		0xa2, 0x3c, 0x23, 0x8f, 0x2a, 0x3d, 0xf9, 0x28) + +/* linux/include/efi.h */ +typedef u16 efi_char16_t; + +typedef struct { +	u8 b[16]; +} efi_guid_t; + +/* based on linux/include/genhd.h */ +struct partition { +	u8 boot_ind;		/* 0x80 - active */ +	u8 head;		/* starting head */ +	u8 sector;		/* starting sector */ +	u8 cyl;			/* starting cylinder */ +	u8 sys_ind;		/* What partition type */ +	u8 end_head;		/* end head */ +	u8 end_sector;		/* end sector */ +	u8 end_cyl;		/* end cylinder */ +	__le32 start_sect;	/* starting sector counting from 0 */ +	__le32 nr_sects;	/* nr of sectors in partition */ +} __packed; + +/* based on linux/fs/partitions/efi.h */ +typedef struct _gpt_header { +	__le64 signature; +	__le32 revision; +	__le32 header_size; +	__le32 header_crc32; +	__le32 reserved1; +	__le64 my_lba; +	__le64 alternate_lba; +	__le64 first_usable_lba; +	__le64 last_usable_lba; +	efi_guid_t disk_guid; +	__le64 partition_entry_lba; +	__le32 num_partition_entries; +	__le32 sizeof_partition_entry; +	__le32 partition_entry_array_crc32; +	u8 reserved2[GPT_BLOCK_SIZE - 92]; +} __packed gpt_header; + +typedef union _gpt_entry_attributes { +	struct { +		u64 required_to_function:1; +		u64 no_block_io_protocol:1; +		u64 legacy_bios_bootable:1; +		u64 reserved:45; +		u64 type_guid_specific:16; +	} fields; +	unsigned long long raw; +} __packed gpt_entry_attributes; + +#define PARTNAME_SZ	(72 / sizeof(efi_char16_t)) +typedef struct _gpt_entry { +	efi_guid_t partition_type_guid; +	efi_guid_t unique_partition_guid; +	__le64 starting_lba; +	__le64 ending_lba; +	gpt_entry_attributes attributes; +	efi_char16_t partition_name[PARTNAME_SZ]; +} __packed gpt_entry; + +typedef struct _legacy_mbr { +	u8 boot_code[440]; +	__le32 unique_mbr_signature; +	__le16 unknown; +	struct partition partition_record[4]; +	__le16 signature; +} __packed legacy_mbr; + +#endif	/* _DISK_PART_EFI_H */ diff --git a/include/power/max77686_pmic.h b/include/power/max77686_pmic.h new file mode 100644 index 000000000..d949aced0 --- /dev/null +++ b/include/power/max77686_pmic.h @@ -0,0 +1,158 @@ +/* + *  Copyright (C) 2012 Samsung Electronics + *  Rajeshwari Shinde <rajeshwari.s@samsung.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 __MAX77686_H_ +#define __MAX77686_H_ + +enum { +	MAX77686_REG_PMIC_ID		= 0x0, +	MAX77686_REG_PMIC_INTSRC, +	MAX77686_REG_PMIC_INT1, +	MAX77686_REG_PMIC_INT2, +	MAX77686_REG_PMIC_INT1MSK, +	MAX77686_REG_PMIC_INT2MSK, + +	MAX77686_REG_PMIC_STATUS1, +	MAX77686_REG_PMIC_STATUS2, + +	MAX77686_REG_PMIC_PWRON, +	MAX77686_REG_PMIC_ONOFFDELAY, +	MAX77686_REG_PMIC_MRSTB, + +	MAX77686_REG_PMIC_BUCK1CRTL	= 0x10, +	MAX77686_REG_PMIC_BUCK1OUT, +	MAX77686_REG_PMIC_BUCK2CTRL1, +	MAX77686_REG_PMIC_BUCK234FREQ, +	MAX77686_REG_PMIC_BUCK2DVS1, +	MAX77686_REG_PMIC_BUCK2DVS2, +	MAX77686_REG_PMIC_BUCK2DVS3, +	MAX77686_REG_PMIC_BUCK2DVS4, +	MAX77686_REG_PMIC_BUCK2DVS5, +	MAX77686_REG_PMIC_BUCK2DVS6, +	MAX77686_REG_PMIC_BUCK2DVS7, +	MAX77686_REG_PMIC_BUCK2DVS8, +	MAX77686_REG_PMIC_BUCK3CTRL, +	MAX77686_REG_PMIC_BUCK3DVS1, +	MAX77686_REG_PMIC_BUCK3DVS2, +	MAX77686_REG_PMIC_BUCK3DVS3, +	MAX77686_REG_PMIC_BUCK3DVS4, +	MAX77686_REG_PMIC_BUCK3DVS5, +	MAX77686_REG_PMIC_BUCK3DVS6, +	MAX77686_REG_PMIC_BUCK3DVS7, +	MAX77686_REG_PMIC_BUCK3DVS8, +	MAX77686_REG_PMIC_BUCK4CTRL1, +	MAX77686_REG_PMIC_BUCK4DVS1	= 0x28, +	MAX77686_REG_PMIC_BUCK4DVS2, +	MAX77686_REG_PMIC_BUCK4DVS3, +	MAX77686_REG_PMIC_BUCK4DVS4, +	MAX77686_REG_PMIC_BUCK4DVS5, +	MAX77686_REG_PMIC_BUCK4DVS6, +	MAX77686_REG_PMIC_BUCK4DVS7, +	MAX77686_REG_PMIC_BUCK4DVS8, +	MAX77686_REG_PMIC_BUCK5CTRL, +	MAX77686_REG_PMIC_BUCK5OUT, +	MAX77686_REG_PMIC_BUCK6CRTL, +	MAX77686_REG_PMIC_BUCK6OUT, +	MAX77686_REG_PMIC_BUCK7CRTL, +	MAX77686_REG_PMIC_BUCK7OUT, +	MAX77686_REG_PMIC_BUCK8CRTL, +	MAX77686_REG_PMIC_BUCK8OUT, +	MAX77686_REG_PMIC_BUCK9CRTL, +	MAX77686_REG_PMIC_BUCK9OUT, + +	MAX77686_REG_PMIC_LDO1CTRL1	= 0x40, +	MAX77686_REG_PMIC_LDO2CTRL1, +	MAX77686_REG_PMIC_LDO3CTRL1, +	MAX77686_REG_PMIC_LDO4CTRL1, +	MAX77686_REG_PMIC_LDO5CTRL1, +	MAX77686_REG_PMIC_LDO6CTRL1, +	MAX77686_REG_PMIC_LDO7CTRL1, +	MAX77686_REG_PMIC_LDO8CTRL1, +	MAX77686_REG_PMIC_LDO9CTRL1, +	MAX77686_REG_PMIC_LDO10CTRL1, +	MAX77686_REG_PMIC_LDO11CTRL1, +	MAX77686_REG_PMIC_LDO12CTRL1, +	MAX77686_REG_PMIC_LDO13CTRL1, +	MAX77686_REG_PMIC_LDO14CTRL1, +	MAX77686_REG_PMIC_LDO15CTRL1, +	MAX77686_REG_PMIC_LDO16CTRL1, +	MAX77686_REG_PMIC_LDO17CTRL1, +	MAX77686_REG_PMIC_LDO18CTRL1, +	MAX77686_REG_PMIC_LDO19CTRL1, +	MAX77686_REG_PMIC_LDO20CTRL1, +	MAX77686_REG_PMIC_LDO21CTRL1, +	MAX77686_REG_PMIC_LDO22CTRL1, +	MAX77686_REG_PMIC_LDO23CTRL1, +	MAX77686_REG_PMIC_LDO24CTRL1, +	MAX77686_REG_PMIC_LDO25CTRL1, +	MAX77686_REG_PMIC_LDO26CTRL1, +	MAX77686_REG_PMIC_LDO1CTRL2, +	MAX77686_REG_PMIC_LDO2CTRL2, +	MAX77686_REG_PMIC_LDO3CTRL2, +	MAX77686_REG_PMIC_LDO4CTRL2, +	MAX77686_REG_PMIC_LDO5CTRL2, +	MAX77686_REG_PMIC_LDO6CTRL2, +	MAX77686_REG_PMIC_LDO7CTRL2, +	MAX77686_REG_PMIC_LDO8CTRL2, +	MAX77686_REG_PMIC_LDO9CTRL2, +	MAX77686_REG_PMIC_LDO10CTRL2, +	MAX77686_REG_PMIC_LDO11CTRL2, +	MAX77686_REG_PMIC_LDO12CTRL2, +	MAX77686_REG_PMIC_LDO13CTRL2, +	MAX77686_REG_PMIC_LDO14CTRL2, +	MAX77686_REG_PMIC_LDO15CTRL2, +	MAX77686_REG_PMIC_LDO16CTRL2, +	MAX77686_REG_PMIC_LDO17CTRL2, +	MAX77686_REG_PMIC_LDO18CTRL2, +	MAX77686_REG_PMIC_LDO19CTRL2, +	MAX77686_REG_PMIC_LDO20CTRL2, +	MAX77686_REG_PMIC_LDO21CTRL2, +	MAX77686_REG_PMIC_LDO22CTRL2, +	MAX77686_REG_PMIC_LDO23CTRL2, +	MAX77686_REG_PMIC_LDO24CTRL2, +	MAX77686_REG_PMIC_LDO25CTRL2, +	MAX77686_REG_PMIC_LDO26CTRL2, + +	MAX77686_REG_PMIC_BBAT		= 0x7e, +	MAX77686_REG_PMIC_32KHZ, + +	PMIC_NUM_OF_REGS, +}; + +/* I2C device address for pmic max77686 */ +#define MAX77686_I2C_ADDR (0x12 >> 1) + +enum { +	REG_DISABLE = 0, +	REG_ENABLE +}; + +enum { +	LDO_OFF = 0, +	LDO_ON, + +	DIS_LDO = (0x00 << 6), +	EN_LDO = (0x3 << 6), +}; + +#endif /* __MAX77686_PMIC_H_ */ diff --git a/include/power/max8998_pmic.h b/include/power/max8998_pmic.h index ca21f882c..0e559f986 100644 --- a/include/power/max8998_pmic.h +++ b/include/power/max8998_pmic.h @@ -76,7 +76,9 @@ enum {  #define MAX8998_LDO3		(1 << 2)  #define MAX8998_LDO4		(1 << 1) +#define MAX8998_LDO7		(1 << 6)  #define MAX8998_LDO8		(1 << 5) +#define MAX8998_LDO17		(1 << 4)  #define MAX8998_SAFEOUT1	(1 << 4)  #define MAX8998_I2C_ADDR        (0xCC >> 1) diff --git a/include/search.h b/include/search.h index 93e1cbc6d..13d3be629 100644 --- a/include/search.h +++ b/include/search.h @@ -32,6 +32,12 @@  #define __set_errno(val) do { errno = val; } while (0) +enum env_op { +	env_op_create, +	env_op_delete, +	env_op_overwrite, +}; +  /* Action which shall be performed in the call the hsearch.  */  typedef enum {  	FIND, @@ -41,6 +47,9 @@ typedef enum {  typedef struct entry {  	const char *key;  	char *data; +	int (*callback)(const char *name, const char *value, enum env_op op, +		int flags); +	int flags;  } ENTRY;  /* Opaque type for internal use.  */ @@ -59,21 +68,20 @@ struct hsearch_data {  	unsigned int filled;  /*   * Callback function which will check whether the given change for variable - * "name" from "oldval" to "newval" may be applied or not, and possibly apply - * such change. + * "item" to "newval" may be applied or not, and possibly apply such change.   * When (flag & H_FORCE) is set, it shall not print out any error message and   * shall force overwriting of write-once variables.  .* Must return 0 for approval, 1 for denial.   */ -	int (*apply)(const char *name, const char *oldval, -			const char *newval, int flag); +	int (*change_ok)(const ENTRY *__item, const char *newval, enum env_op, +		int flag);  };  /* Create a new hashing table which will at most contain NEL elements.  */  extern int hcreate_r(size_t __nel, struct hsearch_data *__htab);  /* Destroy current internal hashing table.  */ -extern void hdestroy_r(struct hsearch_data *__htab, int do_apply); +extern void hdestroy_r(struct hsearch_data *__htab);  /*   * Search for entry matching ITEM.key in internal hash table.  If @@ -82,7 +90,7 @@ extern void hdestroy_r(struct hsearch_data *__htab, int do_apply);   * ITEM.data.   * */  extern int hsearch_r(ENTRY __item, ACTION __action, ENTRY ** __retval, -		     struct hsearch_data *__htab); +		     struct hsearch_data *__htab, int __flag);  /*   * Search for an entry matching `MATCH'.  Otherwise, Same semantics @@ -99,10 +107,10 @@ extern int hstrstr_r(const char *__match, int __last_idx, ENTRY ** __retval,  /* Search and delete entry matching ITEM.key in internal hash table. */  extern int hdelete_r(const char *__key, struct hsearch_data *__htab, -			int do_apply); +		     int __flag);  extern ssize_t hexport_r(struct hsearch_data *__htab, -		     const char __sep, char **__resp, size_t __size, +		     const char __sep, int __flag, char **__resp, size_t __size,  		     int argc, char * const argv[]);  /* @@ -113,10 +121,15 @@ extern ssize_t hexport_r(struct hsearch_data *__htab,   */  extern int himport_r(struct hsearch_data *__htab,  		     const char *__env, size_t __size, const char __sep, -		     int __flag, int nvars, char * const vars[], int do_apply); +		     int __flag, int nvars, char * const vars[]); + +/* Walk the whole table calling the callback on each element */ +extern int hwalk_r(struct hsearch_data *__htab, int (*callback)(ENTRY *)); -/* Flags for himport_r() */ -#define	H_NOCLEAR	(1 << 0) /* do not clear hash table before importing */ -#define	H_FORCE		(1 << 1) /* overwrite read-only/write-once variables */ +/* Flags for himport_r(), hexport_r(), hdelete_r(), and hsearch_r() */ +#define H_NOCLEAR	(1 << 0) /* do not clear hash table before importing */ +#define H_FORCE		(1 << 1) /* overwrite read-only/write-once variables */ +#define H_INTERACTIVE	(1 << 2) /* indicate that an import is user directed */ +#define H_HIDE_DOT	(1 << 3) /* don't print env vars that begin with '.' */  #endif /* search.h */ diff --git a/include/sha1.h b/include/sha1.h index 734d1fb15..da09dab97 100644 --- a/include/sha1.h +++ b/include/sha1.h @@ -59,7 +59,8 @@ void sha1_starts( sha1_context *ctx );   * \param input    buffer holding the  data   * \param ilen	   length of the input data   */ -void sha1_update( sha1_context *ctx, unsigned char *input, int ilen ); +void sha1_update(sha1_context *ctx, const unsigned char *input, +		 unsigned int ilen);  /**   * \brief	   SHA-1 final digest @@ -76,8 +77,8 @@ void sha1_finish( sha1_context *ctx, unsigned char output[20] );   * \param ilen	   length of the input data   * \param output   SHA-1 checksum result   */ -void sha1_csum( unsigned char *input, int ilen, -		unsigned char output[20] ); +void sha1_csum(const unsigned char *input, unsigned int ilen, +		unsigned char *output);  /**   * \brief	   Output = SHA-1( input buffer ), with watchdog triggering @@ -87,17 +88,8 @@ void sha1_csum( unsigned char *input, int ilen,   * \param output   SHA-1 checksum result   * \param chunk_sz watchdog triggering period (in bytes of input processed)   */ -void sha1_csum_wd (unsigned char *input, int ilen, -		unsigned char output[20], unsigned int chunk_sz); - -/** - * \brief	   Output = SHA-1( file contents ) - * - * \param path	   input file name - * \param output   SHA-1 checksum result - * \return	   0 if successful, or 1 if fopen failed - */ -int sha1_file( char *path, unsigned char output[20] ); +void sha1_csum_wd(const unsigned char *input, unsigned int ilen, +		unsigned char *output, unsigned int chunk_sz);  /**   * \brief	   Output = HMAC-SHA-1( input buffer, hmac key ) @@ -108,9 +100,9 @@ int sha1_file( char *path, unsigned char output[20] );   * \param ilen	   length of the input data   * \param output   HMAC-SHA-1 result   */ -void sha1_hmac( unsigned char *key, int keylen, -		unsigned char *input, int ilen, -		unsigned char output[20] ); +void sha1_hmac(const unsigned char *key, int keylen, +		const unsigned char *input, unsigned int ilen, +		unsigned char *output);  /**   * \brief	   Checkup routine diff --git a/include/sha256.h b/include/sha256.h index e38ea898c..beadab35f 100644 --- a/include/sha256.h +++ b/include/sha256.h @@ -3,6 +3,9 @@  #define SHA256_SUM_LEN	32 +/* Reset watchdog each time we process this many bytes */ +#define CHUNKSZ_SHA256	(64 * 1024) +  typedef struct {  	uint32_t total[2];  	uint32_t state[8]; @@ -10,7 +13,10 @@ typedef struct {  } sha256_context;  void sha256_starts(sha256_context * ctx); -void sha256_update(sha256_context * ctx, uint8_t * input, uint32_t length); +void sha256_update(sha256_context *ctx, const uint8_t *input, uint32_t length);  void sha256_finish(sha256_context * ctx, uint8_t digest[SHA256_SUM_LEN]); +void sha256_csum_wd(const unsigned char *input, unsigned int ilen, +		unsigned char *output, unsigned int chunk_sz); +  #endif /* _SHA256_H */ diff --git a/include/sound.h b/include/sound.h new file mode 100644 index 000000000..ea0b1158f --- /dev/null +++ b/include/sound.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * R. Chandrasekar < rcsekar@samsung.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 __SOUND_H__ +#define __SOUND_H__ + +/* sound codec enum */ +enum en_sound_codec { +	CODEC_WM_8994, +	CODEC_WM_8995, +	CODEC_MAX +}; + +/* sound codec enum */ +enum sound_compat { +	AUDIO_COMPAT_SPI, +	AUDIO_COMPAT_I2C, +}; + +/* Codec information structure to store the info from device tree */ +struct sound_codec_info { +	int i2c_bus; +	int i2c_dev_addr; +	enum en_sound_codec codec_type; +}; + +/* + * Initialises audio sub system + * + * @return	int value 0 for success, -1 for error + */ +int sound_init(void); + +/* + * plays the pcm data buffer in pcm_data.h through i2s1 to make the + * sine wave sound + * + * @return	int 0 for success, -1 for error + */ +int sound_play(uint32_t msec, uint32_t frequency); + +#endif  /* __SOUND__H__ */ diff --git a/include/twl6035.h b/include/twl6035.h index e21ddbaf2..ce74348d4 100644 --- a/include/twl6035.h +++ b/include/twl6035.h @@ -39,4 +39,4 @@  int twl6035_i2c_write_u8(u8 chip_no, u8 val, u8 reg);  int twl6035_i2c_read_u8(u8 chip_no, u8 *val, u8 reg);  void twl6035_init_settings(void); -void twl6035_mmc1_poweron_ldo(void); +int twl6035_mmc1_poweron_ldo(void); |