Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Ezequiel Garcia and committed by
Zhang Rui
e6e0a68c e2d5f05b

+32 -1
+2 -1
Documentation/devicetree/bindings/thermal/armada-thermal.txt
··· 1 - * Marvell Armada 370/375/XP thermal management 1 + * Marvell Armada 370/375/380/XP thermal management 2 2 3 3 Required properties: 4 4 ··· 6 6 marvell,armada370-thermal 7 7 marvell,armada375-thermal 8 8 marvell,armada375-z1-thermal 9 + marvell,armada380-thermal 9 10 marvell,armadaxp-thermal 10 11 11 12 Note: As the name suggests, "marvell,armada375-z1-thermal"
+30
drivers/thermal/armada_thermal.c
··· 43 43 #define A375_UNIT_CONTROL_MASK 0x7 44 44 #define A375_READOUT_INVERT BIT(15) 45 45 #define A375_HW_RESETn BIT(8) 46 + #define A380_HW_RESET BIT(8) 46 47 47 48 struct armada_thermal_data; 48 49 ··· 150 149 mdelay(50); 151 150 } 152 151 152 + static void armada380_init_sensor(struct platform_device *pdev, 153 + struct armada_thermal_priv *priv) 154 + { 155 + unsigned long reg = readl_relaxed(priv->control); 156 + 157 + /* Reset hardware once */ 158 + if (!(reg & A380_HW_RESET)) { 159 + reg |= A380_HW_RESET; 160 + writel(reg, priv->control); 161 + mdelay(10); 162 + } 163 + } 164 + 153 165 static bool armada_is_valid(struct armada_thermal_priv *priv) 154 166 { 155 167 unsigned long reg = readl_relaxed(priv->sensor); ··· 234 220 .coef_div = 13616, 235 221 }; 236 222 223 + static const struct armada_thermal_data armada380_data = { 224 + .is_valid = armada_is_valid, 225 + .init_sensor = armada380_init_sensor, 226 + .is_valid_shift = 10, 227 + .temp_shift = 0, 228 + .temp_mask = 0x3ff, 229 + .coef_b = 1169498786UL, 230 + .coef_m = 2000000UL, 231 + .coef_div = 4289, 232 + .inverted = true, 233 + }; 234 + 237 235 static const struct of_device_id armada_thermal_id_table[] = { 238 236 { 239 237 .compatible = "marvell,armadaxp-thermal", ··· 262 236 { 263 237 .compatible = "marvell,armada375-z1-thermal", 264 238 .data = &armada375_data, 239 + }, 240 + { 241 + .compatible = "marvell,armada380-thermal", 242 + .data = &armada380_data, 265 243 }, 266 244 { 267 245 /* sentinel */