Thermal sensor for Orion/Kirkwood
Subsystems (3)
cover Thermal sensor for Orion/Kirkwood
This patchset adds thermal support for Orion Kirkwood devices, based on code from Nobuhiro Iwamatsu. This provides a framework to later add support for the thermal sensor on Dove.
The comments raised when the code was first posted have now been addressed:
* Temperature Reading in milligrad
* marvel -> marvell
* generalized to Orion
* Compatibility string marvell,kirkwood-thermal
* Arithmetic using unsigned long
Nobuhiro Iwamatsu (2):
thermal: Add support for thermal sensor for Orion SoC
ARM: Kirkwood: Add support thermal sensor for 88F6282 and 88F6283
.../devicetree/bindings/thermal/orion-thermal.txt | 16 +++ arch/arm/boot/dts/kirkwood-6282.dtsi | 7 ++ arch/arm/configs/kirkwood_defconfig | 2 + drivers/thermal/Kconfig | 7 ++ drivers/thermal/Makefile | 1 + drivers/thermal/orion_thermal.c | 133 ++++++++++++++++++++ 6 files changed, 166 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/orion-thermal.txt create mode 100644 drivers/thermal/orion_thermal.c
Signature · 1 line
1.7.10.4
PATCH 1/2 thermal: Add support for thermal sensor for Orion SoC
From: Nobuhiro Iwamatsu <[email protected]>
Some Orion SoC has thermal sensor.
This patch adds support for 88F6282 and 88F6283.
--- .../devicetree/bindings/thermal/orion-thermal.txt | 16 +++ drivers/thermal/Kconfig | 7 ++ drivers/thermal/Makefile | 1 + drivers/thermal/orion_thermal.c | 133 ++++++++++++++++++++ 4 files changed, 157 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/orion-thermal.txt create mode 100644 drivers/thermal/orion_thermal.c
Documentation/devicetree/bindings/thermal/orion-thermal.txt new file +16 -0
@@ -0,0 +1,16 @@ +* Orion Thermal + +This initial version is for Kirkwood 88F8262 & 88F6283 SoCs, however +it is expected the driver will sometime in the future be expanded to +also support Dove, using a different compatibility string. + +Required properties: +- compatible : "marvell,kirkwood-thermal" +- reg : Address range of the thermal registers + +Example: + + thermal at 10078 { + compatible = "marvell,kirkwood"; + reg = <0x10078 0x4>; + };
drivers/thermal/Kconfig +7 -0
@@ -55,3 +55,10 @@ config EXYNOS_THERMAL help If you say yes here you get support for TMU (Thermal Managment Unit) on SAMSUNG EXYNOS series of SoC. + +config ORION_THERMAL + tristate "Temperature sensor on Marvel Orion SoCs" + depends on PLAT_ORION && THERMAL + help + Support for the Orion thermal sensor driver into the Linux thermal + framework. This currently supports only 88F6282 and 88F6283.
drivers/thermal/Makefile +1 -0
@@ -6,4 +6,5 @@ obj-$(CONFIG_THERMAL) += thermal_sys.o obj-$(CONFIG_CPU_THERMAL) += cpu_cooling.o obj-$(CONFIG_SPEAR_THERMAL) += spear_thermal.o obj-$(CONFIG_RCAR_THERMAL) += rcar_thermal.o +obj-$(CONFIG_ORION_THERMAL) += orion_thermal.o obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o
drivers/thermal/orion_thermal.c new file +133 -0
133 lines not on this page · raw message
Signature · 1 line
1.7.10.4
PATCH 1/2 thermal: Add support for thermal sensor for Orion SoC
Quoted 54 lines
-----Original Message-----
From: linux-pm-owner at vger.kernel.org [mailto:linux-pm- owner at vger.kernel.org] On Behalf Of Andrew Lunn
Sent: Friday, December 14, 2012 4:33 PM
To: linux ARM; iwamatsu at nigauri.org; linux-pm at vger.kernel.org
Cc: Jason Cooper; Sebastian Hesselbarth; Thomas Petazzoni; jgunthorpe at obsidianresearch.com; Andrew Lunn
Subject: [PATCH 1/2] thermal: Add support for thermal sensor for Orion SoCFrom: Nobuhiro Iwamatsu <[email protected]>
Some Orion SoC has thermal sensor.
This patch adds support for 88F6282 and 88F6283.Signed-off-by Nobuhiro Iwamatsu <[email protected]>Signed-off-by Andrew Lunn <[email protected]>--- .../devicetree/bindings/thermal/orion-thermal.txt | 16 +++ drivers/thermal/Kconfig | 7 ++ drivers/thermal/Makefile | 1 + drivers/thermal/orion_thermal.c | 133 ++++++++++++++++++++ 4 files changed, 157 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/orion- thermal.txt create mode 100644 drivers/thermal/orion_thermal.cDocumentation/devicetree/bindings/thermal/orion-thermal.txt new file +16
-0@@ -0,0 +1,16 @@ +* Orion Thermal + +This initial version is for Kirkwood 88F8262 & 88F6283 SoCs, however +it is expected the driver will sometime in the future be expanded to +also support Dove, using a different compatibility string. + +Required properties: +- compatible : "marvell,kirkwood-thermal" +- reg : Address range of the thermal registers + +Example: + + thermal at 10078 { + compatible = "marvell,kirkwood"; + reg = <0x10078 0x4>; + };drivers/thermal/Kconfig +0
-0
drivers/thermal/Kconfig config EXYNOS_THERMAL · line 61
Quoted 7 lines
drivers/thermal/Kconfig +4
-0@@ -55,3 +55,10 @@ config EXYNOS_THERMAL help If you say yes here you get support for TMU (Thermal Managment Unit) on SAMSUNG EXYNOS series of SoC. + +config ORION_THERMAL + tristate "Temperature sensor on Marvel Orion SoCs" + depends on PLAT_ORION && THERMAL
On what tree is this patch set based on ?
Rui's -next tree ?
If not, it would better if you could rebase it on top of that. If it is, then you don't need '&& THERMAL' in Kconfig.
Quoted 61 lines
drivers/thermal/Kconfig +3
-0+ help + Support for the Orion thermal sensor driver into the Linux thermal + framework. This currently supports only 88F6282 and 88F6283.drivers/thermal/Makefile +1
-0@@ -6,4 +6,5 @@ obj-$(CONFIG_THERMAL) += thermal_sys.o obj-$(CONFIG_CPU_THERMAL) += cpu_cooling.o obj-$(CONFIG_SPEAR_THERMAL) += spear_thermal.o obj-$(CONFIG_RCAR_THERMAL) += rcar_thermal.o +obj-$(CONFIG_ORION_THERMAL) += orion_thermal.o obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.odrivers/thermal/orion_thermal.c new file +41
-0@@ -0,0 +1,133 @@ +/* +* Orion thermal sensor driver +* +* Copyright (C) 2012 Nobuhiro Iwamatsu <[email protected]> +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +*/ +#include <linux/device.h> +#include <linux/err.h> +#include <linux/io.h> +#include <linux/kernel.h> +#include <linux/of.h> +#include <linux/module.h> +#include <linux/platform_device.h> +#include <linux/thermal.h> + +#define THERMAL_VALID_OFFSET 9 +#define THERMAL_VALID_MASK 0x1 +#define THERMAL_TEMP_OFFSET 10 +#define THERMAL_TEMP_MASK 0x1FF + +/* Orion Thermal Sensor Dev Structure */ +struct orion_thermal_dev { +void __iomem *base_addr; +}; + +static int orion_get_temp (struct thermal_zone_device *thermal, +unsigned long *temp) +{ +unsigned long reg; +struct orion_thermal_dev *thermal_dev = thermal->devdata; + + reg =readl_relaxed (thermal_dev->base_addr);
drivers/thermal/orion_thermal.c line 51
Quoted 10 lines
drivers/thermal/orion_thermal.c new file +10
-0+ +/* Valid check */ +if (!(reg >>THERMAL_VALID_OFFSET ) &THERMAL_VALID_MASK ) { +dev_info (&thermal->device, +"Temperature sensor reading not valid\n" ); +return -EIO ; + } + + reg = (reg >>THERMAL_TEMP_OFFSET ) &THERMAL_TEMP_MASK ; +/* Calculate temperature. See Table 814 in 8262 hardware manual. */
Thanks for the comment.
Can we move this comment one line above ? like below:
/* comment */
reg =
*temp =
increases readability.
BTW, is this datasheet public ?
If so, could you please add the link to the datasheet at the top ?
Quoted 30 lines
drivers/thermal/orion_thermal.c new file +30
-0+ *temp = ((322UL - reg) *10000UL *1000UL ) /13625UL ; + +return 0 ; +} + +static struct thermal_zone_device_ops ops = { + .get_temp = orion_get_temp, +}; + +static int orion_thermal_probe (struct platform_device *pdev) +{ +struct thermal_zone_device *thermal =NULL ; +struct orion_thermal_dev *thermal_dev; +struct resource *res; + + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!res) { +dev_err (&pdev->dev,"Failed to get platform resource\n" ); +return -ENODEV ; + } + + thermal_dev =devm_kzalloc (&pdev->dev,sizeof (*thermal_dev), +GFP_KERNEL ); +if (!thermal_dev) { +dev_err (&pdev->dev,"kzalloc fail\n" ); +return -ENOMEM ; + } + + thermal_dev->base_addr =devm_ioremap (&pdev->dev, res->start, +resource_size (res));
drivers/thermal/orion_thermal.c line 91
Quoted 10 lines
drivers/thermal/orion_thermal.c new file +10
-0+if (!thermal_dev->base_addr) { +dev_err (&pdev->dev,"Failed to ioremap memory\n" ); +return -ENOMEM ; + } + + thermal =thermal_zone_device_register ("orion_thermal" ,0 ,0 , + thermal_dev, &ops,0 ,0 ); +if (IS_ERR (thermal)) { +dev_err (&pdev->dev, +"Failed to register thermal zone device\n" );
Don't we have to free ioremap resource ? Or devm_ takes care of that ? please educate me :-)
Quoted 50 lines
drivers/thermal/orion_thermal.c new file +14
-0+return PTR_ERR (thermal); + } + +platform_set_drvdata (pdev, thermal); + +dev_info (&thermal->device, +KBUILD_MODNAME ": Thermal sensor registered\n" ); + +return 0 ; +} + +static int orion_thermal_exit (struct platform_device *pdev) +{ + struct thermal_zone_device *orion_thermal =
platform_get_drvdata(pdev);drivers/thermal/orion_thermal.c new file +28
-1+ +thermal_zone_device_unregister (orion_thermal); +platform_set_drvdata (pdev,NULL ); + +return 0 ; +} + +static const struct of_device_id orion_thermal_id_table[] = { + { .compatible ="marvell,kirkwood-thermal" }, + {} +}; +MODULE_DEVICE_TABLE (of, orion_thermal_id_table); + +static struct platform_driver orion_thermal_driver = { + .probe = orion_thermal_probe, + .remove = orion_thermal_exit, + .driver = { + .name ="orion_thermal" , + .owner =THIS_MODULE , + .of_match_table =of_match_ptr (orion_thermal_id_table), + }, +}; + +module_platform_driver (orion_thermal_driver); + +MODULE_AUTHOR ("Nobuhiro Iwamatsu <[email protected]>" ); +MODULE_DESCRIPTION ("orion thermal driver" ); +MODULE_LICENSE ("GPL" ); --1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 1/2 thermal: Add support for thermal sensor for Orion SoC
Quoted 55 lines · Durgadoss
Quoted 55 lines
-----Original Message-----
From: linux-pm-owner at vger.kernel.org [mailto:linux-pm- owner at vger.kernel.org] On Behalf Of Andrew Lunn
Sent: Friday, December 14, 2012 4:33 PM
To: linux ARM; iwamatsu at nigauri.org; linux-pm at vger.kernel.org
Cc: Jason Cooper; Sebastian Hesselbarth; Thomas Petazzoni; jgunthorpe at obsidianresearch.com; Andrew Lunn
Subject: [PATCH 1/2] thermal: Add support for thermal sensor for Orion SoCFrom: Nobuhiro Iwamatsu <[email protected]>
Some Orion SoC has thermal sensor.
This patch adds support for 88F6282 and 88F6283.Signed-off-by Nobuhiro Iwamatsu <[email protected]>Signed-off-by Andrew Lunn <[email protected]>--- .../devicetree/bindings/thermal/orion-thermal.txt | 16 +++ drivers/thermal/Kconfig | 7 ++ drivers/thermal/Makefile | 1 + drivers/thermal/orion_thermal.c | 133 ++++++++++++++++++++ 4 files changed, 157 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/orion- thermal.txt create mode 100644 drivers/thermal/orion_thermal.cDocumentation/devicetree/bindings/thermal/orion-thermal.txt new file +16
-0@@ -0,0 +1,16 @@ +* Orion Thermal + +This initial version is for Kirkwood 88F8262 & 88F6283 SoCs, however +it is expected the driver will sometime in the future be expanded to +also support Dove, using a different compatibility string. + +Required properties: +- compatible : "marvell,kirkwood-thermal" +- reg : Address range of the thermal registers + +Example: + + thermal at 10078 { + compatible = "marvell,kirkwood"; + reg = <0x10078 0x4>; + };drivers/thermal/Kconfig +0
-0@@ -55,3 +55,10 @@ config EXYNOS_THERMAL help
Quoted 8 lines
drivers/thermal/Kconfig config EXYNOS_THERMAL · line 61
Quoted 6 lines
drivers/thermal/Kconfig +4
-0If you say yes here you get support for TMU (Thermal Managment Unit) on SAMSUNG EXYNOS series of SoC. + +config ORION_THERMAL + tristate "Temperature sensor on Marvel Orion SoCs" + depends on PLAT_ORION && THERMALOn what tree is this patch set based on ?
Not a good one. arm-soc/for-next
I posted these patches to let other know i'm working in the driver and to get further feedback. I've also started on adding support for Dove, which is similar, but different.
It will get rebased onto -rc1 in a couple of weeks time and by then i hope i will have Dove support.
Quoted 10 lines
If it is, then you don't need '&& THERMAL' in
Kconfig.drivers/thermal/Kconfig config EXYNOS_THERMAL · line 63
Quoted 2 lines
drivers/thermal/Kconfig +2
-0+ reg = (reg >> THERMAL_TEMP_OFFSET) & THERMAL_TEMP_MASK; + /* Calculate temperature. See Table 814 in 8262 hardware manual. */Thanks for the comment.
Can we move this comment one line above ? like below:/* comment */
reg =
*temp =
Sure.
Quoted 1 line
BTW, is this datasheet public ?
Humm, think so. Take a look at Documentation/arm/Marvell/REAMDE. I will check and add a reference to this README file and the specific datasheet.
Quoted 37 lines
If so, could you please add the link to the datasheet at the top ?
Quoted 35 lines
drivers/thermal/Kconfig +35
-0+ *temp = ((322UL - reg) * 10000UL * 1000UL) / 13625UL; + + return 0; +} + +static struct thermal_zone_device_ops ops = { + .get_temp = orion_get_temp, +}; + +static int orion_thermal_probe(struct platform_device *pdev) +{ + struct thermal_zone_device *thermal = NULL; + struct orion_thermal_dev *thermal_dev; + struct resource *res; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { + dev_err(&pdev->dev, "Failed to get platform resource\n"); + return -ENODEV; + } + + thermal_dev = devm_kzalloc(&pdev->dev, sizeof(*thermal_dev), + GFP_KERNEL); + if (!thermal_dev) { + dev_err(&pdev->dev, "kzalloc fail\n"); + return -ENOMEM; + } + + thermal_dev->base_addr = devm_ioremap(&pdev->dev, res->start, + resource_size(res)); + if (!thermal_dev->base_addr) { + dev_err(&pdev->dev, "Failed to ioremap memory\n"); + return -ENOMEM; + } +
Quoted 8 lines
drivers/thermal/Kconfig
Quoted 5 lines
drivers/thermal/Kconfig +5
-0+ thermal = thermal_zone_device_register("orion_thermal", 0, 0, + thermal_dev, &ops, 0, 0); + if (IS_ERR(thermal)) { + dev_err(&pdev->dev, + "Failed to register thermal zone device\n");Don't we have to free ioremap resource ? Or
devm_takes care of that ? please educate me :-)
devm_ should take care of that. If the probe function returns an error, or the driver is unloaded, all resources allocated with devm_ get automagically freed.
Andrew
PATCH 1/2 thermal: Add support for thermal sensor for Orion SoC
Hi,
Quoted 85 lines · Andrew Lunn
Quoted 55 lines · Durgadoss
Quoted 55 lines
-----Original Message-----
From: linux-pm-owner at vger.kernel.org [mailto:linux-pm- owner at vger.kernel.org] On Behalf Of Andrew Lunn
Sent: Friday, December 14, 2012 4:33 PM
To: linux ARM; iwamatsu at nigauri.org; linux-pm at vger.kernel.org
Cc: Jason Cooper; Sebastian Hesselbarth; Thomas Petazzoni; jgunthorpe at obsidianresearch.com; Andrew Lunn
Subject: [PATCH 1/2] thermal: Add support for thermal sensor for Orion SoCFrom: Nobuhiro Iwamatsu <[email protected]>
Some Orion SoC has thermal sensor.
This patch adds support for 88F6282 and 88F6283.Signed-off-by Nobuhiro Iwamatsu <[email protected]>Signed-off-by Andrew Lunn <[email protected]>--- .../devicetree/bindings/thermal/orion-thermal.txt | 16 +++ drivers/thermal/Kconfig | 7 ++ drivers/thermal/Makefile | 1 + drivers/thermal/orion_thermal.c | 133 ++++++++++++++++++++ 4 files changed, 157 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/orion- thermal.txt create mode 100644 drivers/thermal/orion_thermal.cDocumentation/devicetree/bindings/thermal/orion-thermal.txt new file +16
-0@@ -0,0 +1,16 @@ +* Orion Thermal + +This initial version is for Kirkwood 88F8262 & 88F6283 SoCs, however +it is expected the driver will sometime in the future be expanded to +also support Dove, using a different compatibility string. + +Required properties: +- compatible : "marvell,kirkwood-thermal" +- reg : Address range of the thermal registers + +Example: + + thermal at 10078 { + compatible = "marvell,kirkwood"; + reg = <0x10078 0x4>; + };drivers/thermal/Kconfig +0
-0@@ -55,3 +55,10 @@ config EXYNOS_THERMAL helpQuoted 8 lines
drivers/thermal/Kconfig config EXYNOS_THERMAL · line 61
Quoted 6 lines
drivers/thermal/Kconfig +4
-0If you say yes here you get support for TMU (Thermal Managment Unit) on SAMSUNG EXYNOS series of SoC. + +config ORION_THERMAL + tristate "Temperature sensor on Marvel Orion SoCs" + depends on PLAT_ORION && THERMALOn what tree is this patch set based on ?
Not a good one. arm-soc/for-next
I posted these patches to let other know i'm working in the driver and to get further feedback. I've also started on adding support for Dove, which is similar, but different.
It will get rebased onto -rc1 in a couple of weeks time and by then i hope i will have Dove support.
Quoted 10 lines
If it is, then you don't need '&& THERMAL' in
Kconfig.drivers/thermal/Kconfig config EXYNOS_THERMAL · line 63
Quoted 2 lines
drivers/thermal/Kconfig +2
-0+ reg = (reg >> THERMAL_TEMP_OFFSET) & THERMAL_TEMP_MASK; + /* Calculate temperature. See Table 814 in 8262 hardware manual. */Thanks for the comment.
Can we move this comment one line above ? like below:/* comment */
reg =
*temp =
Quoted 7 lines
Sure.
Quoted 1 line
BTW, is this datasheet public ?
Humm, think so. Take a look at
Documentation/arm/Marvell/REAMDE. I will check and add a reference to this README file and the specific datasheet.
Datasheet of 88F6282 and 88F6283 is not public.
# I dont know about other SoC (about Dove).
Best regards,
Nobuhiro
Signature · 3 lines
Nobuhiro Iwamatsu
iwamatsu at {nigauri.org / debian.org}
GPG ID: 40AD1FA6PATCH 1/2 thermal: Add support for thermal sensor for Orion SoC
In reply to Andrew LunnQuoted 7 lines · Andrew Lunn
From: Nobuhiro Iwamatsu <[email protected]>
Some Orion SoC has thermal sensor.
This patch adds support for 88F6282 and 88F6283.Signed-off-by Nobuhiro Iwamatsu <[email protected]>Signed-off-by Andrew Lunn <[email protected]>
PATCH 1/2 thermal: Add support for thermal sensor for Orion SoC
In reply to Andrew LunnHi,
Thanks you for your work.
Sorry, I dont hava a time at this week about this.
Quoted 26 lines · Andrew Lunn
From: Nobuhiro Iwamatsu <[email protected]>
Some Orion SoC has thermal sensor.
This patch adds support for 88F6282 and 88F6283.Signed-off-by Nobuhiro Iwamatsu <[email protected]>Signed-off-by Andrew Lunn <[email protected]>--- .../devicetree/bindings/thermal/orion-thermal.txt | 16 +++ drivers/thermal/Kconfig | 7 ++ drivers/thermal/Makefile | 1 + drivers/thermal/orion_thermal.c | 133 ++++++++++++++++++++ 4 files changed, 157 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/orion-thermal.txt create mode 100644 drivers/thermal/orion_thermal.cDocumentation/devicetree/bindings/thermal/orion-thermal.txt new file +4
-0@@ -0,0 +1,16 @@ +* Orion Thermal + +This initial version is for Kirkwood 88F8262 & 88F6283 SoCs, however +it is expected the driver will sometime in the future be expanded to
Documentation/devicetree/bindings/thermal/orion-thermal.txt line 14
Quoted 10 lines
Documentation/devicetree/bindings/thermal/orion-thermal.txt new file +10
-0+also support Dove, using a different compatibility string. + +Required properties: +- compatible : "marvell,kirkwood-thermal" +- reg : Address range of the thermal registers + +Example: + + thermal at 10078 { + compatible = "marvell,kirkwood";
compatible = "marvell,kirkwood-thermal"; ?
drivers/thermal/Kconfig config EXYNOS_THERMAL · line 60
Quoted 13 lines
Documentation/devicetree/bindings/thermal/orion-thermal.txt new file +2
-0+ reg = <0x10078 0x4>; + };drivers/thermal/Kconfig +3
-0@@ -55,3 +55,10 @@ config EXYNOS_THERMAL help If you say yes here you get support for TMU (Thermal Managment Unit) on SAMSUNG EXYNOS series of SoC. + +config ORION_THERMAL + tristate "Temperature sensor on Marvel Orion SoCs"
Marvel -> Marvell
Quoted 154 lines
drivers/thermal/Kconfig +4
-0+ depends on PLAT_ORION && THERMAL + help + Support for the Orion thermal sensor driver into the Linux thermal + framework. This currently supports only 88F6282 and 88F6283.drivers/thermal/Makefile +1
-0@@ -6,4 +6,5 @@ obj-$(CONFIG_THERMAL) += thermal_sys.o obj-$(CONFIG_CPU_THERMAL) += cpu_cooling.o obj-$(CONFIG_SPEAR_THERMAL) += spear_thermal.o obj-$(CONFIG_RCAR_THERMAL) += rcar_thermal.o +obj-$(CONFIG_ORION_THERMAL) += orion_thermal.o obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.odrivers/thermal/orion_thermal.c new file +133
-1@@ -0,0 +1,133 @@ +/* +* Orion thermal sensor driver +* +* Copyright (C) 2012 Nobuhiro Iwamatsu <[email protected]> +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +*/ +#include <linux/device.h> +#include <linux/err.h> +#include <linux/io.h> +#include <linux/kernel.h> +#include <linux/of.h> +#include <linux/module.h> +#include <linux/platform_device.h> +#include <linux/thermal.h> + +#define THERMAL_VALID_OFFSET 9 +#define THERMAL_VALID_MASK 0x1 +#define THERMAL_TEMP_OFFSET 10 +#define THERMAL_TEMP_MASK 0x1FF + +/* Orion Thermal Sensor Dev Structure */ +struct orion_thermal_dev { +void __iomem *base_addr; +}; + +static int orion_get_temp (struct thermal_zone_device *thermal, +unsigned long *temp) +{ +unsigned long reg; +struct orion_thermal_dev *thermal_dev = thermal->devdata; + + reg =readl_relaxed (thermal_dev->base_addr); + +/* Valid check */ +if (!(reg >>THERMAL_VALID_OFFSET ) &THERMAL_VALID_MASK ) { +dev_info (&thermal->device, +"Temperature sensor reading not valid\n" ); +return -EIO ; + } + + reg = (reg >>THERMAL_TEMP_OFFSET ) &THERMAL_TEMP_MASK ; +/* Calculate temperature. See Table 814 in 8262 hardware manual. */ + *temp = ((322UL - reg) *10000UL *1000UL ) /13625UL ; + +return 0 ; +} + +static struct thermal_zone_device_ops ops = { + .get_temp = orion_get_temp, +}; + +static int orion_thermal_probe (struct platform_device *pdev) +{ +struct thermal_zone_device *thermal =NULL ; +struct orion_thermal_dev *thermal_dev; +struct resource *res; + + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!res) { +dev_err (&pdev->dev,"Failed to get platform resource\n" ); +return -ENODEV ; + } + + thermal_dev =devm_kzalloc (&pdev->dev,sizeof (*thermal_dev), +GFP_KERNEL ); +if (!thermal_dev) { +dev_err (&pdev->dev,"kzalloc fail\n" ); +return -ENOMEM ; + } + + thermal_dev->base_addr =devm_ioremap (&pdev->dev, res->start, +resource_size (res)); +if (!thermal_dev->base_addr) { +dev_err (&pdev->dev,"Failed to ioremap memory\n" ); +return -ENOMEM ; + } + + thermal =thermal_zone_device_register ("orion_thermal" ,0 ,0 , + thermal_dev, &ops,0 ,0 ); +if (IS_ERR (thermal)) { +dev_err (&pdev->dev, +"Failed to register thermal zone device\n" ); +return PTR_ERR (thermal); + } + +platform_set_drvdata (pdev, thermal); + +dev_info (&thermal->device, +KBUILD_MODNAME ": Thermal sensor registered\n" ); + +return 0 ; +} + +static int orion_thermal_exit (struct platform_device *pdev) +{ +struct thermal_zone_device *orion_thermal =platform_get_drvdata (pdev); + +thermal_zone_device_unregister (orion_thermal); +platform_set_drvdata (pdev,NULL ); + +return 0 ; +} + +static const struct of_device_id orion_thermal_id_table[] = { + { .compatible ="marvell,kirkwood-thermal" }, + {} +}; +MODULE_DEVICE_TABLE (of, orion_thermal_id_table); + +static struct platform_driver orion_thermal_driver = { + .probe = orion_thermal_probe, + .remove = orion_thermal_exit, + .driver = { + .name ="orion_thermal" , + .owner =THIS_MODULE , + .of_match_table =of_match_ptr (orion_thermal_id_table), + }, +}; + +module_platform_driver (orion_thermal_driver); + +MODULE_AUTHOR ("Nobuhiro Iwamatsu <[email protected]>" ); +MODULE_DESCRIPTION ("orion thermal driver" ); +MODULE_LICENSE ("GPL" ); --
Quoted 2 lines
1.7.10.4
Best regard,
Nobuhiro
Signature · 3 lines
Nobuhiro Iwamatsu
iwamatsu at {nigauri.org / debian.org}
GPG ID: 40AD1FA6PATCH 1/2 thermal: Add support for thermal sensor for Orion SoC
Quoted 4 lines · Nobuhiro Iwamatsu
Hi,
Thanks you for your work.
Sorry, I dont hava a time at this week about this.
Its not a problem. We have plenty of time before the next merge window. I was just interested in seeing it work on my QNAP device, so did some of the cleanup work.
Quoted 31 lines · Andrew Lunn
Quoted 30 lines
From: Nobuhiro Iwamatsu <[email protected]>
Some Orion SoC has thermal sensor.
This patch adds support for 88F6282 and 88F6283.Signed-off-by Nobuhiro Iwamatsu <[email protected]>Signed-off-by Andrew Lunn <[email protected]>--- .../devicetree/bindings/thermal/orion-thermal.txt | 16 +++ drivers/thermal/Kconfig | 7 ++ drivers/thermal/Makefile | 1 + drivers/thermal/orion_thermal.c | 133 ++++++++++++++++++++ 4 files changed, 157 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/orion-thermal.txt create mode 100644 drivers/thermal/orion_thermal.cDocumentation/devicetree/bindings/thermal/orion-thermal.txt new file +8
-0@@ -0,0 +1,16 @@ +* Orion Thermal + +This initial version is for Kirkwood 88F8262 & 88F6283 SoCs, however +it is expected the driver will sometime in the future be expanded to +also support Dove, using a different compatibility string. + +Required properties: +- compatible : "marvell,kirkwood-thermal"
Quoted 8 lines
Documentation/devicetree/bindings/thermal/orion-thermal.txt line 14
Quoted 6 lines
Documentation/devicetree/bindings/thermal/orion-thermal.txt new file +6
-0+- reg : Address range of the thermal registers + +Example: + + thermal at 10078 { + compatible = "marvell,kirkwood";compatible = "marvell,kirkwood-thermal"; ?
Yep, my error.
Quoted 7 lines
Quoted 7 lines
Documentation/devicetree/bindings/thermal/orion-thermal.txt new file +2
-0+ reg = <0x10078 0x4>; + };drivers/thermal/Kconfig +0
-0@@ -55,3 +55,10 @@ config EXYNOS_THERMAL
Quoted 8 lines
drivers/thermal/Kconfig config EXYNOS_THERMAL · line 60
Quoted 6 lines
drivers/thermal/Kconfig +3
-0help If you say yes here you get support for TMU (Thermal Managment Unit) on SAMSUNG EXYNOS series of SoC. + +config ORION_THERMAL + tristate "Temperature sensor on Marvel Orion SoCs"Marvel -> Marvell
Missed that one, thanks.
Thanks for the Tested-by. I will add it to the next version. I started work on Dove support, so i will probably repost when i have that ready for testing.
Andrew
Zhang Rui
reviewerPATCH 1/2 thermal: Add support for thermal sensor for Orion SoC
Quoted 68 lines · Andrew Lunn
Quoted 4 lines · Nobuhiro Iwamatsu
Hi,
Thanks you for your work.
Sorry, I dont hava a time at this week about this.Its not a problem. We have plenty of time before the next merge window. I was just interested in seeing it work on my QNAP device, so did some of the cleanup work.
Quoted 31 lines · Andrew Lunn
Quoted 30 lines
From: Nobuhiro Iwamatsu <[email protected]>
Some Orion SoC has thermal sensor.
This patch adds support for 88F6282 and 88F6283.Signed-off-by Nobuhiro Iwamatsu <[email protected]>Signed-off-by Andrew Lunn <[email protected]>--- .../devicetree/bindings/thermal/orion-thermal.txt | 16 +++ drivers/thermal/Kconfig | 7 ++ drivers/thermal/Makefile | 1 + drivers/thermal/orion_thermal.c | 133 ++++++++++++++++++++ 4 files changed, 157 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/orion-thermal.txt create mode 100644 drivers/thermal/orion_thermal.cDocumentation/devicetree/bindings/thermal/orion-thermal.txt new file +8
-0@@ -0,0 +1,16 @@ +* Orion Thermal + +This initial version is for Kirkwood 88F8262 & 88F6283 SoCs, however +it is expected the driver will sometime in the future be expanded to +also support Dove, using a different compatibility string. + +Required properties: +- compatible : "marvell,kirkwood-thermal"Quoted 8 lines
Documentation/devicetree/bindings/thermal/orion-thermal.txt line 14
Quoted 6 lines
Documentation/devicetree/bindings/thermal/orion-thermal.txt new file +6
-0+- reg : Address range of the thermal registers + +Example: + + thermal at 10078 { + compatible = "marvell,kirkwood";compatible = "marvell,kirkwood-thermal"; ?
Yep, my error.
Quoted 7 lines
Quoted 7 lines
Documentation/devicetree/bindings/thermal/orion-thermal.txt new file +2
-0+ reg = <0x10078 0x4>; + };drivers/thermal/Kconfig +0
-0@@ -55,3 +55,10 @@ config EXYNOS_THERMALQuoted 8 lines
drivers/thermal/Kconfig config EXYNOS_THERMAL · line 60
Quoted 6 lines
drivers/thermal/Kconfig +3
-0help If you say yes here you get support for TMU (Thermal Managment Unit) on SAMSUNG EXYNOS series of SoC. + +config ORION_THERMAL + tristate "Temperature sensor on Marvel Orion SoCs"Marvel -> Marvell
Quoted 5 lines
Missed that one, thanks.
Thanks for the Tested-by. I will add it to the next version. I started work on Dove support, so i will probably repost when i have that ready for testing.
sorry for the late response, can you resend the refreshed version on top of the thermal next tree?
thanks,
rui
PATCH 1/2 thermal: Add support for thermal sensor for Orion SoC
Quoted 69 lines · Zhang Rui
Quoted 68 lines · Andrew Lunn
Quoted 4 lines · Nobuhiro Iwamatsu
Hi,
Thanks you for your work.
Sorry, I dont hava a time at this week about this.Its not a problem. We have plenty of time before the next merge window. I was just interested in seeing it work on my QNAP device, so did some of the cleanup work.
Quoted 31 lines · Andrew Lunn
Quoted 30 lines
From: Nobuhiro Iwamatsu<[email protected]>
Some Orion SoC has thermal sensor.
This patch adds support for 88F6282 and 88F6283.Signed-off-by Nobuhiro Iwamatsu<[email protected]>Signed-off-by Andrew Lunn<[email protected]>--- .../devicetree/bindings/thermal/orion-thermal.txt | 16 +++ drivers/thermal/Kconfig | 7 ++ drivers/thermal/Makefile | 1 + drivers/thermal/orion_thermal.c | 133 ++++++++++++++++++++ 4 files changed, 157 insertions(+)create mode 100644
Documentation/devicetree/bindings/thermal/orion-thermal.txtcreate mode 100644drivers/thermal/orion_thermal.cDocumentation/devicetree/bindings/thermal/orion-thermal.txt new file +8
-0@@ -0,0 +1,16 @@ +* Orion Thermal + +This initial version is for Kirkwood 88F8262& 88F6283 SoCs, however +it is expected the driver will sometime in the future be expanded to +also support Dove, using a different compatibility string. + +Required properties: +- compatible : "marvell,kirkwood-thermal"Quoted 8 lines
Documentation/devicetree/bindings/thermal/orion-thermal.txt line 14
Quoted 6 lines
Documentation/devicetree/bindings/thermal/orion-thermal.txt new file +6
-0+- reg : Address range of the thermal registers + +Example: + + thermal at 10078 { + compatible = "marvell,kirkwood";compatible = "marvell,kirkwood-thermal"; ?
Yep, my error.
Quoted 15 lines
drivers/thermal/Kconfig config EXYNOS_THERMAL · line 60
Quoted 13 lines
Documentation/devicetree/bindings/thermal/orion-thermal.txt new file +2
-0+ reg =<0x10078 0x4>; + };drivers/thermal/Kconfig +3
-0@@ -55,3 +55,10 @@ config EXYNOS_THERMAL help If you say yes here you get support for TMU (Thermal Managment Unit) on SAMSUNG EXYNOS series of SoC. + +config ORION_THERMAL + tristate "Temperature sensor on Marvel Orion SoCs"Marvel -> Marvell
Quoted 8 lines
Quoted 5 lines
Missed that one, thanks.
Thanks for the Tested-by. I will add it to the next version. I started work on Dove support, so i will probably repost when i have that ready for testing.
sorry for the late response, can you resend the refreshed version on top of the thermal next tree?
Hi Rui
Im in the process of generalizing the driver so that it works for Kirkwood, Dove, Armada 370 and Armada XP. The combined driver is not finished yet. Once i have something ready i will repost.
Andrew
PATCH 1/2 thermal: Add support for thermal sensor for Orion SoC
In reply to Andrew LunnHey Andrew,
Quoted 28 lines · Andrew Lunn
From: Nobuhiro Iwamatsu <[email protected]>
Some Orion SoC has thermal sensor.
This patch adds support for 88F6282 and 88F6283.Signed-off-by Nobuhiro Iwamatsu <[email protected]>Signed-off-by Andrew Lunn <[email protected]>--- .../devicetree/bindings/thermal/orion-thermal.txt | 16 +++ drivers/thermal/Kconfig | 7 ++ drivers/thermal/Makefile | 1 + drivers/thermal/orion_thermal.c | 133 ++++++++++++++++++++ 4 files changed, 157 insertions(+)create mode 100644
Documentation/devicetree/bindings/thermal/orion-thermal.txtcreate mode 100644drivers/thermal/orion_thermal.cDocumentation/devicetree/bindings/thermal/orion-thermal.txt new file +6
-0@@ -0,0 +1,16 @@ +* Orion Thermal + +This initial version is for Kirkwood 88F8262 & 88F6283 SoCs, however +it is expected the driver will sometime in the future be expanded to +also support Dove, using a different compatibility string. +
Documentation/devicetree/bindings/thermal/orion-thermal.txt line 16
Quoted 10 lines
Documentation/devicetree/bindings/thermal/orion-thermal.txt new file +10
-0+Required properties: +- compatible : "marvell,kirkwood-thermal" +- reg : Address range of the thermal registers + +Example: + + thermal at 10078 { + compatible = "marvell,kirkwood"; + reg = <0x10078 0x4>; + };
How do you differentiate if the SoC has the temperature sensor? On your patch description you are very clear saying that this supports only 88F8262 & 88F6283 SoCs.
Quoted 66 lines
drivers/thermal/Kconfig +7
-0@@ -55,3 +55,10 @@ config EXYNOS_THERMAL help If you say yes here you get support for TMU (Thermal Managment Unit) on SAMSUNG EXYNOS series of SoC. + +config ORION_THERMAL + tristate "Temperature sensor on Marvel Orion SoCs" + depends on PLAT_ORION && THERMAL + help + Support for the Orion thermal sensor driver into the Linux thermal + framework. This currently supports only 88F6282 and 88F6283.drivers/thermal/Makefile +1
-0@@ -6,4 +6,5 @@ obj-$(CONFIG_THERMAL) += thermal_sys.o obj-$(CONFIG_CPU_THERMAL) += cpu_cooling.o obj-$(CONFIG_SPEAR_THERMAL) += spear_thermal.o obj-$(CONFIG_RCAR_THERMAL) += rcar_thermal.o +obj-$(CONFIG_ORION_THERMAL) += orion_thermal.o obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.odrivers/thermal/orion_thermal.c new file +35
-0@@ -0,0 +1,133 @@ +/* +* Orion thermal sensor driver +* +* Copyright (C) 2012 Nobuhiro Iwamatsu <[email protected]> +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +*/ +#include <linux/device.h> +#include <linux/err.h> +#include <linux/io.h> +#include <linux/kernel.h> +#include <linux/of.h> +#include <linux/module.h> +#include <linux/platform_device.h> +#include <linux/thermal.h> + +#define THERMAL_VALID_OFFSET 9 +#define THERMAL_VALID_MASK 0x1 +#define THERMAL_TEMP_OFFSET 10 +#define THERMAL_TEMP_MASK 0x1FF + +/* Orion Thermal Sensor Dev Structure */ +struct orion_thermal_dev { +void __iomem *base_addr; +}; + +static int orion_get_temp(struct thermal_zone_device *thermal,
drivers/thermal/orion_thermal.c line 45
Quoted 10 lines
drivers/thermal/orion_thermal.c new file +10
-0+ unsigned long *temp) +{ +unsigned long reg; +struct orion_thermal_dev *thermal_dev = thermal->devdata; + + reg =readl_relaxed (thermal_dev->base_addr); + +/* Valid check */ +if (!(reg >>THERMAL_VALID_OFFSET ) &THERMAL_VALID_MASK ) { + dev_info(&thermal->device,
This state seams to be severe enough to get a dev_err level message.
Quoted 26 lines
drivers/thermal/orion_thermal.c new file +26
-0+ "Temperature sensor reading not valid\n"); +return -EIO ; + } + + reg = (reg >>THERMAL_TEMP_OFFSET ) &THERMAL_TEMP_MASK ; +/* Calculate temperature. See Table 814 in 8262 hardware manual. */ + *temp = ((322UL - reg) *10000UL *1000UL ) /13625UL ; + +return 0 ; +} + +static struct thermal_zone_device_ops ops = { + .get_temp = orion_get_temp, +}; + +static int orion_thermal_probe (struct platform_device *pdev) +{ +struct thermal_zone_device *thermal =NULL ; +struct orion_thermal_dev *thermal_dev; +struct resource *res; + + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!res) { +dev_err (&pdev->dev,"Failed to get platform resource\n" ); +return -ENODEV ; + }
drivers/thermal/orion_thermal.c line 81
Quoted 10 lines
drivers/thermal/orion_thermal.c new file +10
-0+ + thermal_dev =devm_kzalloc (&pdev->dev,sizeof (*thermal_dev), +GFP_KERNEL ); +if (!thermal_dev) { +dev_err (&pdev->dev,"kzalloc fail\n" ); +return -ENOMEM ; + } + + thermal_dev->base_addr =devm_ioremap (&pdev->dev, res->start, +resource_size (res));
I believe you forgot to request this memory. I suggest you do:
+ thermal_dev->base_addr = devm_request_and_ioremap(&pdev->dev, res->start,
+ res);
Quoted 7 lines
drivers/thermal/orion_thermal.c new file +7
-0+if (!thermal_dev->base_addr) { +dev_err (&pdev->dev,"Failed to ioremap memory\n" ); +return -ENOMEM ; + } + + thermal =thermal_zone_device_register ("orion_thermal" ,0 ,0 , + thermal_dev, &ops,0 ,0 );
drivers/thermal/orion_thermal.c line 98
Quoted 10 lines
drivers/thermal/orion_thermal.c new file +10
-0+if (IS_ERR (thermal)) { +dev_err (&pdev->dev, +"Failed to register thermal zone device\n" ); +return PTR_ERR (thermal); + } + +platform_set_drvdata (pdev, thermal); + +dev_info (&thermal->device, +KBUILD_MODNAME ": Thermal sensor registered\n" );
Do you really need to be verbose? I suppose one can always check sysfs entries to see if there is a successful driver & device binding...
Quoted 36 lines
drivers/thermal/orion_thermal.c new file +35
-0+ +return 0 ; +} + +static int orion_thermal_exit (struct platform_device *pdev) +{ +struct thermal_zone_device *orion_thermal =platform_get_drvdata (pdev); + +thermal_zone_device_unregister (orion_thermal); +platform_set_drvdata (pdev,NULL ); + +return 0 ; +} + +static const struct of_device_id orion_thermal_id_table[] = { + { .compatible ="marvell,kirkwood-thermal" }, + {} +}; +MODULE_DEVICE_TABLE (of, orion_thermal_id_table); + +static struct platform_driver orion_thermal_driver = { + .probe = orion_thermal_probe, + .remove = orion_thermal_exit, + .driver = { + .name ="orion_thermal" , + .owner =THIS_MODULE , + .of_match_table =of_match_ptr (orion_thermal_id_table), + }, +}; + +module_platform_driver (orion_thermal_driver); + +MODULE_AUTHOR ("Nobuhiro Iwamatsu <[email protected]>" ); +MODULE_DESCRIPTION ("orion thermal driver" ); +MODULE_LICENSE ("GPL" );
PATCH 1/2 thermal: Add support for thermal sensor for Orion SoC
Hello again,
Quoted 4 lines · Eduardo Valentin
Hey Andrew,
Quoted 1 line · Andrew Lunn
From: Nobuhiro Iwamatsu <[email protected]>
<cut>
Quoted 6 lines
I believe you forgot to request this memory. I suggest you do:
+thermal_dev->base_addr= devm_request_and_ioremap(&pdev->dev,res->start,
+ res);
small fix:
+ thermal_dev->base_addr = devm_request_and_ioremap(&pdev->dev,
+ res);
PATCH 1/2 thermal: Add support for thermal sensor for Orion SoC
In reply to Eduardo ValentinQuoted 40 lines · Eduardo Valentin
Hey Andrew,
Quoted 37 lines · Andrew Lunn
From: Nobuhiro Iwamatsu <[email protected]>
Some Orion SoC has thermal sensor.
This patch adds support for 88F6282 and 88F6283.Signed-off-by Nobuhiro Iwamatsu <[email protected]>Signed-off-by Andrew Lunn <[email protected]>---
.../devicetree/bindings/thermal/orion-thermal.txt| 16 +++drivers/thermal/Kconfig| 7 ++drivers/thermal/Makefile| 1 +drivers/thermal/orion_thermal.c| 133 ++++++++++++++++++++4 files changed, 157 insertions(+)create mode 100644
Documentation/devicetree/bindings/thermal/orion-thermal.txtcreate mode 100644drivers/thermal/orion_thermal.cdiff --git
a/Documentation/devicetree/bindings/thermal/orion-thermal.txtb/Documentation/devicetree/bindings/thermal/orion-thermal.txtnew file mode 100644
index 0000000..5ce925dDocumentation/devicetree/bindings/thermal/orion-thermal.txt new file +12
-0@@ -0,0 +1,16 @@ +* Orion Thermal + +This initial version is for Kirkwood 88F8262 & 88F6283 SoCs, however +it is expected the driver will sometime in the future be expanded to +also support Dove, using a different compatibility string. + +Required properties: +- compatible : "marvell,kirkwood-thermal" +- reg : Address range of the thermal registers + +Example: +
Quoted 8 lines
Documentation/devicetree/bindings/thermal/orion-thermal.txt line 16
Quoted 4 lines
Documentation/devicetree/bindings/thermal/orion-thermal.txt new file +4
-0+ thermal at 10078 { + compatible = "marvell,kirkwood"; + reg = <0x10078 0x4>; + };How do you differentiate if the SoC has the temperature sensor? On your patch description you are very clear saying that this supports only 88F8262 & 88F6283 SoCs.
Hi Eduardo
Thanks for the comments. I will address them in the next version.
We differentiate between the different SoCs by DT. Each has its own .dtsi file and we will put the node into only those which have the hardware.
Thanks
Andrew
PATCH 1/2 thermal: Add support for thermal sensor for Orion SoC
Quoted 50 lines · Andrew Lunn
Quoted 40 lines · Eduardo Valentin
Hey Andrew,
Quoted 37 lines · Andrew Lunn
From: Nobuhiro Iwamatsu <[email protected]>
Some Orion SoC has thermal sensor.
This patch adds support for 88F6282 and 88F6283.Signed-off-by Nobuhiro Iwamatsu <[email protected]>Signed-off-by Andrew Lunn <[email protected]>---
.../devicetree/bindings/thermal/orion-thermal.txt| 16 +++drivers/thermal/Kconfig| 7 ++drivers/thermal/Makefile| 1 +drivers/thermal/orion_thermal.c| 133 ++++++++++++++++++++4 files changed, 157 insertions(+)create mode 100644
Documentation/devicetree/bindings/thermal/orion-thermal.txtcreate mode 100644drivers/thermal/orion_thermal.cdiff --git
a/Documentation/devicetree/bindings/thermal/orion-thermal.txtb/Documentation/devicetree/bindings/thermal/orion-thermal.txtnew file mode 100644
index 0000000..5ce925dDocumentation/devicetree/bindings/thermal/orion-thermal.txt new file +12
-0@@ -0,0 +1,16 @@ +* Orion Thermal + +This initial version is for Kirkwood 88F8262 & 88F6283 SoCs, however +it is expected the driver will sometime in the future be expanded to +also support Dove, using a different compatibility string. + +Required properties: +- compatible : "marvell,kirkwood-thermal" +- reg : Address range of the thermal registers + +Example: +Quoted 8 lines
Documentation/devicetree/bindings/thermal/orion-thermal.txt line 16
Quoted 4 lines
Documentation/devicetree/bindings/thermal/orion-thermal.txt new file +4
-0+ thermal at 10078 { + compatible = "marvell,kirkwood"; + reg = <0x10078 0x4>; + };How do you differentiate if the SoC has the temperature sensor? On your patch description you are very clear saying that this supports only 88F8262 & 88F6283 SoCs.
Quoted 4 lines
Hi Eduardo
Thanks for the comments. I will address them in the next version.
OK. Please put me on Cc so I will keep the review.
Quoted 3 lines
We differentiate between the different SoCs by DT. Each has its own .dtsi file and we will put the node into only those which have the hardware.
Ok. That I understand, but my question was more into the difference between 88F6282 and 88F6283. Do you need to differentiate those two? Is there feature set which is specific to one which is not present in the second ? Because the DT entries you have you won't differentiate them, besides you don't read any revision register to check the chip version. That's my point.
Quoted 3 lines
Thanks
Andrew
PATCH 1/2 thermal: Add support for thermal sensor for Orion SoC
Quoted 8 lines
OK. Please put me on Cc so I will keep the review.
Quoted 3 lines
We differentiate between the different SoCs by DT. Each has its own .dtsi file and we will put the node into only those which have the hardware.
Ok. That I understand, but my question was more into the difference between 88F6282 and 88F6283. Do you need to differentiate those two?
Hi Eduardo
No, there is no need to differentiate between these. As far as the temperature sensor goes, they are identical. I've been testing on a 88F6282 and Nobuhiro Iwamatsu on a 88F6283.
Andrew
PATCH 2/2 ARM: Kirkwood: Add support thermal sensor for 88F6282 and 88F6283
In reply to Andrew LunnFrom: Nobuhiro Iwamatsu <[email protected]>
88F6282 and 88F6283 has thermal sensor.
This patch enables DT and kernel config.
--- arch/arm/boot/dts/kirkwood-6282.dtsi | 7 +++++++ arch/arm/configs/kirkwood_defconfig | 2 ++ 2 files changed, 9 insertions(+)
arch/arm/boot/dts/kirkwood-6282.dtsi +7 -0
@@ -32,6 +32,12 @@ }; }; + thermal at 10078 { + compatible = "marvell,kirkwood-thermal"; + reg = <0x10078 0x4>; + status = "okay"; + }; + i2c at 11100 { compatible = "marvell,mv64xxx-i2c"; reg = <0x11100 0x20>;
@@ -41,5 +47,6 @@ clock-frequency = <100000>; status = "disabled"; }; + }; };
arch/arm/configs/kirkwood_defconfig +2 -0
@@ -118,6 +118,8 @@ CONFIG_SPI=y CONFIG_SPI_ORION=y CONFIG_GPIO_SYSFS=y # CONFIG_HWMON is not set +CONFIG_THERMAL=y +CONFIG_ORION_THERMAL=y CONFIG_WATCHDOG=y CONFIG_ORION_WATCHDOG=y CONFIG_HID_DRAGONRISE=y
Signature · 1 line
1.7.10.4