board: purism: librem5: set the board_rev env variable

The board rev gets burned into the fuses during manufacture. Save that
in the environment.
Signed-off-by: default avatarAngus Ainslie (Purism) <angus@akkea.ca>
parent d51ff635
......@@ -20,6 +20,7 @@
#include <asm/arch/clock.h>
#include <asm/mach-imx/video.h>
#include <asm/arch/video_common.h>
#include <fuse.h>
#include <spl.h>
#include <power/pmic.h>
#include "../common/tcpc.h"
......@@ -566,11 +567,22 @@ int fastboot_key_pressed(void)
int board_late_init(void)
{
printf("%s: starting\n", __func__ );
#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
u32 vid, rev;
char rev_str[3];
env_set("board_name", "librem5");
env_set("board_rev", "1.0");
if (fuse_read(8, 2, &vid) || fuse_read(14, 0, &rev))
env_set("board_rev", BOARD_REV_ERROR);
else if (vid == 0) {
env_set("board_rev", BOARD_REV_UNKNOWN);
} else if (vid == (PURISM_PID<<16 | PURISM_VID)) {
sprintf(rev_str, "%u", rev);
env_set("board_rev", rev_str);
}
printf("Board name: %s\n", env_get("board_name"));
printf("Board rev: %s\n", env_get("board_rev"));
#endif
#ifdef CONFIG_ENV_IS_IN_MMC
......
......@@ -45,6 +45,16 @@
#define TPS_RESET IMX_GPIO_NR(3, 24)
#define PURISM_VID 0x316d
#define PURISM_PID 0x4c05
#define BOARD_REV_ERROR "unknown"
#define BOARD_REV_BIRCH "1"
#define BOARD_REV_CHESTNUT "2"
#define BOARD_REV_DOGWOOD "3"
/* Could be ASPEN, BIRCH or CHESTNUT. assume CHESTNUT */
#define BOARD_REV_UNKNOWN BOARD_REV_CHESTNUT
static iomux_v3_cfg_t const configure_pads[] = {
IMX8MQ_PAD_GPIO1_IO00__GPIO1_IO0 | MUX_PAD_CTRL(PAD_CTL_DSE6),
IMX8MQ_PAD_GPIO1_IO03__GPIO1_IO3 | MUX_PAD_CTRL(PAD_CTL_DSE6),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment