Skip to contentSkip to conversation

ARM: mvebu: Don't apply the thermal quirk if the SoC revision is unknown

PATCH New Ezequiel Garcia 2 participants 3 messages Jun 10, 2014 – Jun 21, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ARM: mvebu: Don't apply the thermal quirk if the SoC revision is unknown

Currently, the thermal quirk is skipped only if the SoC revision is known to be one that does not need them, but if the SoC revision cannot be obtained, the quirk is applied assuming it's needed.

However, this quirk must be applied only we are sure the SoC needs it, for it breaks the thermal support if applied on a SoC that doesn't need it. The reason for this is that the quirk consists in changing the thermal devicetree compatible string and register offsets, to workaround a hardware bug in the early SoC revision.

Such changes are wrong if the SoC is a new revision and doesn't need the workaround. Therefore, this commit changes the behavior, by requiring the SoC revision to be known in order to peform a quirk.

---
Changes from v1:
* Add better commit log and a proper explanation in the code.

* Dropped the I2C quirk modification, this fix is only applicable for the thermal quirk.

 arch/arm/mach-mvebu/board-v7.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
arch/arm/mach-mvebu/board-v7.c +11 -2
index 594262b..c94caa1 100644
@@ -119,8 +119,16 @@ static void __init thermal_quirk(void)
 {
 	struct device_node *np;
 	u32 dev, rev;
+	int res;
 
-	if (mvebu_get_soc_id(&dev, &rev) == 0 && rev > ARMADA_375_Z1_REV)
+	/*
+	 * The early SoC Z1 revision needs a quirk to be applied in order
+	 * for the thermal controller to work properly. This quirk breaks
+	 * the thermal support if applied on a SoC that doesn't need it,
+	 * so we enforce the SoC revision to be known.
+	 */
+	res = mvebu_get_soc_id(&dev, &rev);
+	if (res < 0 || (res == 0 && rev > ARMADA_375_Z1_REV))
 		return;
 
 	for_each_compatible_node(np, NULL, "marvell,armada375-thermal") {
@@ -154,7 +162,8 @@ static void __init thermal_quirk(void)
 
 		/*
 		 * The thermal controller needs some quirk too, so let's change
-		 * the compatible string to reflect this.
+		 * the compatible string to reflect this and allow the driver
+		 * the take the necessary action.
 		 */
 		prop = kzalloc(sizeof(*prop), GFP_KERNEL);
 		prop->name = kstrdup("compatible", GFP_KERNEL);
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/1 ARM: mvebu: Don't apply the thermal quirk if the SoC revision is unknown

On Tue, Jun 10, 2014 at 03:34:43PM -0300, Ezequiel Garcia wrote:
...

Quoted 6 lines
arch/arm/mach-mvebu/board-v7.c +0 -0
index 594262b..c94caa1 100644
@@ -119,8 +119,16 @@ static void __init thermal_quirk(void)
 {

arch/arm/mach-mvebu/board-v7.c static void __init thermal_quirk(void) · line 128

Quoted 10 lines
arch/arm/mach-mvebu/board-v7.c +6 -1
 	struct device_node *np;
 	u32 dev, rev;
+	int res;
 
-	if (mvebu_get_soc_id(&dev, &rev) == 0 && rev > ARMADA_375_Z1_REV)
+	/*
+	 * The early SoC Z1 revision needs a quirk to be applied in order
+	 * for the thermal controller to work properly. This quirk breaks
+	 * the thermal support if applied on a SoC that doesn't need it,
+	 * so we enforce the SoC revision to be known.

nit: "so we apply the quirk iff the SoC revision is known."

thx,

Jason.

Applied
#2 lore raw

PATCH v2 1/1 ARM: mvebu: Don't apply the thermal quirk if the SoC revision is unknown

In reply to Ezequiel Garcia
Quoted 19 lines · Ezequiel Garcia

Currently, the thermal quirk is skipped only if the SoC revision is known to be one that does not need them, but if the SoC revision cannot be obtained, the quirk is applied assuming it's needed.

However, this quirk must be applied only we are sure the SoC needs it, for it breaks the thermal support if applied on a SoC that doesn't need it. The reason for this is that the quirk consists in changing the thermal devicetree compatible string and register offsets, to workaround a hardware bug in the early SoC revision.

Such changes are wrong if the SoC is a new revision and doesn't need the workaround. Therefore, this commit changes the behavior, by requiring the SoC revision to be known in order to peform a quirk.

---
Changes from v1:
* Add better commit log and a proper explanation in the code.

Quoted 5 lines

* Dropped the I2C quirk modification, this fix is only applicable for the thermal quirk.

 arch/arm/mach-mvebu/board-v7.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

Applied to mvebu/soc

thx,

Jason.