int board_mmc_get_env_dev(int devno);
+int nxp_board_rev(void);
+char nxp_board_rev_string(void);
+
/*
* Initializes on-chip ethernet controllers.
* to override, implement board_eth_init()
help
This enables the 'hdmidet' command which detects if an HDMI monitor
is connected.
+
+config NXP_BOARD_REVISION
+ bool "Read NXP board revision from fuses"
+ depends on ARCH_MX6 || ARCH_MX7
+ help
+ NXP boards based on i.MX6/7 contain the board revision information
+ stored in the fuses. Select this option if you want to be able to
+ retrieve the board revision information.
writel(reg, &iomuxc_regs->gpr[1]);
}
+
+#ifdef CONFIG_NXP_BOARD_REVISION
+int nxp_board_rev(void)
+{
+ /*
+ * Get Board ID information from OCOTP_GP1[15:8]
+ * RevA: 0x1
+ * RevB: 0x2
+ * RevC: 0x3
+ */
+ 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;
+
+ return (readl(&fuse->gp1) >> 8 & 0x0F);
+}
+
+char nxp_board_rev_string(void)
+{
+ const char *rev = "A";
+
+ return (*rev + nxp_board_rev() - 1);
+}
+#endif
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;
}
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;
}
CONFIG_SPL_SERIAL_SUPPORT=y
CONFIG_SPL_LIBDISK_SUPPORT=y
CONFIG_SPL_WATCHDOG_SUPPORT=y
+CONFIG_NXP_BOARD_REVISION=y
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg"
# CONFIG_CONSOLE_MUX is not set
CONFIG_SYS_CONSOLE_IS_IN_ENV=y