]> git.sur5r.net Git - u-boot/commitdiff
thermal: imx_thermal: rework driver to be reused
authorAdrian Alonso <aalonso@freescale.com>
Wed, 2 Sep 2015 18:54:13 +0000 (13:54 -0500)
committerStefano Babic <sbabic@denx.de>
Sun, 13 Sep 2015 08:11:53 +0000 (10:11 +0200)
Rework imx_thermal driver to be used across i.MX
processor that support thermal sensor

Signed-off-by: Adrian Alonso <aalonso@freescale.com>
Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
13 files changed:
arch/arm/cpu/armv7/mx6/soc.c
arch/arm/imx-common/cpu.c
drivers/thermal/Makefile
drivers/thermal/imx_thermal.c
include/configs/cgtqmx6eval.h
include/configs/embestmx6boards.h
include/configs/gw_ventana.h
include/configs/mx6cuboxi.h
include/configs/mx6sabre_common.h
include/configs/mx6slevk.h
include/configs/mx6sxsabresd.h
include/configs/mx6ul_14x14_evk.h
include/configs/tbs2910.h

index 8ad8da846500e7664faaaa849307de7b68331d91..511011276636a41f93023ca34191bc5ba1ef452d 100644 (file)
@@ -38,7 +38,7 @@ struct scu_regs {
        u32     fpga_rev;
 };
 
-#if defined(CONFIG_IMX6_THERMAL)
+#if defined(CONFIG_IMX_THERMAL)
 static const struct imx_thermal_plat imx6_thermal_plat = {
        .regs = (void *)ANATOP_BASE_ADDR,
        .fuse_bank = 1,
index e27546c906dc6e0251e0d9a7588de6241657ba0f..38cd0c8280717f1b85e76d6ba586e322dfddc5d5 100644 (file)
@@ -154,14 +154,12 @@ int print_cpuinfo(void)
        u32 cpurev;
        __maybe_unused u32 max_freq;
 
-#if defined(CONFIG_MX6) && defined(CONFIG_IMX6_THERMAL)
+       cpurev = get_cpu_rev();
+
+#if defined(CONFIG_IMX_THERMAL)
        struct udevice *thermal_dev;
        int cpu_tmp, minc, maxc, ret;
-#endif
 
-       cpurev = get_cpu_rev();
-
-#if defined(CONFIG_MX6)
        printf("CPU:   Freescale i.MX%s rev%d.%d",
               get_imx_type((cpurev & 0xFF000) >> 12),
               (cpurev & 0x000F0) >> 4,
@@ -181,7 +179,7 @@ int print_cpuinfo(void)
                mxc_get_clock(MXC_ARM_CLK) / 1000000);
 #endif
 
-#if defined(CONFIG_MX6) && defined(CONFIG_IMX6_THERMAL)
+#if defined(CONFIG_IMX_THERMAL)
        puts("CPU:   ");
        switch (get_cpu_temp_grade(&minc, &maxc)) {
        case TEMP_AUTOMOTIVE:
index 6d4cacdcf7fe3d334664d4c23f407d96bd879610..d768f5ef80879e681d5659cc8f23427f1dacb6b4 100644 (file)
@@ -6,4 +6,4 @@
 #
 
 obj-$(CONFIG_DM_THERMAL) += thermal-uclass.o
-obj-$(CONFIG_IMX6_THERMAL) += imx_thermal.o
+obj-$(CONFIG_IMX_THERMAL) += imx_thermal.o
index 3c6c9679f97a89b30a30caf8b8bafb9238a41213..d90874e5ec7a7aa13b9f4885f9c74b9be493fabd 100644 (file)
@@ -41,7 +41,7 @@ struct thermal_data {
        int maxc;
 };
 
-static int read_cpu_temperature(struct udevice *dev)
+static int read_cpu_temperature_mx6(struct udevice *dev)
 {
        int temperature;
        unsigned int reg, n_meas;
@@ -129,13 +129,15 @@ int imx_thermal_get_temp(struct udevice *dev, int *temp)
        struct thermal_data *priv = dev_get_priv(dev);
        int cpu_tmp = 0;
 
-       cpu_tmp = read_cpu_temperature(dev);
+       if (is_soc_type(MXC_SOC_MX6))
+               cpu_tmp = read_cpu_temperature_mx6(dev);
        while (cpu_tmp >= priv->critical) {
                printf("CPU Temperature (%dC) too close to max (%dC)",
                       cpu_tmp, priv->maxc);
                puts(" waiting...\n");
                udelay(5000000);
-               cpu_tmp = read_cpu_temperature(dev);
+               if (is_soc_type(MXC_SOC_MX6))
+                       cpu_tmp = read_cpu_temperature_mx6(dev);
        }
 
        *temp = cpu_tmp;
@@ -157,10 +159,12 @@ static int imx_thermal_probe(struct udevice *dev)
        /* Read Temperature calibration data fuse */
        fuse_read(pdata->fuse_bank, pdata->fuse_word, &fuse);
 
-       /* Check for valid fuse */
-       if (fuse == 0 || fuse == ~0) {
-               printf("CPU:   Thermal invalid data, fuse: 0x%x\n", fuse);
-               return -EPERM;
+       if (is_soc_type(MXC_SOC_MX6)) {
+               /* Check for valid fuse */
+               if (fuse == 0 || fuse == ~0) {
+                       printf("CPU:   Thermal invalid data, fuse: 0x%x\n", fuse);
+                       return -EPERM;
+               }
        }
 
        /* set critical cooling temp */
index 92930c8f7250d9c4b02de3dd97847d7f415aac3b..55a06643dc449a7de652795e8bd888944299c865 100644 (file)
 #define CONFIG_CMD_BMODE
 
 /* Thermal support */
-#define CONFIG_IMX6_THERMAL
+#define CONFIG_IMX_THERMAL
 
 #define CONFIG_CMD_FUSE
-#if defined(CONFIG_CMD_FUSE) || defined(CONFIG_IMX6_THERMAL)
+#if defined(CONFIG_CMD_FUSE) || defined(CONFIG_IMX_THERMAL)
 #define CONFIG_MXC_OCOTP
 #endif
 
index 12744a61432dc89ac8b3506f57fac6d6e6d34a66..58cee96ac313b3a2f58d248392fd2d8b07bb9a7d 100644 (file)
@@ -19,7 +19,7 @@
 
 #define PHYS_SDRAM_SIZE                (1u * 1024 * 1024 * 1024)
 
-#define CONFIG_IMX6_THERMAL
+#define CONFIG_IMX_THERMAL
 
 /* Size of malloc() pool */
 #define CONFIG_SYS_MALLOC_LEN          (10 * SZ_1M)
index 8b9d9228769ef7b7e5c2b78823ea118b02098df7..231bea7855c416b8ebc871d370f4adc75bbff619 100644 (file)
@@ -57,7 +57,7 @@
 #define CONFIG_CMD_GPIO
 
 /* Thermal */
-#define CONFIG_IMX6_THERMAL
+#define CONFIG_IMX_THERMAL
 
 /* Serial */
 #define CONFIG_MXC_UART
index 634a09f34928fd8e7e33233a223b9d139f484ec5..6e89dd1455f7ff1353ecce244937b53fc6210447 100644 (file)
@@ -14,7 +14,7 @@
 #define CONFIG_SPL_MMC_SUPPORT
 #include "imx6_spl.h"
 
-#define CONFIG_IMX6_THERMAL
+#define CONFIG_IMX_THERMAL
 
 #define CONFIG_SYS_MALLOC_LEN          (10 * SZ_1M)
 #define CONFIG_BOARD_EARLY_INIT_F
index 6a57841f5fe02a803e5a7412767297d558562906..98eb0427aa5c5e3ebcfb86c2a6814c58f72893ce 100644 (file)
@@ -11,7 +11,7 @@
 
 #include "mx6_common.h"
 
-#define CONFIG_IMX6_THERMAL
+#define CONFIG_IMX_THERMAL
 
 /* Size of malloc() pool */
 #define CONFIG_SYS_MALLOC_LEN          (10 * SZ_1M)
index 04d53a7f08e4b01e6b0fb20ac4fafffc3b00ea5d..0a641c2daa5ef00fd0c16ca21f05ac063ad47465 100644 (file)
 #define CONFIG_SYS_MMC_ENV_DEV         1       /* SDHC2*/
 #endif
 
-#define CONFIG_IMX6_THERMAL
+#define CONFIG_IMX_THERMAL
 
 #endif                         /* __CONFIG_H */
index 74d04a088f3e2b15403ba4a0a2d4ca1cdd377a3f..f30c1482ec3f07ee64cc27ff41ab8981307e03e9 100644 (file)
 #define CONFIG_PCIE_IMX_POWER_GPIO     IMX_GPIO_NR(2, 1)
 #endif
 
-#define CONFIG_IMX6_THERMAL
+#define CONFIG_IMX_THERMAL
 
 #define CONFIG_CMD_TIME
 
index 4a2280bc1846367a0321f8b4cbbfb72c038ad96d..d8a4f16122383ea61daf14ce0247cd1d8f9ca5a1 100644 (file)
 #define CONFIG_FEC_DMA_MINALIGN                64
 #endif
 
-#define CONFIG_IMX6_THERMAL
+#define CONFIG_IMX_THERMAL
 
 #endif
index 66cb274f68a4fbed81a423755d18c6f281dcb5b7..70b440340ff726123888d0405bafa444a42340eb 100644 (file)
@@ -20,7 +20,7 @@
 
 #define CONFIG_SYS_HZ                  1000
 
-#define CONFIG_IMX6_THERMAL
+#define CONFIG_IMX_THERMAL
 
 /* Physical Memory Map */
 #define CONFIG_NR_DRAM_BANKS           1