Marvell EBU thermal sensor consolidation
Subsystems (3)
v2 cover Marvell EBU thermal sensor consolidation
Given Armada 370/XP and the other Marvell SoC with thermal support, namely Kirkwood and Dove, have fairly similar thermal devices it makes sense to integrate all of them into a single driver: mvebu-thermal.
The patches have been carefully splitted to make the changeset as less invasive as possible. These changes can be divided in five stages:
1. Rename 'kirkwood' driver to 'mvebu'
2. Some fixes inherited from kirkwood driver applied to new mvebu driver
3. Prepare mvebu driver to support multiple SoC
4. Add thermal support for each Marvell SoC on top of mvebu driver
5. Add device tree nodes for Armada 370 and Armada XP
6. Fix defconfigs for all the platforms involved
Testing have been done on the following boards:
Kirkwood: Plat'home Openblocks A6 Armada 370: Globalscale Mirabox and Marvell Armada 370 RD Armada XP: Plat'home Openblocks AX3 and Marvell Armada XP DB-MV784MP-GP
Dove is *not* tested due to lack of hardware.
Also, please note that the defconfigs for involved platforms have been fixed deliberately in a single patch, to ease maintainer's job as the defconfigs file goes through one tree and the thermal driver should go through another.
Since I'm merging two existing drivers into a new driver, I retained authorship and copyright of the merged drivers and added my own. For this reason, I'd like to have Andrew and Nobuhiro Acked (or Nacked, of course).
This series is based in v3.9-rc2 with the following patches applied:
Dove: Thermal: Add DT node and enable in defconfig
ARM: Kirkwood: Add support thermal sensor for 88F6282 and 88F6283
Also it depends on the following fixes that I recently sent for v3.9:
thermal: dove: Fix thermal sensor formula
thermal: kirkwood: Fix thermal sensor formula
thermal: mvebu: Fix valid check for thermal register
To make testing easier I've pushed a github branch:
https://github.com/MISL-EBU-System-SW/mainline-public/commits/mvebu-thermal-v2
Changes from v1:
* Fixed devm_ioremap_resource() API usage, as pointed out by Andrew, Rusell and Sergei.
* The fixes that corresponded to be applied on v3.9 were removed from this patchset and sent as independent patches, as requested by Jason Cooper.
* The formulas for thermal sensor were replaced by better ones, confirmed by Lior Amsalem.
* The infrastructure for multiple SoC was reworked to drop switches, using function pointers instead as suggested by Jason Gunthorpe.
Any feedback or comments are welcome!
Ezequiel Garcia (14):
thermal: Rename driver 'kirkwood' -> 'mvebu'
thermal: mvebu: Rename symbols 'kirkwood' -> 'mvebu'
thermal: mvebu: Move MODULE_DEVICE_TABLE upwards
thermal: mvebu: Remove unneeded variable initialization
thermal: mvebu: Convert to devm_ioremap_resource()
thermal: mvebu: Fix license declaration
thermal: mvebu: Rename kirkwood definitions to mvebu
thermal: mvebu: Add infrastructure to support more multiple SoC
variants
thermal: mvebu: Add support for Armada XP thermal sensor
thermal: mvebu: Add support for Armada 370 thermal sensor
thermal: mvebu: Add support for Marvell Dove SoC family
ARM: mvebu: Add thermal support to Armada XP device tree
ARM: mvebu: Add thermal support to Armada 370 device tree
ARM: configs: Update mvebu, dove and kirkwood defconfigs for thermal
.../devicetree/bindings/thermal/dove-thermal.txt | 18 - .../bindings/thermal/kirkwood-thermal.txt | 15 - .../devicetree/bindings/thermal/mvebu-thermal.txt | 31 ++ arch/arm/boot/dts/armada-370.dtsi | 6 + arch/arm/boot/dts/armada-xp.dtsi | 6 + arch/arm/configs/dove_defconfig | 2 +- arch/arm/configs/kirkwood_defconfig | 2 +- arch/arm/configs/mvebu_defconfig | 2 + drivers/thermal/Kconfig | 18 +- drivers/thermal/Makefile | 3 +- drivers/thermal/dove_thermal.c | 210 ------------ drivers/thermal/kirkwood_thermal.c | 134 -------- drivers/thermal/mvebu_thermal.c | 347 ++++++++++++++++++++ 13 files changed, 400 insertions(+), 394 deletions(-) delete mode 100644 Documentation/devicetree/bindings/thermal/dove-thermal.txt delete mode 100644 Documentation/devicetree/bindings/thermal/kirkwood-thermal.txt create mode 100644 Documentation/devicetree/bindings/thermal/mvebu-thermal.txt delete mode 100644 drivers/thermal/dove_thermal.c delete mode 100644 drivers/thermal/kirkwood_thermal.c create mode 100644 drivers/thermal/mvebu_thermal.c
Signature · 1 line
1.7.8.6
PATCH v2 1/14 thermal: Rename driver 'kirkwood' -> 'mvebu'
This driver will support several Marvell SoC, so it is convenient to rename it to 'mvebu' to represent accurately the hardware it supports.
--- .../bindings/thermal/kirkwood-thermal.txt | 15 --- .../devicetree/bindings/thermal/mvebu-thermal.txt | 15 +++ drivers/thermal/Kconfig | 10 +- drivers/thermal/Makefile | 2 +- drivers/thermal/kirkwood_thermal.c | 134 -------------------- drivers/thermal/mvebu_thermal.c | 134 ++++++++++++++++++++ 6 files changed, 155 insertions(+), 155 deletions(-) delete mode 100644 Documentation/devicetree/bindings/thermal/kirkwood-thermal.txt create mode 100644 Documentation/devicetree/bindings/thermal/mvebu-thermal.txt delete mode 100644 drivers/thermal/kirkwood_thermal.c create mode 100644 drivers/thermal/mvebu_thermal.c
Documentation/devicetree/bindings/thermal/kirkwood-thermal.txt deleted +0 -15
@@ -1,15 +0,0 @@ -* Kirkwood Thermal - -This version is for Kirkwood 88F8262 & 88F6283 SoCs. Other kirkwoods -don't contain a thermal sensor. - -Required properties: -- compatible : "marvell,kirkwood-thermal" -- reg : Address range of the thermal registers - -Example: - - thermal at 10078 { - compatible = "marvell,kirkwood-thermal"; - reg = <0x10078 0x4>; - };
Documentation/devicetree/bindings/thermal/mvebu-thermal.txt new file +15 -0
@@ -0,0 +1,15 @@ +* Kirkwood Thermal + +This version is for Kirkwood 88F8262 & 88F6283 SoCs. Other kirkwoods +don't contain a thermal sensor. + +Required properties: +- compatible : "marvell,kirkwood-thermal" +- reg : Address range of the thermal registers + +Example: + + thermal at 10078 { + compatible = "marvell,kirkwood-thermal"; + reg = <0x10078 0x4>; + };
drivers/thermal/Kconfig +5 -5
@@ -101,13 +101,13 @@ config RCAR_THERMAL Enable this to plug the R-Car thermal sensor driver into the Linux thermal framework -config KIRKWOOD_THERMAL - tristate "Temperature sensor on Marvell Kirkwood SoCs" - depends on ARCH_KIRKWOOD +config MVEBU_THERMAL + tristate "Temperature sensor on Marvell EBU SoCs" + depends on PLAT_ORION depends on OF help - Support for the Kirkwood thermal sensor driver into the Linux thermal - framework. Only kirkwood 88F6282 and 88F6283 have this sensor. + Support for the thermal controllers available in several Marvell + EBU SoCs in the thermal framework. config EXYNOS_THERMAL tristate "Temperature sensor on Samsung EXYNOS"
drivers/thermal/Makefile +1 -1
@@ -15,7 +15,7 @@ obj-$(CONFIG_CPU_THERMAL) += cpu_cooling.o # platform thermal drivers obj-$(CONFIG_SPEAR_THERMAL) += spear_thermal.o obj-$(CONFIG_RCAR_THERMAL) += rcar_thermal.o -obj-$(CONFIG_KIRKWOOD_THERMAL) += kirkwood_thermal.o +obj-$(CONFIG_MVEBU_THERMAL) += mvebu_thermal.o obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o obj-$(CONFIG_DOVE_THERMAL) += dove_thermal.o obj-$(CONFIG_DB8500_THERMAL) += db8500_thermal.o
drivers/thermal/kirkwood_thermal.c deleted +0 -134
134 lines not on this page · raw message
drivers/thermal/mvebu_thermal.c new file +134 -0
134 lines not on this page · raw message
Signature · 1 line
1.7.8.6
PATCH v2 1/14 thermal: Rename driver 'kirkwood' -> 'mvebu'
Hello Ezequiel,
Two minor comments.
Quoted 14 lines · Ezequiel Garcia
This driver will support several Marvell SoC, so it is convenient to rename it to 'mvebu' to represent accurately the hardware it supports.
Signed-off-by Ezequiel Garcia <[email protected]>---
.../bindings/thermal/kirkwood-thermal.txt| 15 ---.../devicetree/bindings/thermal/mvebu-thermal.txt | 15 +++ drivers/thermal/Kconfig | 10 +- drivers/thermal/Makefile | 2 +- drivers/thermal/kirkwood_thermal.c | 134 -------------------- drivers/thermal/mvebu_thermal.c | 134 ++++++++++++++++++++ 6 files changed, 155 insertions(+), 155 deletions(-)
Quoted 4 lines
delete mode 100644
Documentation/devicetree/bindings/thermal/kirkwood-thermal.txtcreate mode 100644Documentation/devicetree/bindings/thermal/mvebu-thermal.txtdelete mode 100644drivers/thermal/kirkwood_thermal.c
create mode 100644drivers/thermal/mvebu_thermal.c
When sending renames, use git format-patch --find-renames. The summary will be much descriptive on what you have done.
I tried applying this patch on top of linux-next, linus/master, ruis/thermal, on top of the your suggested dependencies, and all failed. What is your base?
Quoted 360 lines
Documentation/devicetree/bindings/thermal/kirkwood-thermal.txt deleted +0
-15@@ -1,15 +0,0 @@ -* Kirkwood Thermal - -This version is for Kirkwood 88F8262 & 88F6283 SoCs. Other kirkwoods -don't contain a thermal sensor. - -Required properties: -- compatible : "marvell,kirkwood-thermal" -- reg : Address range of the thermal registers - -Example: - - thermal at 10078 { - compatible = "marvell,kirkwood-thermal"; - reg = <0x10078 0x4>; - };Documentation/devicetree/bindings/thermal/mvebu-thermal.txt new file +15
-0@@ -0,0 +1,15 @@ +* Kirkwood Thermal + +This version is for Kirkwood 88F8262 & 88F6283 SoCs. Other kirkwoods +don't contain a thermal sensor. + +Required properties: +- compatible : "marvell,kirkwood-thermal" +- reg : Address range of the thermal registers + +Example: + + thermal at 10078 { + compatible = "marvell,kirkwood-thermal"; + reg = <0x10078 0x4>; + };drivers/thermal/Kconfig +5
-5@@ -101,13 +101,13 @@ config RCAR_THERMAL Enable this to plug the R-Car thermal sensor driver into the Linux thermal framework -config KIRKWOOD_THERMAL - tristate "Temperature sensor on Marvell Kirkwood SoCs" - depends on ARCH_KIRKWOOD +config MVEBU_THERMAL + tristate "Temperature sensor on Marvell EBU SoCs" + depends on PLAT_ORION depends on OF help - Support for the Kirkwood thermal sensor driver into the Linux thermal - framework. Only kirkwood 88F6282 and 88F6283 have this sensor. + Support for the thermal controllers available in several Marvell + EBU SoCs in the thermal framework. config EXYNOS_THERMAL tristate "Temperature sensor on Samsung EXYNOS"drivers/thermal/Makefile +1
-1@@ -15,7 +15,7 @@ obj-$(CONFIG_CPU_THERMAL) += cpu_cooling.o # platform thermal drivers obj-$(CONFIG_SPEAR_THERMAL) += spear_thermal.o obj-$(CONFIG_RCAR_THERMAL) += rcar_thermal.o -obj-$(CONFIG_KIRKWOOD_THERMAL) += kirkwood_thermal.o +obj-$(CONFIG_MVEBU_THERMAL) += mvebu_thermal.o obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o obj-$(CONFIG_DOVE_THERMAL) += dove_thermal.o obj-$(CONFIG_DB8500_THERMAL) += db8500_thermal.odrivers/thermal/kirkwood_thermal.c deleted +0
-134@@ -1,134 +0,0 @@ -/* -* Kirkwood 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 KIRKWOOD_THERMAL_VALID_OFFSET 9 -#define KIRKWOOD_THERMAL_VALID_MASK 0x1 -#define KIRKWOOD_THERMAL_TEMP_OFFSET 10 -#define KIRKWOOD_THERMAL_TEMP_MASK 0x1FF - -/* Kirkwood Thermal Sensor Dev Structure */ -struct kirkwood_thermal_priv { -void __iomem *sensor; -}; - -static int kirkwood_get_temp (struct thermal_zone_device *thermal, -unsigned long *temp) -{ -unsigned long reg; -struct kirkwood_thermal_priv *priv = thermal->devdata; - - reg =readl_relaxed (priv->sensor); - -/* Valid check */ -if (!((reg >>KIRKWOOD_THERMAL_VALID_OFFSET ) & -KIRKWOOD_THERMAL_VALID_MASK )) { -dev_err (&thermal->device, -"Temperature sensor reading not valid\n" ); -return -EIO ; - } - -/* -* Calculate temperature. According to Marvell internal -* documentation the formula for this is: -* Celsius = (322-reg)/1.3625 -*/ - reg = (reg >>KIRKWOOD_THERMAL_TEMP_OFFSET ) & -KIRKWOOD_THERMAL_TEMP_MASK ; - *temp = ((3220000000UL - (10000000UL * reg)) /13625 ); - -return 0 ; -} - -static struct thermal_zone_device_ops ops = { - .get_temp = kirkwood_get_temp, -}; - -static const struct of_device_id kirkwood_thermal_id_table[] = { - { .compatible ="marvell,kirkwood-thermal" }, - {} -}; - -static int kirkwood_thermal_probe (struct platform_device *pdev) -{ -struct thermal_zone_device *thermal =NULL ; -struct kirkwood_thermal_priv *priv; -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 ; - } - - priv =devm_kzalloc (&pdev->dev,sizeof (*priv),GFP_KERNEL ); -if (!priv) -return -ENOMEM ; - - priv->sensor =devm_request_and_ioremap (&pdev->dev, res); -if (!priv->sensor) { -dev_err (&pdev->dev,"Failed to request_ioremap memory\n" ); -return -EADDRNOTAVAIL ; - } - - thermal =thermal_zone_device_register ("kirkwood_thermal" ,0 ,0 , - priv, &ops,NULL ,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); - -return 0 ; -} - -static int kirkwood_thermal_exit (struct platform_device *pdev) -{ -struct thermal_zone_device *kirkwood_thermal = -platform_get_drvdata (pdev); - -thermal_zone_device_unregister (kirkwood_thermal); -platform_set_drvdata (pdev,NULL ); - -return 0 ; -} - -MODULE_DEVICE_TABLE (of, kirkwood_thermal_id_table); - -static struct platform_driver kirkwood_thermal_driver = { - .probe = kirkwood_thermal_probe, - .remove = kirkwood_thermal_exit, - .driver = { - .name ="kirkwood_thermal" , - .owner =THIS_MODULE , - .of_match_table =of_match_ptr (kirkwood_thermal_id_table), - }, -}; - -module_platform_driver (kirkwood_thermal_driver); - -MODULE_AUTHOR ("Nobuhiro Iwamatsu <[email protected]>" ); -MODULE_DESCRIPTION ("kirkwood thermal driver" ); -MODULE_LICENSE ("GPL" );drivers/thermal/mvebu_thermal.c new file +134
-0@@ -0,0 +1,134 @@ +/* +* Kirkwood 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 KIRKWOOD_THERMAL_VALID_OFFSET 9 +#define KIRKWOOD_THERMAL_VALID_MASK 0x1 +#define KIRKWOOD_THERMAL_TEMP_OFFSET 10 +#define KIRKWOOD_THERMAL_TEMP_MASK 0x1FF + +/* Kirkwood Thermal Sensor Dev Structure */ +struct kirkwood_thermal_priv { +void __iomem *sensor; +}; + +static int kirkwood_get_temp (struct thermal_zone_device *thermal, +unsigned long *temp) +{ +unsigned long reg; +struct kirkwood_thermal_priv *priv = thermal->devdata; + + reg =readl_relaxed (priv->sensor); + +/* Valid check */ +if (!((reg >>KIRKWOOD_THERMAL_VALID_OFFSET ) & +KIRKWOOD_THERMAL_VALID_MASK )) { +dev_err (&thermal->device, +"Temperature sensor reading not valid\n" ); +return -EIO ; + } + +/* +* Calculate temperature. According to Marvell internal +* documentation the formula for this is: +* Celsius = (322-reg)/1.3625 +*/ + reg = (reg >>KIRKWOOD_THERMAL_TEMP_OFFSET ) & +KIRKWOOD_THERMAL_TEMP_MASK ; + *temp = ((3220000000UL - (10000000UL * reg)) /13625 ); + +return 0 ; +} + +static struct thermal_zone_device_ops ops = { + .get_temp = kirkwood_get_temp, +}; + +static const struct of_device_id kirkwood_thermal_id_table[] = { + { .compatible ="marvell,kirkwood-thermal" }, + {} +}; + +static int kirkwood_thermal_probe (struct platform_device *pdev) +{ +struct thermal_zone_device *thermal =NULL ; +struct kirkwood_thermal_priv *priv; +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 ; + } + + priv =devm_kzalloc (&pdev->dev,sizeof (*priv),GFP_KERNEL ); +if (!priv) +return -ENOMEM ; + + priv->sensor =devm_request_and_ioremap (&pdev->dev, res); +if (!priv->sensor) { +dev_err (&pdev->dev,"Failed to request_ioremap memory\n" ); +return -EADDRNOTAVAIL ; + } + + thermal =thermal_zone_device_register ("kirkwood_thermal" ,0 ,0 , + priv, &ops,NULL ,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); + +return 0 ; +} + +static int kirkwood_thermal_exit (struct platform_device *pdev) +{ +struct thermal_zone_device *kirkwood_thermal = +platform_get_drvdata (pdev); + +thermal_zone_device_unregister (kirkwood_thermal); +platform_set_drvdata (pdev,NULL ); + +return 0 ; +} + +MODULE_DEVICE_TABLE (of, kirkwood_thermal_id_table); + +static struct platform_driver kirkwood_thermal_driver = { + .probe = kirkwood_thermal_probe, + .remove = kirkwood_thermal_exit, + .driver = { + .name ="kirkwood_thermal" , + .owner =THIS_MODULE , + .of_match_table =of_match_ptr (kirkwood_thermal_id_table), + }, +}; + +module_platform_driver (kirkwood_thermal_driver); + +MODULE_AUTHOR ("Nobuhiro Iwamatsu <[email protected]>" ); +MODULE_DESCRIPTION ("kirkwood thermal driver" ); +MODULE_LICENSE ("GPL" );
PATCH v2 1/14 thermal: Rename driver 'kirkwood' -> 'mvebu'
Hi Eduardo,
Thanks for your testing.
Quoted 24 lines · Eduardo Valentin
Hello Ezequiel,
Two minor comments.
Quoted 14 lines · Ezequiel Garcia
This driver will support several Marvell SoC, so it is convenient to rename it to 'mvebu' to represent accurately the hardware it supports.
Signed-off-by Ezequiel Garcia <[email protected]>---
.../bindings/thermal/kirkwood-thermal.txt| 15 ---.../devicetree/bindings/thermal/mvebu-thermal.txt | 15 +++ drivers/thermal/Kconfig | 10 +- drivers/thermal/Makefile | 2 +- drivers/thermal/kirkwood_thermal.c | 134 -------------------- drivers/thermal/mvebu_thermal.c | 134 ++++++++++++++++++++ 6 files changed, 155 insertions(+), 155 deletions(-)Quoted 4 lines
delete mode 100644
Documentation/devicetree/bindings/thermal/kirkwood-thermal.txtcreate mode 100644Documentation/devicetree/bindings/thermal/mvebu-thermal.txtdelete mode 100644drivers/thermal/kirkwood_thermal.c
create mode 100644drivers/thermal/mvebu_thermal.c
Quoted 3 lines
When sending renames, use git format-patch --find-renames. The summary will be much descriptive on what you have done.
Yes, you're right I forgot about this.
Quoted 4 lines
I tried applying this patch on top of linux-next, linus/master, ruis/thermal, on top of the your suggested dependencies, and all failed. What is your base?
Well, first of all this patchset has been dropped entirely after some discussion. If you're interested in this discussion you can read:
http://www.spinics.net/lists/arm-kernel/msg231697.html
If you still want to try this series, the easiest way is to try
https://github.com/MISL-EBU-System-SW/mainline-public/commits/mvebu-thermal-v2
That branch is based on v3.9-rc2, with a bunch of patches applied as explained in the cover letter.
I appreciate your feedback a lot, but this are really ancient patches! You came in a little late :)
Signature · 3 lines
Ezequiel Garc?a, Free Electrons Embedded Linux, Kernel and Android Engineering http://free-electrons.com
PATCH v2 1/14 thermal: Rename driver 'kirkwood' -> 'mvebu'
Quoted 47 lines · Ezequiel Garcia
Hi Eduardo,
Thanks for your testing.
Quoted 24 lines · Eduardo Valentin
Hello Ezequiel,
Two minor comments.
Quoted 14 lines · Ezequiel Garcia
This driver will support several Marvell SoC, so it is convenient to rename it to 'mvebu' to represent accurately the hardware it supports.
Signed-off-by Ezequiel Garcia <[email protected]>---
.../bindings/thermal/kirkwood-thermal.txt| 15 ---.../devicetree/bindings/thermal/mvebu-thermal.txt | 15 +++ drivers/thermal/Kconfig | 10 +- drivers/thermal/Makefile | 2 +- drivers/thermal/kirkwood_thermal.c | 134 -------------------- drivers/thermal/mvebu_thermal.c | 134 ++++++++++++++++++++ 6 files changed, 155 insertions(+), 155 deletions(-)Quoted 4 lines
delete mode 100644
Documentation/devicetree/bindings/thermal/kirkwood-thermal.txtcreate mode 100644Documentation/devicetree/bindings/thermal/mvebu-thermal.txtdelete mode 100644drivers/thermal/kirkwood_thermal.c
create mode 100644drivers/thermal/mvebu_thermal.cQuoted 3 lines
When sending renames, use git format-patch --find-renames. The summary will be much descriptive on what you have done.
Yes, you're right I forgot about this.
Quoted 4 lines
I tried applying this patch on top of linux-next, linus/master, ruis/thermal, on top of the your suggested dependencies, and all failed. What is your base?
Well, first of all this patchset has been dropped entirely after some discussion. If you're interested in this discussion you can read:
http://www.spinics.net/lists/arm-kernel/msg231697.htmlIf you still want to try this series, the easiest way is to try
Quoted 7 lines
https://github.com/MISL-EBU-System-SW/mainline-public/commits/mvebu-thermal-v2
That branch is based on v3.9-rc2, with a bunch of patches applied as explained in the cover letter.
I appreciate your feedback a lot, but this are really ancient patches! You came in a little late :)
OK. Thanks for updating me. On the other hand. Some of your patches are still applicable. Can you please resend them based on kirkwood file still?
Quoted 1 line
PATCH v2 1/14 thermal: Rename driver 'kirkwood' -> 'mvebu'
Quoted 60 lines · Eduardo Valentin
Quoted 59 lines · Ezequiel Garcia
Hi Eduardo,
Thanks for your testing.
Quoted 28 lines · Eduardo Valentin
Hello Ezequiel,
Two minor comments.
Quoted 16 lines · Ezequiel Garcia
This driver will support several Marvell SoC, so it is convenient to rename it to 'mvebu' to represent accurately the hardware it supports.
Signed-off-by Ezequiel Garcia <[email protected]>---
.../bindings/thermal/kirkwood-thermal.txt| 15 ---.../devicetree/bindings/thermal/mvebu-thermal.txt | 15 +++ drivers/thermal/Kconfig | 10 +- drivers/thermal/Makefile | 2 +- drivers/thermal/kirkwood_thermal.c | 134 -------------------- drivers/thermal/mvebu_thermal.c | 134 ++++++++++++++++++++ 6 files changed, 155 insertions(+), 155 deletions(-)Quoted 6 lines
delete mode 100644
Documentation/devicetree/bindings/thermal/kirkwood-thermal.txt
create mode 100644Documentation/devicetree/bindings/thermal/mvebu-thermal.txt
delete mode 100644drivers/thermal/kirkwood_thermal.ccreate mode 100644drivers/thermal/mvebu_thermal.cQuoted 3 lines
When sending renames, use git format-patch --find-renames. The summary will be much descriptive on what you have done.
Yes, you're right I forgot about this.
Quoted 4 lines
I tried applying this patch on top of linux-next, linus/master, ruis/thermal, on top of the your suggested dependencies, and all failed. What is your base?
Well, first of all this patchset has been dropped entirely after some discussion.
If you're interested in this discussion you can read:http://www.spinics.net/lists/arm-kernel/msg231697.htmlIf you still want to try this series, the easiest way is to try
https://github.com/MISL-EBU-System-SW/mainline-public/commits/mvebu-thermal-v2
That branch is based on v3.9-rc2, with a bunch of patches applied as explained in the cover letter.
Quoted 7 lines
Quoted 2 lines
I appreciate your feedback a lot, but this are really ancient patches! You came in a little late :)
OK. Thanks for updating me. On the other hand. Some of your patches are still applicable. Can you please resend them based on kirkwood file still?
Specifically, patches 04/05/06 are still applicable to the kirkwood driver. Feel free to resend them with my Acked-by.
Quoted 4 lines
Quoted 1 line
PATCH v2 1/14 thermal: Rename driver 'kirkwood' -> 'mvebu'
In reply to Eduardo ValentinQuoted 8 lines · Eduardo Valentin
Quoted 3 lines
I appreciate your feedback a lot, but this are really ancient patches! You came in a little late :)
OK. Thanks for updating me. On the other hand. Some of your patches are still applicable. Can you please resend them based on kirkwood file still?
Yes, that's the plan! (and thanks for remembering me)
I'll resubmit the appropriate patches, with your Acked-by.
Thanks for reviewing,
Signature · 3 lines
Ezequiel Garc?a, Free Electrons Embedded Linux, Kernel and Android Engineering http://free-electrons.com
PATCH v2 1/14 thermal: Rename driver 'kirkwood' -> 'mvebu'
In reply to Ezequiel GarciaEzequiel,
Quoted 71 lines · Ezequiel Garcia
This driver will support several Marvell SoC, so it is convenient to rename it to 'mvebu' to represent accurately the hardware it supports.
Signed-off-by Ezequiel Garcia <[email protected]>---
.../bindings/thermal/kirkwood-thermal.txt| 15 ---.../devicetree/bindings/thermal/mvebu-thermal.txt | 15 +++ drivers/thermal/Kconfig | 10 +- drivers/thermal/Makefile | 2 +- drivers/thermal/kirkwood_thermal.c | 134 -------------------- drivers/thermal/mvebu_thermal.c | 134 ++++++++++++++++++++ 6 files changed, 155 insertions(+), 155 deletions(-)delete mode 100644
Documentation/devicetree/bindings/thermal/kirkwood-thermal.txtcreate mode 100644Documentation/devicetree/bindings/thermal/mvebu-thermal.txtdelete mode 100644drivers/thermal/kirkwood_thermal.c
create mode 100644drivers/thermal/mvebu_thermal.cDocumentation/devicetree/bindings/thermal/kirkwood-thermal.txt deleted +0
-15@@ -1,15 +0,0 @@ -* Kirkwood Thermal - -This version is for Kirkwood 88F8262 & 88F6283 SoCs. Other kirkwoods -don't contain a thermal sensor. - -Required properties: -- compatible : "marvell,kirkwood-thermal" -- reg : Address range of the thermal registers - -Example: - - thermal at 10078 { - compatible = "marvell,kirkwood-thermal"; - reg = <0x10078 0x4>; - };Documentation/devicetree/bindings/thermal/mvebu-thermal.txt new file +15
-0@@ -0,0 +1,15 @@ +* Kirkwood Thermal + +This version is for Kirkwood 88F8262 & 88F6283 SoCs. Other kirkwoods +don't contain a thermal sensor. + +Required properties: +- compatible : "marvell,kirkwood-thermal" +- reg : Address range of the thermal registers + +Example: + + thermal at 10078 { + compatible = "marvell,kirkwood-thermal"; + reg = <0x10078 0x4>; + };drivers/thermal/Kconfig +0
-2@@ -101,13 +101,13 @@ config RCAR_THERMAL Enable this to plug the R-Car thermal sensor driver into the Linux thermal framework -config KIRKWOOD_THERMAL - tristate "Temperature sensor on Marvell Kirkwood SoCs"
drivers/thermal/Kconfig config RCAR_THERMAL · line 110
Quoted 10 lines
drivers/thermal/Kconfig +5
-3- depends on ARCH_KIRKWOOD +config MVEBU_THERMAL + tristate "Temperature sensor on Marvell EBU SoCs" + depends on PLAT_ORION depends on OF help - Support for the Kirkwood thermal sensor driver into the Linux thermal - framework. Only kirkwood 88F6282 and 88F6283 have this sensor. + Support for the thermal controllers available in several Marvell + EBU SoCs in the thermal framework.
While here, could you please be more descriptive?
WARNING: please write a paragraph that describes the config symbol fully #90: FILE: drivers/thermal/Kconfig:104:
+config MVEBU_THERMAL
total: 0 errors, 1 warnings, 175 lines checked
v2-01-14-thermal-Rename-driver-kirkwood---mvebu.patch has style problems, please review.
If any of these errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Quoted 297 lines
drivers/thermal/Kconfig +0
-0config EXYNOS_THERMAL tristate "Temperature sensor on Samsung EXYNOS"drivers/thermal/Makefile +1
-1@@ -15,7 +15,7 @@ obj-$(CONFIG_CPU_THERMAL) += cpu_cooling.o # platform thermal drivers obj-$(CONFIG_SPEAR_THERMAL) += spear_thermal.o obj-$(CONFIG_RCAR_THERMAL) += rcar_thermal.o -obj-$(CONFIG_KIRKWOOD_THERMAL) += kirkwood_thermal.o +obj-$(CONFIG_MVEBU_THERMAL) += mvebu_thermal.o obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o obj-$(CONFIG_DOVE_THERMAL) += dove_thermal.o obj-$(CONFIG_DB8500_THERMAL) += db8500_thermal.odrivers/thermal/kirkwood_thermal.c deleted +0
-134@@ -1,134 +0,0 @@ -/* -* Kirkwood 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 KIRKWOOD_THERMAL_VALID_OFFSET 9 -#define KIRKWOOD_THERMAL_VALID_MASK 0x1 -#define KIRKWOOD_THERMAL_TEMP_OFFSET 10 -#define KIRKWOOD_THERMAL_TEMP_MASK 0x1FF - -/* Kirkwood Thermal Sensor Dev Structure */ -struct kirkwood_thermal_priv { -void __iomem *sensor; -}; - -static int kirkwood_get_temp (struct thermal_zone_device *thermal, -unsigned long *temp) -{ -unsigned long reg; -struct kirkwood_thermal_priv *priv = thermal->devdata; - - reg =readl_relaxed (priv->sensor); - -/* Valid check */ -if (!((reg >>KIRKWOOD_THERMAL_VALID_OFFSET ) & -KIRKWOOD_THERMAL_VALID_MASK )) { -dev_err (&thermal->device, -"Temperature sensor reading not valid\n" ); -return -EIO ; - } - -/* -* Calculate temperature. According to Marvell internal -* documentation the formula for this is: -* Celsius = (322-reg)/1.3625 -*/ - reg = (reg >>KIRKWOOD_THERMAL_TEMP_OFFSET ) & -KIRKWOOD_THERMAL_TEMP_MASK ; - *temp = ((3220000000UL - (10000000UL * reg)) /13625 ); - -return 0 ; -} - -static struct thermal_zone_device_ops ops = { - .get_temp = kirkwood_get_temp, -}; - -static const struct of_device_id kirkwood_thermal_id_table[] = { - { .compatible ="marvell,kirkwood-thermal" }, - {} -}; - -static int kirkwood_thermal_probe (struct platform_device *pdev) -{ -struct thermal_zone_device *thermal =NULL ; -struct kirkwood_thermal_priv *priv; -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 ; - } - - priv =devm_kzalloc (&pdev->dev,sizeof (*priv),GFP_KERNEL ); -if (!priv) -return -ENOMEM ; - - priv->sensor =devm_request_and_ioremap (&pdev->dev, res); -if (!priv->sensor) { -dev_err (&pdev->dev,"Failed to request_ioremap memory\n" ); -return -EADDRNOTAVAIL ; - } - - thermal =thermal_zone_device_register ("kirkwood_thermal" ,0 ,0 , - priv, &ops,NULL ,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); - -return 0 ; -} - -static int kirkwood_thermal_exit (struct platform_device *pdev) -{ -struct thermal_zone_device *kirkwood_thermal = -platform_get_drvdata (pdev); - -thermal_zone_device_unregister (kirkwood_thermal); -platform_set_drvdata (pdev,NULL ); - -return 0 ; -} - -MODULE_DEVICE_TABLE (of, kirkwood_thermal_id_table); - -static struct platform_driver kirkwood_thermal_driver = { - .probe = kirkwood_thermal_probe, - .remove = kirkwood_thermal_exit, - .driver = { - .name ="kirkwood_thermal" , - .owner =THIS_MODULE , - .of_match_table =of_match_ptr (kirkwood_thermal_id_table), - }, -}; - -module_platform_driver (kirkwood_thermal_driver); - -MODULE_AUTHOR ("Nobuhiro Iwamatsu <[email protected]>" ); -MODULE_DESCRIPTION ("kirkwood thermal driver" ); -MODULE_LICENSE ("GPL" );drivers/thermal/mvebu_thermal.c new file +134
-0@@ -0,0 +1,134 @@ +/* +* Kirkwood 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 KIRKWOOD_THERMAL_VALID_OFFSET 9 +#define KIRKWOOD_THERMAL_VALID_MASK 0x1 +#define KIRKWOOD_THERMAL_TEMP_OFFSET 10 +#define KIRKWOOD_THERMAL_TEMP_MASK 0x1FF + +/* Kirkwood Thermal Sensor Dev Structure */ +struct kirkwood_thermal_priv { +void __iomem *sensor; +}; + +static int kirkwood_get_temp (struct thermal_zone_device *thermal, +unsigned long *temp) +{ +unsigned long reg; +struct kirkwood_thermal_priv *priv = thermal->devdata; + + reg =readl_relaxed (priv->sensor); + +/* Valid check */ +if (!((reg >>KIRKWOOD_THERMAL_VALID_OFFSET ) & +KIRKWOOD_THERMAL_VALID_MASK )) { +dev_err (&thermal->device, +"Temperature sensor reading not valid\n" ); +return -EIO ; + } + +/* +* Calculate temperature. According to Marvell internal +* documentation the formula for this is: +* Celsius = (322-reg)/1.3625 +*/ + reg = (reg >>KIRKWOOD_THERMAL_TEMP_OFFSET ) & +KIRKWOOD_THERMAL_TEMP_MASK ; + *temp = ((3220000000UL - (10000000UL * reg)) /13625 ); + +return 0 ; +} + +static struct thermal_zone_device_ops ops = { + .get_temp = kirkwood_get_temp, +}; + +static const struct of_device_id kirkwood_thermal_id_table[] = { + { .compatible ="marvell,kirkwood-thermal" }, + {} +}; + +static int kirkwood_thermal_probe (struct platform_device *pdev) +{ +struct thermal_zone_device *thermal =NULL ; +struct kirkwood_thermal_priv *priv; +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 ; + } + + priv =devm_kzalloc (&pdev->dev,sizeof (*priv),GFP_KERNEL ); +if (!priv) +return -ENOMEM ; + + priv->sensor =devm_request_and_ioremap (&pdev->dev, res); +if (!priv->sensor) { +dev_err (&pdev->dev,"Failed to request_ioremap memory\n" ); +return -EADDRNOTAVAIL ; + } + + thermal =thermal_zone_device_register ("kirkwood_thermal" ,0 ,0 , + priv, &ops,NULL ,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); + +return 0 ; +} + +static int kirkwood_thermal_exit (struct platform_device *pdev) +{ +struct thermal_zone_device *kirkwood_thermal = +platform_get_drvdata (pdev); + +thermal_zone_device_unregister (kirkwood_thermal); +platform_set_drvdata (pdev,NULL ); + +return 0 ; +} + +MODULE_DEVICE_TABLE (of, kirkwood_thermal_id_table); + +static struct platform_driver kirkwood_thermal_driver = { + .probe = kirkwood_thermal_probe, + .remove = kirkwood_thermal_exit, + .driver = { + .name ="kirkwood_thermal" , + .owner =THIS_MODULE , + .of_match_table =of_match_ptr (kirkwood_thermal_id_table), + }, +}; + +module_platform_driver (kirkwood_thermal_driver); + +MODULE_AUTHOR ("Nobuhiro Iwamatsu <[email protected]>" ); +MODULE_DESCRIPTION ("kirkwood thermal driver" ); +MODULE_LICENSE ("GPL" );
PATCH v2 2/14 thermal: mvebu: Rename symbols 'kirkwood' -> 'mvebu'
In reply to Ezequiel GarciaThis driver will be used to support Marvell EBU SoC thermal sensors. Therefore, we change every symbol and comment accordingly, before we make any functionality change.
--- drivers/thermal/mvebu_thermal.c | 42 +++++++++++++++++++------------------- 1 files changed, 21 insertions(+), 21 deletions(-)
drivers/thermal/mvebu_thermal.c +21 -21
@@ -1,5 +1,5 @@/* -* Kirkwood thermal sensor driver +* Marvell EBU thermal sensor driver * * Copyright (C) 2012 Nobuhiro Iwamatsu <[email protected]> *
@@ -27,16 +27,16 @@#define KIRKWOOD_THERMAL_TEMP_OFFSET 10#define KIRKWOOD_THERMAL_TEMP_MASK 0x1FF -/* Kirkwood Thermal Sensor Dev Structure */ -struct kirkwood_thermal_priv { +/* Marvell EBU Thermal Sensor Dev Structure */ +struct mvebu_thermal_priv {void __iomem *sensor; }; -static int kirkwood_get_temp (struct thermal_zone_device *thermal, +static int mvebu_get_temp (struct thermal_zone_device *thermal,unsigned long *temp) {unsigned long reg; -struct kirkwood_thermal_priv *priv = thermal->devdata; +struct mvebu_thermal_priv *priv = thermal->devdata; reg =readl_relaxed (priv->sensor);
@@ -61,18 +61,18 @@ static int kirkwood_get_temp(struct thermal_zone_device *thermal, }static struct thermal_zone_device_ops ops = { - .get_temp = kirkwood_get_temp, + .get_temp = mvebu_get_temp, }; -static const struct of_device_id kirkwood_thermal_id_table[] = { +static const struct of_device_id mvebu_thermal_id_table[] = { { .compatible ="marvell,kirkwood-thermal" }, {} }; -static int kirkwood_thermal_probe (struct platform_device *pdev) +static int mvebu_thermal_probe (struct platform_device *pdev) {struct thermal_zone_device *thermal =NULL ; -struct kirkwood_thermal_priv *priv; +struct mvebu_thermal_priv *priv;struct resource *res; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );
@@ -91,7 +91,7 @@ static int kirkwood_thermal_probe(struct platform_device *pdev)return -EADDRNOTAVAIL ; } - thermal =thermal_zone_device_register ("kirkwood_thermal" ,0 ,0 , + thermal =thermal_zone_device_register ("mvebu_thermal" ,0 ,0 , priv, &ops,NULL ,0 ,0 );if (IS_ERR (thermal)) { dev_err(&pdev->dev,
@@ -104,31 +104,31 @@ static int kirkwood_thermal_probe(struct platform_device *pdev)return 0 ; } -static int kirkwood_thermal_exit (struct platform_device *pdev) +static int mvebu_thermal_exit (struct platform_device *pdev) { -struct thermal_zone_device *kirkwood_thermal = +struct thermal_zone_device *mvebu_thermal =platform_get_drvdata (pdev); -thermal_zone_device_unregister (kirkwood_thermal); +thermal_zone_device_unregister (mvebu_thermal);platform_set_drvdata (pdev,NULL );return 0 ; } -MODULE_DEVICE_TABLE (of, kirkwood_thermal_id_table); +MODULE_DEVICE_TABLE (of, mvebu_thermal_id_table); -static struct platform_driver kirkwood_thermal_driver = { - .probe = kirkwood_thermal_probe, - .remove = kirkwood_thermal_exit, +static struct platform_driver mvebu_thermal_driver = { + .probe = mvebu_thermal_probe, + .remove = mvebu_thermal_exit, .driver = { - .name ="kirkwood_thermal" , + .name ="mvebu_thermal" , .owner =THIS_MODULE , - .of_match_table =of_match_ptr (kirkwood_thermal_id_table), + .of_match_table =of_match_ptr (mvebu_thermal_id_table), }, }; -module_platform_driver (kirkwood_thermal_driver); +module_platform_driver (mvebu_thermal_driver);MODULE_AUTHOR ("Nobuhiro Iwamatsu <[email protected]>" ); -MODULE_DESCRIPTION ("kirkwood thermal driver" ); +MODULE_DESCRIPTION ("mvebu thermal driver" );MODULE_LICENSE ("GPL" );
Signature · 1 line
1.7.8.6
PATCH v2 2/14 thermal: mvebu: Rename symbols 'kirkwood' -> 'mvebu'
Quoted 5 lines · Ezequiel Garcia
This driver will be used to support Marvell EBU SoC thermal sensors. Therefore, we change every symbol and comment accordingly, before we make any functionality change.
Signed-off-by Ezequiel Garcia <[email protected]>
Rui,
This patch looks fine to me. You can add my:
Quoted 38 lines
---
drivers/thermal/mvebu_thermal.c| 42 +++++++++++++++++++-------------------1 files changed, 21 insertions(+), 21 deletions(-)drivers/thermal/mvebu_thermal.c +5
-5@@ -1,5 +1,5 @@/* -* Kirkwood thermal sensor driver +* Marvell EBU thermal sensor driver * * Copyright (C) 2012 Nobuhiro Iwamatsu <[email protected]> * @@ -27,16 +27,16 @@#define KIRKWOOD_THERMAL_TEMP_OFFSET 10#define KIRKWOOD_THERMAL_TEMP_MASK 0x1FF -/* Kirkwood Thermal Sensor Dev Structure */ -struct kirkwood_thermal_priv { +/* Marvell EBU Thermal Sensor Dev Structure */ +struct mvebu_thermal_priv {void __iomem *sensor; }; -static int kirkwood_get_temp (struct thermal_zone_device *thermal, +static int mvebu_get_temp (struct thermal_zone_device *thermal,unsigned long *temp) {unsigned long reg; -struct kirkwood_thermal_priv *priv = thermal->devdata; +struct mvebu_thermal_priv *priv = thermal->devdata; reg =readl_relaxed (priv->sensor);
drivers/thermal/mvebu_thermal.c static int kirkwood_get_temp(struct thermal_zone_device *thermal, · line 68
Quoted 10 lines
drivers/thermal/mvebu_thermal.c +2
-2@@ -61,18 +61,18 @@ static int kirkwood_get_temp(struct thermal_zone_device *thermal, }static struct thermal_zone_device_ops ops = { - .get_temp = kirkwood_get_temp, + .get_temp = mvebu_get_temp, }; -static const struct of_device_id kirkwood_thermal_id_table[] = { +static const struct of_device_id mvebu_thermal_id_table[] = { { .compatible ="marvell,kirkwood-thermal" },
The device tree node will still be kept kirkwood?
Quoted 65 lines
drivers/thermal/mvebu_thermal.c +14
-14{} }; -static int kirkwood_thermal_probe (struct platform_device *pdev) +static int mvebu_thermal_probe (struct platform_device *pdev) {struct thermal_zone_device *thermal =NULL ; -struct kirkwood_thermal_priv *priv; +struct mvebu_thermal_priv *priv;struct resource *res; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );@@ -91,7 +91,7 @@ static int kirkwood_thermal_probe(struct platform_device *pdev)return -EADDRNOTAVAIL ; } - thermal =thermal_zone_device_register ("kirkwood_thermal" ,0 ,0 , + thermal =thermal_zone_device_register ("mvebu_thermal" ,0 ,0 , priv, &ops,NULL ,0 ,0 );if (IS_ERR (thermal)) { dev_err(&pdev->dev,@@ -104,31 +104,31 @@ static int kirkwood_thermal_probe(struct platform_device *pdev)return 0 ; } -static int kirkwood_thermal_exit (struct platform_device *pdev) +static int mvebu_thermal_exit (struct platform_device *pdev) { -struct thermal_zone_device *kirkwood_thermal = +struct thermal_zone_device *mvebu_thermal =platform_get_drvdata (pdev); -thermal_zone_device_unregister (kirkwood_thermal); +thermal_zone_device_unregister (mvebu_thermal);platform_set_drvdata (pdev,NULL );return 0 ; } -MODULE_DEVICE_TABLE (of, kirkwood_thermal_id_table); +MODULE_DEVICE_TABLE (of, mvebu_thermal_id_table); -static struct platform_driver kirkwood_thermal_driver = { - .probe = kirkwood_thermal_probe, - .remove = kirkwood_thermal_exit, +static struct platform_driver mvebu_thermal_driver = { + .probe = mvebu_thermal_probe, + .remove = mvebu_thermal_exit, .driver = { - .name ="kirkwood_thermal" , + .name ="mvebu_thermal" , .owner =THIS_MODULE , - .of_match_table =of_match_ptr (kirkwood_thermal_id_table), + .of_match_table =of_match_ptr (mvebu_thermal_id_table), }, }; -module_platform_driver (kirkwood_thermal_driver); +module_platform_driver (mvebu_thermal_driver);MODULE_AUTHOR ("Nobuhiro Iwamatsu <[email protected]>" ); -MODULE_DESCRIPTION ("kirkwood thermal driver" ); +MODULE_DESCRIPTION ("mvebu thermal driver" );MODULE_LICENSE ("GPL" );
PATCH v2 3/14 thermal: mvebu: Move MODULE_DEVICE_TABLE upwards
In reply to Ezequiel GarciaThis table will be needed by mvebu_thermal_probe() so we move it just below the declaration of the compatible device table.
--- drivers/thermal/mvebu_thermal.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/thermal/mvebu_thermal.c +1 -2
@@ -68,6 +68,7 @@ static const struct of_device_id mvebu_thermal_id_table[] = { { .compatible = "marvell,kirkwood-thermal" }, {} }; +MODULE_DEVICE_TABLE (of, mvebu_thermal_id_table);static int mvebu_thermal_probe (struct platform_device *pdev) {
@@ -115,8 +116,6 @@ static int mvebu_thermal_exit(struct platform_device *pdev)return 0 ; } -MODULE_DEVICE_TABLE (of, mvebu_thermal_id_table); -static struct platform_driver mvebu_thermal_driver = { .probe = mvebu_thermal_probe, .remove = mvebu_thermal_exit,
Signature · 1 line
1.7.8.6
PATCH v2 3/14 thermal: mvebu: Move MODULE_DEVICE_TABLE upwards
Rui,
Quoted 5 lines · Ezequiel Garcia
This table will be needed by
mvebu_thermal_probe()so we move it just below the declaration of the compatible device table.Signed-off-by Ezequiel Garcia <[email protected]>
This patch looks fine to me.
Quoted 26 lines
---
drivers/thermal/mvebu_thermal.c| 3 +--1 files changed, 1 insertions(+), 2 deletions(-)drivers/thermal/mvebu_thermal.c +1
-2@@ -68,6 +68,7 @@ static const struct of_device_id mvebu_thermal_id_table[] = { { .compatible = "marvell,kirkwood-thermal" }, {} }; +MODULE_DEVICE_TABLE (of, mvebu_thermal_id_table);static int mvebu_thermal_probe (struct platform_device *pdev) {@@ -115,8 +116,6 @@ static int mvebu_thermal_exit(struct platform_device *pdev)return 0 ; } -MODULE_DEVICE_TABLE (of, mvebu_thermal_id_table); -static struct platform_driver mvebu_thermal_driver = { .probe = mvebu_thermal_probe, .remove = mvebu_thermal_exit,
PATCH v2 4/14 thermal: mvebu: Remove unneeded variable initialization
In reply to Ezequiel GarciaThis variable is used only after it's properly initialized, so there's no need to set it to NULL in its declaration.
--- drivers/thermal/mvebu_thermal.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/thermal/mvebu_thermal.c +1 -1
@@ -72,7 +72,7 @@ MODULE_DEVICE_TABLE(of, mvebu_thermal_id_table);static int mvebu_thermal_probe (struct platform_device *pdev) { -struct thermal_zone_device *thermal =NULL ; +struct thermal_zone_device *thermal;struct mvebu_thermal_priv *priv;struct resource *res;
Signature · 1 line
1.7.8.6
PATCH v2 4/14 thermal: mvebu: Remove unneeded variable initialization
Rui, Ezequiel,
Quoted 5 lines · Ezequiel Garcia
This variable is used only after it's properly initialized, so there's no need to set it to NULL in its declaration.
Signed-off-by Ezequiel Garcia <[email protected]>
I am fine with this patch. Though it doesn t hurt to have this initialization, the code looks cleaner though.
Quoted 18 lines
---
drivers/thermal/mvebu_thermal.c| 2 +-1 files changed, 1 insertions(+), 1 deletions(-)drivers/thermal/mvebu_thermal.c +1
-1@@ -72,7 +72,7 @@ MODULE_DEVICE_TABLE(of, mvebu_thermal_id_table);static int mvebu_thermal_probe (struct platform_device *pdev) { -struct thermal_zone_device *thermal =NULL ; +struct thermal_zone_device *thermal;struct mvebu_thermal_priv *priv;struct resource *res;
PATCH v2 4/14 thermal: mvebu: Remove unneeded variable initialization
Ezequiel,
Quoted 6 lines · Eduardo Valentin
Rui, Ezequiel,
Quoted 3 lines · Ezequiel Garcia
This variable is used only after it's properly initialized, so there's no need to set it to NULL in its declaration.
Quoted 7 lines
Quoted 2 lines
Signed-off-by Ezequiel Garcia <[email protected]>I am fine with this patch. Though it doesn t hurt to have this initialization, the code looks cleaner though.
Acked-by Eduardo Valentin <[email protected]>
I know you have discarded the idea of merging the driver into a single driver, but can you please resend this patch on top of drivers/thermal/kirkwood_thermal.c file. This change still applies.
Quoted 24 lines
Quoted 21 lines
---
drivers/thermal/mvebu_thermal.c| 2 +-1 files changed, 1 insertions(+), 1 deletions(-)drivers/thermal/mvebu_thermal.c +1
-1@@ -72,7 +72,7 @@ MODULE_DEVICE_TABLE(of, mvebu_thermal_id_table);static int mvebu_thermal_probe (struct platform_device *pdev) { -struct thermal_zone_device *thermal =NULL ; +struct thermal_zone_device *thermal;struct mvebu_thermal_priv *priv;struct resource *res;
PATCH v2 5/14 thermal: mvebu: Convert to devm_ioremap_resource()
In reply to Ezequiel GarciaConvert devm_request_and_ioremap() to the newly introduced devm_ioremap_resource() which provides more consistent error handling.
--- drivers/thermal/mvebu_thermal.c | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-)
drivers/thermal/mvebu_thermal.c +3 -5
@@ -86,11 +86,9 @@ static int mvebu_thermal_probe(struct platform_device *pdev)if (!priv)return -ENOMEM ; - priv->sensor =devm_request_and_ioremap (&pdev->dev, res); -if (!priv->sensor) { -dev_err (&pdev->dev,"Failed to request_ioremap memory\n" ); -return -EADDRNOTAVAIL ; - } + priv->sensor =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (priv->sensor)) +return PTR_ERR (priv->sensor); thermal =thermal_zone_device_register ("mvebu_thermal" ,0 ,0 , priv, &ops,NULL ,0 ,0 );
Signature · 1 line
1.7.8.6
PATCH v2 5/14 thermal: mvebu: Convert to devm_ioremap_resource()
Rui,
Quoted 5 lines · Ezequiel Garcia
Convert
devm_request_and_ioremap()to the newly introduceddevm_ioremap_resource()which provides more consistent error handling.Signed-off-by Ezequiel Garcia <[email protected]>
This patch looks correct to me too.
Quoted 24 lines
---
drivers/thermal/mvebu_thermal.c| 8 +++-----1 files changed, 3 insertions(+), 5 deletions(-)drivers/thermal/mvebu_thermal.c +3
-5@@ -86,11 +86,9 @@ static int mvebu_thermal_probe(struct platform_device *pdev)if (!priv)return -ENOMEM ; - priv->sensor =devm_request_and_ioremap (&pdev->dev, res); -if (!priv->sensor) { -dev_err (&pdev->dev,"Failed to request_ioremap memory\n" ); -return -EADDRNOTAVAIL ; - } + priv->sensor =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (priv->sensor)) +return PTR_ERR (priv->sensor); thermal =thermal_zone_device_register ("mvebu_thermal" ,0 ,0 , priv, &ops,NULL ,0 ,0 );
PATCH v2 5/14 thermal: mvebu: Convert to devm_ioremap_resource()
Ezequiel,
Quoted 6 lines · Eduardo Valentin
Rui,
Quoted 3 lines · Ezequiel Garcia
Convert
devm_request_and_ioremap()to the newly introduceddevm_ioremap_resource()which provides more consistent error handling.
Quoted 7 lines
Quoted 2 lines
Signed-off-by Ezequiel Garcia <[email protected]>This patch looks correct to me too.
Acked-by Eduardo Valentin <[email protected]>
I know you have discarded the idea of merging the driver into a single driver, but can you please resend this patch on top of drivers/thermal/kirkwood_thermal.c file. This change still applies.
Quoted 29 lines
Quoted 26 lines
---
drivers/thermal/mvebu_thermal.c| 8 +++-----1 files changed, 3 insertions(+), 5 deletions(-)drivers/thermal/mvebu_thermal.c +3
-5@@ -86,11 +86,9 @@ static int mvebu_thermal_probe(struct platform_device *pdev)if (!priv)return -ENOMEM ; - priv->sensor =devm_request_and_ioremap (&pdev->dev, res); -if (!priv->sensor) { -dev_err (&pdev->dev,"Failed to request_ioremap memory\n" ); -return -EADDRNOTAVAIL ; - } + priv->sensor =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (priv->sensor)) +return PTR_ERR (priv->sensor); thermal = thermal_zone_device_register("mvebu_thermal", 0, 0,priv, &ops, NULL, 0, 0);
PATCH v2 6/14 thermal: mvebu: Fix license declaration
In reply to Ezequiel GarciaThe license text declared in the header explicit says GPL v2 only, but the MODULE_LICENSE macro says GPL, which means GPL v2 or later. Fix it.
--- drivers/thermal/mvebu_thermal.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/thermal/mvebu_thermal.c +1 -1
@@ -128,4 +128,4 @@ module_platform_driver(mvebu_thermal_driver);MODULE_AUTHOR ("Nobuhiro Iwamatsu <[email protected]>" );MODULE_DESCRIPTION ("mvebu thermal driver" ); -MODULE_LICENSE ("GPL" ); +MODULE_LICENSE ("GPL v2" );
Signature · 1 line
1.7.8.6
PATCH v2 6/14 thermal: mvebu: Fix license declaration
Hi Rui,
Quoted 5 lines · Ezequiel Garcia
The license text declared in the header explicit says GPL v2 only, but the
MODULE_LICENSEmacro says GPL, which means GPL v2 or later. Fix it.Signed-off-by Ezequiel Garcia <[email protected]>
This specific patch is fine to me.
Quoted 10 lines
---
drivers/thermal/mvebu_thermal.c| 2 +-1 files changed, 1 insertions(+), 1 deletions(-)drivers/thermal/mvebu_thermal.c +0
-0
drivers/thermal/mvebu_thermal.c module_platform_driver(mvebu_thermal_driver); · line 131
Quoted 5 lines
drivers/thermal/mvebu_thermal.c +1
-1@@ -128,4 +128,4 @@ module_platform_driver(mvebu_thermal_driver);MODULE_AUTHOR ("Nobuhiro Iwamatsu <[email protected]>" );MODULE_DESCRIPTION ("mvebu thermal driver" ); -MODULE_LICENSE ("GPL" ); +MODULE_LICENSE ("GPL v2" );
Side question, while here:
Ezequiel, does this driver need a MODULE_ALIAS
PATCH v2 6/14 thermal: mvebu: Fix license declaration
Ezequiel,
Quoted 7 lines · Eduardo Valentin
Hi Rui,
Quoted 4 lines · Ezequiel Garcia
The license text declared in the header explicit says GPL v2 only, but the
MODULE_LICENSEmacro says GPL, which means GPL v2 or later. Fix it.
Quoted 7 lines
Quoted 2 lines
Signed-off-by Ezequiel Garcia <[email protected]>This specific patch is fine to me.
Acked-by Eduardo Valentin <[email protected]>
I know you have discarded the idea of merging the driver into a single driver, but can you please resend this patch on top of drivers/thermal/kirkwood_thermal.c file. This change still applies.
Quoted 22 lines
Quoted 11 lines
---
drivers/thermal/mvebu_thermal.c| 2 +-1 files changed, 1 insertions(+), 1 deletions(-)drivers/thermal/mvebu_thermal.c +0
-0drivers/thermal/mvebu_thermal.c module_platform_driver(mvebu_thermal_driver); · line 131
Quoted 5 lines
drivers/thermal/mvebu_thermal.c +1
-1@@ -128,4 +128,4 @@ module_platform_driver(mvebu_thermal_driver);MODULE_AUTHOR ("Nobuhiro Iwamatsu <[email protected]>" );MODULE_DESCRIPTION ("mvebu thermal driver" ); -MODULE_LICENSE ("GPL" ); +MODULE_LICENSE ("GPL v2" );Side question, while here:
Ezequiel, does this driver need aMODULE_ALIAS
PATCH v2 7/14 thermal: mvebu: Rename kirkwood definitions to mvebu
In reply to Ezequiel GarciaThis definitions will be also valid for other SoC,
such as Armada 370 and Armada XP. Therefore we rename them as 'mvebu'.
--- drivers/thermal/mvebu_thermal.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-)
drivers/thermal/mvebu_thermal.c +8 -8
@@ -22,10 +22,10 @@#include <linux/platform_device.h> #include <linux/thermal.h> -#define KIRKWOOD_THERMAL_VALID_OFFSET 9 -#define KIRKWOOD_THERMAL_VALID_MASK 0x1 -#define KIRKWOOD_THERMAL_TEMP_OFFSET 10 -#define KIRKWOOD_THERMAL_TEMP_MASK 0x1FF +#define MVEBU_THERMAL_VALID_OFFSET 9 +#define MVEBU_THERMAL_VALID_MASK 0x1 +#define MVEBU_THERMAL_TEMP_OFFSET 10 +#define MVEBU_THERMAL_TEMP_MASK 0x1FF/* Marvell EBU Thermal Sensor Dev Structure */ struct mvebu_thermal_priv {
@@ -41,8 +41,8 @@ static int mvebu_get_temp(struct thermal_zone_device *thermal, reg =readl_relaxed (priv->sensor);/* Valid check */ -if (!((reg >>KIRKWOOD_THERMAL_VALID_OFFSET ) & -KIRKWOOD_THERMAL_VALID_MASK )) { +if (!((reg >>MVEBU_THERMAL_VALID_OFFSET ) & +MVEBU_THERMAL_VALID_MASK )) {dev_err (&thermal->device,"Temperature sensor reading not valid\n" );return -EIO ;
@@ -53,8 +53,8 @@ static int mvebu_get_temp(struct thermal_zone_device *thermal,* documentation the formula for this is: * Celsius = (322-reg)/1.3625 */ - reg = (reg >>KIRKWOOD_THERMAL_TEMP_OFFSET ) & -KIRKWOOD_THERMAL_TEMP_MASK ; + reg = (reg >>MVEBU_THERMAL_TEMP_OFFSET ) & +MVEBU_THERMAL_TEMP_MASK ; *temp = ((3220000000UL - (10000000UL * reg)) /13625 );return 0 ;
Signature · 1 line
1.7.8.6
PATCH v2 7/14 thermal: mvebu: Rename kirkwood definitions to mvebu
Quoted 3 lines · Ezequiel Garcia
This definitions will be also valid for other SoC,
such as Armada 370 and Armada XP. Therefore we rename them as 'mvebu'.
I believe it is appropriated to squash this one to your patch v2 02/14.
Quoted 48 lines
Signed-off-by Ezequiel Garcia <[email protected]>---
drivers/thermal/mvebu_thermal.c| 16 ++++++++--------1 files changed, 8 insertions(+), 8 deletions(-)drivers/thermal/mvebu_thermal.c +8
-8@@ -22,10 +22,10 @@#include <linux/platform_device.h> #include <linux/thermal.h> -#define KIRKWOOD_THERMAL_VALID_OFFSET 9 -#define KIRKWOOD_THERMAL_VALID_MASK 0x1 -#define KIRKWOOD_THERMAL_TEMP_OFFSET 10 -#define KIRKWOOD_THERMAL_TEMP_MASK 0x1FF +#define MVEBU_THERMAL_VALID_OFFSET 9 +#define MVEBU_THERMAL_VALID_MASK 0x1 +#define MVEBU_THERMAL_TEMP_OFFSET 10 +#define MVEBU_THERMAL_TEMP_MASK 0x1FF/* Marvell EBU Thermal Sensor Dev Structure */ struct mvebu_thermal_priv {@@ -41,8 +41,8 @@ static int mvebu_get_temp(struct thermal_zone_device *thermal, reg =readl_relaxed (priv->sensor);/* Valid check */ -if (!((reg >>KIRKWOOD_THERMAL_VALID_OFFSET ) & -KIRKWOOD_THERMAL_VALID_MASK )) { +if (!((reg >>MVEBU_THERMAL_VALID_OFFSET ) & +MVEBU_THERMAL_VALID_MASK )) {dev_err (&thermal->device,"Temperature sensor reading not valid\n" );return -EIO ;@@ -53,8 +53,8 @@ static int mvebu_get_temp(struct thermal_zone_device *thermal,* documentation the formula for this is: * Celsius = (322-reg)/1.3625 */ - reg = (reg >>KIRKWOOD_THERMAL_TEMP_OFFSET ) & -KIRKWOOD_THERMAL_TEMP_MASK ; + reg = (reg >>MVEBU_THERMAL_TEMP_OFFSET ) & +MVEBU_THERMAL_TEMP_MASK ; *temp = ((3220000000UL - (10000000UL * reg)) /13625 );return 0 ;
PATCH v2 8/14 thermal: mvebu: Add infrastructure to support more multiple SoC variants
In reply to Ezequiel GarciaThis commit adds the infrastructure required for mvebu thermal driver to support multiple SoC variants.
In particular, we add support for an optional memory resource, and a new struct to contain the operation for each SoC variant.
--- drivers/thermal/mvebu_thermal.c | 80 +++++++++++++++++++++++++++++++-------- 1 files changed, 64 insertions(+), 16 deletions(-)
drivers/thermal/mvebu_thermal.c +64 -16
@@ -20,6 +20,7 @@#include <linux/of.h> #include <linux/module.h> #include <linux/platform_device.h> +#include <linux/of_device.h> #include <linux/thermal.h> #define MVEBU_THERMAL_VALID_OFFSET 9
@@ -27,36 +28,56 @@#define MVEBU_THERMAL_TEMP_OFFSET 10#define MVEBU_THERMAL_TEMP_MASK 0x1FF +struct mvebu_thermal_ops ; +/* Marvell EBU Thermal Sensor Dev Structure */ struct mvebu_thermal_priv {void __iomem *sensor; +void __iomem *control; +struct mvebu_thermal_ops *ops; +}; + +struct mvebu_thermal_ops { +/* Converts the sensor register to ajunction temperature */ +unsigned long (*sensor_temp)(struct mvebu_thermal_priv *); + +/* Initialize the sensor (optional) */ +void (*init_sensor)(struct mvebu_thermal_priv *); + +/* Test for a valid sensor value (optional) */ +bool (*is_valid)(struct mvebu_thermal_priv *); }; +static bool mvebu_is_valid (struct mvebu_thermal_priv *priv) +{ +unsigned long reg =readl_relaxed (priv->sensor); + +return (reg >>MVEBU_THERMAL_VALID_OFFSET ) & +MVEBU_THERMAL_VALID_MASK ; +} + +static unsigned long orion_sensor_temp (struct mvebu_thermal_priv *priv) +{ +unsigned long reg =readl_relaxed (priv->sensor); + + reg = (reg >>MVEBU_THERMAL_TEMP_OFFSET ) & +MVEBU_THERMAL_TEMP_MASK ; +return (3220000000UL - (10000000UL * reg)) /13625 ; +} +static int mvebu_get_temp (struct thermal_zone_device *thermal,unsigned long *temp) { -unsigned long reg;struct mvebu_thermal_priv *priv = thermal->devdata; - reg =readl_relaxed (priv->sensor); -/* Valid check */ -if (!((reg >>MVEBU_THERMAL_VALID_OFFSET ) & -MVEBU_THERMAL_VALID_MASK )) { +if (priv->ops->is_valid && !priv->ops->is_valid (priv)) {dev_err (&thermal->device,"Temperature sensor reading not valid\n" );return -EIO ; } -/* -* Calculate temperature. According to Marvell internal -* documentation the formula for this is: -* Celsius = (322-reg)/1.3625 -*/ - reg = (reg >>MVEBU_THERMAL_TEMP_OFFSET ) & -MVEBU_THERMAL_TEMP_MASK ; - *temp = ((3220000000UL - (10000000UL * reg)) /13625 ); - + *temp = priv->ops->sensor_temp (priv);return 0 ; }
@@ -64,18 +85,33 @@ static struct thermal_zone_device_ops ops = { .get_temp = mvebu_get_temp, }; +static const struct mvebu_thermal_ops kirkwood_ops = { + .sensor_temp = orion_sensor_temp, + .is_valid = mvebu_is_valid, +}; +static const struct of_device_id mvebu_thermal_id_table[] = { - { .compatible ="marvell,kirkwood-thermal" }, - {} + { + .compatible ="marvell,kirkwood-thermal" , + .data = &kirkwood_ops, + }, + { +/* sentinel */ + }, };MODULE_DEVICE_TABLE (of, mvebu_thermal_id_table);static int mvebu_thermal_probe (struct platform_device *pdev) {struct thermal_zone_device *thermal; +const struct of_device_id *match;struct mvebu_thermal_priv *priv;struct resource *res; + match =of_match_device (mvebu_thermal_id_table, &pdev->dev); +if (!match) +return -ENODEV ; + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );if (!res) {dev_err (&pdev->dev,"Failed to get platform resource\n" );
@@ -90,6 +126,18 @@ static int mvebu_thermal_probe(struct platform_device *pdev)if (IS_ERR (priv->sensor))return PTR_ERR (priv->sensor); + res =platform_get_resource (pdev,IORESOURCE_MEM ,1 ); +if (res) { + priv->control =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (priv->control)) +return PTR_ERR (priv->control); + } + + priv->ops = (struct mvebu_thermal_ops *)match->data; + +if (priv->ops->init_sensor) + priv->ops->init_sensor (priv); + thermal =thermal_zone_device_register ("mvebu_thermal" ,0 ,0 , priv, &ops,NULL ,0 ,0 );if (IS_ERR (thermal)) {
Signature · 1 line
1.7.8.6
PATCH v2 9/14 thermal: mvebu: Add support for Armada XP thermal sensor
In reply to Ezequiel GarciaWith the infrastructure introduced to support more SoC, we can now easily add another thermal sensor.
The Armada XP sensor has no register to check for a valid temperature, and has a special formula to obtain the temperature from the thermal sensor output register.
--- .../devicetree/bindings/thermal/mvebu-thermal.txt | 21 +++++--- drivers/thermal/mvebu_thermal.c | 57 ++++++++++++++++++++ 2 files changed, 71 insertions(+), 7 deletions(-)
Documentation/devicetree/bindings/thermal/mvebu-thermal.txt +14 -7
@@ -1,13 +1,20 @@ -* Kirkwood Thermal - -This version is for Kirkwood 88F8262 & 88F6283 SoCs. Other kirkwoods -don't contain a thermal sensor. +* Marvell EBU Thermal Required properties: -- compatible : "marvell,kirkwood-thermal" -- reg : Address range of the thermal registers -Example: +- compatible: Should be set to one of the following: + marvell,kirkwood-thermal + marvell,armadaxp-thermal + +- reg: Device's register space. + One or two entries are expected, see the examples below. + The first one is required for the sensor register; + the second one is optional and is used as the control + register for sensor calibration. + Currently the only SoC variant having one register range + is Kirkwood. + +Kirkwood example: thermal at 10078 { compatible = "marvell,kirkwood-thermal";
drivers/thermal/mvebu_thermal.c +57 -0
98 lines not on this page · raw message
Signature · 1 line
1.7.8.6
PATCH v2 10/14 thermal: mvebu: Add support for Armada 370 thermal sensor
In reply to Ezequiel GarciaThe Armada 370 has a register to check a valid temperature, its own function to initialize (i.e. calibrate) the thermal sensor. The temperature formula is the same as the one for Armada XP.
--- .../devicetree/bindings/thermal/mvebu-thermal.txt | 1 + drivers/thermal/mvebu_thermal.c | 37 ++++++++++++++++++++ 2 files changed, 38 insertions(+), 0 deletions(-)
Documentation/devicetree/bindings/thermal/mvebu-thermal.txt +1 -0
@@ -5,6 +5,7 @@ Required properties: - compatible: Should be set to one of the following: marvell,kirkwood-thermal marvell,armadaxp-thermal + marvell,armada370-thermal - reg: Device's register space. One or two entries are expected, see the examples below.
drivers/thermal/mvebu_thermal.c +37 -0
@@ -20,6 +20,7 @@#include <linux/kernel.h> #include <linux/of.h> #include <linux/module.h> +#include <linux/delay.h> #include <linux/platform_device.h> #include <linux/of_device.h> #include <linux/thermal.h>
@@ -36,6 +37,7 @@#define PMU_TDC0_REF_CAL_CNT_OFFS 11#define PMU_TDC0_REF_CAL_CNT_MASK (0x1ff << PMU_TDC0_REF_CAL_CNT_OFFS)#define PMU_TDC0_OTF_CAL_MASK (0x1 << 30) +#define PMU_TDC0_START_CAL_MASK (0x1 << 25)struct mvebu_thermal_ops ;
@@ -86,6 +88,31 @@ static void armadaxp_init_sensor(struct mvebu_thermal_priv *priv)writel (reg, priv->sensor); } +static void armada370_init_sensor (struct mvebu_thermal_priv *priv) +{ +unsigned long reg; + +if (!priv->control) +return ; + +/* ??? */ + reg =readl_relaxed (priv->control); + reg |=PMU_TDC0_OTF_CAL_MASK ; +writel (reg, priv->control); + +/* Reference calibration value */ + reg &= ~PMU_TDC0_REF_CAL_CNT_MASK ; + reg |= (0xf1 <<PMU_TDC0_REF_CAL_CNT_OFFS ); +writel (reg, priv->control); + +/* ??? */ + reg &= ~PMU_TDC0_START_CAL_MASK ; +writel (reg, priv->control); + +/* FIXME: Why do we need this delay? */ +mdelay (10 ); +} +static bool mvebu_is_valid (struct mvebu_thermal_priv *priv) {unsigned long reg =readl_relaxed (priv->sensor);
@@ -142,6 +169,12 @@ static const struct mvebu_thermal_ops armadaxp_ops = { .init_sensor = armadaxp_init_sensor, }; +static const struct mvebu_thermal_ops armada370_ops = { + .sensor_temp = armada_sensor_temp, + .is_valid = mvebu_is_valid, + .init_sensor = armada370_init_sensor, +}; +static const struct of_device_id mvebu_thermal_id_table[] = { { .compatible ="marvell,kirkwood-thermal" ,
@@ -152,6 +185,10 @@ static const struct of_device_id mvebu_thermal_id_table[] = { .data = &armadaxp_ops, }, { + .compatible = "marvell,armada370-thermal", + .data = &armada370_ops, + }, + {/* sentinel */ }, };
Signature · 1 line
1.7.8.6
PATCH v2 11/14 thermal: mvebu: Add support for Marvell Dove SoC family
In reply to Ezequiel GarciaWith the infrastructure added in mvebu-thermal to support multiple SoC families, it is now possible to add support for Dove SoC. This patch adds such support taking the implementation from the dove-thermal driver, and then removing it.
--- .../devicetree/bindings/thermal/dove-thermal.txt | 18 -- .../devicetree/bindings/thermal/mvebu-thermal.txt | 8 + drivers/thermal/Kconfig | 8 - drivers/thermal/Makefile | 1 - drivers/thermal/dove_thermal.c | 210 -------------------- drivers/thermal/mvebu_thermal.c | 74 +++++++ 6 files changed, 82 insertions(+), 237 deletions(-) delete mode 100644 Documentation/devicetree/bindings/thermal/dove-thermal.txt delete mode 100644 drivers/thermal/dove_thermal.c
Documentation/devicetree/bindings/thermal/dove-thermal.txt deleted +0 -18
@@ -1,18 +0,0 @@ -* Dove Thermal - -This driver is for Dove SoCs which contain a thermal sensor. - -Required properties: -- compatible : "marvell,dove-thermal" -- reg : Address range of the thermal registers - -The reg properties should contain two ranges. The first is for the -three Thermal Manager registers, while the second range contains the -Thermal Diode Control Registers. - -Example: - - thermal at 10078 { - compatible = "marvell,dove-thermal"; - reg = <0xd001c 0x0c>, <0xd005c 0x08>; - };
Documentation/devicetree/bindings/thermal/mvebu-thermal.txt +8 -0
@@ -6,6 +6,7 @@ Required properties: marvell,kirkwood-thermal marvell,armadaxp-thermal marvell,armada370-thermal + marvell,dove-thermal - reg: Device's register space. One or two entries are expected, see the examples below.
@@ -21,3 +22,10 @@ Kirkwood example: compatible = "marvell,kirkwood-thermal"; reg = <0x10078 0x4>; }; + +Dove example: + + thermal: thermal at d001c { + compatible = "marvell,dove-thermal"; + reg = <0xd001c 0x0c>, <0xd005c 0x08>; + };
drivers/thermal/Kconfig +0 -8
@@ -126,14 +126,6 @@ config EXYNOS_THERMAL_EMUL device directory to support emulation mode. With emulation mode sysfs node, you can manually input temperature to TMU for simulation purpose. -config DOVE_THERMAL - tristate "Temperature sensor on Marvell Dove SoCs" - depends on ARCH_DOVE - depends on OF - help - Support for the Dove thermal sensor driver in the Linux thermal - framework. - config DB8500_THERMAL bool "DB8500 thermal management" depends on ARCH_U8500
drivers/thermal/Makefile +0 -1
@@ -17,7 +17,6 @@ obj-$(CONFIG_SPEAR_THERMAL) += spear_thermal.o obj-$(CONFIG_RCAR_THERMAL) += rcar_thermal.o obj-$(CONFIG_MVEBU_THERMAL) += mvebu_thermal.o obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o -obj-$(CONFIG_DOVE_THERMAL) += dove_thermal.o obj-$(CONFIG_DB8500_THERMAL) += db8500_thermal.o obj-$(CONFIG_DB8500_CPUFREQ_COOLING) += db8500_cpufreq_cooling.o obj-$(CONFIG_INTEL_POWERCLAMP) += intel_powerclamp.o
drivers/thermal/dove_thermal.c deleted +0 -210
210 lines not on this page · raw message
drivers/thermal/mvebu_thermal.c +74 -0
116 lines not on this page · raw message
Signature · 1 line
1.7.8.6
PATCH v2 11/14 thermal: mvebu: Add support for Marvell Dove SoC family
Quoted 17 lines · Ezequiel Garcia
With the infrastructure added in mvebu-thermal to support multiple SoC families, it is now possible to add support for Dove SoC. This patch adds such support taking the implementation from the dove-thermal driver, and then removing it.
Signed-off-by Ezequiel Garcia<[email protected]>--- .../devicetree/bindings/thermal/dove-thermal.txt | 18 -- .../devicetree/bindings/thermal/mvebu-thermal.txt | 8 + drivers/thermal/Kconfig | 8 - drivers/thermal/Makefile | 1 - drivers/thermal/dove_thermal.c | 210 -------------------- drivers/thermal/mvebu_thermal.c | 74 +++++++ 6 files changed, 82 insertions(+), 237 deletions(-)delete mode 100644
Documentation/devicetree/bindings/thermal/dove-thermal.txtdelete mode 100644drivers/thermal/dove_thermal.c
[...]
Quoted 32 lines
drivers/thermal/dove_thermal.c deleted +0
-26@@ -1,210 +0,0 @@ -/* -* Dove thermal sensor driver -* -* Copyright (C) 2013 Andrew Lunn<[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 DOVE_THERMAL_TEMP_OFFSET 1 -#define DOVE_THERMAL_TEMP_MASK 0x1FF
[...]
Quoted 14 lines
drivers/thermal/mvebu_thermal.c +1
-0@@ -2,6 +2,7 @@* Marvell EBU thermal sensor driver * * Copyright (C) 2013 Marvell +* Copyright (C) 2013 Andrew Lunn<[email protected]> * Copyright (C) 2012 Nobuhiro Iwamatsu<[email protected]> * * This software is licensed under the terms of the GNU General Public @@ -38,6 +39,14 @@#define PMU_TDC0_REF_CAL_CNT_MASK (0x1ff<< PMU_TDC0_REF_CAL_CNT_OFFS)
drivers/thermal/mvebu_thermal.c line 49
Quoted 10 lines
drivers/thermal/mvebu_thermal.c +8
-0#define PMU_TDC0_OTF_CAL_MASK (0x1<< 30)#define PMU_TDC0_START_CAL_MASK (0x1<< 25) +#define PMU_TDC0_AVG_NUM_OFFS 25 +#define PMU_TDC0_AVG_NUM_MASK (0x7<< PMU_TDC0_AVG_NUM_OFFS) +#define PMU_TDC0_SEL_VCAL_OFFS 5 +#define PMU_TDC0_SEL_VCAL_MASK (0x3<< PMU_TDC0_SEL_VCAL_OFFS) + +/* Dove Thermal Diode Control 1 Register */ +#define PMU_TEMP_DIOD_CTRL1_REG 0x04 +#define PMU_TDC1_TEMP_VALID_MASK (0x1<< 10)
Ezequiel,
maybe Dove thermal isn't that compatible with the others as you thought.
Have a look@DOVE_THERMAL_TEMP_OFFSET above, it is 1 while MVEBU_THERMAL_TEMP_OFFSET is 10. I've tested your patches on Dove and they break thermal. You either need a dove_get_temp() that uses correct DOVE_THERMAL_TEMP_OFFSET or have it stored within mvebu_thermal_ops and use it in mvebu_get_temp().
Sebastian
PATCH v2 11/14 thermal: mvebu: Add support for Marvell Dove SoC family
Quoted 83 lines · Sebastian Hesselbarth
Quoted 17 lines · Ezequiel Garcia
With the infrastructure added in mvebu-thermal to support multiple SoC families, it is now possible to add support for Dove SoC. This patch adds such support taking the implementation from the dove-thermal driver, and then removing it.
Signed-off-by Ezequiel Garcia<[email protected]>--- .../devicetree/bindings/thermal/dove-thermal.txt | 18 -- .../devicetree/bindings/thermal/mvebu-thermal.txt | 8 + drivers/thermal/Kconfig | 8 - drivers/thermal/Makefile | 1 - drivers/thermal/dove_thermal.c | 210 -------------------- drivers/thermal/mvebu_thermal.c | 74 +++++++ 6 files changed, 82 insertions(+), 237 deletions(-)delete mode 100644
Documentation/devicetree/bindings/thermal/dove-thermal.txtdelete mode 100644drivers/thermal/dove_thermal.c[...]
Quoted 32 lines
drivers/thermal/dove_thermal.c deleted +0
-26@@ -1,210 +0,0 @@ -/* -* Dove thermal sensor driver -* -* Copyright (C) 2013 Andrew Lunn<[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 DOVE_THERMAL_TEMP_OFFSET 1 -#define DOVE_THERMAL_TEMP_MASK 0x1FF[...]
Quoted 14 lines
drivers/thermal/mvebu_thermal.c +1
-0@@ -2,6 +2,7 @@* Marvell EBU thermal sensor driver * * Copyright (C) 2013 Marvell +* Copyright (C) 2013 Andrew Lunn<[email protected]> * Copyright (C) 2012 Nobuhiro Iwamatsu<[email protected]> * * This software is licensed under the terms of the GNU General Public @@ -38,6 +39,14 @@#define PMU_TDC0_REF_CAL_CNT_MASK (0x1ff<< PMU_TDC0_REF_CAL_CNT_OFFS)drivers/thermal/mvebu_thermal.c line 49
Quoted 10 lines
drivers/thermal/mvebu_thermal.c +8
-0#define PMU_TDC0_OTF_CAL_MASK (0x1<< 30)#define PMU_TDC0_START_CAL_MASK (0x1<< 25) +#define PMU_TDC0_AVG_NUM_OFFS 25 +#define PMU_TDC0_AVG_NUM_MASK (0x7<< PMU_TDC0_AVG_NUM_OFFS) +#define PMU_TDC0_SEL_VCAL_OFFS 5 +#define PMU_TDC0_SEL_VCAL_MASK (0x3<< PMU_TDC0_SEL_VCAL_OFFS) + +/* Dove Thermal Diode Control 1 Register */ +#define PMU_TEMP_DIOD_CTRL1_REG 0x04 +#define PMU_TDC1_TEMP_VALID_MASK (0x1<< 10)Ezequiel,
Quoted 7 lines
maybe Dove thermal isn't that compatible with the others as you thought.
Have a look at
DOVE_THERMAL_TEMP_OFFSETabove, it is 1 whileMVEBU_THERMAL_TEMP_OFFSETis 10. I've tested your patches on Dove and they break thermal. You either need adove_get_temp()that uses correctDOVE_THERMAL_TEMP_OFFSETor have it stored withinmvebu_thermal_opsand use it inmvebu_get_temp().
Ouch, you're totally right. I was too fast on this and I forgot that Dove has a specific way of reading the sensor, only the formula is shared with Kirkwood.
I'll send a fix for this in v3, probably monday.
Thanks for testing, and sorry for being so careless.
Signature · 3 lines
Ezequiel Garc?a, Free Electrons Embedded Linux, Kernel and Android Engineering http://free-electrons.com
PATCH v2 11/14 thermal: mvebu: Add support for Marvell Dove SoC family
In reply to Sebastian HesselbarthHi Sebastian,
Thanks again for your testing.
On Sat, Mar 23, 2013 at 12:26:05PM +0100, Sebastian Hesselbarth wrote:
[...]
Quoted 8 lines
maybe Dove thermal isn't that compatible with the others as you thought.
Have a look at
DOVE_THERMAL_TEMP_OFFSETabove, it is 1 whileMVEBU_THERMAL_TEMP_OFFSETis 10. I've tested your patches on Dove and they break thermal. You either need adove_get_temp()that uses correctDOVE_THERMAL_TEMP_OFFSETor have it stored withinmvebu_thermal_opsand use it inmvebu_get_temp().
Can you try replacing this patch (i.e. the whole Dove patch) with the one below?
If you confirm this is working, I can send v3 patchset.
-------------------------------------8<-------------------------------------------
Quoted 1 line
From
8695c7cbdb4922cf0ab7004fd185fea199db6174Mon Sep 17 00:00:00 2001
From: Ezequiel Garcia <[email protected]>
Date: Fri, 15 Mar 2013 18:28:41 -0300
Subject: [PATCH] thermal: mvebu: Add support for Marvell Dove SoC
family
With the infrastructure added in mvebu-thermal to support multiple SoC families, it is now possible to add support for Dove SoC. This patch adds such support taking the implementation from the dove-thermal driver, and then removing it.
--- .../devicetree/bindings/thermal/dove-thermal.txt | 18 -- .../devicetree/bindings/thermal/mvebu-thermal.txt | 8 + drivers/thermal/Kconfig | 8 - drivers/thermal/Makefile | 1 - drivers/thermal/dove_thermal.c | 210 -------------------- drivers/thermal/mvebu_thermal.c | 86 ++++++++ 6 files changed, 94 insertions(+), 237 deletions(-) delete mode 100644 Documentation/devicetree/bindings/thermal/dove-thermal.txt delete mode 100644 drivers/thermal/dove_thermal.c
Documentation/devicetree/bindings/thermal/dove-thermal.txt deleted +0 -18
@@ -1,18 +0,0 @@ -* Dove Thermal - -This driver is for Dove SoCs which contain a thermal sensor. - -Required properties: -- compatible : "marvell,dove-thermal" -- reg : Address range of the thermal registers - -The reg properties should contain two ranges. The first is for the -three Thermal Manager registers, while the second range contains the -Thermal Diode Control Registers. - -Example: - - thermal at 10078 { - compatible = "marvell,dove-thermal"; - reg = <0xd001c 0x0c>, <0xd005c 0x08>; - };
Documentation/devicetree/bindings/thermal/mvebu-thermal.txt +8 -0
@@ -6,6 +6,7 @@ Required properties: marvell,kirkwood-thermal marvell,armadaxp-thermal marvell,armada370-thermal + marvell,dove-thermal - reg: Device's register space. One or two entries are expected, see the examples below.
@@ -21,3 +22,10 @@ Kirkwood example: compatible = "marvell,kirkwood-thermal"; reg = <0x10078 0x4>; }; + +Dove example: + + thermal: thermal at d001c { + compatible = "marvell,dove-thermal"; + reg = <0xd001c 0x0c>, <0xd005c 0x08>; + };
drivers/thermal/Kconfig +0 -8
@@ -126,14 +126,6 @@ config EXYNOS_THERMAL_EMUL device directory to support emulation mode. With emulation mode sysfs node, you can manually input temperature to TMU for simulation purpose. -config DOVE_THERMAL - tristate "Temperature sensor on Marvell Dove SoCs" - depends on ARCH_DOVE - depends on OF - help - Support for the Dove thermal sensor driver in the Linux thermal - framework. - config DB8500_THERMAL bool "DB8500 thermal management" depends on ARCH_U8500
drivers/thermal/Makefile +0 -1
@@ -17,7 +17,6 @@ obj-$(CONFIG_SPEAR_THERMAL) += spear_thermal.o obj-$(CONFIG_RCAR_THERMAL) += rcar_thermal.o obj-$(CONFIG_MVEBU_THERMAL) += mvebu_thermal.o obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o -obj-$(CONFIG_DOVE_THERMAL) += dove_thermal.o obj-$(CONFIG_DB8500_THERMAL) += db8500_thermal.o obj-$(CONFIG_DB8500_CPUFREQ_COOLING) += db8500_cpufreq_cooling.o obj-$(CONFIG_INTEL_POWERCLAMP) += intel_powerclamp.o
drivers/thermal/dove_thermal.c deleted +0 -210
210 lines not on this page · raw message
drivers/thermal/mvebu_thermal.c +86 -0
140 lines not on this page · raw message
Signature · 10 lines
1.7.8.6 ------------------------------------->8------------------------------------------- Thanks a lot, -- Ezequiel Garc?a, Free Electrons Embedded Linux, Kernel and Android Engineering http://free-electrons.com
PATCH v2 12/14 ARM: mvebu: Add thermal support to Armada XP device tree
In reply to Ezequiel GarciaThis patch adds support for the thermal controller available in all Armada XP boards. This controller has two 4-byte registers:
one to read the thermal sensor, the other for sensor initialization.
---
This patch depends on the patch to support Armada XP in mvebu_thermal driver:
'thermal: mvebu: Add support for Armada XP thermal sensor'
arch/arm/boot/dts/armada-xp.dtsi | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
arch/arm/boot/dts/armada-xp.dtsi +6 -0
@@ -151,5 +151,11 @@ status = "disabled"; }; + thermal at d00182b0 { + compatible = "marvell,armadaxp-thermal"; + reg = <0xd00182b0 0x4 + 0xd00184d0 0x4>; + status = "okay"; + }; }; };
Signature · 1 line
1.7.8.6
PATCH v2 13/14 ARM: mvebu: Add thermal support to Armada 370 device tree
In reply to Ezequiel GarciaThis patch adds support for the thermal controller available in all Armada 370 boards. This controller has two 4-byte registers:
one to read the thermal sensor, the other for sensor initialization.
---
This patch depends on the patch to add Armada 370 support in the mvebu_thermal driver:
'thermal: mvebu: Add support for Armada 370 thermal sensor'
arch/arm/boot/dts/armada-370.dtsi | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
arch/arm/boot/dts/armada-370.dtsi +6 -0
@@ -153,5 +153,11 @@ clocks = <&coreclk 0>; }; + thermal at d0018300 { + compatible = "marvell,armada370-thermal"; + reg = <0xd0018300 0x4 + 0xd0018304 0x4>; + status = "okay"; + }; }; };
Signature · 1 line
1.7.8.6
PATCH v2 13/14 ARM: mvebu: Add thermal support to Armada 370 device tree
Hello.
Quoted 18 lines · Ezequiel Garcia
This patch adds support for the thermal controller available in all Armada 370 boards. This controller has two 4-byte registers:
one to read the thermal sensor, the other for sensor initialization.Signed-off-by Ezequiel Garcia <[email protected]>---
This patch depends on the patch to add Armada 370 support in themvebu_thermaldriver:
'thermal: mvebu: Add support for Armada 370 thermal sensor'arch/arm/boot/dts/armada-370.dtsi | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)arch/arm/boot/dts/armada-370.dtsi +0
-0
arch/arm/boot/dts/armada-370.dtsi line 159
Quoted 7 lines
arch/arm/boot/dts/armada-370.dtsi +4
-0@@ -153,5 +153,11 @@ clocks = <&coreclk 0>; }; + thermal at d0018300 { + compatible = "marvell,armada370-thermal"; + reg = <0xd0018300 0x4 + 0xd0018304 0x4>;
As the two registers are adjacent to each other, why have two register
regions ISO one?
WBR, Sergei
PATCH v2 13/14 ARM: mvebu: Add thermal support to Armada 370 device tree
Quoted 22 lines · Sergei Shtylyov
Quoted 22 lines
This patch adds support for the thermal controller available in all Armada 370 boards. This controller has two 4-byte registers:
one to read the thermal sensor, the other for sensor initialization.Signed-off-by Ezequiel Garcia <[email protected]>---
This patch depends on the patch to add Armada 370 support in themvebu_thermaldriver:
'thermal: mvebu: Add support for Armada 370 thermal sensor'arch/arm/boot/dts/armada-370.dtsi | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)arch/arm/boot/dts/armada-370.dtsi +0
-0@@ -153,5 +153,11 @@ clocks = <&coreclk 0>; };
Quoted 7 lines
arch/arm/boot/dts/armada-370.dtsi line 159
Quoted 4 lines
arch/arm/boot/dts/armada-370.dtsi +4
-0+ thermal at d0018300 { + compatible = "marvell,armada370-thermal"; + reg = <0xd0018300 0x4 + 0xd0018304 0x4>;As the two registers are adjacent to each other, why have two register
regions ISO one?
Ah, I just saw the previous patch where the registers are not adjacent and
it became clear why.
WBR, Sergei
PATCH v2 13/14 ARM: mvebu: Add thermal support to Armada 370 device tree
Quoted 30 lines · Sergei Shtylyov
Quoted 22 lines
Quoted 22 lines
This patch adds support for the thermal controller available in all Armada 370 boards. This controller has two 4-byte registers:
one to read the thermal sensor, the other for sensor initialization.Signed-off-by Ezequiel Garcia <[email protected]>---
This patch depends on the patch to add Armada 370 support in themvebu_thermaldriver:
'thermal: mvebu: Add support for Armada 370 thermal sensor'arch/arm/boot/dts/armada-370.dtsi | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)arch/arm/boot/dts/armada-370.dtsi +0
-0@@ -153,5 +153,11 @@ clocks = <&coreclk 0>; };Quoted 7 lines
arch/arm/boot/dts/armada-370.dtsi line 159
Quoted 4 lines
arch/arm/boot/dts/armada-370.dtsi +4
-0+ thermal at d0018300 { + compatible = "marvell,armada370-thermal"; + reg = <0xd0018300 0x4 + 0xd0018304 0x4>;As the two registers are adjacent to each other, why have two register
regions ISO one?
Quoted 2 lines
Ah, I just saw the previous patch where the registers are not adjacent and
it became clear why.
However, the "compatible" properties are different...
WBR, Sergei
PATCH v2 13/14 ARM: mvebu: Add thermal support to Armada 370 device tree
Quoted 32 lines · Sergei Shtylyov
Quoted 29 lines · Sergei Shtylyov
Quoted 29 lines
Quoted 19 lines
This patch adds support for the thermal controller available in all Armada 370 boards. This controller has two 4-byte registers:
one to read the thermal sensor, the other for sensor initialization.Signed-off-by Ezequiel Garcia <[email protected]>---
This patch depends on the patch to add Armada 370 support in themvebu_thermaldriver:
'thermal: mvebu: Add support for Armada 370 thermal sensor'arch/arm/boot/dts/armada-370.dtsi | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)arch/arm/boot/dts/armada-370.dtsi +0
-0arch/arm/boot/dts/armada-370.dtsi line 159
Quoted 7 lines
arch/arm/boot/dts/armada-370.dtsi +4
-0@@ -153,5 +153,11 @@ clocks = <&coreclk 0>; }; + thermal at d0018300 { + compatible = "marvell,armada370-thermal"; + reg = <0xd0018300 0x4 + 0xd0018304 0x4>;As the two registers are adjacent to each other, why have two register
regions ISO one?
Quoted 5 lines
Quoted 2 lines
Ah, I just saw the previous patch where the registers are not adjacent and
it became clear why.However, the "compatible" properties are different...
Well, the compatible maybe different, but they belong to the same family (i.e. same driver).
IMHO, it doesn't matter whether the registers are adjacents or not as they have different meanings, as clearly stated in the device tree binding documentation: the first register is for the sensor, and second one (which is optional) is for the calibration.
Do you think this is confusing?
Signature · 3 lines
Ezequiel Garc?a, Free Electrons Embedded Linux, Kernel and Android Engineering http://free-electrons.com
PATCH v2 14/14 ARM: configs: Update mvebu, dove and kirkwood defconfigs for thermal
In reply to Ezequiel GarciaThe driver for Dove, Kirkwood and Armada XP/370 SoC has been integrated in a single driver called mvebu-thermal. Update the defconfig for each platform to reflect this.
---
Please note that this change was done independentely from the thermal driver patch in order to facilitate its merge by the respective maintainers.
arch/arm/configs/dove_defconfig | 2 +- arch/arm/configs/kirkwood_defconfig | 2 +- arch/arm/configs/mvebu_defconfig | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-)
arch/arm/configs/dove_defconfig +1 -1
@@ -76,7 +76,7 @@ CONFIG_SPI=y CONFIG_SPI_ORION=y # CONFIG_HWMON is not set CONFIG_THERMAL=y -CONFIG_DOVE_THERMAL=y +CONFIG_MVEBU_THERMAL=y CONFIG_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_ROOT_HUB_TT=y
arch/arm/configs/kirkwood_defconfig +1 -1
@@ -120,7 +120,7 @@ CONFIG_SPI_ORION=y CONFIG_GPIO_SYSFS=y # CONFIG_HWMON is not set CONFIG_THERMAL=y -CONFIG_KIRKWOOD_THERMAL=y +CONFIG_MVEBU_THERMAL=y CONFIG_WATCHDOG=y CONFIG_ORION_WATCHDOG=y CONFIG_HID_DRAGONRISE=y
arch/arm/configs/mvebu_defconfig +2 -0
@@ -49,6 +49,8 @@ CONFIG_MTD_M25P80=y CONFIG_SERIAL_8250_DW=y CONFIG_GPIOLIB=y CONFIG_GPIO_SYSFS=y +CONFIG_THERMAL=y +CONFIG_MVEBU_THERMAL=y CONFIG_USB_SUPPORT=y CONFIG_USB=y CONFIG_USB_EHCI_HCD=y
Signature · 1 line
1.7.8.6
v2 cover Marvell EBU thermal sensor consolidation
In reply to Ezequiel GarciaOn Fri, Mar 22, 2013 at 07:25:00PM -0300, Ezequiel Garcia wrote:
...
Quoted 5 lines
Ezequiel Garcia (14):
thermal: Rename driver 'kirkwood' -> 'mvebu'
thermal: mvebu: Rename symbols 'kirkwood' -> 'mvebu'
thermal: mvebu: MoveMODULE_DEVICE_TABLEupwards
thermal: mvebu: Remove unneeded variable initialization
Quoted 8 lines
thermal: mvebu: Convert to
devm_ioremap_resource()
thermal: mvebu: Fix license declaration
thermal: mvebu: Rename kirkwood definitions to mvebu
thermal: mvebu: Add infrastructure to support more multiple SoC
variants
thermal: mvebu: Add support for Armada XP thermal sensor
thermal: mvebu: Add support for Armada 370 thermal sensor
thermal: mvebu: Add support for Marvell Dove SoC family
Once the thermal maintainers agree to take this in, I'll take the three below through mvebu/arm-soc. This shouldn't cause any dependency headaches, and will reduce the possibility of merge conflicts.
Quoted 3 lines
ARM: mvebu: Add thermal support to Armada XP device tree
ARM: mvebu: Add thermal support to Armada 370 device tree
ARM: configs: Update mvebu, dove and kirkwood defconfigs for thermal
thx,
Jason.
v2 cover Marvell EBU thermal sensor consolidation
Quoted 16 lines · Jason Cooper
On Fri, Mar 22, 2013 at 07:25:00PM -0300, Ezequiel Garcia wrote:
...Quoted 5 lines
Ezequiel Garcia (14):
thermal: Rename driver 'kirkwood' -> 'mvebu'
thermal: mvebu: Rename symbols 'kirkwood' -> 'mvebu'
thermal: mvebu: MoveMODULE_DEVICE_TABLEupwards
thermal: mvebu: Remove unneeded variable initializationQuoted 8 lines
thermal: mvebu: Convert to
devm_ioremap_resource()
thermal: mvebu: Fix license declaration
thermal: mvebu: Rename kirkwood definitions to mvebu
thermal: mvebu: Add infrastructure to support more multiple SoC
variants
thermal: mvebu: Add support for Armada XP thermal sensor
thermal: mvebu: Add support for Armada 370 thermal sensor
thermal: mvebu: Add support for Marvell Dove SoC family
Quoted 3 lines
Once the thermal maintainers agree to take this in, I'll take the three below through mvebu/arm-soc. This shouldn't cause any dependency headaches, and will reduce the possibility of merge conflicts.
NACK. This patch set breaks thermal on Dove. I sent a mail earlier.
Sebastian
v2 cover Marvell EBU thermal sensor consolidation
Quoted 17 lines · Sebastian Hesselbarth
Quoted 16 lines · Jason Cooper
On Fri, Mar 22, 2013 at 07:25:00PM -0300, Ezequiel Garcia wrote:
...Quoted 13 lines
Ezequiel Garcia (14):
thermal: Rename driver 'kirkwood' -> 'mvebu'
thermal: mvebu: Rename symbols 'kirkwood' -> 'mvebu'
thermal: mvebu: MoveMODULE_DEVICE_TABLEupwards
thermal: mvebu: Remove unneeded variable initialization
thermal: mvebu: Convert todevm_ioremap_resource()
thermal: mvebu: Fix license declaration
thermal: mvebu: Rename kirkwood definitions to mvebu
thermal: mvebu: Add infrastructure to support more multiple SoC
variants
thermal: mvebu: Add support for Armada XP thermal sensor
thermal: mvebu: Add support for Armada 370 thermal sensor
thermal: mvebu: Add support for Marvell Dove SoC family
Quoted 1 line
Quoted 1 line
Once the thermal maintainers agree to take this in, I'll take the three
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Was I not clear?
Quoted 4 lines
Quoted 2 lines
below through mvebu/arm-soc. This shouldn't cause any dependency headaches, and will reduce the possibility of merge conflicts.
NACK. This patch set breaks thermal on Dove. I sent a mail earlier.
thx,
Jason.
v2 cover Marvell EBU thermal sensor consolidation
Quoted 18 lines · Jason Cooper
Quoted 17 lines · Sebastian Hesselbarth
Quoted 16 lines · Jason Cooper
On Fri, Mar 22, 2013 at 07:25:00PM -0300, Ezequiel Garcia wrote:
...Quoted 13 lines
Ezequiel Garcia (14):
thermal: Rename driver 'kirkwood' -> 'mvebu'
thermal: mvebu: Rename symbols 'kirkwood' -> 'mvebu'
thermal: mvebu: MoveMODULE_DEVICE_TABLEupwards
thermal: mvebu: Remove unneeded variable initialization
thermal: mvebu: Convert todevm_ioremap_resource()
thermal: mvebu: Fix license declaration
thermal: mvebu: Rename kirkwood definitions to mvebu
thermal: mvebu: Add infrastructure to support more multiple SoC
variants
thermal: mvebu: Add support for Armada XP thermal sensor
thermal: mvebu: Add support for Armada 370 thermal sensor
thermal: mvebu: Add support for Marvell Dove SoC family
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Once the thermal maintainers agree to take this in, I'll take the three
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Was I not clear?
Just wanted to make sure you or one of the other maintainers didn't see my note on Patch 11/14. I don't want to send a follow up patch just because of that ;)
Sebastian
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
below through mvebu/arm-soc. This shouldn't cause any dependency headaches, and will reduce the possibility of merge conflicts.
NACK. This patch set breaks thermal on Dove. I sent a mail earlier.
v2 cover Marvell EBU thermal sensor consolidation
In reply to Ezequiel GarciaQuoted 3 lines · Ezequiel Garcia
Given Armada 370/XP and the other Marvell SoC with thermal support, namely Kirkwood and Dove, have fairly similar thermal devices it makes sense to integrate all of them into a single driver: mvebu-thermal.
Hi Ezequiel
I'm still not convinced that one driver is the right way to go.
As you have recently seen, Dove needs its own get_value() function, adding yet more differences. There is still the open question about 370 "managed" temperature, do that also need exporting?
Lets also try to look into the crystal ball about what may happen next.
There is an out of tree Dove driver
https://github.com/rabeeh/linux-2.6.32.9/blob/master/arch/arm/mach-dove/hwmon.c
This shows that the same register space is also used for core and CPU voltage measurements. At some point it might be nice to add support for these, and it probably needs to be in this driver, otherwise the locking is not nice. That driver also adds basic thermal management, by scaling the CPU frequency. Most of the scaling code will go into a driver in drivers/cpu_freq, but i guess there needs to be some glue somewhere?
370 seems to have some thermal management hardware. There are registers called Thermal Manager Control and Status Register, Thermal Manager Cooling Delay Register, Thermal Manager Overheat Delay Register. I've no idea what they do, if they are setup once and forgotten, or if there needs to be active monitoring etc? Maybe we will want to again link to cpu_freq? Will this need 370 specific glue code?
I assume XP also have some thermal management system, since this is a server class CPU. More glue to cpu_freq, again specific to XP? Maybe the 370 and XP require the same glue?
Orion and Kirkwood are simple, in that i've never seen any thermal management, other than a fan for the whole box, often controlled by a PIC, sometimes by GPIO lines.
What does all this mean? I _think_ there will be less and less shared code in future as these extra features are added.
I've not a strong opinion, but i think separate drivers are better.
If we do stick to one driver, i would however want #ifdef CONFIG_ARCH_DOVE, CONFIG_ARCH_KIRKWOOD, CONFIG_MACH_ARMADA_XP & CONFIG_MACH_ARMADA_370 scattered through the code.
Andrew
v2 cover Marvell EBU thermal sensor consolidation
On Mon, Mar 25, 2013 at 10:30:01AM +0100, Andrew Lunn wrote:
[...]
Quoted 4 lines
What does all this mean? I _think_ there will be less and less shared code in future as these extra features are added.
Yes, I see your point. On the other side, I don't like the idea of taking this decision based in the uncertain science of futurology :)
When will we add this extra features? Will we add them at all?
Quoted 2 lines
I've not a strong opinion, but i think separate drivers are better.
Don't you think a single driver could make maintenance cheaper?
Quoted 4 lines
If we do stick to one driver, i would however want #ifdef
CONFIG_ARCH_DOVE,CONFIG_ARCH_KIRKWOOD,CONFIG_MACH_ARMADA_XP&CONFIG_MACH_ARMADA_370scattered through the code.
Mmm... I'm not a fan for ifdefs. Actually, I really *hate* ifdefs. I'll try to come up with an ifdef solution without making it too nasty.
Otherwise, perhaps I'll send a patch for Armada 370/XP only; I don't want to push harder on something I'm not *absolutely* sure about either. If we see there's an opportunity to merge the drivers, we can do always do that later.
Signature · 3 lines
Ezequiel Garc?a, Free Electrons Embedded Linux, Kernel and Android Engineering http://free-electrons.com
v2 cover Marvell EBU thermal sensor consolidation
Quoted 4 lines · Ezequiel Garcia
Quoted 1 line · Andrew Lunn
I've not a strong opinion, but i think separate drivers are better.
Don't you think a single driver could make maintenance cheaper?
Ezequiel, Andrew,
just to sum up my opinion on the whole discussion
+1 for formula fixes for kirkwood and dove
+1 for separate drivers
+1 for thermal-mmio as Jason Gunthorpe suggested
And then port thermal drivers to thermal-mmio..
Sebastian
v2 cover Marvell EBU thermal sensor consolidation
Sebastian,
Quoted 11 lines · Sebastian Hesselbarth
Quoted 4 lines · Ezequiel Garcia
Quoted 1 line · Andrew Lunn
I've not a strong opinion, but i think separate drivers are better.
Don't you think a single driver could make maintenance cheaper?
Ezequiel, Andrew,
just to sum up my opinion on the whole discussion
Thanks for jumping in.
Quoted 1 line
+1 for formula fixes for kirkwood and dove
Could you test the Dove formula fixes and provide a Tested-by? However little the patches maybe, it still makes me nervous to send untested patches.
Quoted 1 line
+1 for separate drivers
I'll send an Armada only patchset soon.
Thanks,
Signature · 3 lines
Ezequiel Garc?a, Free Electrons Embedded Linux, Kernel and Android Engineering http://free-electrons.com
v2 cover Marvell EBU thermal sensor consolidation
Quoted 13 lines · Ezequiel Garcia
Quoted 11 lines · Sebastian Hesselbarth
Quoted 4 lines · Ezequiel Garcia
Quoted 1 line · Andrew Lunn
I've not a strong opinion, but i think separate drivers are better.
Don't you think a single driver could make maintenance cheaper?
Ezequiel, Andrew,
just to sum up my opinion on the whole discussion
Quoted 7 lines
Thanks for jumping in.
Quoted 1 line
+1 for formula fixes for kirkwood and dove
Could you test the Dove formula fixes and provide a Tested-by? However little the patches maybe, it still makes me nervous to send untested patches.
Well, I cannot "test" if temperature values are correct but at least returned values look reasonable. I suggest to trust Marvell engineers here.
Sebastian
v2 cover Marvell EBU thermal sensor consolidation
In reply to Ezequiel GarciaQuoted 3 lines · Ezequiel Garcia
Could you test the Dove formula fixes and provide a Tested-by? However little the patches maybe, it still makes me nervous to send untested patches.
FWIW, I reviewed and confirmed your new calculation based on the Kirkwood doc's I have.
Jason