diff options
author | Michael Jones <michael.jones@matrix-vision.de> | 2013-02-07 23:53:36 +0000 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2013-02-18 13:51:20 -0500 |
commit | 71c4ae3f6db39b888497923573bff215b64a36bd (patch) | |
tree | 54174c43617465b1efadd9663a8ad061a4c952a5 | |
parent | 661bb0f8f49303891b8460149943e32337544e03 (diff) | |
download | u-boot-imx-71c4ae3f6db39b888497923573bff215b64a36bd.zip u-boot-imx-71c4ae3f6db39b888497923573bff215b64a36bd.tar.gz u-boot-imx-71c4ae3f6db39b888497923573bff215b64a36bd.tar.bz2 |
omap3: mvblx: select fpgafilename according to orientation
Rather than load the FPGA file from the FAT partition, look
at entry in system EEPROM to decide which file to retrieve directly
from the EXT3 partition.
Signed-off-by: Michael Jones <michael.jones@matrix-vision.de>
-rw-r--r-- | board/matrix_vision/mvblx/sys_eeprom.c | 24 | ||||
-rw-r--r-- | include/configs/omap3_mvblx.h | 6 |
2 files changed, 27 insertions, 3 deletions
diff --git a/board/matrix_vision/mvblx/sys_eeprom.c b/board/matrix_vision/mvblx/sys_eeprom.c index 945a36d..15269c6 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; } diff --git a/include/configs/omap3_mvblx.h b/include/configs/omap3_mvblx.h index 99f0d4b..7bb05ca 100644 --- a/include/configs/omap3_mvblx.h +++ b/include/configs/omap3_mvblx.h @@ -170,9 +170,9 @@ "vram=12M\0" \ "dvimode=1024x768-24@60\0" \ "defaultdisplay=dvi\0" \ - "fpgafilename=mvbluelynx_x.rbf\0" \ - "loadfpga=if fatload mmc ${mmcdev} ${loadaddr} ${fpgafilename}; then " \ - "fpga load 0 ${loadaddr} ${filesize}; " \ + "loadfpga=if ext2load mmc ${mmcdev}:2 ${loadaddr} "\ + "/lib/firmware/mvblx/${fpgafilename}; then " \ + "fpga load 0 ${loadaddr} ${filesize}; " \ "fi;\0" \ "mmcdev=0\0" \ "mmcroot=/dev/mmcblk0p2 rw\0" \ |