Skip to content

Commit

Permalink
thermal: armada: Support Armada 380 SoC
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ezequiel Garcia authored and Zhang Rui committed May 15, 2014
1 parent e2d5f05 commit e6e0a68
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Documentation/devicetree/bindings/thermal/armada-thermal.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
* Marvell Armada 370/375/XP thermal management
* Marvell Armada 370/375/380/XP thermal management

Required properties:

- compatible: Should be set to one of the following:
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"
Expand Down
30 changes: 30 additions & 0 deletions drivers/thermal/armada_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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",
Expand All @@ -237,6 +263,10 @@ static const struct of_device_id armada_thermal_id_table[] = {
.compatible = "marvell,armada375-z1-thermal",
.data = &armada375_data,
},
{
.compatible = "marvell,armada380-thermal",
.data = &armada380_data,
},
{
/* sentinel */
},
Expand Down

0 comments on commit e6e0a68

Please sign in to comment.