MLK-16470 thermal: imx_thermal: fix wrong thermal grade register read for MX7D
authorDong Aisheng <aisheng.dong@nxp.com>
Wed, 13 Sep 2017 14:23:21 +0000 (22:23 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:38:33 +0000 (15:38 -0500)
From MX7D Fuse Map v2.9, the thermal grade register is 0x440[7:6],
not 0x480[7:6] as before.

Fixes: 2045abb4391a ("MLK-11518-01 thermal: imx: add thermal support for imx7")
Reviewed-by: Bai Ping <ping.bai@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
drivers/thermal/imx_thermal.c

index 4b6ba99..586b3f1 100644 (file)
@@ -84,7 +84,7 @@
 
 #define IMX6_OCOTP_ANA1                0x04e0
 #define IMX7_OCOTP_ANA1                0x04f0
-
+#define IMX7_OCOTP_TESTER3     0x0440
 
 /* The driver supports 1 passive trip point and 1 critical trip point */
 enum imx_thermal_trip {
@@ -625,7 +625,11 @@ static int imx_get_sensor_data(struct platform_device *pdev)
                imx6_calibrate_data(data, val);
 
        /* use OTP for thermal grade */
-       ret = regmap_read(map, OCOTP_MEM0, &val);
+       if (data->socdata->version == TEMPMON_IMX7)
+               ret = regmap_read(map, IMX7_OCOTP_TESTER3, &val);
+       else
+               ret = regmap_read(map, OCOTP_MEM0, &val);
+
        if (ret) {
                dev_err(&pdev->dev, "failed to read temp grade: %d\n", ret);
                return ret;