env: Export soc_hw_version to environment variable

soc_hw_version can used to prevent cross-platform
flashing of single images to prevent board
from getting bricked.

Signed-off-by: Gokul Sriram Palanisamy <gokulsri@codeaurora.org>
Change-Id: I579489498c8cbbc944b54e3050a319d1e11cb825
This commit is contained in:
Gokul Sriram Palanisamy 2020-05-22 17:30:29 +05:30
parent e0fdbf3dfb
commit bae298d521
6 changed files with 41 additions and 0 deletions

View file

@ -105,6 +105,7 @@ void aquantia_phy_reset_init(void);
int bring_sec_core_up(unsigned int cpuid, unsigned int entry, unsigned int arg);
int is_secondary_core_off(unsigned int cpuid);
int smem_read_cpu_count(void);
int get_soc_hw_version(void);
struct dumpinfo_t{
char name[16]; /* use only file name in 8.3 format */

View file

@ -352,11 +352,17 @@ void board_flash_protect(void)
}
#endif
__weak int get_soc_hw_version(void)
{
return 0;
}
int board_late_init(void)
{
unsigned int machid;
uint32_t flash_type;
uint32_t soc_ver_major, soc_ver_minor;
uint32_t soc_hw_version;
int ret;
char *s = NULL;
@ -384,6 +390,10 @@ int board_late_init(void)
setenv_ulong("soc_version_major", (unsigned long)soc_ver_major);
setenv_ulong("soc_version_minor", (unsigned long)soc_ver_minor);
}
soc_hw_version = get_soc_hw_version();
if (soc_hw_version)
setenv_hex("soc_hw_version", (unsigned long)soc_hw_version);
#ifdef CONFIG_FLASH_PROTECT
board_flash_protect();
#endif

View file

@ -37,6 +37,9 @@
#define DLOAD_MAGIC_COOKIE 0x10
#define TCSR_USB_HSPHY_DEVICE_MODE 0x00C700E7
#define TCSR_SOC_HW_VERSION_REG 0x194D000
DECLARE_GLOBAL_DATA_PTR;
#define CPU0_APCS_SAW2_VCTL 0x0b089014
@ -788,3 +791,7 @@ void ipq_uboot_fdt_fixup(void)
return;
}
int get_soc_hw_version(void)
{
return readl(TCSR_SOC_HW_VERSION_REG);
}

View file

@ -36,6 +36,8 @@
#define DLOAD_MAGIC_COOKIE 0x10
#define DLOAD_DISABLED 0x40
#define TCSR_SOC_HW_VERSION_REG 0x194D000
ipq_gmac_board_cfg_t gmac_cfg[CONFIG_IPQ_NO_MACS];
DECLARE_GLOBAL_DATA_PTR;
@ -1705,3 +1707,8 @@ int bring_sec_core_up(unsigned int cpuid, unsigned int entry, unsigned int arg)
return 0;
}
#endif
int get_soc_hw_version(void)
{
return readl(TCSR_SOC_HW_VERSION_REG);
}

View file

@ -31,6 +31,9 @@
#define DLOAD_MAGIC_COOKIE 0x10
#define DLOAD_DISABLED 0x40
#define TCSR_SOC_HW_VERSION_REG 0x194D000
DECLARE_GLOBAL_DATA_PTR;
struct sdhci_host mmc_host;
extern int ipq6018_edma_init(void *cfg);
@ -1374,3 +1377,8 @@ void fdt_fixup_wcss_rproc_for_atf(void *blob)
parse_fdt_fixup("/soc/qcom_q6v5_wcss@CD00000%qcom,nosecure%1", blob);
parse_fdt_fixup("/soc/qcom_q6v5_wcss@CD00000%qca,wcss-aon-reset-seq%1", blob);
}
int get_soc_hw_version(void)
{
return readl(TCSR_SOC_HW_VERSION_REG);
}

View file

@ -59,6 +59,9 @@
#define NOC_ERR_CLR_REG 0xb0002a0
#define DLOAD_MAGIC_COOKIE 0x10
#define TCSR_SOC_HW_VERSION_REG 0x194D000
DECLARE_GLOBAL_DATA_PTR;
#define GCNT_PSHOLD 0x004AB000
@ -1884,3 +1887,8 @@ void qgic_init(void)
qgic_dist_init();
qgic_cpu_init();
}
int get_soc_hw_version(void)
{
return readl(TCSR_SOC_HW_VERSION_REG);
}