--- 045dee6010356f9a563d4a9910316670ed7104c0 +++ adc2d2ff3310a17fb7b451cf006ab8f35f8dcab1 @@ -325,7 +325,52 @@ char *socinfo_get_build_id(void) { return (socinfo) ? socinfo->v1.build_id : NULL; } +#ifdef CONFIG_PVS_IDDQ_FACTORY +uint32_t socinfo_get_iddq(void) +{ + void __iomem *pte_efuse; + uint32_t pte_efuse_val; + uint32_t qfprom_iddq; + + pte_efuse = ioremap(0x007000C4, 4); + if (!pte_efuse) { + pr_err("%s : Unable to map QFPROM base\n", __func__); + return 0; + } + + pte_efuse_val = readl_relaxed(pte_efuse); + iounmap(pte_efuse); + qfprom_iddq = pte_efuse_val & 0xFFFFFFFF; + + return qfprom_iddq; +} + +uint32_t socinfo_get_pvs(void) +{ + void __iomem *pte_efuse; + uint32_t pte_efuse_val; + uint32_t pvs_bin; + + pte_efuse = ioremap(0x007000C0, 4); + if (!pte_efuse) { + pr_err("%s : Unable to map QFPROM base\n", __func__); + return 0; + } + + pte_efuse_val = readl_relaxed(pte_efuse); + iounmap(pte_efuse); + + pvs_bin = (pte_efuse_val >> 10) & 0x7; + if (pvs_bin == 0x7) + pvs_bin = (pte_efuse_val >> 13) & 0x7; + + if (pvs_bin == 0x7) + pvs_bin = 0; + + return pvs_bin; +} +#endif uint32_t socinfo_get_raw_id(void) { return socinfo ? @@ -435,8 +480,34 @@ socinfo_show_build_id(struct sys_device return snprintf(buf, PAGE_SIZE, "%-.32s\n", socinfo_get_build_id()); } +#ifdef CONFIG_PVS_IDDQ_FACTORY +static ssize_t +socinfo_show_soc_iddq(struct sys_device *dev, + struct sysdev_attribute *attr, + char *buf) +{ + if (!socinfo) { + pr_err("%s: No socinfo found!\n", __func__); + return 0; + } + + return snprintf(buf, PAGE_SIZE, "%x\n", socinfo_get_iddq()); +} static ssize_t +socinfo_show_soc_pvs(struct sys_device *dev, + struct sysdev_attribute *attr, + char *buf) +{ + if (!socinfo) { + pr_err("%s: No socinfo found!\n", __func__); + return 0; + } + + return snprintf(buf, PAGE_SIZE, "%x\n", socinfo_get_pvs()); +} +#endif +static ssize_t socinfo_show_raw_id(struct sys_device *dev, struct sysdev_attribute *attr, char *buf) @@ -598,6 +669,10 @@ static struct sysdev_attribute socinfo_v _SYSDEV_ATTR(id, 0444, socinfo_show_id, NULL), _SYSDEV_ATTR(version, 0444, socinfo_show_version, NULL), _SYSDEV_ATTR(build_id, 0444, socinfo_show_build_id, NULL), +#ifdef CONFIG_PVS_IDDQ_FACTORY + _SYSDEV_ATTR(soc_iddq, 0444, socinfo_show_soc_iddq, NULL), + _SYSDEV_ATTR(soc_pvs, 0444, socinfo_show_soc_pvs, NULL), +#endif }; static struct sysdev_attribute socinfo_v2_files[] = {