All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] ARM: mvebu: fixes and improvements for 375 support
@ 2014-05-05 14:20 Thomas Petazzoni
  2014-05-05 14:20 ` [PATCH 1/5] ARM: mvebu: fix thermal quirk SoC revision check Thomas Petazzoni
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2014-05-05 14:20 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Jason,

Here are five patches making fixes and improvements to the Armada 375
support. They are related to the fact that we now have access to
Armada 375 A0 boards (however, Ezequiel still only has access to a Z1
platform, so we would like to keep Z1 support for now).

 * Patch 1 is really a fix. It fixes the thermal related quirk that
   was added by Ezequiel, to make sure it really works on A0 revision.

 * Patch 2 to 5 make the SMP and coherency workarounds conditional on
   the Armada 375 Z1. The condition on SMP is really mandatory to get
   SMP working on A0. For coherency, the WA could be used on A0, but
   it is useless and hurt performance.

The series is based on your mvebu/soc branch.

Thanks,

Thomas

Thomas Petazzoni (5):
  ARM: mvebu: fix thermal quirk SoC revision check
  ARM: mvebu: initialize mvebu-soc-id earlier
  ARM: mvebu: add Armada 375 A0 revision definition
  ARM: mvebu: conditionalize Armada 375 SMP workaround
  ARM: mvebu: conditionalize Armada 375 coherency workaround

 arch/arm/mach-mvebu/board-v7.c     |  2 +-
 arch/arm/mach-mvebu/coherency.c    |  9 +++++++--
 arch/arm/mach-mvebu/mvebu-soc-id.c |  2 +-
 arch/arm/mach-mvebu/mvebu-soc-id.h |  1 +
 arch/arm/mach-mvebu/platsmp-a9.c   | 22 +++++++++++-----------
 5 files changed, 21 insertions(+), 15 deletions(-)

-- 
1.9.2

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/5] ARM: mvebu: fix thermal quirk SoC revision check
  2014-05-05 14:20 [PATCH 0/5] ARM: mvebu: fixes and improvements for 375 support Thomas Petazzoni
@ 2014-05-05 14:20 ` Thomas Petazzoni
  2014-05-05 14:32   ` Ezequiel Garcia
  2014-05-05 14:20 ` [PATCH 2/5] ARM: mvebu: initialize mvebu-soc-id earlier Thomas Petazzoni
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2014-05-05 14:20 UTC (permalink / raw)
  To: linux-arm-kernel

In commit 54fe26a900bc528f3df1e4235cb6b9ca5c6d4dc2 ('ARM: mvebu: Add
thermal quirk for the Armada 375 DB board'), a check on the Armada SoC
revision was added to decide whether a quirk for the thermal device
should be applied or not.

However, the quirk implementation has a bug: it assumes
mvebu_get_soc_id() returns true on success, but it returns
0. Therefore, the condition:

  if (mvebu_get_soc_id(&dev, &rev) && rev > ARMADA_375_Z1_REV)

is always false (as long as mvebu-soc-id is properly initialized). As
a consequence, the quirk is always applied, even on A0 steppings, for
which the quirk should not be applied.

This was spotted by testing the thermal driver on Armada 375 A0, which
Ezequiel could not do since he does not have access to the A0 revision
of the SoC for the moment.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Fixes: 54fe26a900bc528f3df1e4235cb6b9ca5c6d4dc2 ('ARM: mvebu: Add thermal quirk for the Armada 375 DB board')
---
 arch/arm/mach-mvebu/board-v7.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-mvebu/board-v7.c b/arch/arm/mach-mvebu/board-v7.c
index bc0283f..01cfce6 100644
--- a/arch/arm/mach-mvebu/board-v7.c
+++ b/arch/arm/mach-mvebu/board-v7.c
@@ -120,7 +120,7 @@ static void __init thermal_quirk(void)
 	struct device_node *np;
 	u32 dev, rev;
 
-	if (mvebu_get_soc_id(&dev, &rev) && rev > ARMADA_375_Z1_REV)
+	if (mvebu_get_soc_id(&dev, &rev) == 0 && rev > ARMADA_375_Z1_REV)
 		return;
 
 	for_each_compatible_node(np, NULL, "marvell,armada375-thermal") {
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/5] ARM: mvebu: initialize mvebu-soc-id earlier
  2014-05-05 14:20 [PATCH 0/5] ARM: mvebu: fixes and improvements for 375 support Thomas Petazzoni
  2014-05-05 14:20 ` [PATCH 1/5] ARM: mvebu: fix thermal quirk SoC revision check Thomas Petazzoni
@ 2014-05-05 14:20 ` Thomas Petazzoni
  2014-05-05 14:20 ` [PATCH 3/5] ARM: mvebu: add Armada 375 A0 revision definition Thomas Petazzoni
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2014-05-05 14:20 UTC (permalink / raw)
  To: linux-arm-kernel

Currently, the mvebu-soc-id logic is initialized through a
core_initcall(). However, we will soon need to know the SoC revision
before booting secondary CPUs, because a workaround affects Armada 375
Z1 steppings, but should not be applied on Armada 375 A0 steppings.

Unfortunately, core_initcall() are called way too late compared to the
SMP initialization. Therefore, the mvebu-soc-id initialization is move
to an early_initcall(), which is called before the SMP initialization.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 arch/arm/mach-mvebu/mvebu-soc-id.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-mvebu/mvebu-soc-id.c b/arch/arm/mach-mvebu/mvebu-soc-id.c
index 874a750..e9119a9 100644
--- a/arch/arm/mach-mvebu/mvebu-soc-id.c
+++ b/arch/arm/mach-mvebu/mvebu-soc-id.c
@@ -118,7 +118,7 @@ clk_err:
 
 	return ret;
 }
-core_initcall(mvebu_soc_id_init);
+early_initcall(mvebu_soc_id_init);
 
 static int __init mvebu_soc_device(void)
 {
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/5] ARM: mvebu: add Armada 375 A0 revision definition
  2014-05-05 14:20 [PATCH 0/5] ARM: mvebu: fixes and improvements for 375 support Thomas Petazzoni
  2014-05-05 14:20 ` [PATCH 1/5] ARM: mvebu: fix thermal quirk SoC revision check Thomas Petazzoni
  2014-05-05 14:20 ` [PATCH 2/5] ARM: mvebu: initialize mvebu-soc-id earlier Thomas Petazzoni
@ 2014-05-05 14:20 ` Thomas Petazzoni
  2014-05-05 14:20 ` [PATCH 4/5] ARM: mvebu: conditionalize Armada 375 SMP workaround Thomas Petazzoni
  2014-05-05 14:20 ` [PATCH 5/5] ARM: mvebu: conditionalize Armada 375 coherency workaround Thomas Petazzoni
  4 siblings, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2014-05-05 14:20 UTC (permalink / raw)
  To: linux-arm-kernel

Now that we have access to Armada 375 A0 platforms, we can add the
corresponding revision definition in mvebu-soc-id.h.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 arch/arm/mach-mvebu/mvebu-soc-id.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-mvebu/mvebu-soc-id.h b/arch/arm/mach-mvebu/mvebu-soc-id.h
index 294a443..c16bb68 100644
--- a/arch/arm/mach-mvebu/mvebu-soc-id.h
+++ b/arch/arm/mach-mvebu/mvebu-soc-id.h
@@ -22,6 +22,7 @@
 
 /* Armada 375 */
 #define ARMADA_375_Z1_REV   0x0
+#define ARMADA_375_A0_REV   0x3
 
 #ifdef CONFIG_ARCH_MVEBU
 int mvebu_get_soc_id(u32 *dev, u32 *rev);
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/5] ARM: mvebu: conditionalize Armada 375 SMP workaround
  2014-05-05 14:20 [PATCH 0/5] ARM: mvebu: fixes and improvements for 375 support Thomas Petazzoni
                   ` (2 preceding siblings ...)
  2014-05-05 14:20 ` [PATCH 3/5] ARM: mvebu: add Armada 375 A0 revision definition Thomas Petazzoni
@ 2014-05-05 14:20 ` Thomas Petazzoni
  2014-05-05 14:20 ` [PATCH 5/5] ARM: mvebu: conditionalize Armada 375 coherency workaround Thomas Petazzoni
  4 siblings, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2014-05-05 14:20 UTC (permalink / raw)
  To: linux-arm-kernel

The Armada 375 SMP workaround only needs to be applied to the Z1
revision of the SoC. The A0 and later revisions have been fixed, and
no longer need this workaround.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 arch/arm/mach-mvebu/platsmp-a9.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-mvebu/platsmp-a9.c b/arch/arm/mach-mvebu/platsmp-a9.c
index 04d0b18..6038c1d 100644
--- a/arch/arm/mach-mvebu/platsmp-a9.c
+++ b/arch/arm/mach-mvebu/platsmp-a9.c
@@ -20,6 +20,7 @@
 #include <asm/smp_scu.h>
 #include <asm/smp_plat.h>
 #include "common.h"
+#include "mvebu-soc-id.h"
 #include "pmsu.h"
 
 #define CRYPT0_ENG_ID   41
@@ -53,8 +54,6 @@ static int __cpuinit mvebu_cortex_a9_boot_secondary(unsigned int cpu,
 {
 	int ret, hw_cpu;
 
-	pr_info("Booting CPU %d\n", cpu);
-
 	/*
 	 * Write the address of secondary startup into the system-wide
 	 * flags register. The boot monitor waits until it receives a
@@ -63,11 +62,19 @@ static int __cpuinit mvebu_cortex_a9_boot_secondary(unsigned int cpu,
 	 */
 	hw_cpu = cpu_logical_map(cpu);
 
-	if (of_machine_is_compatible("marvell,armada375"))
+	if (of_machine_is_compatible("marvell,armada375")) {
+		u32 dev, rev;
+
+		if (mvebu_get_soc_id(&dev, &rev) == 0 &&
+		    rev == ARMADA_375_Z1_REV)
+			armada_375_smp_cpu1_enable_wa();
+
 		mvebu_system_controller_set_cpu_boot_addr(mvebu_cortex_a9_secondary_startup);
-	else
+	}
+	else {
 		mvebu_pmsu_set_cpu_boot_addr(hw_cpu,
 					     mvebu_cortex_a9_secondary_startup);
+	}
 
 	smp_wmb();
 	ret = mvebu_cpu_reset_deassert(hw_cpu);
@@ -80,14 +87,7 @@ static int __cpuinit mvebu_cortex_a9_boot_secondary(unsigned int cpu,
 	return 0;
 }
 
-static void __init mvebu_cortex_a9_smp_prepare_cpus(unsigned int max_cpus)
-{
-	if (of_machine_is_compatible("marvell,armada375"))
-		armada_375_smp_cpu1_enable_wa();
-}
-
 static struct smp_operations mvebu_cortex_a9_smp_ops __initdata = {
-	.smp_prepare_cpus	= mvebu_cortex_a9_smp_prepare_cpus,
 	.smp_boot_secondary	= mvebu_cortex_a9_boot_secondary,
 #ifdef CONFIG_HOTPLUG_CPU
 	.cpu_die		= armada_xp_cpu_die,
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/5] ARM: mvebu: conditionalize Armada 375 coherency workaround
  2014-05-05 14:20 [PATCH 0/5] ARM: mvebu: fixes and improvements for 375 support Thomas Petazzoni
                   ` (3 preceding siblings ...)
  2014-05-05 14:20 ` [PATCH 4/5] ARM: mvebu: conditionalize Armada 375 SMP workaround Thomas Petazzoni
@ 2014-05-05 14:20 ` Thomas Petazzoni
  4 siblings, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2014-05-05 14:20 UTC (permalink / raw)
  To: linux-arm-kernel

The Armada 375 coherency workaround only needs to be applied to the Z1
revision of the SoC. The A0 and later revisions have been fixed, and
no longer need this workaround.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 arch/arm/mach-mvebu/coherency.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c
index 489edd1..673c830 100644
--- a/arch/arm/mach-mvebu/coherency.c
+++ b/arch/arm/mach-mvebu/coherency.c
@@ -33,6 +33,7 @@
 #include <asm/cacheflush.h>
 #include "armada-370-xp.h"
 #include "coherency.h"
+#include "mvebu-soc-id.h"
 
 unsigned long coherency_phys_base;
 static void __iomem *coherency_base;
@@ -361,12 +362,16 @@ int __init coherency_init(void)
 static int __init coherency_late_init(void)
 {
 	int type = coherency_type();
+	u32 dev, rev;
 
 	if (type == COHERENCY_FABRIC_TYPE_NONE)
 		return 0;
 
-	if (type == COHERENCY_FABRIC_TYPE_ARMADA_375)
-		armada_375_coherency_init_wa();
+	if (type == COHERENCY_FABRIC_TYPE_ARMADA_375) {
+		if (mvebu_get_soc_id(&dev, &rev) == 0 &&
+		    rev == ARMADA_375_Z1_REV)
+			armada_375_coherency_init_wa();
+	}
 
 	bus_register_notifier(&platform_bus_type,
 			      &mvebu_hwcc_platform_nb);
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 1/5] ARM: mvebu: fix thermal quirk SoC revision check
  2014-05-05 14:20 ` [PATCH 1/5] ARM: mvebu: fix thermal quirk SoC revision check Thomas Petazzoni
@ 2014-05-05 14:32   ` Ezequiel Garcia
  0 siblings, 0 replies; 7+ messages in thread
From: Ezequiel Garcia @ 2014-05-05 14:32 UTC (permalink / raw)
  To: linux-arm-kernel

On 05 May 04:20 PM, Thomas Petazzoni wrote:
> In commit 54fe26a900bc528f3df1e4235cb6b9ca5c6d4dc2 ('ARM: mvebu: Add
> thermal quirk for the Armada 375 DB board'), a check on the Armada SoC
> revision was added to decide whether a quirk for the thermal device
> should be applied or not.
> 
> However, the quirk implementation has a bug: it assumes
> mvebu_get_soc_id() returns true on success, but it returns
> 0. Therefore, the condition:
> 
>   if (mvebu_get_soc_id(&dev, &rev) && rev > ARMADA_375_Z1_REV)
> 
> is always false (as long as mvebu-soc-id is properly initialized). As
> a consequence, the quirk is always applied, even on A0 steppings, for
> which the quirk should not be applied.
> 
> This was spotted by testing the thermal driver on Armada 375 A0, which
> Ezequiel could not do since he does not have access to the A0 revision
> of the SoC for the moment.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Fixes: 54fe26a900bc528f3df1e4235cb6b9ca5c6d4dc2 ('ARM: mvebu: Add thermal quirk for the Armada 375 DB board')

Acked-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
-- 
Ezequiel Garc?a, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-05-05 14:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-05 14:20 [PATCH 0/5] ARM: mvebu: fixes and improvements for 375 support Thomas Petazzoni
2014-05-05 14:20 ` [PATCH 1/5] ARM: mvebu: fix thermal quirk SoC revision check Thomas Petazzoni
2014-05-05 14:32   ` Ezequiel Garcia
2014-05-05 14:20 ` [PATCH 2/5] ARM: mvebu: initialize mvebu-soc-id earlier Thomas Petazzoni
2014-05-05 14:20 ` [PATCH 3/5] ARM: mvebu: add Armada 375 A0 revision definition Thomas Petazzoni
2014-05-05 14:20 ` [PATCH 4/5] ARM: mvebu: conditionalize Armada 375 SMP workaround Thomas Petazzoni
2014-05-05 14:20 ` [PATCH 5/5] ARM: mvebu: conditionalize Armada 375 coherency workaround Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.