* [PATCH v2 00/14] Marvell EBU thermal sensor consolidation
@ 2013-03-22 22:25 Ezequiel Garcia
2013-03-22 22:25 ` [PATCH v2 01/14] thermal: Rename driver 'kirkwood' -> 'mvebu' Ezequiel Garcia
` (15 more replies)
0 siblings, 16 replies; 47+ messages in thread
From: Ezequiel Garcia @ 2013-03-22 22:25 UTC (permalink / raw)
To: linux-arm-kernel
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
--
1.7.8.6
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH v2 01/14] thermal: Rename driver 'kirkwood' -> 'mvebu'
2013-03-22 22:25 [PATCH v2 00/14] Marvell EBU thermal sensor consolidation Ezequiel Garcia
@ 2013-03-22 22:25 ` Ezequiel Garcia
2013-04-11 16:00 ` [v2,01/14] " Eduardo Valentin
2013-04-11 16:21 ` Eduardo Valentin
2013-03-22 22:25 ` [PATCH v2 02/14] thermal: mvebu: Rename symbols " Ezequiel Garcia
` (14 subsequent siblings)
15 siblings, 2 replies; 47+ messages in thread
From: Ezequiel Garcia @ 2013-03-22 22:25 UTC (permalink / raw)
To: linux-arm-kernel
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 <ezequiel.garcia@free-electrons.com>
---
.../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
diff --git a/Documentation/devicetree/bindings/thermal/kirkwood-thermal.txt b/Documentation/devicetree/bindings/thermal/kirkwood-thermal.txt
deleted file mode 100644
index 8c0f5eb..0000000
--- a/Documentation/devicetree/bindings/thermal/kirkwood-thermal.txt
+++ /dev/null
@@ -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>;
- };
diff --git a/Documentation/devicetree/bindings/thermal/mvebu-thermal.txt b/Documentation/devicetree/bindings/thermal/mvebu-thermal.txt
new file mode 100644
index 0000000..8c0f5eb
--- /dev/null
+++ b/Documentation/devicetree/bindings/thermal/mvebu-thermal.txt
@@ -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>;
+ };
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index a764f16..74f6b97 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -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"
diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
index d3a2b38..40293a1 100644
--- a/drivers/thermal/Makefile
+++ b/drivers/thermal/Makefile
@@ -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
diff --git a/drivers/thermal/kirkwood_thermal.c b/drivers/thermal/kirkwood_thermal.c
deleted file mode 100644
index 19320dd..0000000
--- a/drivers/thermal/kirkwood_thermal.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Kirkwood thermal sensor driver
- *
- * Copyright (C) 2012 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
- *
- * 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 <iwamatsu@nigauri.org>");
-MODULE_DESCRIPTION("kirkwood thermal driver");
-MODULE_LICENSE("GPL");
diff --git a/drivers/thermal/mvebu_thermal.c b/drivers/thermal/mvebu_thermal.c
new file mode 100644
index 0000000..19320dd
--- /dev/null
+++ b/drivers/thermal/mvebu_thermal.c
@@ -0,0 +1,134 @@
+/*
+ * Kirkwood thermal sensor driver
+ *
+ * Copyright (C) 2012 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+ *
+ * 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 <iwamatsu@nigauri.org>");
+MODULE_DESCRIPTION("kirkwood thermal driver");
+MODULE_LICENSE("GPL");
--
1.7.8.6
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH v2 02/14] thermal: mvebu: Rename symbols 'kirkwood' -> 'mvebu'
2013-03-22 22:25 [PATCH v2 00/14] Marvell EBU thermal sensor consolidation Ezequiel Garcia
2013-03-22 22:25 ` [PATCH v2 01/14] thermal: Rename driver 'kirkwood' -> 'mvebu' Ezequiel Garcia
@ 2013-03-22 22:25 ` Ezequiel Garcia
2013-04-11 16:18 ` [v2,02/14] " Eduardo Valentin
2013-03-22 22:25 ` [PATCH v2 03/14] thermal: mvebu: Move MODULE_DEVICE_TABLE upwards Ezequiel Garcia
` (13 subsequent siblings)
15 siblings, 1 reply; 47+ messages in thread
From: Ezequiel Garcia @ 2013-03-22 22:25 UTC (permalink / raw)
To: linux-arm-kernel
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 <ezequiel.garcia@free-electrons.com>
---
drivers/thermal/mvebu_thermal.c | 42 +++++++++++++++++++-------------------
1 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/drivers/thermal/mvebu_thermal.c b/drivers/thermal/mvebu_thermal.c
index 19320dd..9ba9e4d 100644
--- a/drivers/thermal/mvebu_thermal.c
+++ b/drivers/thermal/mvebu_thermal.c
@@ -1,5 +1,5 @@
/*
- * Kirkwood thermal sensor driver
+ * Marvell EBU thermal sensor driver
*
* Copyright (C) 2012 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
*
@@ -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 <iwamatsu@nigauri.org>");
-MODULE_DESCRIPTION("kirkwood thermal driver");
+MODULE_DESCRIPTION("mvebu thermal driver");
MODULE_LICENSE("GPL");
--
1.7.8.6
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH v2 03/14] thermal: mvebu: Move MODULE_DEVICE_TABLE upwards
2013-03-22 22:25 [PATCH v2 00/14] Marvell EBU thermal sensor consolidation Ezequiel Garcia
2013-03-22 22:25 ` [PATCH v2 01/14] thermal: Rename driver 'kirkwood' -> 'mvebu' Ezequiel Garcia
2013-03-22 22:25 ` [PATCH v2 02/14] thermal: mvebu: Rename symbols " Ezequiel Garcia
@ 2013-03-22 22:25 ` Ezequiel Garcia
2013-04-11 16:25 ` [v2,03/14] " Eduardo Valentin
2013-03-22 22:25 ` [PATCH v2 04/14] thermal: mvebu: Remove unneeded variable initialization Ezequiel Garcia
` (12 subsequent siblings)
15 siblings, 1 reply; 47+ messages in thread
From: Ezequiel Garcia @ 2013-03-22 22:25 UTC (permalink / raw)
To: linux-arm-kernel
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 <ezequiel.garcia@free-electrons.com>
---
drivers/thermal/mvebu_thermal.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/drivers/thermal/mvebu_thermal.c b/drivers/thermal/mvebu_thermal.c
index 9ba9e4d..031f94d 100644
--- a/drivers/thermal/mvebu_thermal.c
+++ b/drivers/thermal/mvebu_thermal.c
@@ -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,
--
1.7.8.6
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH v2 04/14] thermal: mvebu: Remove unneeded variable initialization
2013-03-22 22:25 [PATCH v2 00/14] Marvell EBU thermal sensor consolidation Ezequiel Garcia
` (2 preceding siblings ...)
2013-03-22 22:25 ` [PATCH v2 03/14] thermal: mvebu: Move MODULE_DEVICE_TABLE upwards Ezequiel Garcia
@ 2013-03-22 22:25 ` Ezequiel Garcia
2013-04-11 16:29 ` [v2, " Eduardo Valentin
2013-03-22 22:25 ` [PATCH v2 05/14] thermal: mvebu: Convert to devm_ioremap_resource() Ezequiel Garcia
` (11 subsequent siblings)
15 siblings, 1 reply; 47+ messages in thread
From: Ezequiel Garcia @ 2013-03-22 22:25 UTC (permalink / raw)
To: linux-arm-kernel
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 <ezequiel.garcia@free-electrons.com>
---
drivers/thermal/mvebu_thermal.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/thermal/mvebu_thermal.c b/drivers/thermal/mvebu_thermal.c
index 031f94d..1f502ed 100644
--- a/drivers/thermal/mvebu_thermal.c
+++ b/drivers/thermal/mvebu_thermal.c
@@ -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;
--
1.7.8.6
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH v2 05/14] thermal: mvebu: Convert to devm_ioremap_resource()
2013-03-22 22:25 [PATCH v2 00/14] Marvell EBU thermal sensor consolidation Ezequiel Garcia
` (3 preceding siblings ...)
2013-03-22 22:25 ` [PATCH v2 04/14] thermal: mvebu: Remove unneeded variable initialization Ezequiel Garcia
@ 2013-03-22 22:25 ` Ezequiel Garcia
2013-04-11 16:35 ` [v2,05/14] " Eduardo Valentin
2013-03-22 22:25 ` [PATCH v2 06/14] thermal: mvebu: Fix license declaration Ezequiel Garcia
` (10 subsequent siblings)
15 siblings, 1 reply; 47+ messages in thread
From: Ezequiel Garcia @ 2013-03-22 22:25 UTC (permalink / raw)
To: linux-arm-kernel
Convert devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
drivers/thermal/mvebu_thermal.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/thermal/mvebu_thermal.c b/drivers/thermal/mvebu_thermal.c
index 1f502ed..2aeaf75 100644
--- a/drivers/thermal/mvebu_thermal.c
+++ b/drivers/thermal/mvebu_thermal.c
@@ -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);
--
1.7.8.6
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH v2 06/14] thermal: mvebu: Fix license declaration
2013-03-22 22:25 [PATCH v2 00/14] Marvell EBU thermal sensor consolidation Ezequiel Garcia
` (4 preceding siblings ...)
2013-03-22 22:25 ` [PATCH v2 05/14] thermal: mvebu: Convert to devm_ioremap_resource() Ezequiel Garcia
@ 2013-03-22 22:25 ` Ezequiel Garcia
2013-04-11 16:40 ` [v2,06/14] " Eduardo Valentin
2013-03-22 22:25 ` [PATCH v2 07/14] thermal: mvebu: Rename kirkwood definitions to mvebu Ezequiel Garcia
` (9 subsequent siblings)
15 siblings, 1 reply; 47+ messages in thread
From: Ezequiel Garcia @ 2013-03-22 22:25 UTC (permalink / raw)
To: linux-arm-kernel
The 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.
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
drivers/thermal/mvebu_thermal.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/thermal/mvebu_thermal.c b/drivers/thermal/mvebu_thermal.c
index 2aeaf75..0c9344d 100644
--- a/drivers/thermal/mvebu_thermal.c
+++ b/drivers/thermal/mvebu_thermal.c
@@ -128,4 +128,4 @@ module_platform_driver(mvebu_thermal_driver);
MODULE_AUTHOR("Nobuhiro Iwamatsu <iwamatsu@nigauri.org>");
MODULE_DESCRIPTION("mvebu thermal driver");
-MODULE_LICENSE("GPL");
+MODULE_LICENSE("GPL v2");
--
1.7.8.6
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH v2 07/14] thermal: mvebu: Rename kirkwood definitions to mvebu
2013-03-22 22:25 [PATCH v2 00/14] Marvell EBU thermal sensor consolidation Ezequiel Garcia
` (5 preceding siblings ...)
2013-03-22 22:25 ` [PATCH v2 06/14] thermal: mvebu: Fix license declaration Ezequiel Garcia
@ 2013-03-22 22:25 ` Ezequiel Garcia
2013-04-11 16:43 ` [v2,07/14] " Eduardo Valentin
2013-03-22 22:25 ` [PATCH v2 08/14] thermal: mvebu: Add infrastructure to support more multiple SoC variants Ezequiel Garcia
` (8 subsequent siblings)
15 siblings, 1 reply; 47+ messages in thread
From: Ezequiel Garcia @ 2013-03-22 22:25 UTC (permalink / raw)
To: linux-arm-kernel
This definitions will be also valid for other SoC,
such as Armada 370 and Armada XP. Therefore we rename them as 'mvebu'.
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
drivers/thermal/mvebu_thermal.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/thermal/mvebu_thermal.c b/drivers/thermal/mvebu_thermal.c
index 0c9344d..39ddded 100644
--- a/drivers/thermal/mvebu_thermal.c
+++ b/drivers/thermal/mvebu_thermal.c
@@ -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;
--
1.7.8.6
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH v2 08/14] thermal: mvebu: Add infrastructure to support more multiple SoC variants
2013-03-22 22:25 [PATCH v2 00/14] Marvell EBU thermal sensor consolidation Ezequiel Garcia
` (6 preceding siblings ...)
2013-03-22 22:25 ` [PATCH v2 07/14] thermal: mvebu: Rename kirkwood definitions to mvebu Ezequiel Garcia
@ 2013-03-22 22:25 ` Ezequiel Garcia
2013-03-22 22:25 ` [PATCH v2 09/14] thermal: mvebu: Add support for Armada XP thermal sensor Ezequiel Garcia
` (7 subsequent siblings)
15 siblings, 0 replies; 47+ messages in thread
From: Ezequiel Garcia @ 2013-03-22 22:25 UTC (permalink / raw)
To: linux-arm-kernel
This 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.
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
drivers/thermal/mvebu_thermal.c | 80 +++++++++++++++++++++++++++++++--------
1 files changed, 64 insertions(+), 16 deletions(-)
diff --git a/drivers/thermal/mvebu_thermal.c b/drivers/thermal/mvebu_thermal.c
index 39ddded..a7c9b34 100644
--- a/drivers/thermal/mvebu_thermal.c
+++ b/drivers/thermal/mvebu_thermal.c
@@ -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)) {
--
1.7.8.6
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH v2 09/14] thermal: mvebu: Add support for Armada XP thermal sensor
2013-03-22 22:25 [PATCH v2 00/14] Marvell EBU thermal sensor consolidation Ezequiel Garcia
` (7 preceding siblings ...)
2013-03-22 22:25 ` [PATCH v2 08/14] thermal: mvebu: Add infrastructure to support more multiple SoC variants Ezequiel Garcia
@ 2013-03-22 22:25 ` Ezequiel Garcia
2013-03-22 22:25 ` [PATCH v2 10/14] thermal: mvebu: Add support for Armada 370 " Ezequiel Garcia
` (6 subsequent siblings)
15 siblings, 0 replies; 47+ messages in thread
From: Ezequiel Garcia @ 2013-03-22 22:25 UTC (permalink / raw)
To: linux-arm-kernel
With 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.
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
.../devicetree/bindings/thermal/mvebu-thermal.txt | 21 +++++---
drivers/thermal/mvebu_thermal.c | 57 ++++++++++++++++++++
2 files changed, 71 insertions(+), 7 deletions(-)
diff --git a/Documentation/devicetree/bindings/thermal/mvebu-thermal.txt b/Documentation/devicetree/bindings/thermal/mvebu-thermal.txt
index 8c0f5eb..7cc3fd4 100644
--- a/Documentation/devicetree/bindings/thermal/mvebu-thermal.txt
+++ b/Documentation/devicetree/bindings/thermal/mvebu-thermal.txt
@@ -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";
diff --git a/drivers/thermal/mvebu_thermal.c b/drivers/thermal/mvebu_thermal.c
index a7c9b34..fc4d9f4 100644
--- a/drivers/thermal/mvebu_thermal.c
+++ b/drivers/thermal/mvebu_thermal.c
@@ -1,6 +1,7 @@
/*
* Marvell EBU thermal sensor driver
*
+ * Copyright (C) 2013 Marvell
* Copyright (C) 2012 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
*
* This software is licensed under the terms of the GNU General Public
@@ -28,6 +29,14 @@
#define MVEBU_THERMAL_TEMP_OFFSET 10
#define MVEBU_THERMAL_TEMP_MASK 0x1FF
+/* Thermal Manager Control and Status Register */
+#define PMU_TDC0_SW_RST_MASK (0x1 << 1)
+#define PMU_TM_DISABLE_OFFS 0
+#define PMU_TM_DISABLE_MASK (0x1 << PMU_TM_DISABLE_OFFS)
+#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)
+
struct mvebu_thermal_ops;
/* Marvell EBU Thermal Sensor Dev Structure */
@@ -48,6 +57,35 @@ struct mvebu_thermal_ops {
bool (*is_valid)(struct mvebu_thermal_priv *);
};
+static void armadaxp_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);
+
+ /* Reset the sensor */
+ reg = readl_relaxed(priv->control);
+ writel((reg | PMU_TDC0_SW_RST_MASK), priv->control);
+
+ writel(reg, priv->control);
+
+ /* Enable the sensor */
+ reg = readl_relaxed(priv->sensor);
+ reg &= ~PMU_TM_DISABLE_MASK;
+ writel(reg, priv->sensor);
+}
+
static bool mvebu_is_valid(struct mvebu_thermal_priv *priv)
{
unsigned long reg = readl_relaxed(priv->sensor);
@@ -65,6 +103,15 @@ static unsigned long orion_sensor_temp(struct mvebu_thermal_priv *priv)
return (3220000000UL - (10000000UL * reg)) / 13625;
}
+static unsigned long armada_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 (3153000000UL - (10000000UL*reg)) / 13825;
+}
+
static int mvebu_get_temp(struct thermal_zone_device *thermal,
unsigned long *temp)
{
@@ -90,12 +137,21 @@ static const struct mvebu_thermal_ops kirkwood_ops = {
.is_valid = mvebu_is_valid,
};
+static const struct mvebu_thermal_ops armadaxp_ops = {
+ .sensor_temp = armada_sensor_temp,
+ .init_sensor = armadaxp_init_sensor,
+};
+
static const struct of_device_id mvebu_thermal_id_table[] = {
{
.compatible = "marvell,kirkwood-thermal",
.data = &kirkwood_ops,
},
{
+ .compatible = "marvell,armadaxp-thermal",
+ .data = &armadaxp_ops,
+ },
+ {
/* sentinel */
},
};
@@ -175,5 +231,6 @@ static struct platform_driver mvebu_thermal_driver = {
module_platform_driver(mvebu_thermal_driver);
MODULE_AUTHOR("Nobuhiro Iwamatsu <iwamatsu@nigauri.org>");
+MODULE_AUTHOR("Ezequiel Garcia <ezequiel.garcia@free-electrons.com>");
MODULE_DESCRIPTION("mvebu thermal driver");
MODULE_LICENSE("GPL v2");
--
1.7.8.6
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH v2 10/14] thermal: mvebu: Add support for Armada 370 thermal sensor
2013-03-22 22:25 [PATCH v2 00/14] Marvell EBU thermal sensor consolidation Ezequiel Garcia
` (8 preceding siblings ...)
2013-03-22 22:25 ` [PATCH v2 09/14] thermal: mvebu: Add support for Armada XP thermal sensor Ezequiel Garcia
@ 2013-03-22 22:25 ` Ezequiel Garcia
2013-03-22 22:25 ` [PATCH v2 11/14] thermal: mvebu: Add support for Marvell Dove SoC family Ezequiel Garcia
` (5 subsequent siblings)
15 siblings, 0 replies; 47+ messages in thread
From: Ezequiel Garcia @ 2013-03-22 22:25 UTC (permalink / raw)
To: linux-arm-kernel
The 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.
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
.../devicetree/bindings/thermal/mvebu-thermal.txt | 1 +
drivers/thermal/mvebu_thermal.c | 37 ++++++++++++++++++++
2 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/Documentation/devicetree/bindings/thermal/mvebu-thermal.txt b/Documentation/devicetree/bindings/thermal/mvebu-thermal.txt
index 7cc3fd4..49d55a9 100644
--- a/Documentation/devicetree/bindings/thermal/mvebu-thermal.txt
+++ b/Documentation/devicetree/bindings/thermal/mvebu-thermal.txt
@@ -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.
diff --git a/drivers/thermal/mvebu_thermal.c b/drivers/thermal/mvebu_thermal.c
index fc4d9f4..56c58b1 100644
--- a/drivers/thermal/mvebu_thermal.c
+++ b/drivers/thermal/mvebu_thermal.c
@@ -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 */
},
};
--
1.7.8.6
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH v2 11/14] thermal: mvebu: Add support for Marvell Dove SoC family
2013-03-22 22:25 [PATCH v2 00/14] Marvell EBU thermal sensor consolidation Ezequiel Garcia
` (9 preceding siblings ...)
2013-03-22 22:25 ` [PATCH v2 10/14] thermal: mvebu: Add support for Armada 370 " Ezequiel Garcia
@ 2013-03-22 22:25 ` Ezequiel Garcia
2013-03-23 11:26 ` Sebastian Hesselbarth
2013-03-22 22:25 ` [PATCH v2 12/14] ARM: mvebu: Add thermal support to Armada XP device tree Ezequiel Garcia
` (4 subsequent siblings)
15 siblings, 1 reply; 47+ messages in thread
From: Ezequiel Garcia @ 2013-03-22 22:25 UTC (permalink / raw)
To: linux-arm-kernel
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 <ezequiel.garcia@free-electrons.com>
---
.../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
diff --git a/Documentation/devicetree/bindings/thermal/dove-thermal.txt b/Documentation/devicetree/bindings/thermal/dove-thermal.txt
deleted file mode 100644
index 6f47467..0000000
--- a/Documentation/devicetree/bindings/thermal/dove-thermal.txt
+++ /dev/null
@@ -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>;
- };
diff --git a/Documentation/devicetree/bindings/thermal/mvebu-thermal.txt b/Documentation/devicetree/bindings/thermal/mvebu-thermal.txt
index 49d55a9..2c5297a 100644
--- a/Documentation/devicetree/bindings/thermal/mvebu-thermal.txt
+++ b/Documentation/devicetree/bindings/thermal/mvebu-thermal.txt
@@ -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>;
+ };
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index 74f6b97..237c3e6 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -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
diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
index 40293a1..ddd77f4 100644
--- a/drivers/thermal/Makefile
+++ b/drivers/thermal/Makefile
@@ -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
diff --git a/drivers/thermal/dove_thermal.c b/drivers/thermal/dove_thermal.c
deleted file mode 100644
index ddd73a5..0000000
--- a/drivers/thermal/dove_thermal.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * Dove thermal sensor driver
- *
- * Copyright (C) 2013 Andrew Lunn <andrew@lunn.ch>
- *
- * 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
-
-/* Dove Thermal Manager Control and Status Register */
-#define PMU_TM_DISABLE_OFFS 0
-#define PMU_TM_DISABLE_MASK (0x1 << PMU_TM_DISABLE_OFFS)
-
-/* Dove Theraml Diode Control 0 Register */
-#define PMU_TDC0_SW_RST_MASK (0x1 << 1)
-#define PMU_TDC0_SEL_VCAL_OFFS 5
-#define PMU_TDC0_SEL_VCAL_MASK (0x3 << PMU_TDC0_SEL_VCAL_OFFS)
-#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_AVG_NUM_OFFS 25
-#define PMU_TDC0_AVG_NUM_MASK (0x7 << PMU_TDC0_AVG_NUM_OFFS)
-
-/* Dove Thermal Diode Control 1 Register */
-#define PMU_TEMP_DIOD_CTRL1_REG 0x04
-#define PMU_TDC1_TEMP_VALID_MASK (0x1 << 10)
-
-/* Dove Thermal Sensor Dev Structure */
-struct dove_thermal_priv {
- void __iomem *sensor;
- void __iomem *control;
-};
-
-static int dove_init_sensor(const struct dove_thermal_priv *priv)
-{
- u32 reg;
- u32 i;
-
- /* Configure the Diode Control Register #0 */
- reg = readl_relaxed(priv->control);
-
- /* Use average of 2 */
- reg &= ~PMU_TDC0_AVG_NUM_MASK;
- reg |= (0x1 << PMU_TDC0_AVG_NUM_OFFS);
-
- /* Reference calibration value */
- reg &= ~PMU_TDC0_REF_CAL_CNT_MASK;
- reg |= (0x0F1 << PMU_TDC0_REF_CAL_CNT_OFFS);
-
- /* Set the high level reference for calibration */
- reg &= ~PMU_TDC0_SEL_VCAL_MASK;
- reg |= (0x2 << PMU_TDC0_SEL_VCAL_OFFS);
- writel(reg, priv->control);
-
- /* Reset the sensor */
- reg = readl_relaxed(priv->control);
- writel((reg | PMU_TDC0_SW_RST_MASK), priv->control);
- writel(reg, priv->control);
-
- /* Enable the sensor */
- reg = readl_relaxed(priv->sensor);
- reg &= ~PMU_TM_DISABLE_MASK;
- writel(reg, priv->sensor);
-
- /* Poll the sensor for the first reading */
- for (i = 0; i < 1000000; i++) {
- reg = readl_relaxed(priv->sensor);
- if (reg & DOVE_THERMAL_TEMP_MASK)
- break;
- }
-
- if (i == 1000000)
- return -EIO;
-
- return 0;
-}
-
-static int dove_get_temp(struct thermal_zone_device *thermal,
- unsigned long *temp)
-{
- unsigned long reg;
- struct dove_thermal_priv *priv = thermal->devdata;
-
- /* Valid check */
- reg = readl_relaxed(priv->control + PMU_TEMP_DIOD_CTRL1_REG);
- if ((reg & PMU_TDC1_TEMP_VALID_MASK) == 0x0) {
- 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 = readl_relaxed(priv->sensor);
- reg = (reg >> DOVE_THERMAL_TEMP_OFFSET) & DOVE_THERMAL_TEMP_MASK;
- *temp = ((3220000000UL - (10000000UL * reg)) / 13625);
-
- return 0;
-}
-
-static struct thermal_zone_device_ops ops = {
- .get_temp = dove_get_temp,
-};
-
-static const struct of_device_id dove_thermal_id_table[] = {
- { .compatible = "marvell,dove-thermal" },
- {}
-};
-
-static int dove_thermal_probe(struct platform_device *pdev)
-{
- struct thermal_zone_device *thermal = NULL;
- struct dove_thermal_priv *priv;
- struct resource *res;
- int ret;
-
- 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;
- }
-
- res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
- if (!res) {
- dev_err(&pdev->dev, "Failed to get platform resource\n");
- return -ENODEV;
- }
- priv->control = devm_request_and_ioremap(&pdev->dev, res);
- if (!priv->control) {
- dev_err(&pdev->dev, "Failed to request_ioremap memory\n");
- return -EADDRNOTAVAIL;
- }
-
- ret = dove_init_sensor(priv);
- if (ret) {
- dev_err(&pdev->dev, "Failed to initialize sensor\n");
- return ret;
- }
-
- thermal = thermal_zone_device_register("dove_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 dove_thermal_exit(struct platform_device *pdev)
-{
- struct thermal_zone_device *dove_thermal =
- platform_get_drvdata(pdev);
-
- thermal_zone_device_unregister(dove_thermal);
- platform_set_drvdata(pdev, NULL);
-
- return 0;
-}
-
-MODULE_DEVICE_TABLE(of, dove_thermal_id_table);
-
-static struct platform_driver dove_thermal_driver = {
- .probe = dove_thermal_probe,
- .remove = dove_thermal_exit,
- .driver = {
- .name = "dove_thermal",
- .owner = THIS_MODULE,
- .of_match_table = of_match_ptr(dove_thermal_id_table),
- },
-};
-
-module_platform_driver(dove_thermal_driver);
-
-MODULE_AUTHOR("Andrew Lunn <andrew@lunn.ch>");
-MODULE_DESCRIPTION("Dove thermal driver");
-MODULE_LICENSE("GPL");
diff --git a/drivers/thermal/mvebu_thermal.c b/drivers/thermal/mvebu_thermal.c
index 56c58b1..2f37b3e 100644
--- a/drivers/thermal/mvebu_thermal.c
+++ b/drivers/thermal/mvebu_thermal.c
@@ -2,6 +2,7 @@
* Marvell EBU thermal sensor driver
*
* Copyright (C) 2013 Marvell
+ * Copyright (C) 2013 Andrew Lunn <andrew@lunn.ch>
* Copyright (C) 2012 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
*
* 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)
#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)
struct mvebu_thermal_ops;
@@ -113,6 +122,53 @@ static void armada370_init_sensor(struct mvebu_thermal_priv *priv)
mdelay(10);
}
+static void dove_init_sensor(struct mvebu_thermal_priv *priv)
+{
+ unsigned long reg;
+ int i;
+
+ if (!priv->control)
+ return;
+
+ /* Configure the Diode Control Register #0 */
+ reg = readl_relaxed(priv->control);
+
+ /* Use average of 2 */
+ reg &= ~PMU_TDC0_AVG_NUM_MASK;
+ reg |= (0x1 << PMU_TDC0_AVG_NUM_OFFS);
+
+ /* Reference calibration value */
+ reg &= ~PMU_TDC0_REF_CAL_CNT_MASK;
+ reg |= (0x0F1 << PMU_TDC0_REF_CAL_CNT_OFFS);
+
+ /* Set the high level reference for calibration */
+ reg &= ~PMU_TDC0_SEL_VCAL_MASK;
+ reg |= (0x2 << PMU_TDC0_SEL_VCAL_OFFS);
+ writel(reg, priv->control);
+
+ /* Reset the sensor */
+ reg = readl_relaxed(priv->control);
+ writel((reg | PMU_TDC0_SW_RST_MASK), priv->control);
+ writel(reg, priv->control);
+
+ /* Enable the sensor */
+ reg = readl_relaxed(priv->sensor);
+ reg &= ~PMU_TM_DISABLE_MASK;
+ writel(reg, priv->sensor);
+
+ /*
+ * FIXME: This looks really ugly. Can't we just remove it?
+ * Poll the sensor for the first reading
+ */
+ for (i = 0; i < 1000000; i++) {
+ reg = (readl_relaxed(priv->sensor) >> MVEBU_THERMAL_TEMP_OFFSET)
+ & MVEBU_THERMAL_TEMP_MASK;
+ if (reg)
+ break;
+ }
+ return;
+}
+
static bool mvebu_is_valid(struct mvebu_thermal_priv *priv)
{
unsigned long reg = readl_relaxed(priv->sensor);
@@ -139,6 +195,13 @@ static unsigned long armada_sensor_temp(struct mvebu_thermal_priv *priv)
return (3153000000UL - (10000000UL*reg)) / 13825;
}
+static bool dove_is_valid(struct mvebu_thermal_priv *priv)
+{
+ unsigned long reg =
+ readl_relaxed(priv->control + PMU_TEMP_DIOD_CTRL1_REG);
+ return reg & PMU_TDC1_TEMP_VALID_MASK;
+}
+
static int mvebu_get_temp(struct thermal_zone_device *thermal,
unsigned long *temp)
{
@@ -164,6 +227,12 @@ static const struct mvebu_thermal_ops kirkwood_ops = {
.is_valid = mvebu_is_valid,
};
+static const struct mvebu_thermal_ops dove_ops = {
+ .sensor_temp = orion_sensor_temp,
+ .is_valid = dove_is_valid,
+ .init_sensor = dove_init_sensor,
+};
+
static const struct mvebu_thermal_ops armadaxp_ops = {
.sensor_temp = armada_sensor_temp,
.init_sensor = armadaxp_init_sensor,
@@ -189,6 +258,10 @@ static const struct of_device_id mvebu_thermal_id_table[] = {
.data = &armada370_ops,
},
{
+ .compatible = "marvell,dove-thermal",
+ .data = &dove_ops,
+ },
+ {
/* sentinel */
},
};
@@ -267,6 +340,7 @@ static struct platform_driver mvebu_thermal_driver = {
module_platform_driver(mvebu_thermal_driver);
+MODULE_AUTHOR("Andrew Lunn <andrew@lunn.ch>");
MODULE_AUTHOR("Nobuhiro Iwamatsu <iwamatsu@nigauri.org>");
MODULE_AUTHOR("Ezequiel Garcia <ezequiel.garcia@free-electrons.com>");
MODULE_DESCRIPTION("mvebu thermal driver");
--
1.7.8.6
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH v2 12/14] ARM: mvebu: Add thermal support to Armada XP device tree
2013-03-22 22:25 [PATCH v2 00/14] Marvell EBU thermal sensor consolidation Ezequiel Garcia
` (10 preceding siblings ...)
2013-03-22 22:25 ` [PATCH v2 11/14] thermal: mvebu: Add support for Marvell Dove SoC family Ezequiel Garcia
@ 2013-03-22 22:25 ` Ezequiel Garcia
2013-03-22 22:25 ` [PATCH v2 13/14] ARM: mvebu: Add thermal support to Armada 370 " Ezequiel Garcia
` (3 subsequent siblings)
15 siblings, 0 replies; 47+ messages in thread
From: Ezequiel Garcia @ 2013-03-22 22:25 UTC (permalink / raw)
To: linux-arm-kernel
This 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.
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
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(-)
diff --git a/arch/arm/boot/dts/armada-xp.dtsi b/arch/arm/boot/dts/armada-xp.dtsi
index ca00d83..29dfeb6 100644
--- a/arch/arm/boot/dts/armada-xp.dtsi
+++ b/arch/arm/boot/dts/armada-xp.dtsi
@@ -151,5 +151,11 @@
status = "disabled";
};
+ thermal at d00182b0 {
+ compatible = "marvell,armadaxp-thermal";
+ reg = <0xd00182b0 0x4
+ 0xd00184d0 0x4>;
+ status = "okay";
+ };
};
};
--
1.7.8.6
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH v2 13/14] ARM: mvebu: Add thermal support to Armada 370 device tree
2013-03-22 22:25 [PATCH v2 00/14] Marvell EBU thermal sensor consolidation Ezequiel Garcia
` (11 preceding siblings ...)
2013-03-22 22:25 ` [PATCH v2 12/14] ARM: mvebu: Add thermal support to Armada XP device tree Ezequiel Garcia
@ 2013-03-22 22:25 ` Ezequiel Garcia
2013-03-23 14:18 ` Sergei Shtylyov
2013-03-22 22:25 ` [PATCH v2 14/14] ARM: configs: Update mvebu, dove and kirkwood defconfigs for thermal Ezequiel Garcia
` (2 subsequent siblings)
15 siblings, 1 reply; 47+ messages in thread
From: Ezequiel Garcia @ 2013-03-22 22:25 UTC (permalink / raw)
To: linux-arm-kernel
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 <ezequiel.garcia@free-electrons.com>
---
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(-)
diff --git a/arch/arm/boot/dts/armada-370.dtsi b/arch/arm/boot/dts/armada-370.dtsi
index 8188d13..5831994 100644
--- a/arch/arm/boot/dts/armada-370.dtsi
+++ b/arch/arm/boot/dts/armada-370.dtsi
@@ -153,5 +153,11 @@
clocks = <&coreclk 0>;
};
+ thermal at d0018300 {
+ compatible = "marvell,armada370-thermal";
+ reg = <0xd0018300 0x4
+ 0xd0018304 0x4>;
+ status = "okay";
+ };
};
};
--
1.7.8.6
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH v2 14/14] ARM: configs: Update mvebu, dove and kirkwood defconfigs for thermal
2013-03-22 22:25 [PATCH v2 00/14] Marvell EBU thermal sensor consolidation Ezequiel Garcia
` (12 preceding siblings ...)
2013-03-22 22:25 ` [PATCH v2 13/14] ARM: mvebu: Add thermal support to Armada 370 " Ezequiel Garcia
@ 2013-03-22 22:25 ` Ezequiel Garcia
2013-03-23 18:16 ` [PATCH v2 00/14] Marvell EBU thermal sensor consolidation Jason Cooper
2013-03-25 9:30 ` Andrew Lunn
15 siblings, 0 replies; 47+ messages in thread
From: Ezequiel Garcia @ 2013-03-22 22:25 UTC (permalink / raw)
To: linux-arm-kernel
The 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.
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
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(-)
diff --git a/arch/arm/configs/dove_defconfig b/arch/arm/configs/dove_defconfig
index 4364eff..2136442 100644
--- a/arch/arm/configs/dove_defconfig
+++ b/arch/arm/configs/dove_defconfig
@@ -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
diff --git a/arch/arm/configs/kirkwood_defconfig b/arch/arm/configs/kirkwood_defconfig
index 8f0065b..081d39f 100644
--- a/arch/arm/configs/kirkwood_defconfig
+++ b/arch/arm/configs/kirkwood_defconfig
@@ -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
diff --git a/arch/arm/configs/mvebu_defconfig b/arch/arm/configs/mvebu_defconfig
index 2ec8119..f2ac593 100644
--- a/arch/arm/configs/mvebu_defconfig
+++ b/arch/arm/configs/mvebu_defconfig
@@ -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
--
1.7.8.6
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH v2 11/14] thermal: mvebu: Add support for Marvell Dove SoC family
2013-03-22 22:25 ` [PATCH v2 11/14] thermal: mvebu: Add support for Marvell Dove SoC family Ezequiel Garcia
@ 2013-03-23 11:26 ` Sebastian Hesselbarth
2013-03-24 0:16 ` Ezequiel Garcia
2013-03-25 9:34 ` Ezequiel Garcia
0 siblings, 2 replies; 47+ messages in thread
From: Sebastian Hesselbarth @ 2013-03-23 11:26 UTC (permalink / raw)
To: linux-arm-kernel
On 03/22/2013 11:25 PM, Ezequiel Garcia wrote:
> 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<ezequiel.garcia@free-electrons.com>
> ---
> .../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
>
[...]
> diff --git a/drivers/thermal/dove_thermal.c b/drivers/thermal/dove_thermal.c
> deleted file mode 100644
> index ddd73a5..0000000
> --- a/drivers/thermal/dove_thermal.c
> +++ /dev/null
> @@ -1,210 +0,0 @@
> -/*
> - * Dove thermal sensor driver
> - *
> - * Copyright (C) 2013 Andrew Lunn<andrew@lunn.ch>
> - *
> - * 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
[...]
> diff --git a/drivers/thermal/mvebu_thermal.c b/drivers/thermal/mvebu_thermal.c
> index 56c58b1..2f37b3e 100644
> --- a/drivers/thermal/mvebu_thermal.c
> +++ b/drivers/thermal/mvebu_thermal.c
> @@ -2,6 +2,7 @@
> * Marvell EBU thermal sensor driver
> *
> * Copyright (C) 2013 Marvell
> + * Copyright (C) 2013 Andrew Lunn<andrew@lunn.ch>
> * Copyright (C) 2012 Nobuhiro Iwamatsu<iwamatsu@nigauri.org>
> *
> * 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)
> #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
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH v2 13/14] ARM: mvebu: Add thermal support to Armada 370 device tree
2013-03-22 22:25 ` [PATCH v2 13/14] ARM: mvebu: Add thermal support to Armada 370 " Ezequiel Garcia
@ 2013-03-23 14:18 ` Sergei Shtylyov
2013-03-23 14:20 ` Sergei Shtylyov
0 siblings, 1 reply; 47+ messages in thread
From: Sergei Shtylyov @ 2013-03-23 14:18 UTC (permalink / raw)
To: linux-arm-kernel
Hello.
On 23-03-2013 2:25, Ezequiel Garcia wrote:
> 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 <ezequiel.garcia@free-electrons.com>
> ---
> 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(-)
> diff --git a/arch/arm/boot/dts/armada-370.dtsi b/arch/arm/boot/dts/armada-370.dtsi
> index 8188d13..5831994 100644
> --- a/arch/arm/boot/dts/armada-370.dtsi
> +++ b/arch/arm/boot/dts/armada-370.dtsi
> @@ -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
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH v2 13/14] ARM: mvebu: Add thermal support to Armada 370 device tree
2013-03-23 14:18 ` Sergei Shtylyov
@ 2013-03-23 14:20 ` Sergei Shtylyov
2013-03-23 14:25 ` Sergei Shtylyov
0 siblings, 1 reply; 47+ messages in thread
From: Sergei Shtylyov @ 2013-03-23 14:20 UTC (permalink / raw)
To: linux-arm-kernel
On 23-03-2013 18:18, Sergei Shtylyov wrote:
>> 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 <ezequiel.garcia@free-electrons.com>
>> ---
>> 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(-)
>> diff --git a/arch/arm/boot/dts/armada-370.dtsi
>> b/arch/arm/boot/dts/armada-370.dtsi
>> index 8188d13..5831994 100644
>> --- a/arch/arm/boot/dts/armada-370.dtsi
>> +++ b/arch/arm/boot/dts/armada-370.dtsi
>> @@ -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?
Ah, I just saw the previous patch where the registers are not adjacent and
it became clear why.
WBR, Sergei
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH v2 13/14] ARM: mvebu: Add thermal support to Armada 370 device tree
2013-03-23 14:20 ` Sergei Shtylyov
@ 2013-03-23 14:25 ` Sergei Shtylyov
2013-03-24 0:22 ` Ezequiel Garcia
0 siblings, 1 reply; 47+ messages in thread
From: Sergei Shtylyov @ 2013-03-23 14:25 UTC (permalink / raw)
To: linux-arm-kernel
On 23-03-2013 18:20, Sergei Shtylyov wrote:
>>> 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 <ezequiel.garcia@free-electrons.com>
>>> ---
>>> 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(-)
>>> diff --git a/arch/arm/boot/dts/armada-370.dtsi
>>> b/arch/arm/boot/dts/armada-370.dtsi
>>> index 8188d13..5831994 100644
>>> --- a/arch/arm/boot/dts/armada-370.dtsi
>>> +++ b/arch/arm/boot/dts/armada-370.dtsi
>>> @@ -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?
> 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
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH v2 00/14] Marvell EBU thermal sensor consolidation
2013-03-22 22:25 [PATCH v2 00/14] Marvell EBU thermal sensor consolidation Ezequiel Garcia
` (13 preceding siblings ...)
2013-03-22 22:25 ` [PATCH v2 14/14] ARM: configs: Update mvebu, dove and kirkwood defconfigs for thermal Ezequiel Garcia
@ 2013-03-23 18:16 ` Jason Cooper
2013-03-23 18:28 ` Sebastian Hesselbarth
2013-03-25 9:30 ` Andrew Lunn
15 siblings, 1 reply; 47+ messages in thread
From: Jason Cooper @ 2013-03-23 18:16 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Mar 22, 2013 at 07:25:00PM -0300, Ezequiel Garcia wrote:
...
> 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
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.
> 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.
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH v2 00/14] Marvell EBU thermal sensor consolidation
2013-03-23 18:16 ` [PATCH v2 00/14] Marvell EBU thermal sensor consolidation Jason Cooper
@ 2013-03-23 18:28 ` Sebastian Hesselbarth
2013-03-23 18:31 ` Jason Cooper
0 siblings, 1 reply; 47+ messages in thread
From: Sebastian Hesselbarth @ 2013-03-23 18:28 UTC (permalink / raw)
To: linux-arm-kernel
On 03/23/2013 07:16 PM, Jason Cooper wrote:
> On Fri, Mar 22, 2013 at 07:25:00PM -0300, Ezequiel Garcia wrote:
> ...
>> 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
>
> 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
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH v2 00/14] Marvell EBU thermal sensor consolidation
2013-03-23 18:28 ` Sebastian Hesselbarth
@ 2013-03-23 18:31 ` Jason Cooper
2013-03-23 18:38 ` Sebastian Hesselbarth
0 siblings, 1 reply; 47+ messages in thread
From: Jason Cooper @ 2013-03-23 18:31 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, Mar 23, 2013 at 07:28:51PM +0100, Sebastian Hesselbarth wrote:
> On 03/23/2013 07:16 PM, Jason Cooper wrote:
> >On Fri, Mar 22, 2013 at 07:25:00PM -0300, Ezequiel Garcia wrote:
> >...
> >>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
> >
> >Once the thermal maintainers agree to take this in, I'll take the three
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Was I not clear?
> >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.
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH v2 00/14] Marvell EBU thermal sensor consolidation
2013-03-23 18:31 ` Jason Cooper
@ 2013-03-23 18:38 ` Sebastian Hesselbarth
0 siblings, 0 replies; 47+ messages in thread
From: Sebastian Hesselbarth @ 2013-03-23 18:38 UTC (permalink / raw)
To: linux-arm-kernel
On 03/23/2013 07:31 PM, Jason Cooper wrote:
> On Sat, Mar 23, 2013 at 07:28:51PM +0100, Sebastian Hesselbarth wrote:
>> On 03/23/2013 07:16 PM, Jason Cooper wrote:
>>> On Fri, Mar 22, 2013 at 07:25:00PM -0300, Ezequiel Garcia wrote:
>>> ...
>>>> 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
>>>
>>> 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
>>> 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.
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH v2 11/14] thermal: mvebu: Add support for Marvell Dove SoC family
2013-03-23 11:26 ` Sebastian Hesselbarth
@ 2013-03-24 0:16 ` Ezequiel Garcia
2013-03-25 9:34 ` Ezequiel Garcia
1 sibling, 0 replies; 47+ messages in thread
From: Ezequiel Garcia @ 2013-03-24 0:16 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, Mar 23, 2013 at 12:26:05PM +0100, Sebastian Hesselbarth wrote:
> On 03/22/2013 11:25 PM, Ezequiel Garcia wrote:
> > 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<ezequiel.garcia@free-electrons.com>
> > ---
> > .../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
> >
>
> [...]
>
> > diff --git a/drivers/thermal/dove_thermal.c b/drivers/thermal/dove_thermal.c
> > deleted file mode 100644
> > index ddd73a5..0000000
> > --- a/drivers/thermal/dove_thermal.c
> > +++ /dev/null
> > @@ -1,210 +0,0 @@
> > -/*
> > - * Dove thermal sensor driver
> > - *
> > - * Copyright (C) 2013 Andrew Lunn<andrew@lunn.ch>
> > - *
> > - * 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
>
> [...]
>
> > diff --git a/drivers/thermal/mvebu_thermal.c b/drivers/thermal/mvebu_thermal.c
> > index 56c58b1..2f37b3e 100644
> > --- a/drivers/thermal/mvebu_thermal.c
> > +++ b/drivers/thermal/mvebu_thermal.c
> > @@ -2,6 +2,7 @@
> > * Marvell EBU thermal sensor driver
> > *
> > * Copyright (C) 2013 Marvell
> > + * Copyright (C) 2013 Andrew Lunn<andrew@lunn.ch>
> > * Copyright (C) 2012 Nobuhiro Iwamatsu<iwamatsu@nigauri.org>
> > *
> > * 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)
> > #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 at 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().
>
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.
--
Ezequiel Garc?a, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH v2 13/14] ARM: mvebu: Add thermal support to Armada 370 device tree
2013-03-23 14:25 ` Sergei Shtylyov
@ 2013-03-24 0:22 ` Ezequiel Garcia
0 siblings, 0 replies; 47+ messages in thread
From: Ezequiel Garcia @ 2013-03-24 0:22 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, Mar 23, 2013 at 06:25:58PM +0400, Sergei Shtylyov wrote:
> On 23-03-2013 18:20, Sergei Shtylyov wrote:
>
> >>> 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 <ezequiel.garcia@free-electrons.com>
> >>> ---
> >>> 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(-)
>
> >>> diff --git a/arch/arm/boot/dts/armada-370.dtsi
> >>> b/arch/arm/boot/dts/armada-370.dtsi
> >>> index 8188d13..5831994 100644
> >>> --- a/arch/arm/boot/dts/armada-370.dtsi
> >>> +++ b/arch/arm/boot/dts/armada-370.dtsi
> >>> @@ -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?
>
> > 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?
--
Ezequiel Garc?a, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH v2 00/14] Marvell EBU thermal sensor consolidation
2013-03-22 22:25 [PATCH v2 00/14] Marvell EBU thermal sensor consolidation Ezequiel Garcia
` (14 preceding siblings ...)
2013-03-23 18:16 ` [PATCH v2 00/14] Marvell EBU thermal sensor consolidation Jason Cooper
@ 2013-03-25 9:30 ` Andrew Lunn
2013-03-25 10:45 ` Ezequiel Garcia
15 siblings, 1 reply; 47+ messages in thread
From: Andrew Lunn @ 2013-03-25 9:30 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Mar 22, 2013 at 07:25:00PM -0300, Ezequiel Garcia wrote:
> 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
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH v2 11/14] thermal: mvebu: Add support for Marvell Dove SoC family
2013-03-23 11:26 ` Sebastian Hesselbarth
2013-03-24 0:16 ` Ezequiel Garcia
@ 2013-03-25 9:34 ` Ezequiel Garcia
1 sibling, 0 replies; 47+ messages in thread
From: Ezequiel Garcia @ 2013-03-25 9:34 UTC (permalink / raw)
To: linux-arm-kernel
Hi Sebastian,
Thanks again for your testing.
On Sat, Mar 23, 2013 at 12:26:05PM +0100, Sebastian Hesselbarth wrote:
[...]
>
> maybe Dove thermal isn't that compatible with the others as you thought.
>
> Have a look at 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().
>
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<-------------------------------------------
>From 8695c7cbdb4922cf0ab7004fd185fea199db6174 Mon Sep 17 00:00:00 2001
From: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
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.
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
.../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
diff --git a/Documentation/devicetree/bindings/thermal/dove-thermal.txt b/Documentation/devicetree/bindings/thermal/dove-thermal.txt
deleted file mode 100644
index 6f47467..0000000
--- a/Documentation/devicetree/bindings/thermal/dove-thermal.txt
+++ /dev/null
@@ -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>;
- };
diff --git a/Documentation/devicetree/bindings/thermal/mvebu-thermal.txt b/Documentation/devicetree/bindings/thermal/mvebu-thermal.txt
index 49d55a9..2c5297a 100644
--- a/Documentation/devicetree/bindings/thermal/mvebu-thermal.txt
+++ b/Documentation/devicetree/bindings/thermal/mvebu-thermal.txt
@@ -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>;
+ };
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index 74f6b97..237c3e6 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -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
diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
index 40293a1..ddd77f4 100644
--- a/drivers/thermal/Makefile
+++ b/drivers/thermal/Makefile
@@ -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
diff --git a/drivers/thermal/dove_thermal.c b/drivers/thermal/dove_thermal.c
deleted file mode 100644
index ddd73a5..0000000
--- a/drivers/thermal/dove_thermal.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * Dove thermal sensor driver
- *
- * Copyright (C) 2013 Andrew Lunn <andrew@lunn.ch>
- *
- * 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
-
-/* Dove Thermal Manager Control and Status Register */
-#define PMU_TM_DISABLE_OFFS 0
-#define PMU_TM_DISABLE_MASK (0x1 << PMU_TM_DISABLE_OFFS)
-
-/* Dove Theraml Diode Control 0 Register */
-#define PMU_TDC0_SW_RST_MASK (0x1 << 1)
-#define PMU_TDC0_SEL_VCAL_OFFS 5
-#define PMU_TDC0_SEL_VCAL_MASK (0x3 << PMU_TDC0_SEL_VCAL_OFFS)
-#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_AVG_NUM_OFFS 25
-#define PMU_TDC0_AVG_NUM_MASK (0x7 << PMU_TDC0_AVG_NUM_OFFS)
-
-/* Dove Thermal Diode Control 1 Register */
-#define PMU_TEMP_DIOD_CTRL1_REG 0x04
-#define PMU_TDC1_TEMP_VALID_MASK (0x1 << 10)
-
-/* Dove Thermal Sensor Dev Structure */
-struct dove_thermal_priv {
- void __iomem *sensor;
- void __iomem *control;
-};
-
-static int dove_init_sensor(const struct dove_thermal_priv *priv)
-{
- u32 reg;
- u32 i;
-
- /* Configure the Diode Control Register #0 */
- reg = readl_relaxed(priv->control);
-
- /* Use average of 2 */
- reg &= ~PMU_TDC0_AVG_NUM_MASK;
- reg |= (0x1 << PMU_TDC0_AVG_NUM_OFFS);
-
- /* Reference calibration value */
- reg &= ~PMU_TDC0_REF_CAL_CNT_MASK;
- reg |= (0x0F1 << PMU_TDC0_REF_CAL_CNT_OFFS);
-
- /* Set the high level reference for calibration */
- reg &= ~PMU_TDC0_SEL_VCAL_MASK;
- reg |= (0x2 << PMU_TDC0_SEL_VCAL_OFFS);
- writel(reg, priv->control);
-
- /* Reset the sensor */
- reg = readl_relaxed(priv->control);
- writel((reg | PMU_TDC0_SW_RST_MASK), priv->control);
- writel(reg, priv->control);
-
- /* Enable the sensor */
- reg = readl_relaxed(priv->sensor);
- reg &= ~PMU_TM_DISABLE_MASK;
- writel(reg, priv->sensor);
-
- /* Poll the sensor for the first reading */
- for (i = 0; i < 1000000; i++) {
- reg = readl_relaxed(priv->sensor);
- if (reg & DOVE_THERMAL_TEMP_MASK)
- break;
- }
-
- if (i == 1000000)
- return -EIO;
-
- return 0;
-}
-
-static int dove_get_temp(struct thermal_zone_device *thermal,
- unsigned long *temp)
-{
- unsigned long reg;
- struct dove_thermal_priv *priv = thermal->devdata;
-
- /* Valid check */
- reg = readl_relaxed(priv->control + PMU_TEMP_DIOD_CTRL1_REG);
- if ((reg & PMU_TDC1_TEMP_VALID_MASK) == 0x0) {
- 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 = readl_relaxed(priv->sensor);
- reg = (reg >> DOVE_THERMAL_TEMP_OFFSET) & DOVE_THERMAL_TEMP_MASK;
- *temp = ((3220000000UL - (10000000UL * reg)) / 13625);
-
- return 0;
-}
-
-static struct thermal_zone_device_ops ops = {
- .get_temp = dove_get_temp,
-};
-
-static const struct of_device_id dove_thermal_id_table[] = {
- { .compatible = "marvell,dove-thermal" },
- {}
-};
-
-static int dove_thermal_probe(struct platform_device *pdev)
-{
- struct thermal_zone_device *thermal = NULL;
- struct dove_thermal_priv *priv;
- struct resource *res;
- int ret;
-
- 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;
- }
-
- res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
- if (!res) {
- dev_err(&pdev->dev, "Failed to get platform resource\n");
- return -ENODEV;
- }
- priv->control = devm_request_and_ioremap(&pdev->dev, res);
- if (!priv->control) {
- dev_err(&pdev->dev, "Failed to request_ioremap memory\n");
- return -EADDRNOTAVAIL;
- }
-
- ret = dove_init_sensor(priv);
- if (ret) {
- dev_err(&pdev->dev, "Failed to initialize sensor\n");
- return ret;
- }
-
- thermal = thermal_zone_device_register("dove_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 dove_thermal_exit(struct platform_device *pdev)
-{
- struct thermal_zone_device *dove_thermal =
- platform_get_drvdata(pdev);
-
- thermal_zone_device_unregister(dove_thermal);
- platform_set_drvdata(pdev, NULL);
-
- return 0;
-}
-
-MODULE_DEVICE_TABLE(of, dove_thermal_id_table);
-
-static struct platform_driver dove_thermal_driver = {
- .probe = dove_thermal_probe,
- .remove = dove_thermal_exit,
- .driver = {
- .name = "dove_thermal",
- .owner = THIS_MODULE,
- .of_match_table = of_match_ptr(dove_thermal_id_table),
- },
-};
-
-module_platform_driver(dove_thermal_driver);
-
-MODULE_AUTHOR("Andrew Lunn <andrew@lunn.ch>");
-MODULE_DESCRIPTION("Dove thermal driver");
-MODULE_LICENSE("GPL");
diff --git a/drivers/thermal/mvebu_thermal.c b/drivers/thermal/mvebu_thermal.c
index 60d50c7..b043da3 100644
--- a/drivers/thermal/mvebu_thermal.c
+++ b/drivers/thermal/mvebu_thermal.c
@@ -2,6 +2,7 @@
* Marvell EBU thermal sensor driver
*
* Copyright (C) 2013 Marvell
+ * Copyright (C) 2013 Andrew Lunn <andrew@lunn.ch>
* Copyright (C) 2012 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
*
* This software is licensed under the terms of the GNU General Public
@@ -30,6 +31,9 @@
#define MVEBU_THERMAL_TEMP_OFFSET 10
#define MVEBU_THERMAL_TEMP_MASK 0x1FF
+#define DOVE_THERMAL_TEMP_OFFSET 1
+#define DOVE_THERMAL_TEMP_MASK 0x1FF
+
/* Thermal Manager Control and Status Register */
#define PMU_TDC0_SW_RST_MASK (0x1 << 1)
#define PMU_TM_DISABLE_OFFS 0
@@ -38,6 +42,14 @@
#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)
+#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)
struct mvebu_thermal_ops;
@@ -113,6 +125,53 @@ static void armada370_init_sensor(struct mvebu_thermal_priv *priv)
mdelay(10);
}
+static void dove_init_sensor(struct mvebu_thermal_priv *priv)
+{
+ unsigned long reg;
+ int i;
+
+ if (!priv->control)
+ return;
+
+ /* Configure the Diode Control Register #0 */
+ reg = readl_relaxed(priv->control);
+
+ /* Use average of 2 */
+ reg &= ~PMU_TDC0_AVG_NUM_MASK;
+ reg |= (0x1 << PMU_TDC0_AVG_NUM_OFFS);
+
+ /* Reference calibration value */
+ reg &= ~PMU_TDC0_REF_CAL_CNT_MASK;
+ reg |= (0x0F1 << PMU_TDC0_REF_CAL_CNT_OFFS);
+
+ /* Set the high level reference for calibration */
+ reg &= ~PMU_TDC0_SEL_VCAL_MASK;
+ reg |= (0x2 << PMU_TDC0_SEL_VCAL_OFFS);
+ writel(reg, priv->control);
+
+ /* Reset the sensor */
+ reg = readl_relaxed(priv->control);
+ writel((reg | PMU_TDC0_SW_RST_MASK), priv->control);
+ writel(reg, priv->control);
+
+ /* Enable the sensor */
+ reg = readl_relaxed(priv->sensor);
+ reg &= ~PMU_TM_DISABLE_MASK;
+ writel(reg, priv->sensor);
+
+ /*
+ * FIXME: This looks really ugly. Can't we just remove it?
+ * Poll the sensor for the first reading
+ */
+ for (i = 0; i < 1000000; i++) {
+ reg = (readl_relaxed(priv->sensor) >> MVEBU_THERMAL_TEMP_OFFSET)
+ & MVEBU_THERMAL_TEMP_MASK;
+ if (reg)
+ break;
+ }
+ return;
+}
+
static bool mvebu_is_valid(struct mvebu_thermal_priv *priv)
{
unsigned long reg = readl_relaxed(priv->sensor);
@@ -130,6 +189,15 @@ static unsigned long kirkwood_sensor_temp(struct mvebu_thermal_priv *priv)
return (3220000000UL - (10000000UL * reg)) / 13625;
}
+static unsigned long dove_sensor_temp(struct mvebu_thermal_priv *priv)
+{
+ unsigned long reg = readl_relaxed(priv->sensor);
+
+ reg = (reg >> DOVE_THERMAL_TEMP_OFFSET) &
+ DOVE_THERMAL_TEMP_MASK;
+ return (3220000000UL - (10000000UL * reg)) / 13625;
+}
+
static unsigned long armada_sensor_temp(struct mvebu_thermal_priv *priv)
{
unsigned long reg = readl_relaxed(priv->sensor);
@@ -139,6 +207,13 @@ static unsigned long armada_sensor_temp(struct mvebu_thermal_priv *priv)
return (3153000000UL - (10000000UL*reg)) / 13825;
}
+static bool dove_is_valid(struct mvebu_thermal_priv *priv)
+{
+ unsigned long reg =
+ readl_relaxed(priv->control + PMU_TEMP_DIOD_CTRL1_REG);
+ return reg & PMU_TDC1_TEMP_VALID_MASK;
+}
+
static int mvebu_get_temp(struct thermal_zone_device *thermal,
unsigned long *temp)
{
@@ -164,6 +239,12 @@ static const struct mvebu_thermal_ops kirkwood_ops = {
.is_valid = mvebu_is_valid,
};
+static const struct mvebu_thermal_ops dove_ops = {
+ .sensor_temp = dove_sensor_temp,
+ .is_valid = dove_is_valid,
+ .init_sensor = dove_init_sensor,
+};
+
static const struct mvebu_thermal_ops armadaxp_ops = {
.sensor_temp = armada_sensor_temp,
.init_sensor = armadaxp_init_sensor,
@@ -189,6 +270,10 @@ static const struct of_device_id mvebu_thermal_id_table[] = {
.data = &armada370_ops,
},
{
+ .compatible = "marvell,dove-thermal",
+ .data = &dove_ops,
+ },
+ {
/* sentinel */
},
};
@@ -267,6 +352,7 @@ static struct platform_driver mvebu_thermal_driver = {
module_platform_driver(mvebu_thermal_driver);
+MODULE_AUTHOR("Andrew Lunn <andrew@lunn.ch>");
MODULE_AUTHOR("Nobuhiro Iwamatsu <iwamatsu@nigauri.org>");
MODULE_AUTHOR("Ezequiel Garcia <ezequiel.garcia@free-electrons.com>");
MODULE_DESCRIPTION("mvebu thermal driver");
--
1.7.8.6
------------------------------------->8-------------------------------------------
Thanks a lot,
--
Ezequiel Garc?a, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH v2 00/14] Marvell EBU thermal sensor consolidation
2013-03-25 9:30 ` Andrew Lunn
@ 2013-03-25 10:45 ` Ezequiel Garcia
2013-03-25 12:23 ` Sebastian Hesselbarth
0 siblings, 1 reply; 47+ messages in thread
From: Ezequiel Garcia @ 2013-03-25 10:45 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Mar 25, 2013 at 10:30:01AM +0100, Andrew Lunn wrote:
[...]
>
> 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?
> I've not a strong opinion, but i think separate drivers are better.
>
Don't you think a single driver could make maintenance cheaper?
> 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.
>
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.
--
Ezequiel Garc?a, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH v2 00/14] Marvell EBU thermal sensor consolidation
2013-03-25 10:45 ` Ezequiel Garcia
@ 2013-03-25 12:23 ` Sebastian Hesselbarth
2013-03-25 12:39 ` Ezequiel Garcia
0 siblings, 1 reply; 47+ messages in thread
From: Sebastian Hesselbarth @ 2013-03-25 12:23 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Mar 25, 2013 at 11:45 AM, Ezequiel Garcia
<ezequiel.garcia@free-electrons.com> wrote:
> On Mon, Mar 25, 2013 at 10:30:01AM +0100, Andrew Lunn wrote:
>> 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
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH v2 00/14] Marvell EBU thermal sensor consolidation
2013-03-25 12:23 ` Sebastian Hesselbarth
@ 2013-03-25 12:39 ` Ezequiel Garcia
2013-03-25 13:58 ` Sebastian Hesselbarth
2013-03-25 16:29 ` Jason Gunthorpe
0 siblings, 2 replies; 47+ messages in thread
From: Ezequiel Garcia @ 2013-03-25 12:39 UTC (permalink / raw)
To: linux-arm-kernel
Sebastian,
On Mon, Mar 25, 2013 at 01:23:32PM +0100, Sebastian Hesselbarth wrote:
> On Mon, Mar 25, 2013 at 11:45 AM, Ezequiel Garcia
> <ezequiel.garcia@free-electrons.com> wrote:
> > On Mon, Mar 25, 2013 at 10:30:01AM +0100, Andrew Lunn wrote:
> >> 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.
> +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.
> +1 for separate drivers
I'll send an Armada only patchset soon.
Thanks,
--
Ezequiel Garc?a, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH v2 00/14] Marvell EBU thermal sensor consolidation
2013-03-25 12:39 ` Ezequiel Garcia
@ 2013-03-25 13:58 ` Sebastian Hesselbarth
2013-03-25 16:29 ` Jason Gunthorpe
1 sibling, 0 replies; 47+ messages in thread
From: Sebastian Hesselbarth @ 2013-03-25 13:58 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Mar 25, 2013 at 1:39 PM, Ezequiel Garcia
<ezequiel.garcia@free-electrons.com> wrote:
> On Mon, Mar 25, 2013 at 01:23:32PM +0100, Sebastian Hesselbarth wrote:
>> On Mon, Mar 25, 2013 at 11:45 AM, Ezequiel Garcia
>> <ezequiel.garcia@free-electrons.com> wrote:
>> > On Mon, Mar 25, 2013 at 10:30:01AM +0100, Andrew Lunn wrote:
>> >> 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.
>
>> +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
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH v2 00/14] Marvell EBU thermal sensor consolidation
2013-03-25 12:39 ` Ezequiel Garcia
2013-03-25 13:58 ` Sebastian Hesselbarth
@ 2013-03-25 16:29 ` Jason Gunthorpe
1 sibling, 0 replies; 47+ messages in thread
From: Jason Gunthorpe @ 2013-03-25 16:29 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Mar 25, 2013 at 09:39:30AM -0300, Ezequiel Garcia wrote:
> 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
^ permalink raw reply [flat|nested] 47+ messages in thread
* [v2,01/14] thermal: Rename driver 'kirkwood' -> 'mvebu'
2013-03-22 22:25 ` [PATCH v2 01/14] thermal: Rename driver 'kirkwood' -> 'mvebu' Ezequiel Garcia
@ 2013-04-11 16:00 ` Eduardo Valentin
2013-04-11 16:31 ` Ezequiel Garcia
2013-04-11 16:21 ` Eduardo Valentin
1 sibling, 1 reply; 47+ messages in thread
From: Eduardo Valentin @ 2013-04-11 16:00 UTC (permalink / raw)
To: linux-arm-kernel
Hello Ezequiel,
Two minor comments.
On 22-03-2013 18:25, Ezequiel Garcia wrote:
> 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 <ezequiel.garcia@free-electrons.com>
>
> ---
> .../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
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?
>
> diff --git a/Documentation/devicetree/bindings/thermal/kirkwood-thermal.txt b/Documentation/devicetree/bindings/thermal/kirkwood-thermal.txt
> deleted file mode 100644
> index 8c0f5eb..0000000
> --- a/Documentation/devicetree/bindings/thermal/kirkwood-thermal.txt
> +++ /dev/null
> @@ -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>;
> - };
> diff --git a/Documentation/devicetree/bindings/thermal/mvebu-thermal.txt b/Documentation/devicetree/bindings/thermal/mvebu-thermal.txt
> new file mode 100644
> index 0000000..8c0f5eb
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/thermal/mvebu-thermal.txt
> @@ -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>;
> + };
> diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
> index a764f16..74f6b97 100644
> --- a/drivers/thermal/Kconfig
> +++ b/drivers/thermal/Kconfig
> @@ -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"
> diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
> index d3a2b38..40293a1 100644
> --- a/drivers/thermal/Makefile
> +++ b/drivers/thermal/Makefile
> @@ -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
> diff --git a/drivers/thermal/kirkwood_thermal.c b/drivers/thermal/kirkwood_thermal.c
> deleted file mode 100644
> index 19320dd..0000000
> --- a/drivers/thermal/kirkwood_thermal.c
> +++ /dev/null
> @@ -1,134 +0,0 @@
> -/*
> - * Kirkwood thermal sensor driver
> - *
> - * Copyright (C) 2012 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
> - *
> - * 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 <iwamatsu@nigauri.org>");
> -MODULE_DESCRIPTION("kirkwood thermal driver");
> -MODULE_LICENSE("GPL");
> diff --git a/drivers/thermal/mvebu_thermal.c b/drivers/thermal/mvebu_thermal.c
> new file mode 100644
> index 0000000..19320dd
> --- /dev/null
> +++ b/drivers/thermal/mvebu_thermal.c
> @@ -0,0 +1,134 @@
> +/*
> + * Kirkwood thermal sensor driver
> + *
> + * Copyright (C) 2012 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
> + *
> + * 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 <iwamatsu@nigauri.org>");
> +MODULE_DESCRIPTION("kirkwood thermal driver");
> +MODULE_LICENSE("GPL");
>
^ permalink raw reply [flat|nested] 47+ messages in thread
* [v2,02/14] thermal: mvebu: Rename symbols 'kirkwood' -> 'mvebu'
2013-03-22 22:25 ` [PATCH v2 02/14] thermal: mvebu: Rename symbols " Ezequiel Garcia
@ 2013-04-11 16:18 ` Eduardo Valentin
0 siblings, 0 replies; 47+ messages in thread
From: Eduardo Valentin @ 2013-04-11 16:18 UTC (permalink / raw)
To: linux-arm-kernel
On 22-03-2013 18:25, Ezequiel Garcia wrote:
> 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 <ezequiel.garcia@free-electrons.com>
Rui,
This patch looks fine to me. You can add my:
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
>
> ---
> drivers/thermal/mvebu_thermal.c | 42 +++++++++++++++++++-------------------
> 1 files changed, 21 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/thermal/mvebu_thermal.c b/drivers/thermal/mvebu_thermal.c
> index 19320dd..9ba9e4d 100644
> --- a/drivers/thermal/mvebu_thermal.c
> +++ b/drivers/thermal/mvebu_thermal.c
> @@ -1,5 +1,5 @@
> /*
> - * Kirkwood thermal sensor driver
> + * Marvell EBU thermal sensor driver
> *
> * Copyright (C) 2012 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
> *
> @@ -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" },
The device tree node will still be kept kirkwood?
> {}
> };
>
> -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 <iwamatsu@nigauri.org>");
> -MODULE_DESCRIPTION("kirkwood thermal driver");
> +MODULE_DESCRIPTION("mvebu thermal driver");
> MODULE_LICENSE("GPL");
>
^ permalink raw reply [flat|nested] 47+ messages in thread
* [v2,01/14] thermal: Rename driver 'kirkwood' -> 'mvebu'
2013-03-22 22:25 ` [PATCH v2 01/14] thermal: Rename driver 'kirkwood' -> 'mvebu' Ezequiel Garcia
2013-04-11 16:00 ` [v2,01/14] " Eduardo Valentin
@ 2013-04-11 16:21 ` Eduardo Valentin
1 sibling, 0 replies; 47+ messages in thread
From: Eduardo Valentin @ 2013-04-11 16:21 UTC (permalink / raw)
To: linux-arm-kernel
Ezequiel,
On 22-03-2013 18:25, Ezequiel Garcia wrote:
> 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 <ezequiel.garcia@free-electrons.com>
>
> ---
> .../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
>
> diff --git a/Documentation/devicetree/bindings/thermal/kirkwood-thermal.txt b/Documentation/devicetree/bindings/thermal/kirkwood-thermal.txt
> deleted file mode 100644
> index 8c0f5eb..0000000
> --- a/Documentation/devicetree/bindings/thermal/kirkwood-thermal.txt
> +++ /dev/null
> @@ -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>;
> - };
> diff --git a/Documentation/devicetree/bindings/thermal/mvebu-thermal.txt b/Documentation/devicetree/bindings/thermal/mvebu-thermal.txt
> new file mode 100644
> index 0000000..8c0f5eb
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/thermal/mvebu-thermal.txt
> @@ -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>;
> + };
> diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
> index a764f16..74f6b97 100644
> --- a/drivers/thermal/Kconfig
> +++ b/drivers/thermal/Kconfig
> @@ -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.
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.
>
> config EXYNOS_THERMAL
> tristate "Temperature sensor on Samsung EXYNOS"
> diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
> index d3a2b38..40293a1 100644
> --- a/drivers/thermal/Makefile
> +++ b/drivers/thermal/Makefile
> @@ -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
> diff --git a/drivers/thermal/kirkwood_thermal.c b/drivers/thermal/kirkwood_thermal.c
> deleted file mode 100644
> index 19320dd..0000000
> --- a/drivers/thermal/kirkwood_thermal.c
> +++ /dev/null
> @@ -1,134 +0,0 @@
> -/*
> - * Kirkwood thermal sensor driver
> - *
> - * Copyright (C) 2012 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
> - *
> - * 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 <iwamatsu@nigauri.org>");
> -MODULE_DESCRIPTION("kirkwood thermal driver");
> -MODULE_LICENSE("GPL");
> diff --git a/drivers/thermal/mvebu_thermal.c b/drivers/thermal/mvebu_thermal.c
> new file mode 100644
> index 0000000..19320dd
> --- /dev/null
> +++ b/drivers/thermal/mvebu_thermal.c
> @@ -0,0 +1,134 @@
> +/*
> + * Kirkwood thermal sensor driver
> + *
> + * Copyright (C) 2012 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
> + *
> + * 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 <iwamatsu@nigauri.org>");
> +MODULE_DESCRIPTION("kirkwood thermal driver");
> +MODULE_LICENSE("GPL");
>
^ permalink raw reply [flat|nested] 47+ messages in thread
* [v2,03/14] thermal: mvebu: Move MODULE_DEVICE_TABLE upwards
2013-03-22 22:25 ` [PATCH v2 03/14] thermal: mvebu: Move MODULE_DEVICE_TABLE upwards Ezequiel Garcia
@ 2013-04-11 16:25 ` Eduardo Valentin
0 siblings, 0 replies; 47+ messages in thread
From: Eduardo Valentin @ 2013-04-11 16:25 UTC (permalink / raw)
To: linux-arm-kernel
Rui,
On 22-03-2013 18:25, Ezequiel Garcia wrote:
> 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 <ezequiel.garcia@free-electrons.com>
>
This patch looks fine to me.
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
> ---
> drivers/thermal/mvebu_thermal.c | 3 +--
> 1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/thermal/mvebu_thermal.c b/drivers/thermal/mvebu_thermal.c
> index 9ba9e4d..031f94d 100644
> --- a/drivers/thermal/mvebu_thermal.c
> +++ b/drivers/thermal/mvebu_thermal.c
> @@ -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,
>
^ permalink raw reply [flat|nested] 47+ messages in thread
* [v2, 04/14] thermal: mvebu: Remove unneeded variable initialization
2013-03-22 22:25 ` [PATCH v2 04/14] thermal: mvebu: Remove unneeded variable initialization Ezequiel Garcia
@ 2013-04-11 16:29 ` Eduardo Valentin
2013-04-11 18:54 ` Eduardo Valentin
0 siblings, 1 reply; 47+ messages in thread
From: Eduardo Valentin @ 2013-04-11 16:29 UTC (permalink / raw)
To: linux-arm-kernel
Rui, Ezequiel,
On 22-03-2013 18:25, Ezequiel Garcia wrote:
> 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 <ezequiel.garcia@free-electrons.com>
>
I am fine with this patch. Though it doesn t hurt to have this
initialization, the code looks cleaner though.
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
> ---
> drivers/thermal/mvebu_thermal.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/thermal/mvebu_thermal.c b/drivers/thermal/mvebu_thermal.c
> index 031f94d..1f502ed 100644
> --- a/drivers/thermal/mvebu_thermal.c
> +++ b/drivers/thermal/mvebu_thermal.c
> @@ -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;
>
>
^ permalink raw reply [flat|nested] 47+ messages in thread
* [v2,01/14] thermal: Rename driver 'kirkwood' -> 'mvebu'
2013-04-11 16:00 ` [v2,01/14] " Eduardo Valentin
@ 2013-04-11 16:31 ` Ezequiel Garcia
2013-04-11 18:47 ` Eduardo Valentin
0 siblings, 1 reply; 47+ messages in thread
From: Ezequiel Garcia @ 2013-04-11 16:31 UTC (permalink / raw)
To: linux-arm-kernel
Hi Eduardo,
Thanks for your testing.
On Thu, Apr 11, 2013 at 12:00:48PM -0400, Eduardo Valentin wrote:
> Hello Ezequiel,
>
> Two minor comments.
>
> On 22-03-2013 18:25, Ezequiel Garcia wrote:
> > 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 <ezequiel.garcia@free-electrons.com>
> >
> > ---
> > .../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
>
> 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.
> 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 :)
--
Ezequiel Garc?a, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 47+ messages in thread
* [v2,05/14] thermal: mvebu: Convert to devm_ioremap_resource()
2013-03-22 22:25 ` [PATCH v2 05/14] thermal: mvebu: Convert to devm_ioremap_resource() Ezequiel Garcia
@ 2013-04-11 16:35 ` Eduardo Valentin
2013-04-11 18:55 ` Eduardo Valentin
0 siblings, 1 reply; 47+ messages in thread
From: Eduardo Valentin @ 2013-04-11 16:35 UTC (permalink / raw)
To: linux-arm-kernel
Rui,
On 22-03-2013 18:25, Ezequiel Garcia wrote:
> Convert devm_request_and_ioremap() to the newly introduced
> devm_ioremap_resource() which provides more consistent error handling.
>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
>
This patch looks correct to me too.
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
> ---
> drivers/thermal/mvebu_thermal.c | 8 +++-----
> 1 files changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/thermal/mvebu_thermal.c b/drivers/thermal/mvebu_thermal.c
> index 1f502ed..2aeaf75 100644
> --- a/drivers/thermal/mvebu_thermal.c
> +++ b/drivers/thermal/mvebu_thermal.c
> @@ -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);
>
^ permalink raw reply [flat|nested] 47+ messages in thread
* [v2,06/14] thermal: mvebu: Fix license declaration
2013-03-22 22:25 ` [PATCH v2 06/14] thermal: mvebu: Fix license declaration Ezequiel Garcia
@ 2013-04-11 16:40 ` Eduardo Valentin
2013-04-11 18:55 ` Eduardo Valentin
0 siblings, 1 reply; 47+ messages in thread
From: Eduardo Valentin @ 2013-04-11 16:40 UTC (permalink / raw)
To: linux-arm-kernel
Hi Rui,
On 22-03-2013 18:25, Ezequiel Garcia wrote:
> The 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.
>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
>
This specific patch is fine to me.
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
> ---
> drivers/thermal/mvebu_thermal.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/thermal/mvebu_thermal.c b/drivers/thermal/mvebu_thermal.c
> index 2aeaf75..0c9344d 100644
> --- a/drivers/thermal/mvebu_thermal.c
> +++ b/drivers/thermal/mvebu_thermal.c
> @@ -128,4 +128,4 @@ module_platform_driver(mvebu_thermal_driver);
>
> MODULE_AUTHOR("Nobuhiro Iwamatsu <iwamatsu@nigauri.org>");
> MODULE_DESCRIPTION("mvebu thermal driver");
> -MODULE_LICENSE("GPL");
> +MODULE_LICENSE("GPL v2");
>
Side question, while here:
Ezequiel, does this driver need a MODULE_ALIAS
^ permalink raw reply [flat|nested] 47+ messages in thread
* [v2,07/14] thermal: mvebu: Rename kirkwood definitions to mvebu
2013-03-22 22:25 ` [PATCH v2 07/14] thermal: mvebu: Rename kirkwood definitions to mvebu Ezequiel Garcia
@ 2013-04-11 16:43 ` Eduardo Valentin
0 siblings, 0 replies; 47+ messages in thread
From: Eduardo Valentin @ 2013-04-11 16:43 UTC (permalink / raw)
To: linux-arm-kernel
On 22-03-2013 18:25, Ezequiel Garcia wrote:
> 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.
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
>
> ---
> drivers/thermal/mvebu_thermal.c | 16 ++++++++--------
> 1 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/thermal/mvebu_thermal.c b/drivers/thermal/mvebu_thermal.c
> index 0c9344d..39ddded 100644
> --- a/drivers/thermal/mvebu_thermal.c
> +++ b/drivers/thermal/mvebu_thermal.c
> @@ -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;
>
^ permalink raw reply [flat|nested] 47+ messages in thread
* [v2,01/14] thermal: Rename driver 'kirkwood' -> 'mvebu'
2013-04-11 16:31 ` Ezequiel Garcia
@ 2013-04-11 18:47 ` Eduardo Valentin
2013-04-11 18:57 ` Eduardo Valentin
2013-04-11 19:09 ` Ezequiel Garcia
0 siblings, 2 replies; 47+ messages in thread
From: Eduardo Valentin @ 2013-04-11 18:47 UTC (permalink / raw)
To: linux-arm-kernel
On 11-04-2013 12:31, Ezequiel Garcia wrote:
> Hi Eduardo,
>
> Thanks for your testing.
>
> On Thu, Apr 11, 2013 at 12:00:48PM -0400, Eduardo Valentin wrote:
>> Hello Ezequiel,
>>
>> Two minor comments.
>>
>> On 22-03-2013 18:25, Ezequiel Garcia wrote:
>>> 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 <ezequiel.garcia@free-electrons.com>
>>>
>>> ---
>>> .../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
>>
>> 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.
>
>> 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 :)
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?
>
^ permalink raw reply [flat|nested] 47+ messages in thread
* [v2, 04/14] thermal: mvebu: Remove unneeded variable initialization
2013-04-11 16:29 ` [v2, " Eduardo Valentin
@ 2013-04-11 18:54 ` Eduardo Valentin
0 siblings, 0 replies; 47+ messages in thread
From: Eduardo Valentin @ 2013-04-11 18:54 UTC (permalink / raw)
To: linux-arm-kernel
Ezequiel,
On 11-04-2013 12:29, Eduardo Valentin wrote:
> Rui, Ezequiel,
>
> On 22-03-2013 18:25, Ezequiel Garcia wrote:
>> 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 <ezequiel.garcia@free-electrons.com>
>>
>
> I am fine with this patch. Though it doesn t hurt to have this
> initialization, the code looks cleaner though.
>
> Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
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.
>
>
>> ---
>> drivers/thermal/mvebu_thermal.c | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/thermal/mvebu_thermal.c
>> b/drivers/thermal/mvebu_thermal.c
>> index 031f94d..1f502ed 100644
>> --- a/drivers/thermal/mvebu_thermal.c
>> +++ b/drivers/thermal/mvebu_thermal.c
>> @@ -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;
>>
>>
>
>
>
^ permalink raw reply [flat|nested] 47+ messages in thread
* [v2,05/14] thermal: mvebu: Convert to devm_ioremap_resource()
2013-04-11 16:35 ` [v2,05/14] " Eduardo Valentin
@ 2013-04-11 18:55 ` Eduardo Valentin
0 siblings, 0 replies; 47+ messages in thread
From: Eduardo Valentin @ 2013-04-11 18:55 UTC (permalink / raw)
To: linux-arm-kernel
Ezequiel,
On 11-04-2013 12:35, Eduardo Valentin wrote:
> Rui,
>
> On 22-03-2013 18:25, Ezequiel Garcia wrote:
>> Convert devm_request_and_ioremap() to the newly introduced
>> devm_ioremap_resource() which provides more consistent error handling.
>>
>> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
>>
>
> This patch looks correct to me too.
>
> Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
>
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.
>> ---
>> drivers/thermal/mvebu_thermal.c | 8 +++-----
>> 1 files changed, 3 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/thermal/mvebu_thermal.c
>> b/drivers/thermal/mvebu_thermal.c
>> index 1f502ed..2aeaf75 100644
>> --- a/drivers/thermal/mvebu_thermal.c
>> +++ b/drivers/thermal/mvebu_thermal.c
>> @@ -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);
>>
>
>
>
^ permalink raw reply [flat|nested] 47+ messages in thread
* [v2,06/14] thermal: mvebu: Fix license declaration
2013-04-11 16:40 ` [v2,06/14] " Eduardo Valentin
@ 2013-04-11 18:55 ` Eduardo Valentin
0 siblings, 0 replies; 47+ messages in thread
From: Eduardo Valentin @ 2013-04-11 18:55 UTC (permalink / raw)
To: linux-arm-kernel
Ezequiel,
On 11-04-2013 12:40, Eduardo Valentin wrote:
> Hi Rui,
>
> On 22-03-2013 18:25, Ezequiel Garcia wrote:
>> The 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.
>>
>> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
>>
>
> This specific patch is fine to me.
>
> Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
>
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.
>> ---
>> drivers/thermal/mvebu_thermal.c | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/thermal/mvebu_thermal.c
>> b/drivers/thermal/mvebu_thermal.c
>> index 2aeaf75..0c9344d 100644
>> --- a/drivers/thermal/mvebu_thermal.c
>> +++ b/drivers/thermal/mvebu_thermal.c
>> @@ -128,4 +128,4 @@ module_platform_driver(mvebu_thermal_driver);
>>
>> MODULE_AUTHOR("Nobuhiro Iwamatsu <iwamatsu@nigauri.org>");
>> MODULE_DESCRIPTION("mvebu thermal driver");
>> -MODULE_LICENSE("GPL");
>> +MODULE_LICENSE("GPL v2");
>>
>
> Side question, while here:
> Ezequiel, does this driver need a MODULE_ALIAS
>
>
>
^ permalink raw reply [flat|nested] 47+ messages in thread
* [v2,01/14] thermal: Rename driver 'kirkwood' -> 'mvebu'
2013-04-11 18:47 ` Eduardo Valentin
@ 2013-04-11 18:57 ` Eduardo Valentin
2013-04-11 19:09 ` Ezequiel Garcia
1 sibling, 0 replies; 47+ messages in thread
From: Eduardo Valentin @ 2013-04-11 18:57 UTC (permalink / raw)
To: linux-arm-kernel
On 11-04-2013 14:47, Eduardo Valentin wrote:
> On 11-04-2013 12:31, Ezequiel Garcia wrote:
>> Hi Eduardo,
>>
>> Thanks for your testing.
>>
>> On Thu, Apr 11, 2013 at 12:00:48PM -0400, Eduardo Valentin wrote:
>>> Hello Ezequiel,
>>>
>>> Two minor comments.
>>>
>>> On 22-03-2013 18:25, Ezequiel Garcia wrote:
>>>> 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 <ezequiel.garcia@free-electrons.com>
>>>>
>>>> ---
>>>> .../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
>>>
>>> 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.
>>
>>> 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 :)
>
>
> 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.
>>
>
>
>
^ permalink raw reply [flat|nested] 47+ messages in thread
* [v2,01/14] thermal: Rename driver 'kirkwood' -> 'mvebu'
2013-04-11 18:47 ` Eduardo Valentin
2013-04-11 18:57 ` Eduardo Valentin
@ 2013-04-11 19:09 ` Ezequiel Garcia
1 sibling, 0 replies; 47+ messages in thread
From: Ezequiel Garcia @ 2013-04-11 19:09 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Apr 11, 2013 at 02:47:27PM -0400, Eduardo Valentin wrote:
> >
> > 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,
--
Ezequiel Garc?a, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 47+ messages in thread
end of thread, other threads:[~2013-04-11 19:09 UTC | newest]
Thread overview: 47+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-22 22:25 [PATCH v2 00/14] Marvell EBU thermal sensor consolidation Ezequiel Garcia
2013-03-22 22:25 ` [PATCH v2 01/14] thermal: Rename driver 'kirkwood' -> 'mvebu' Ezequiel Garcia
2013-04-11 16:00 ` [v2,01/14] " Eduardo Valentin
2013-04-11 16:31 ` Ezequiel Garcia
2013-04-11 18:47 ` Eduardo Valentin
2013-04-11 18:57 ` Eduardo Valentin
2013-04-11 19:09 ` Ezequiel Garcia
2013-04-11 16:21 ` Eduardo Valentin
2013-03-22 22:25 ` [PATCH v2 02/14] thermal: mvebu: Rename symbols " Ezequiel Garcia
2013-04-11 16:18 ` [v2,02/14] " Eduardo Valentin
2013-03-22 22:25 ` [PATCH v2 03/14] thermal: mvebu: Move MODULE_DEVICE_TABLE upwards Ezequiel Garcia
2013-04-11 16:25 ` [v2,03/14] " Eduardo Valentin
2013-03-22 22:25 ` [PATCH v2 04/14] thermal: mvebu: Remove unneeded variable initialization Ezequiel Garcia
2013-04-11 16:29 ` [v2, " Eduardo Valentin
2013-04-11 18:54 ` Eduardo Valentin
2013-03-22 22:25 ` [PATCH v2 05/14] thermal: mvebu: Convert to devm_ioremap_resource() Ezequiel Garcia
2013-04-11 16:35 ` [v2,05/14] " Eduardo Valentin
2013-04-11 18:55 ` Eduardo Valentin
2013-03-22 22:25 ` [PATCH v2 06/14] thermal: mvebu: Fix license declaration Ezequiel Garcia
2013-04-11 16:40 ` [v2,06/14] " Eduardo Valentin
2013-04-11 18:55 ` Eduardo Valentin
2013-03-22 22:25 ` [PATCH v2 07/14] thermal: mvebu: Rename kirkwood definitions to mvebu Ezequiel Garcia
2013-04-11 16:43 ` [v2,07/14] " Eduardo Valentin
2013-03-22 22:25 ` [PATCH v2 08/14] thermal: mvebu: Add infrastructure to support more multiple SoC variants Ezequiel Garcia
2013-03-22 22:25 ` [PATCH v2 09/14] thermal: mvebu: Add support for Armada XP thermal sensor Ezequiel Garcia
2013-03-22 22:25 ` [PATCH v2 10/14] thermal: mvebu: Add support for Armada 370 " Ezequiel Garcia
2013-03-22 22:25 ` [PATCH v2 11/14] thermal: mvebu: Add support for Marvell Dove SoC family Ezequiel Garcia
2013-03-23 11:26 ` Sebastian Hesselbarth
2013-03-24 0:16 ` Ezequiel Garcia
2013-03-25 9:34 ` Ezequiel Garcia
2013-03-22 22:25 ` [PATCH v2 12/14] ARM: mvebu: Add thermal support to Armada XP device tree Ezequiel Garcia
2013-03-22 22:25 ` [PATCH v2 13/14] ARM: mvebu: Add thermal support to Armada 370 " Ezequiel Garcia
2013-03-23 14:18 ` Sergei Shtylyov
2013-03-23 14:20 ` Sergei Shtylyov
2013-03-23 14:25 ` Sergei Shtylyov
2013-03-24 0:22 ` Ezequiel Garcia
2013-03-22 22:25 ` [PATCH v2 14/14] ARM: configs: Update mvebu, dove and kirkwood defconfigs for thermal Ezequiel Garcia
2013-03-23 18:16 ` [PATCH v2 00/14] Marvell EBU thermal sensor consolidation Jason Cooper
2013-03-23 18:28 ` Sebastian Hesselbarth
2013-03-23 18:31 ` Jason Cooper
2013-03-23 18:38 ` Sebastian Hesselbarth
2013-03-25 9:30 ` Andrew Lunn
2013-03-25 10:45 ` Ezequiel Garcia
2013-03-25 12:23 ` Sebastian Hesselbarth
2013-03-25 12:39 ` Ezequiel Garcia
2013-03-25 13:58 ` Sebastian Hesselbarth
2013-03-25 16:29 ` Jason Gunthorpe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).