diff options
author | Prabhakar Kushwaha <prabhakar@freescale.com> | 2012-12-23 19:24:47 +0000 |
---|---|---|
committer | Andy Fleming <afleming@freescale.com> | 2013-01-30 11:25:10 -0600 |
commit | 2ae4e8d9587a3ca9a642ff634c070f66235b571d (patch) | |
tree | 38c08edd53639abe1a8fa41f9ee5ef779ef26292 /board/freescale/common/qixis.c | |
parent | e1dbdd81523c7c7de1ac5dee03dd9e4587e808af (diff) | |
download | u-boot-imx-2ae4e8d9587a3ca9a642ff634c070f66235b571d.zip u-boot-imx-2ae4e8d9587a3ca9a642ff634c070f66235b571d.tar.gz u-boot-imx-2ae4e8d9587a3ca9a642ff634c070f66235b571d.tar.bz2 |
board/freescale/common:Add support of QTAG register
QIXIS FPGA's QIXIS Tag Access register (QTAG) defines TAG, VER, DATE, IMAGE
fields. These fields have FPGA build version, image name and build date
information.
Add support to parse these fields to have complete FPGA image information.
Signed-off-by: York Sun <yorksun@freescale.com>
Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
Signed-off-by: Poonam Aggrwal <poonam.aggrwal@freescale.com>
Signed-off-by: Andy Fleming <afleming@freescale.com>
Diffstat (limited to 'board/freescale/common/qixis.c')
-rw-r--r-- | board/freescale/common/qixis.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/board/freescale/common/qixis.c b/board/freescale/common/qixis.c index c92902a..2cf393b 100644 --- a/board/freescale/common/qixis.c +++ b/board/freescale/common/qixis.c @@ -14,6 +14,7 @@ #include <common.h> #include <command.h> #include <asm/io.h> +#include <linux/time.h> #include "qixis.h" u8 qixis_read(unsigned int reg) @@ -30,6 +31,51 @@ void qixis_write(unsigned int reg, u8 value) out_8(p + reg, value); } +u16 qixis_read_minor(void) +{ + u16 minor; + + /* this data is in little endian */ + QIXIS_WRITE(tagdata, 5); + minor = QIXIS_READ(tagdata); + QIXIS_WRITE(tagdata, 6); + minor += QIXIS_READ(tagdata) << 8; + + return minor; +} + +char *qixis_read_time(char *result) +{ + time_t time = 0; + int i; + + /* timestamp is in 32-bit big endian */ + for (i = 8; i <= 11; i++) { + QIXIS_WRITE(tagdata, i); + time = (time << 8) + QIXIS_READ(tagdata); + } + + return ctime_r(&time, result); +} + +char *qixis_read_tag(char *buf) +{ + int i; + char tag, *ptr = buf; + + for (i = 16; i <= 63; i++) { + QIXIS_WRITE(tagdata, i); + tag = QIXIS_READ(tagdata); + *(ptr++) = tag; + if (!tag) + break; + } + if (i > 63) + *ptr = '\0'; + + return buf; +} + void qixis_reset(void) { QIXIS_WRITE(rst_ctl, QIXIS_RST_CTL_RESET); |