diff options
author | Fabio Estevam <fabio.estevam@nxp.com> | 2017-11-27 10:25:09 -0200 |
---|---|---|
committer | Stefano Babic <sbabic@denx.de> | 2017-12-29 11:18:59 +0100 |
commit | 4555c26142f893aa5d23f95c8eb3982e4a05b334 (patch) | |
tree | 1dd321cf3b94548dc841b60868173e002f947556 /board/freescale | |
parent | 9a7295831e23fd3ff68b54992cdace1a1c8249e2 (diff) |
imx: Add a common way for detecting NXP boards revision
NXP development boards based on i.MX6/i.MX7 contain the board
revision information stored in the fuses.
Introduce a common function that can be shared by different boards and
convert mx6sabreauto to use this new mechanism.
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Diffstat (limited to 'board/freescale')
-rw-r--r-- | board/freescale/mx6sabreauto/mx6sabreauto.c | 47 |
1 files changed, 2 insertions, 45 deletions
diff --git a/board/freescale/mx6sabreauto/mx6sabreauto.c b/board/freescale/mx6sabreauto/mx6sabreauto.c index bdeb5f7667..9c83e350d4 100644 --- a/board/freescale/mx6sabreauto/mx6sabreauto.c +++ b/board/freescale/mx6sabreauto/mx6sabreauto.c @@ -397,39 +397,9 @@ int board_eth_init(bd_t *bis) return cpu_eth_init(bis); } -#define BOARD_REV_B 0x200 -#define BOARD_REV_A 0x100 - -static int mx6sabre_rev(void) -{ - /* - * Get Board ID information from OCOTP_GP1[15:8] - * i.MX6Q ARD RevA: 0x01 - * i.MX6Q ARD RevB: 0x02 - */ - struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR; - struct fuse_bank *bank = &ocotp->bank[4]; - struct fuse_bank4_regs *fuse = - (struct fuse_bank4_regs *)bank->fuse_regs; - int reg = readl(&fuse->gp1); - int ret; - - switch (reg >> 8 & 0x0F) { - case 0x02: - ret = BOARD_REV_B; - break; - case 0x01: - default: - ret = BOARD_REV_A; - break; - } - - return ret; -} - u32 get_board_rev(void) { - int rev = mx6sabre_rev(); + int rev = nxp_board_rev(); return (get_cpu_rev() & ~(0xF << 8)) | rev; } @@ -703,20 +673,7 @@ int board_late_init(void) int checkboard(void) { - int rev = mx6sabre_rev(); - char *revname; - - switch (rev) { - case BOARD_REV_B: - revname = "B"; - break; - case BOARD_REV_A: - default: - revname = "A"; - break; - } - - printf("Board: MX6Q-Sabreauto rev%s\n", revname); + printf("Board: MX6Q-Sabreauto rev%c\n", nxp_board_rev_string()); return 0; } |