linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] ARM: shmobile: SCU cleanup and consolidation
@ 2016-01-28 15:13 Geert Uytterhoeven
  2016-01-28 15:13 ` [PATCH 1/3] ARM: shmobile: Typo s/MIPDR/MPIDR/ Geert Uytterhoeven
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2016-01-28 15:13 UTC (permalink / raw)
  To: linux-arm-kernel

	Hi Magnus, Simon,

This patch series contains cleanups and consolidations of the SCU code
for shmobile SoCs with Cortex-A9 CPU cores.

This has been tested on emev2/kzm9d, r8a7779/marzen, and sh73a0/kzm9g.

Thanks!

Geert Uytterhoeven (3):
  ARM: shmobile: Typo s/MIPDR/MPIDR/
  ARM: shmobile: r8a7779: Remove remainings of removed SCU boot setup
    code
  ARM: shmobile: Consolidate SCU mapping code

 arch/arm/mach-shmobile/common.h      |  5 ++---
 arch/arm/mach-shmobile/headsmp-scu.S |  2 +-
 arch/arm/mach-shmobile/platsmp-scu.c | 10 +++++++---
 arch/arm/mach-shmobile/smp-emev2.c   |  3 +--
 arch/arm/mach-shmobile/smp-r8a7779.c |  5 +----
 arch/arm/mach-shmobile/smp-sh73a0.c  |  3 +--
 6 files changed, 13 insertions(+), 15 deletions(-)

-- 
1.9.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* [PATCH 1/3] ARM: shmobile: Typo s/MIPDR/MPIDR/
  2016-01-28 15:13 [PATCH 0/3] ARM: shmobile: SCU cleanup and consolidation Geert Uytterhoeven
@ 2016-01-28 15:13 ` Geert Uytterhoeven
  2016-01-28 15:13 ` [PATCH 2/3] ARM: shmobile: r8a7779: Remove remainings of removed SCU boot setup code Geert Uytterhoeven
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2016-01-28 15:13 UTC (permalink / raw)
  To: linux-arm-kernel

The ARM Multiprocessor Affinity Register is called "MPIDR".

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/arm/mach-shmobile/headsmp-scu.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-shmobile/headsmp-scu.S b/arch/arm/mach-shmobile/headsmp-scu.S
index 5e503d91ad70ddf2..936d7011c3141b73 100644
--- a/arch/arm/mach-shmobile/headsmp-scu.S
+++ b/arch/arm/mach-shmobile/headsmp-scu.S
@@ -27,7 +27,7 @@
  */
 ENTRY(shmobile_boot_scu)
 					@ r0 = SCU base address
-	mrc     p15, 0, r1, c0, c0, 5	@ read MIPDR
+	mrc     p15, 0, r1, c0, c0, 5	@ read MPIDR
 	and	r1, r1, #3		@ mask out cpu ID
 	lsl	r1, r1, #3		@ we will shift by cpu_id * 8 bits
 	ldr	r2, [r0, #8]		@ SCU Power Status Register
-- 
1.9.1

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

* [PATCH 2/3] ARM: shmobile: r8a7779: Remove remainings of removed SCU boot setup code
  2016-01-28 15:13 [PATCH 0/3] ARM: shmobile: SCU cleanup and consolidation Geert Uytterhoeven
  2016-01-28 15:13 ` [PATCH 1/3] ARM: shmobile: Typo s/MIPDR/MPIDR/ Geert Uytterhoeven
@ 2016-01-28 15:13 ` Geert Uytterhoeven
  2016-01-28 15:13 ` [PATCH 3/3] ARM: shmobile: Consolidate SCU mapping code Geert Uytterhoeven
  2016-02-02 14:05 ` [PATCH 0/3] ARM: shmobile: SCU cleanup and consolidation Simon Horman
  3 siblings, 0 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2016-01-28 15:13 UTC (permalink / raw)
  To: linux-arm-kernel

Commit 0ca2894b5a900709 ("ARM: shmobile: Use shared SCU SMP boot code on
r8a7779") obsoleted the r8a7779-specific SCU boot code, but forgot to
remove the setup of shmobile_boot_fn and shmobile_boot_arg, which is
overwritten by shmobile_smp_scu_prepare_cpus().

Note that shmobile_scu_base wasn't initialized at that point yet anyway.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/arm/mach-shmobile/smp-r8a7779.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c
index b854fe2095ad1461..0b024a9dbd4397e7 100644
--- a/arch/arm/mach-shmobile/smp-r8a7779.c
+++ b/arch/arm/mach-shmobile/smp-r8a7779.c
@@ -92,8 +92,6 @@ static void __init r8a7779_smp_prepare_cpus(unsigned int max_cpus)
 {
 	/* Map the reset vector (in headsmp-scu.S, headsmp.S) */
 	__raw_writel(__pa(shmobile_boot_vector), AVECR);
-	shmobile_boot_fn = virt_to_phys(shmobile_boot_scu);
-	shmobile_boot_arg = (unsigned long)shmobile_scu_base;
 
 	/* setup r8a7779 specific SCU bits */
 	shmobile_scu_base = IOMEM(R8A7779_SCU_BASE);
-- 
1.9.1

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

* [PATCH 3/3] ARM: shmobile: Consolidate SCU mapping code
  2016-01-28 15:13 [PATCH 0/3] ARM: shmobile: SCU cleanup and consolidation Geert Uytterhoeven
  2016-01-28 15:13 ` [PATCH 1/3] ARM: shmobile: Typo s/MIPDR/MPIDR/ Geert Uytterhoeven
  2016-01-28 15:13 ` [PATCH 2/3] ARM: shmobile: r8a7779: Remove remainings of removed SCU boot setup code Geert Uytterhoeven
@ 2016-01-28 15:13 ` Geert Uytterhoeven
  2016-02-02 14:05 ` [PATCH 0/3] ARM: shmobile: SCU cleanup and consolidation Simon Horman
  3 siblings, 0 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2016-01-28 15:13 UTC (permalink / raw)
  To: linux-arm-kernel

Currently the SCU registers are mapped in SoC-specific code, using
different methods, all involving the static mapping set up from
machine_desc.map_io():
  - On emev2, a static (non-identity) mapping is used, with ioremap().
    As the static mapping uses the MT_DEVICE type, ioremap() reuses it,
    and the returned virtual address is suitable for passing to
    shmobile_smp_hook(),
  - On sh73a0 and r8a7779, a static identity mapping is used, with the
    legacy IOMEM() macro.
    As the static mapping uses the MT_DEVICE_NONSHARED type, replacing
    IOMEM() by ioremap() would create a new mapping, whose virtual
    address cannot be passed to shmobile_smp_hook().

Move the mapping of the SCU registers from SoC-specific code to common
code, always using ioremap(). To work in the absence of a static
mapping, this requires passing the physical SCU base address to
shmobile_smp_hook().

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Tested on emev2/kzm9d, r8a7779/marzen, and sh73a0/kzm9g.
---
 arch/arm/mach-shmobile/common.h      |  5 ++---
 arch/arm/mach-shmobile/platsmp-scu.c | 10 +++++++---
 arch/arm/mach-shmobile/smp-emev2.c   |  3 +--
 arch/arm/mach-shmobile/smp-r8a7779.c |  3 +--
 arch/arm/mach-shmobile/smp-sh73a0.c  |  3 +--
 5 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-shmobile/common.h b/arch/arm/mach-shmobile/common.h
index 9cb11215cebaeb2e..225c12bb3de91e76 100644
--- a/arch/arm/mach-shmobile/common.h
+++ b/arch/arm/mach-shmobile/common.h
@@ -12,7 +12,8 @@ extern void shmobile_smp_hook(unsigned int cpu, unsigned long fn,
 			      unsigned long arg);
 extern bool shmobile_smp_cpu_can_disable(unsigned int cpu);
 extern void shmobile_boot_scu(void);
-extern void shmobile_smp_scu_prepare_cpus(unsigned int max_cpus);
+extern void shmobile_smp_scu_prepare_cpus(phys_addr_t scu_base_phys,
+					  unsigned int max_cpus);
 extern void shmobile_smp_scu_cpu_die(unsigned int cpu);
 extern int shmobile_smp_scu_cpu_kill(unsigned int cpu);
 extern struct platform_suspend_ops shmobile_suspend_ops;
@@ -31,8 +32,6 @@ int shmobile_cpufreq_init(void);
 static inline int shmobile_cpufreq_init(void) { return 0; }
 #endif
 
-extern void __iomem *shmobile_scu_base;
-
 static inline void __init shmobile_init_late(void)
 {
 	shmobile_suspend_init();
diff --git a/arch/arm/mach-shmobile/platsmp-scu.c b/arch/arm/mach-shmobile/platsmp-scu.c
index f2198c9c74359736..4c7d2caf3730f644 100644
--- a/arch/arm/mach-shmobile/platsmp-scu.c
+++ b/arch/arm/mach-shmobile/platsmp-scu.c
@@ -18,7 +18,8 @@
 #include "common.h"
 
 
-void __iomem *shmobile_scu_base;
+static phys_addr_t shmobile_scu_base_phys;
+static void __iomem *shmobile_scu_base;
 
 static int shmobile_smp_scu_notifier_call(struct notifier_block *nfb,
 					  unsigned long action, void *hcpu)
@@ -29,7 +30,7 @@ static int shmobile_smp_scu_notifier_call(struct notifier_block *nfb,
 	case CPU_UP_PREPARE:
 		/* For this particular CPU register SCU SMP boot vector */
 		shmobile_smp_hook(cpu, virt_to_phys(shmobile_boot_scu),
-				  (unsigned long)shmobile_scu_base);
+				  shmobile_scu_base_phys);
 		break;
 	};
 
@@ -40,13 +41,16 @@ static struct notifier_block shmobile_smp_scu_notifier = {
 	.notifier_call = shmobile_smp_scu_notifier_call,
 };
 
-void __init shmobile_smp_scu_prepare_cpus(unsigned int max_cpus)
+void __init shmobile_smp_scu_prepare_cpus(phys_addr_t scu_base_phys,
+					  unsigned int max_cpus)
 {
 	/* install boot code shared by all CPUs */
 	shmobile_boot_fn = virt_to_phys(shmobile_smp_boot);
 	shmobile_boot_arg = MPIDR_HWID_BITMASK;
 
 	/* enable SCU and cache coherency on booting CPU */
+	shmobile_scu_base_phys = scu_base_phys;
+	shmobile_scu_base = ioremap(scu_base_phys, PAGE_SIZE);
 	scu_enable(shmobile_scu_base);
 	scu_power_mode(shmobile_scu_base, SCU_PM_NORMAL);
 
diff --git a/arch/arm/mach-shmobile/smp-emev2.c b/arch/arm/mach-shmobile/smp-emev2.c
index adbac6963f2b962e..4dfafd84545296ff 100644
--- a/arch/arm/mach-shmobile/smp-emev2.c
+++ b/arch/arm/mach-shmobile/smp-emev2.c
@@ -45,8 +45,7 @@ static void __init emev2_smp_prepare_cpus(unsigned int max_cpus)
 	}
 
 	/* setup EMEV2 specific SCU bits */
-	shmobile_scu_base = ioremap(EMEV2_SCU_BASE, PAGE_SIZE);
-	shmobile_smp_scu_prepare_cpus(max_cpus);
+	shmobile_smp_scu_prepare_cpus(EMEV2_SCU_BASE, max_cpus);
 }
 
 const struct smp_operations emev2_smp_ops __initconst = {
diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c
index 0b024a9dbd4397e7..f5c31fbc10b2efbf 100644
--- a/arch/arm/mach-shmobile/smp-r8a7779.c
+++ b/arch/arm/mach-shmobile/smp-r8a7779.c
@@ -94,8 +94,7 @@ static void __init r8a7779_smp_prepare_cpus(unsigned int max_cpus)
 	__raw_writel(__pa(shmobile_boot_vector), AVECR);
 
 	/* setup r8a7779 specific SCU bits */
-	shmobile_scu_base = IOMEM(R8A7779_SCU_BASE);
-	shmobile_smp_scu_prepare_cpus(max_cpus);
+	shmobile_smp_scu_prepare_cpus(R8A7779_SCU_BASE, max_cpus);
 
 	r8a7779_pm_init();
 
diff --git a/arch/arm/mach-shmobile/smp-sh73a0.c b/arch/arm/mach-shmobile/smp-sh73a0.c
index ee1a4b70604bd6ea..41137404382e2f94 100644
--- a/arch/arm/mach-shmobile/smp-sh73a0.c
+++ b/arch/arm/mach-shmobile/smp-sh73a0.c
@@ -52,8 +52,7 @@ static void __init sh73a0_smp_prepare_cpus(unsigned int max_cpus)
 	__raw_writel(__pa(shmobile_boot_vector), SBAR);
 
 	/* setup sh73a0 specific SCU bits */
-	shmobile_scu_base = IOMEM(SH73A0_SCU_BASE);
-	shmobile_smp_scu_prepare_cpus(max_cpus);
+	shmobile_smp_scu_prepare_cpus(SH73A0_SCU_BASE, max_cpus);
 }
 
 const struct smp_operations sh73a0_smp_ops __initconst = {
-- 
1.9.1

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

* [PATCH 0/3] ARM: shmobile: SCU cleanup and consolidation
  2016-01-28 15:13 [PATCH 0/3] ARM: shmobile: SCU cleanup and consolidation Geert Uytterhoeven
                   ` (2 preceding siblings ...)
  2016-01-28 15:13 ` [PATCH 3/3] ARM: shmobile: Consolidate SCU mapping code Geert Uytterhoeven
@ 2016-02-02 14:05 ` Simon Horman
  2016-02-08 15:04   ` Geert Uytterhoeven
  3 siblings, 1 reply; 7+ messages in thread
From: Simon Horman @ 2016-02-02 14:05 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jan 28, 2016 at 04:13:29PM +0100, Geert Uytterhoeven wrote:
> 	Hi Magnus, Simon,
> 
> This patch series contains cleanups and consolidations of the SCU code
> for shmobile SoCs with Cortex-A9 CPU cores.
> 
> This has been tested on emev2/kzm9d, r8a7779/marzen, and sh73a0/kzm9g.
> 
> Thanks!

Thanks, I have queued these up.

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

* [PATCH 0/3] ARM: shmobile: SCU cleanup and consolidation
  2016-02-02 14:05 ` [PATCH 0/3] ARM: shmobile: SCU cleanup and consolidation Simon Horman
@ 2016-02-08 15:04   ` Geert Uytterhoeven
  2016-02-09 19:07     ` Simon Horman
  0 siblings, 1 reply; 7+ messages in thread
From: Geert Uytterhoeven @ 2016-02-08 15:04 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Simon,

On Tue, Feb 2, 2016 at 3:05 PM, Simon Horman <horms@verge.net.au> wrote:
> On Thu, Jan 28, 2016 at 04:13:29PM +0100, Geert Uytterhoeven wrote:
>> This patch series contains cleanups and consolidations of the SCU code
>> for shmobile SoCs with Cortex-A9 CPU cores.
>>
>> This has been tested on emev2/kzm9d, r8a7779/marzen, and sh73a0/kzm9g.
>>
>> Thanks!
>
> Thanks, I have queued these up.

Except for the third patch?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* [PATCH 0/3] ARM: shmobile: SCU cleanup and consolidation
  2016-02-08 15:04   ` Geert Uytterhoeven
@ 2016-02-09 19:07     ` Simon Horman
  0 siblings, 0 replies; 7+ messages in thread
From: Simon Horman @ 2016-02-09 19:07 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Feb 08, 2016 at 04:04:34PM +0100, Geert Uytterhoeven wrote:
> Hi Simon,
> 
> On Tue, Feb 2, 2016 at 3:05 PM, Simon Horman <horms@verge.net.au> wrote:
> > On Thu, Jan 28, 2016 at 04:13:29PM +0100, Geert Uytterhoeven wrote:
> >> This patch series contains cleanups and consolidations of the SCU code
> >> for shmobile SoCs with Cortex-A9 CPU cores.
> >>
> >> This has been tested on emev2/kzm9d, r8a7779/marzen, and sh73a0/kzm9g.
> >>
> >> Thanks!
> >
> > Thanks, I have queued these up.
> 
> Except for the third patch?

It seems that I missed the first one too.
I'll try to do better this time around :^)

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

end of thread, other threads:[~2016-02-09 19:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-28 15:13 [PATCH 0/3] ARM: shmobile: SCU cleanup and consolidation Geert Uytterhoeven
2016-01-28 15:13 ` [PATCH 1/3] ARM: shmobile: Typo s/MIPDR/MPIDR/ Geert Uytterhoeven
2016-01-28 15:13 ` [PATCH 2/3] ARM: shmobile: r8a7779: Remove remainings of removed SCU boot setup code Geert Uytterhoeven
2016-01-28 15:13 ` [PATCH 3/3] ARM: shmobile: Consolidate SCU mapping code Geert Uytterhoeven
2016-02-02 14:05 ` [PATCH 0/3] ARM: shmobile: SCU cleanup and consolidation Simon Horman
2016-02-08 15:04   ` Geert Uytterhoeven
2016-02-09 19:07     ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).