diff options
author | Adrian Alonso <aalonso@freescale.com> | 2015-09-02 21:54:13 +0300 |
---|---|---|
committer | Stefano Babic <sbabic@denx.de> | 2015-09-13 11:11:53 +0300 |
commit | 1368f99346b1a6c566095bcb1df662cdbdb129b3 (patch) | |
tree | 62c61701a30e15abd3e7adf2a21dd19fbe32233a /drivers | |
parent | 15c52b3ddd1e46743f5fb604f0cbcae144237ed5 (diff) | |
download | u-boot-1368f99346b1a6c566095bcb1df662cdbdb129b3.tar.xz |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/thermal/Makefile | 2 | ||||
-rw-r--r-- | drivers/thermal/imx_thermal.c | 18 |
2 files changed, 12 insertions, 8 deletions
diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile index 6d4cacdcf7..d768f5ef80 100644 --- a/drivers/thermal/Makefile +++ b/drivers/thermal/Makefile @@ -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 diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index 3c6c9679f9..d90874e5ec 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -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 */ |