diff options
| author | Stefano Babic <sbabic@denx.de> | 2013-02-23 10:13:40 +0100 | 
|---|---|---|
| committer | Stefano Babic <sbabic@denx.de> | 2013-02-23 10:13:40 +0100 | 
| commit | 9cd9b34dc7f247fd0fce08ab688bf8197f1bfdbc (patch) | |
| tree | 89561497322fff78d3d2e4a8e736f18ab4e0ddfb /board/matrix_vision/mvblx/sys_eeprom.c | |
| parent | bec0160e9f5adab1d451ded3a95b0114b14e1970 (diff) | |
| parent | a5627914daad144727655a72bd3c8a8958fbcdcf (diff) | |
| download | olio-uboot-2014.01-9cd9b34dc7f247fd0fce08ab688bf8197f1bfdbc.tar.xz olio-uboot-2014.01-9cd9b34dc7f247fd0fce08ab688bf8197f1bfdbc.zip  | |
Merge branch 'master' of git://git.denx.de/u-boot-arm
Diffstat (limited to 'board/matrix_vision/mvblx/sys_eeprom.c')
| -rw-r--r-- | board/matrix_vision/mvblx/sys_eeprom.c | 24 | 
1 files changed, 24 insertions, 0 deletions
diff --git a/board/matrix_vision/mvblx/sys_eeprom.c b/board/matrix_vision/mvblx/sys_eeprom.c index 945a36dfe..15269c6d7 100644 --- a/board/matrix_vision/mvblx/sys_eeprom.c +++ b/board/matrix_vision/mvblx/sys_eeprom.c @@ -326,10 +326,28 @@ int do_mac(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])  	return 0;  } +static inline int is_portrait(void) +{ +	int i; +	unsigned int orient_index = 0; /* idx of char which determines orientation */ + +	for (i = sizeof(e.id)/sizeof(*e.id) - 1; i>=0; i--) { +		if (e.id[i] == '-') { +			orient_index = i+1; +			break; +		} +	} + +	return (orient_index && +			(e.id[orient_index] >= '5') && (e.id[orient_index] <= '8')); +} +  int mac_read_from_eeprom(void)  {  	u32 crc, crc_offset = offsetof(struct eeprom, crc);  	u32 *crcp; /* Pointer to the CRC in the data read from the EEPROM */ +#define FILENAME_LANDSCAPE "mvBlueLynx_X.rbf" +#define FILENAME_PORTRAIT "mvBlueLynx_X_sensor_cd.rbf"  	if (read_eeprom()) {  		printf("EEPROM Read failed.\n"); @@ -374,6 +392,12 @@ int mac_read_from_eeprom(void)  			setenv("serial#", serial_num);  	} +	/* decide which fpga file to load depending on orientation */ +	if (is_portrait()) +		setenv("fpgafilename", FILENAME_PORTRAIT); +	else +		setenv("fpgafilename", FILENAME_LANDSCAPE); +  	/* TODO should I calculate CRC here? */  	return 0;  }  |