Commit 1368f99346b1a6c566095bcb1df662cdbdb129b3
Committed by
Stefano Babic
1 parent
15c52b3ddd
Exists in
v2017.01-smarct4x
and in
30 other branches
thermal: imx_thermal: rework driver to be reused
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>
Showing 13 changed files with 27 additions and 25 deletions Side-by-side Diff
- 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
arch/arm/cpu/armv7/mx6/soc.c
arch/arm/imx-common/cpu.c
... | ... | @@ -154,14 +154,12 @@ |
154 | 154 | u32 cpurev; |
155 | 155 | __maybe_unused u32 max_freq; |
156 | 156 | |
157 | -#if defined(CONFIG_MX6) && defined(CONFIG_IMX6_THERMAL) | |
157 | + cpurev = get_cpu_rev(); | |
158 | + | |
159 | +#if defined(CONFIG_IMX_THERMAL) | |
158 | 160 | struct udevice *thermal_dev; |
159 | 161 | int cpu_tmp, minc, maxc, ret; |
160 | -#endif | |
161 | 162 | |
162 | - cpurev = get_cpu_rev(); | |
163 | - | |
164 | -#if defined(CONFIG_MX6) | |
165 | 163 | printf("CPU: Freescale i.MX%s rev%d.%d", |
166 | 164 | get_imx_type((cpurev & 0xFF000) >> 12), |
167 | 165 | (cpurev & 0x000F0) >> 4, |
... | ... | @@ -181,7 +179,7 @@ |
181 | 179 | mxc_get_clock(MXC_ARM_CLK) / 1000000); |
182 | 180 | #endif |
183 | 181 | |
184 | -#if defined(CONFIG_MX6) && defined(CONFIG_IMX6_THERMAL) | |
182 | +#if defined(CONFIG_IMX_THERMAL) | |
185 | 183 | puts("CPU: "); |
186 | 184 | switch (get_cpu_temp_grade(&minc, &maxc)) { |
187 | 185 | case TEMP_AUTOMOTIVE: |
drivers/thermal/Makefile
drivers/thermal/imx_thermal.c
... | ... | @@ -41,7 +41,7 @@ |
41 | 41 | int maxc; |
42 | 42 | }; |
43 | 43 | |
44 | -static int read_cpu_temperature(struct udevice *dev) | |
44 | +static int read_cpu_temperature_mx6(struct udevice *dev) | |
45 | 45 | { |
46 | 46 | int temperature; |
47 | 47 | unsigned int reg, n_meas; |
48 | 48 | |
... | ... | @@ -129,13 +129,15 @@ |
129 | 129 | struct thermal_data *priv = dev_get_priv(dev); |
130 | 130 | int cpu_tmp = 0; |
131 | 131 | |
132 | - cpu_tmp = read_cpu_temperature(dev); | |
132 | + if (is_soc_type(MXC_SOC_MX6)) | |
133 | + cpu_tmp = read_cpu_temperature_mx6(dev); | |
133 | 134 | while (cpu_tmp >= priv->critical) { |
134 | 135 | printf("CPU Temperature (%dC) too close to max (%dC)", |
135 | 136 | cpu_tmp, priv->maxc); |
136 | 137 | puts(" waiting...\n"); |
137 | 138 | udelay(5000000); |
138 | - cpu_tmp = read_cpu_temperature(dev); | |
139 | + if (is_soc_type(MXC_SOC_MX6)) | |
140 | + cpu_tmp = read_cpu_temperature_mx6(dev); | |
139 | 141 | } |
140 | 142 | |
141 | 143 | *temp = cpu_tmp; |
... | ... | @@ -157,10 +159,12 @@ |
157 | 159 | /* Read Temperature calibration data fuse */ |
158 | 160 | fuse_read(pdata->fuse_bank, pdata->fuse_word, &fuse); |
159 | 161 | |
160 | - /* Check for valid fuse */ | |
161 | - if (fuse == 0 || fuse == ~0) { | |
162 | - printf("CPU: Thermal invalid data, fuse: 0x%x\n", fuse); | |
163 | - return -EPERM; | |
162 | + if (is_soc_type(MXC_SOC_MX6)) { | |
163 | + /* Check for valid fuse */ | |
164 | + if (fuse == 0 || fuse == ~0) { | |
165 | + printf("CPU: Thermal invalid data, fuse: 0x%x\n", fuse); | |
166 | + return -EPERM; | |
167 | + } | |
164 | 168 | } |
165 | 169 | |
166 | 170 | /* set critical cooling temp */ |
include/configs/cgtqmx6eval.h
... | ... | @@ -33,10 +33,10 @@ |
33 | 33 | #define CONFIG_CMD_BMODE |
34 | 34 | |
35 | 35 | /* Thermal support */ |
36 | -#define CONFIG_IMX6_THERMAL | |
36 | +#define CONFIG_IMX_THERMAL | |
37 | 37 | |
38 | 38 | #define CONFIG_CMD_FUSE |
39 | -#if defined(CONFIG_CMD_FUSE) || defined(CONFIG_IMX6_THERMAL) | |
39 | +#if defined(CONFIG_CMD_FUSE) || defined(CONFIG_IMX_THERMAL) | |
40 | 40 | #define CONFIG_MXC_OCOTP |
41 | 41 | #endif |
42 | 42 |
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