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