[TSENSE_PLLX] = { 1106500, -6729300 },
};
+/* old ATE pattern */
static struct soctherm_fuse_correction_war t13x_fuse_war1[] = {
[TSENSE_CPU0] = { 1119800, -6330400 },
[TSENSE_CPU1] = { 1094100, -3751800 },
[TSENSE_PLLX] = { 1150000, -11899000 },
};
+/* new ATE pattern */
+static struct soctherm_fuse_correction_war t13x_fuse_war2[] = {
+ [TSENSE_CPU0] = { 1126600, -9433500 },
+ [TSENSE_CPU1] = { 1110800, -7383000 },
+ [TSENSE_CPU2] = { 1113800, -6215200 },
+ [TSENSE_CPU3] = { 1129600, -8196100 },
+ [TSENSE_MEM0] = { 1132900, -6755300 },
+ [TSENSE_MEM1] = { 1142300, -7374200 },
+ [TSENSE_GPU] = { 1125100, -6350400 },
+ [TSENSE_PLLX] = { 1118100, -8208800 },
+};
+
/**
* soctherm_fuse_read_tsensor() - calculates therm_a and therm_b for a sensor
* @sensor: The sensor for which to calculate.
fuse_rev = tegra_fuse_calib_base_get_cp(&base_cp, &shft_cp);
if (fuse_rev < 0)
return fuse_rev;
+ pr_debug("%s: fuse_rev %d\n", __func__, fuse_rev);
tegra_fuse_get_tsensor_calib(sensor2tsensorcalib[sensor], &value);
war = fuse_rev ?
&t12x_fuse_war1[sensor] : &t12x_fuse_war2[sensor];
else if (IS_T13X)
- war = &t13x_fuse_war1[sensor];
+ war = fuse_rev ?
+ &t13x_fuse_war1[sensor] : &t13x_fuse_war2[sensor];
+ else
+ war = &no_fuse_war[sensor];
therm_a = div64_s64_precise((s64)therm_a * war->a,
(s64)1000000LL);
DEVICE_ATTR(odm_lock, 0440, tegra_fuse_show, tegra_fuse_store);
/*
- * Check CP fuse revision.
- * ERROR: -ve: Negative return value
- * CP/FT: 1: Old style CP/FT fuse
- * CP1/CP2: 0: New style CP1/CP2 fuse (default)
+ * Check CP fuse revision. Return value (depending on chip) is as below:
+ * Any: ERROR: -ve: Negative return value
+ * T12x: CP/FT: 1: Old style CP/FT fuse
+ * T12x: CP1/CP2: 0: New style CP1/CP2 fuse (default for t12x)
+ * T13x: Old pattern: 1: Old ATE pattern CP1/CP2 fuse
+ * T13x: New pattern: 0: New ATE pattern CP1/CP2 fuse (default for t13x)
*/
static inline int fuse_cp_rev_check(void)
{
if (!chip_id)
chip_id = tegra_get_chipid();
- /* T13x: No min CP rev (yet) */
- if (chip_id == TEGRA_CHIPID_TEGRA13)
- return 1; /* Use (old) CP/FT fuse style */
-
- /* CP rev < 00.4 is unsupported */
- if ((rev_major == 0) && (rev_minor < 4))
- return -EINVAL;
+ /* T13x: all CP rev are valid */
+ if (chip_id == TEGRA_CHIPID_TEGRA13) {
+ /* CP rev < 00.9 is old ATE pattern */
+ if ((rev_major == 0) && (rev_minor < 9))
+ return 1;
+ return 0; /* default new ATE pattern */
+ }
- /* CP rev < 00.8 is CP/FT (old style) */
- if ((rev_major == 0) && (rev_minor < 8))
- return 1;
+ if (chip_id == TEGRA_CHIPID_TEGRA12) {
+ /* CP rev < 00.4 is unsupported */
+ if ((rev_major == 0) && (rev_minor < 4))
+ return -EINVAL;
+ /* CP rev < 00.8 is CP/FT (old style) */
+ if ((rev_major == 0) && (rev_minor < 8))
+ return 1;
+ return 0; /* default new CP1/CP2 fuse */
+ }
- return 0;
+ return -EINVAL;
}
/*
* Check FT fuse revision.
* We check CP-rev and if it shows NEW style, we return ERROR.
* ERROR: -ve: Negative return value
- * CP/FT: 0: Old style CP/FT fuse (default)
+ * CP/FT: 0: Old style CP/FT fuse (default for t12x)
+ * T13x: 1: CP1/CP2 new ATE pattern (default for t13x)
*/
static inline int fuse_ft_rev_check(void)
{
u32 rev, rev_major, rev_minor;
int check_cp = fuse_cp_rev_check();
- rev = tegra_fuse_readl(FUSE_FT_REV);
- rev_minor = rev & 0x1f;
- rev_major = (rev >> 5) & 0x3f;
- pr_debug("%s: FT rev %d.%d\n", __func__, rev_major, rev_minor);
-
if (!chip_id)
chip_id = tegra_get_chipid();
- /* T13x: No min FT rev (yet) */
+ /* T13x does not use FT */
if (chip_id == TEGRA_CHIPID_TEGRA13)
- return 0;
+ return 1;
+ /* T12x */
if (check_cp < 0)
return check_cp;
if (check_cp == 0)
return -ENODEV; /* No FT rev in CP1/CP2 mode */
+ rev = tegra_fuse_readl(FUSE_FT_REV);
+ rev_minor = rev & 0x1f;
+ rev_major = (rev >> 5) & 0x3f;
+ pr_debug("%s: FT rev %d.%d\n", __func__, rev_major, rev_minor);
+
/* FT rev < 00.5 is unsupported */
if ((rev_major == 0) && (rev_minor < 5))
return -EINVAL;
if (check_cp < 0)
return check_cp;
/* when check_cp is 1, check_ft must be valid */
- if (check_cp != 0 && check_ft != 0)
+ if (check_cp != 0 && check_ft < 0)
return -EINVAL;
val = tegra_fuse_readl(FUSE_TSENSOR_CALIB_8);