summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEzequiel Garcia <ezequiel.garcia@free-electrons.com>2014-05-06 18:59:51 +0200
committerZhang Rui <rui.zhang@intel.com>2014-05-15 11:12:49 +0200
commite6e0a68c6cd585773fa1fbbd1ca71272afe15203 (patch)
treeeee8fac79a9842b4fb2529833baa6a5c2a1571a3
parentthermal: armada: Support Armada 375 SoC (diff)
downloadlinux-e6e0a68c6cd585773fa1fbbd1ca71272afe15203.tar.xz
linux-e6e0a68c6cd585773fa1fbbd1ca71272afe15203.zip
thermal: armada: Support Armada 380 SoC
Now that a generic infrastructure is in place, it's possible to support the Armada 380 SoC thermal sensor. This sensor is similar to the one available in the already supported SoCs, with its specific temperature formula and specific sensor initialization. Acked-by: Jason Cooper <jason@lakedaemon.net> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
-rw-r--r--Documentation/devicetree/bindings/thermal/armada-thermal.txt3
-rw-r--r--drivers/thermal/armada_thermal.c30
2 files changed, 32 insertions, 1 deletions
diff --git a/Documentation/devicetree/bindings/thermal/armada-thermal.txt b/Documentation/devicetree/bindings/thermal/armada-thermal.txt
index 2a67e5135835..4cf024929a3f 100644
--- a/Documentation/devicetree/bindings/thermal/armada-thermal.txt
+++ b/Documentation/devicetree/bindings/thermal/armada-thermal.txt
@@ -1,4 +1,4 @@
-* Marvell Armada 370/375/XP thermal management
+* Marvell Armada 370/375/380/XP thermal management
Required properties:
@@ -6,6 +6,7 @@ Required properties:
marvell,armada370-thermal
marvell,armada375-thermal
marvell,armada375-z1-thermal
+ marvell,armada380-thermal
marvell,armadaxp-thermal
Note: As the name suggests, "marvell,armada375-z1-thermal"
diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
index e65c5e442ed5..9d1420acb391 100644
--- a/drivers/thermal/armada_thermal.c
+++ b/drivers/thermal/armada_thermal.c
@@ -43,6 +43,7 @@
#define A375_UNIT_CONTROL_MASK 0x7
#define A375_READOUT_INVERT BIT(15)
#define A375_HW_RESETn BIT(8)
+#define A380_HW_RESET BIT(8)
struct armada_thermal_data;
@@ -149,6 +150,19 @@ static void armada375_init_sensor(struct platform_device *pdev,
mdelay(50);
}
+static void armada380_init_sensor(struct platform_device *pdev,
+ struct armada_thermal_priv *priv)
+{
+ unsigned long reg = readl_relaxed(priv->control);
+
+ /* Reset hardware once */
+ if (!(reg & A380_HW_RESET)) {
+ reg |= A380_HW_RESET;
+ writel(reg, priv->control);
+ mdelay(10);
+ }
+}
+
static bool armada_is_valid(struct armada_thermal_priv *priv)
{
unsigned long reg = readl_relaxed(priv->sensor);
@@ -220,6 +234,18 @@ static const struct armada_thermal_data armada375_data = {
.coef_div = 13616,
};
+static const struct armada_thermal_data armada380_data = {
+ .is_valid = armada_is_valid,
+ .init_sensor = armada380_init_sensor,
+ .is_valid_shift = 10,
+ .temp_shift = 0,
+ .temp_mask = 0x3ff,
+ .coef_b = 1169498786UL,
+ .coef_m = 2000000UL,
+ .coef_div = 4289,
+ .inverted = true,
+};
+
static const struct of_device_id armada_thermal_id_table[] = {
{
.compatible = "marvell,armadaxp-thermal",
@@ -238,6 +264,10 @@ static const struct of_device_id armada_thermal_id_table[] = {
.data = &armada375_data,
},
{
+ .compatible = "marvell,armada380-thermal",
+ .data = &armada380_data,
+ },
+ {
/* sentinel */
},
};