linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/8] Support for secondary cores on Tegra30
@ 2012-01-26 17:07 Peter De Schrijver
  2012-01-26 17:07 ` [PATCH v1 1/8] ARM: tegra: introduce support for reading chipid Peter De Schrijver
                   ` (7 more replies)
  0 siblings, 8 replies; 16+ messages in thread
From: Peter De Schrijver @ 2012-01-26 17:07 UTC (permalink / raw)
  To: Peter De Schrijver
  Cc: Colin Cross, Olof Johansson, Stephen Warren, Russell King,
	Gary King, Arnd Bergmann, linux-tegra, linux-arm-kernel,
	linux-kernel

Implement bringing up secondary cores on Tegra30. This involves unpowergating
the appropriate domains enabling the CPU clocks and releasing the reset lines.

Peter De Schrijver (8):
  ARM: tegra: introduce support for reading chipid
  ARM: tegra: functions to access the flowcontroller
  ARM: tegra: rework Tegra secondary CPU core bringup
  ARM: tegra: prepare powergate.c for multiple variants
  ARM: tegra: export tegra_powergate_is_powered()
  ARM: tegra: add support for Tegra30 powerdomains
  ARM: tegra: support for Tegra30 CPU powerdomains
  ARM: tegra: support for secondary cores on Tegra30

 arch/arm/mach-tegra/Makefile                 |    2 +
 arch/arm/mach-tegra/chipid.h                 |   38 +++++
 arch/arm/mach-tegra/common.c                 |    3 +
 arch/arm/mach-tegra/flowctrl.c               |   62 ++++++++
 arch/arm/mach-tegra/flowctrl.h               |    5 +
 arch/arm/mach-tegra/headsmp.S                |  192 ++++++++++++++++++++++++-
 arch/arm/mach-tegra/include/mach/iomap.h     |    3 +
 arch/arm/mach-tegra/include/mach/powergate.h |   15 ++-
 arch/arm/mach-tegra/platsmp.c                |  139 +++++++++++++------
 arch/arm/mach-tegra/powergate.c              |   53 +++++++-
 arch/arm/mach-tegra/reset.c                  |   82 +++++++++++
 arch/arm/mach-tegra/reset.h                  |   50 +++++++
 12 files changed, 588 insertions(+), 56 deletions(-)
 create mode 100644 arch/arm/mach-tegra/chipid.h
 create mode 100644 arch/arm/mach-tegra/flowctrl.c
 create mode 100644 arch/arm/mach-tegra/reset.c
 create mode 100644 arch/arm/mach-tegra/reset.h

-- 
1.7.7.rc0.72.g4b5ea.dirty


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

* [PATCH v1 1/8] ARM: tegra: introduce support for reading chipid
  2012-01-26 17:07 [PATCH v1 0/8] Support for secondary cores on Tegra30 Peter De Schrijver
@ 2012-01-26 17:07 ` Peter De Schrijver
  2012-01-27  8:19   ` Olof Johansson
  2012-01-26 17:07 ` [PATCH v1 2/8] ARM: tegra: functions to access the flowcontroller Peter De Schrijver
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Peter De Schrijver @ 2012-01-26 17:07 UTC (permalink / raw)
  To: Peter De Schrijver
  Cc: Colin Cross, Olof Johansson, Stephen Warren, Russell King,
	Gary King, Arnd Bergmann, linux-tegra, linux-arm-kernel,
	linux-kernel

Introduce a function to read the Tegra chipid. This will be used by the SMP
code to distinguish between Tegra variants.

---

Should this be merged with the fuse reading code even though this is a
hardwired register, not a fuse based register?

Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
---
 arch/arm/mach-tegra/chipid.h |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-tegra/chipid.h

diff --git a/arch/arm/mach-tegra/chipid.h b/arch/arm/mach-tegra/chipid.h
new file mode 100644
index 0000000..beb6a66
--- /dev/null
+++ b/arch/arm/mach-tegra/chipid.h
@@ -0,0 +1,38 @@
+/*
+ * arch/arm/mach-tegra/chipid.h
+ *
+ * Copyright (c) 2010-2012, NVIDIA Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __MACH_TEGRA_CHIPID_H
+#define __MACH_TEGRA_CHIPID_H
+
+#define APB_MISC_GP_HIDREV	0x804
+
+#define	TEGRA20			0x20
+#define	TEGRA30			0x30
+
+#ifndef __ASSEMBLY__
+
+#include <asm/io.h>
+
+static inline u32 tegra_get_chipid(void)
+{
+	return readl_relaxed(IO_ADDRESS(TEGRA_APB_MISC_BASE) +
+				APB_MISC_GP_HIDREV) >> 8 & 0xff;
+}
+
+#endif
+#endif
-- 
1.7.7.rc0.72.g4b5ea.dirty


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

* [PATCH v1 2/8] ARM: tegra: functions to access the flowcontroller
  2012-01-26 17:07 [PATCH v1 0/8] Support for secondary cores on Tegra30 Peter De Schrijver
  2012-01-26 17:07 ` [PATCH v1 1/8] ARM: tegra: introduce support for reading chipid Peter De Schrijver
@ 2012-01-26 17:07 ` Peter De Schrijver
  2012-01-26 17:07 ` [PATCH v1 3/8] ARM: tegra: rework Tegra secondary CPU core bringup Peter De Schrijver
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 16+ messages in thread
From: Peter De Schrijver @ 2012-01-26 17:07 UTC (permalink / raw)
  To: Peter De Schrijver
  Cc: Colin Cross, Olof Johansson, Stephen Warren, Russell King,
	Gary King, Arnd Bergmann, linux-tegra, linux-arm-kernel,
	linux-kernel

Introduce some functions to write to the flowcontroller registers.

Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
---
 arch/arm/mach-tegra/Makefile   |    1 +
 arch/arm/mach-tegra/flowctrl.c |   62 ++++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-tegra/flowctrl.h |    5 +++
 3 files changed, 68 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-tegra/flowctrl.c

diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile
index b78bda8..60c286e 100644
--- a/arch/arm/mach-tegra/Makefile
+++ b/arch/arm/mach-tegra/Makefile
@@ -6,6 +6,7 @@ obj-y                                   += irq.o
 obj-y                                   += clock.o
 obj-y                                   += timer.o
 obj-y					+= fuse.o
+obj-y					+= flowctrl.o
 obj-$(CONFIG_ARCH_TEGRA_2x_SOC)		+= powergate.o
 obj-$(CONFIG_ARCH_TEGRA_2x_SOC)         += tegra2_clocks.o
 obj-$(CONFIG_ARCH_TEGRA_2x_SOC)		+= tegra2_emc.o
diff --git a/arch/arm/mach-tegra/flowctrl.c b/arch/arm/mach-tegra/flowctrl.c
new file mode 100644
index 0000000..fef66a7
--- /dev/null
+++ b/arch/arm/mach-tegra/flowctrl.c
@@ -0,0 +1,62 @@
+/*
+ * arch/arm/mach-tegra/flowctrl.c
+ *
+ * functions and macros to control the flowcontroller
+ *
+ * Copyright (c) 2010-2012, NVIDIA Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/io.h>
+
+#include <mach/iomap.h>
+
+#include "flowctrl.h"
+
+u8 flowctrl_offset_halt_cpu[] = {
+	FLOW_CTRL_HALT_CPU0_EVENTS,
+	FLOW_CTRL_HALT_CPU1_EVENTS,
+	FLOW_CTRL_HALT_CPU1_EVENTS + 8,
+	FLOW_CTRL_HALT_CPU1_EVENTS + 16,
+};
+
+u8 flowctrl_offset_cpu_csr[] = {
+	FLOW_CTRL_CPU0_CSR,
+	FLOW_CTRL_CPU1_CSR,
+	FLOW_CTRL_CPU1_CSR + 8,
+	FLOW_CTRL_CPU1_CSR + 16,
+};
+
+static void flowctrl_update(u8 offset, u32 value)
+{
+	void __iomem *addr = IO_ADDRESS(TEGRA_FLOW_CTRL_BASE) + offset;
+
+	writel(value, addr);
+
+	/* ensure the update has reached the flow controller */
+	wmb();
+	readl_relaxed(addr);
+}
+
+void flowctrl_write_cpu_csr(unsigned int cpuid, u32 value)
+{
+	return flowctrl_update(flowctrl_offset_halt_cpu[cpuid], value);
+}
+
+void flowctrl_write_cpu_halt(unsigned int cpuid, u32 value)
+{
+	return flowctrl_update(flowctrl_offset_cpu_csr[cpuid], value);
+}
diff --git a/arch/arm/mach-tegra/flowctrl.h b/arch/arm/mach-tegra/flowctrl.h
index 74c6efb..1942817 100644
--- a/arch/arm/mach-tegra/flowctrl.h
+++ b/arch/arm/mach-tegra/flowctrl.h
@@ -34,4 +34,9 @@
 #define FLOW_CTRL_HALT_CPU1_EVENTS	0x14
 #define FLOW_CTRL_CPU1_CSR		0x18
 
+#ifndef __ASSEMBLY__
+void flowctrl_write_cpu_csr(unsigned int cpuid, u32 value);
+void flowctrl_write_cpu_halt(unsigned int cpuid, u32 value);
+#endif
+
 #endif
-- 
1.7.7.rc0.72.g4b5ea.dirty


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

* [PATCH v1 3/8] ARM: tegra: rework Tegra secondary CPU core bringup
  2012-01-26 17:07 [PATCH v1 0/8] Support for secondary cores on Tegra30 Peter De Schrijver
  2012-01-26 17:07 ` [PATCH v1 1/8] ARM: tegra: introduce support for reading chipid Peter De Schrijver
  2012-01-26 17:07 ` [PATCH v1 2/8] ARM: tegra: functions to access the flowcontroller Peter De Schrijver
@ 2012-01-26 17:07 ` Peter De Schrijver
  2012-01-26 20:25   ` Stephen Warren
  2012-01-26 17:07 ` [PATCH v1 4/8] ARM: tegra: prepare powergate.c for multiple variants Peter De Schrijver
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Peter De Schrijver @ 2012-01-26 17:07 UTC (permalink / raw)
  To: Peter De Schrijver
  Cc: Colin Cross, Olof Johansson, Stephen Warren, Russell King,
	Gary King, Arnd Bergmann, linux-tegra, linux-arm-kernel,
	linux-kernel

Prepare the Tegra secondary CPU core bringup code for other Tegra variants.
The reset handler is also generalized to allow for future introduction of
powersaving modes which turn off the CPU cores.

Based on work by:

Scott Williams <scwilliams@nvidia.com>
Chris Johnson <cwj@nvidia.com>
Colin Cross <ccross@android.com>

Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
---
 arch/arm/mach-tegra/Makefile             |    1 +
 arch/arm/mach-tegra/headsmp.S            |  160 ++++++++++++++++++++++++++++--
 arch/arm/mach-tegra/include/mach/iomap.h |    3 +
 arch/arm/mach-tegra/platsmp.c            |   97 ++++++++++---------
 arch/arm/mach-tegra/reset.c              |   82 +++++++++++++++
 arch/arm/mach-tegra/reset.h              |   50 +++++++++
 6 files changed, 340 insertions(+), 53 deletions(-)
 create mode 100644 arch/arm/mach-tegra/reset.c
 create mode 100644 arch/arm/mach-tegra/reset.h

diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile
index 60c286e..a954654 100644
--- a/arch/arm/mach-tegra/Makefile
+++ b/arch/arm/mach-tegra/Makefile
@@ -13,6 +13,7 @@ obj-$(CONFIG_ARCH_TEGRA_2x_SOC)		+= tegra2_emc.o
 obj-$(CONFIG_ARCH_TEGRA_3x_SOC)		+= board-dt-tegra30.o
 obj-$(CONFIG_ARCH_TEGRA_3x_SOC)		+= tegra30_clocks.o
 obj-$(CONFIG_SMP)                       += platsmp.o localtimer.o headsmp.o
+obj-$(CONFIG_SMP)                       += reset.o
 obj-$(CONFIG_HOTPLUG_CPU)               += hotplug.o
 obj-$(CONFIG_TEGRA_SYSTEM_DMA)		+= dma.o apbio.o
 obj-$(CONFIG_CPU_FREQ)                  += cpu-tegra.o
diff --git a/arch/arm/mach-tegra/headsmp.S b/arch/arm/mach-tegra/headsmp.S
index b5349b2..bb13e22 100644
--- a/arch/arm/mach-tegra/headsmp.S
+++ b/arch/arm/mach-tegra/headsmp.S
@@ -1,6 +1,31 @@
 #include <linux/linkage.h>
 #include <linux/init.h>
 
+#include <asm/cache.h>
+
+#include <mach/iomap.h>
+
+#include "flowctrl.h"
+#include "reset.h"
+
+#define DEBUG_CPU_RESET_HANDLER 0
+
+#define APB_MISC_GP_HIDREV	0x804
+#define PMC_SCRATCH41	0x140
+
+
+#define RESET_DATA(x)	((TEGRA_RESET_##x)*4)
+
+	.macro mov32, reg, val
+	movw	\reg, #:lower16:\val
+	movt	\reg, #:upper16:\val
+	.endm
+
+	.macro	enable_coresight, reg
+	mov32	\reg, 0xC5ACCE55
+	mcr	p14, 0, \reg, c7, c12, 6
+	.endm
+
         .section ".text.head", "ax"
 	__CPUINIT
 
@@ -47,15 +72,134 @@ ENTRY(v7_invalidate_l1)
         mov     pc, lr
 ENDPROC(v7_invalidate_l1)
 
+
 ENTRY(tegra_secondary_startup)
-	msr	cpsr_fsxc, #0xd3
         bl      v7_invalidate_l1
-	mrc	p15, 0, r0, c0, c0, 5
-        and	r0, r0, #15
-        ldr     r1, =0x6000f100
-        str     r0, [r1]
-1:      ldr     r2, [r1]
-        cmp     r0, r2
-        beq     1b
+	enable_coresight r0
         b       secondary_startup
 ENDPROC(tegra_secondary_startup)
+
+	.align L1_CACHE_SHIFT
+ENTRY(__tegra_cpu_reset_handler_start)
+
+/*
+ * __tegra_cpu_reset_handler:
+ *
+ * Common handler for all CPU reset events.
+ *
+ * Register usage within the reset handler:
+ *
+ *      R7  = CPU present (to the OS) mask
+ *      R8  = CPU in LP1 state mask
+ *      R9  = CPU in LP2 state mask
+ *      R10 = CPU number
+ *      R11 = CPU mask
+ *      R12 = pointer to reset handler data
+ *
+ * NOTE: This code is copied to IRAM. All code and data accesses
+ *       must be position-independent.
+ */
+
+	.align L1_CACHE_SHIFT
+ENTRY(__tegra_cpu_reset_handler)
+
+#if DEBUG_CPU_RESET_HANDLER
+	enable_coresight r0
+	b	.
+#endif
+	cpsid	aif, 0x13			@ SVC mode, interrupts disabled
+	mrc	p15, 0, r0, c0, c0, 0		@ read main ID register
+	and	r5, r0, #0x00f00000		@ variant
+	and	r6, r0, #0x0000000f		@ revision
+	orr	r6, r6, r5, lsr #20-4		@ combine variant and revision
+#ifdef CONFIG_ARM_ERRATA_743622
+	teq	r6, #0x20			@ present in r2p0
+	teqne	r6, #0x21			@ present in r2p1
+	teqne	r6, #0x22			@ present in r2p2
+	teqne	r6, #0x27			@ present in r2p7
+	teqne	r6, #0x29			@ present in r2p9
+	mrceq	p15, 0, r10, c15, c0, 1		@ read diagnostic register
+	orreq	r10, r10, #1 << 6		@ set bit #6
+	mcreq	p15, 0, r10, c15, c0, 1		@ write diagnostic register
+#endif
+	mrc	p15, 0, r10, c0, c0, 5		@ MPIDR
+	and	r10, r10, #0x3			@ R10 = CPU number
+	mov	r11, #1
+	mov	r11, r11, lsl r10  		@ R11 = CPU mask
+	adr	r12, __tegra_cpu_reset_handler_data
+
+#ifdef CONFIG_SMP
+	/* Does the OS know about this CPU? */
+	ldr	r7, [r12, #RESET_DATA(MASK_PRESENT)]
+	tst	r7, r11 			@ if !present
+	bleq	__die				@ CPU not present (to OS)
+#endif
+
+#ifdef CONFIG_ARCH_TEGRA_2x_SOC
+	/* Are we on Tegra20? */
+	mov32	r6, TEGRA_APB_MISC_BASE
+	ldr	r0, [r6, #APB_MISC_GP_HIDREV]
+	and	r0, r0, #0xff00
+	cmp	r0, #(0x20 << 8)
+	bne	1f
+	/* If not CPU0, don't let CPU0 reset CPU1 now that CPU1 is coming up. */
+	mov32	r6, TEGRA_PMC_BASE
+	mov	r0, #0
+	cmp	r10, #0
+	strne	r0, [r6, #PMC_SCRATCH41]
+1:
+#endif
+
+#ifdef CONFIG_SMP
+	/*
+	 * Can only be secondary boot (initial or hotplug) but CPU 0
+	 * cannot be here.
+	 */
+	cmp	r10, #0
+	bleq	__die				@ CPU0 cannot be here
+	ldr	lr, [r12, #RESET_DATA(STARTUP_SECONDARY)]
+	cmp	lr, #0
+	bleq	__die				@ no secondary startup handler
+	bx	lr
+#endif
+
+/*
+ * We don't know why the CPU reset. Just kill it.
+ * The LR register will contain the address we died at + 4.
+ */
+
+__die:
+	sub	lr, lr, #4
+	mov32	r7, TEGRA_PMC_BASE
+	str	lr, [r7, #PMC_SCRATCH41]
+
+	mov32	r7, TEGRA_CLK_RESET_BASE
+
+	/* Are we on Tegra20? */
+	mov32	r6, TEGRA_APB_MISC_BASE
+	ldr	r0, [r6, #APB_MISC_GP_HIDREV]
+	and	r0, r0, #0xff00
+	cmp	r0, #(0x20 << 8)
+	bne	1f
+
+#ifdef CONFIG_ARCH_TEGRA_2x_SOC
+	mov32	r0, 0x1111
+	mov	r1, r0, lsl r10
+	str	r1, [r7, #0x340]		@ CLK_RST_CPU_CMPLX_SET
+#endif
+1:
+	/* If the CPU still isn't dead, just spin here. */
+	b	.
+ENDPROC(__tegra_cpu_reset_handler)
+
+	.align L1_CACHE_SHIFT
+	.type	__tegra_cpu_reset_handler_data, %object
+	.globl	__tegra_cpu_reset_handler_data
+__tegra_cpu_reset_handler_data:
+	.rept	TEGRA_RESET_DATA_SIZE
+	.long	0
+	.endr
+	.size	__tegra_cpu_reset_handler_data, .-tegra_cpu_reset_handler_data
+	.align L1_CACHE_SHIFT
+
+ENTRY(__tegra_cpu_reset_handler_end)
diff --git a/arch/arm/mach-tegra/include/mach/iomap.h b/arch/arm/mach-tegra/include/mach/iomap.h
index 67644c9..cff672a 100644
--- a/arch/arm/mach-tegra/include/mach/iomap.h
+++ b/arch/arm/mach-tegra/include/mach/iomap.h
@@ -113,6 +113,9 @@
 #define TEGRA_AHB_GIZMO_BASE		0x6000C004
 #define TEGRA_AHB_GIZMO_SIZE		0x10C
 
+#define TEGRA_SB_BASE			0x6000C200
+#define TEGRA_SB_SIZE			256
+
 #define TEGRA_STATMON_BASE		0x6000C400
 #define TEGRA_STATMON_SIZE		SZ_1K
 
diff --git a/arch/arm/mach-tegra/platsmp.c b/arch/arm/mach-tegra/platsmp.c
index 7d2b5d0..fa1178d 100644
--- a/arch/arm/mach-tegra/platsmp.c
+++ b/arch/arm/mach-tegra/platsmp.c
@@ -26,18 +26,26 @@
 
 #include <mach/iomap.h>
 
+#include "chipid.h"
+#include "flowctrl.h"
+#include "reset.h"
+
 extern void tegra_secondary_startup(void);
 
-static DEFINE_SPINLOCK(boot_lock);
 static void __iomem *scu_base = IO_ADDRESS(TEGRA_ARM_PERIF_BASE);
 
 #define EVP_CPU_RESET_VECTOR \
 	(IO_ADDRESS(TEGRA_EXCEPTION_VECTORS_BASE) + 0x100)
 #define CLK_RST_CONTROLLER_CLK_CPU_CMPLX \
 	(IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x4c)
+#define CLK_RST_CONTROLLER_RST_CPU_CMPLX_SET \
+	(IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x340)
 #define CLK_RST_CONTROLLER_RST_CPU_CMPLX_CLR \
 	(IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x344)
 
+#define CPU_CLOCK(cpu)	(0x1<<(8+cpu))
+#define CPU_RESET(cpu)	(0x1111ul<<(cpu))
+
 void __cpuinit platform_secondary_init(unsigned int cpu)
 {
 	/*
@@ -47,63 +55,62 @@ void __cpuinit platform_secondary_init(unsigned int cpu)
 	 */
 	gic_secondary_init(0);
 
-	/*
-	 * Synchronise with the boot thread.
-	 */
-	spin_lock(&boot_lock);
-	spin_unlock(&boot_lock);
 }
 
-int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
+static int tegra20_power_up_cpu(unsigned int cpu)
 {
-	unsigned long old_boot_vector;
-	unsigned long boot_vector;
-	unsigned long timeout;
 	u32 reg;
 
-	/*
-	 * set synchronisation state between this boot processor
-	 * and the secondary one
-	 */
-	spin_lock(&boot_lock);
-
-
-	/* set the reset vector to point to the secondary_startup routine */
-
-	boot_vector = virt_to_phys(tegra_secondary_startup);
-	old_boot_vector = readl(EVP_CPU_RESET_VECTOR);
-	writel(boot_vector, EVP_CPU_RESET_VECTOR);
-
-	/* enable cpu clock on cpu1 */
+	/* Enable the CPU clock. */
+	reg = readl(CLK_RST_CONTROLLER_CLK_CPU_CMPLX);
+	writel(reg & ~CPU_CLOCK(cpu), CLK_RST_CONTROLLER_CLK_CPU_CMPLX);
+	barrier();
 	reg = readl(CLK_RST_CONTROLLER_CLK_CPU_CMPLX);
-	writel(reg & ~(1<<9), CLK_RST_CONTROLLER_CLK_CPU_CMPLX);
-
-	reg = (1<<13) | (1<<9) | (1<<5) | (1<<1);
-	writel(reg, CLK_RST_CONTROLLER_RST_CPU_CMPLX_CLR);
 
-	smp_wmb();
-	flush_cache_all();
+	/* Clear flow controller CSR. */
+	flowctrl_write_cpu_csr(cpu, 0);
 
-	/* unhalt the cpu */
-	writel(0, IO_ADDRESS(TEGRA_FLOW_CTRL_BASE) + 0x14);
+	return 0;
+}
 
-	timeout = jiffies + (1 * HZ);
-	while (time_before(jiffies, timeout)) {
-		if (readl(EVP_CPU_RESET_VECTOR) != boot_vector)
-			break;
-		udelay(10);
-	}
+int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
+{
+	int status;
 
-	/* put the old boot vector back */
-	writel(old_boot_vector, EVP_CPU_RESET_VECTOR);
+	/* Force the CPU into reset. The CPU must remain in reset when the
+	 * flow controller state is cleared (which will cause the flow
+	 * controller to stop driving reset if the CPU has been power-gated
+	 * via the flow controller). This will have no effect on first boot
+	 * of the CPU since it should already be in reset.
+	 */
+	writel(CPU_RESET(cpu), CLK_RST_CONTROLLER_RST_CPU_CMPLX_SET);
+	dmb();
 
 	/*
-	 * now the secondary core is starting up let it run its
-	 * calibrations, then wait for it to finish
+	 * Unhalt the CPU. If the flow controller was used to power-gate the
+	 * CPU this will cause the flow controller to stop driving reset.
+	 * The CPU will remain in reset because the clock and reset block
+	 * is now driving reset.
 	 */
-	spin_unlock(&boot_lock);
+	flowctrl_write_cpu_halt(cpu, 0);
+
+	switch (tegra_get_chipid()) {
+	case TEGRA20:
+		status = tegra20_power_up_cpu(cpu);
+		break;
+	default:
+		status = -EINVAL;
+		break;
+	}
 
-	return 0;
+	if (status)
+		goto done;
+
+	/* Take the CPU out of reset. */
+	writel(CPU_RESET(cpu), CLK_RST_CONTROLLER_RST_CPU_CMPLX_CLR);
+	wmb();
+done:
+	return status;
 }
 
 /*
@@ -128,6 +135,6 @@ void __init smp_init_cpus(void)
 
 void __init platform_smp_prepare_cpus(unsigned int max_cpus)
 {
-
+	tegra_cpu_reset_handler_init();
 	scu_enable(scu_base);
 }
diff --git a/arch/arm/mach-tegra/reset.c b/arch/arm/mach-tegra/reset.c
new file mode 100644
index 0000000..d408349
--- /dev/null
+++ b/arch/arm/mach-tegra/reset.c
@@ -0,0 +1,82 @@
+/*
+ * arch/arm/mach-tegra/reset.c
+ *
+ * Copyright (C) 2011,2012 NVIDIA Corporation.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/cpumask.h>
+#include <linux/bitops.h>
+
+#include <asm/cacheflush.h>
+#include <asm/hardware/cache-l2x0.h>
+
+#include <mach/iomap.h>
+#include <mach/irammap.h>
+
+#include "reset.h"
+
+#define TEGRA_IRAM_RESET_BASE (TEGRA_IRAM_BASE + \
+				TEGRA_IRAM_RESET_HANDLER_OFFSET)
+
+static bool is_enabled;
+
+static void tegra_cpu_reset_handler_enable(void)
+{
+	void __iomem *iram_base = IO_ADDRESS(TEGRA_IRAM_RESET_BASE);
+	void __iomem *evp_cpu_reset =
+		IO_ADDRESS(TEGRA_EXCEPTION_VECTORS_BASE + 0x100);
+	void __iomem *sb_ctrl = IO_ADDRESS(TEGRA_SB_BASE);
+	u32 reg;
+
+	BUG_ON(is_enabled);
+	BUG_ON(tegra_cpu_reset_handler_size > TEGRA_IRAM_RESET_HANDLER_SIZE);
+
+	memcpy(iram_base, (void *)__tegra_cpu_reset_handler_start,
+			tegra_cpu_reset_handler_size);
+
+	/*
+	 * NOTE: This must be the one and only write to the EVP CPU reset
+	 *       vector in the entire system.
+	 */
+	writel(TEGRA_IRAM_RESET_BASE + tegra_cpu_reset_handler_offset,
+			evp_cpu_reset);
+	wmb();
+	reg = readl(evp_cpu_reset);
+
+	/*
+	 * Prevent further modifications to the physical reset vector.
+	 *  NOTE: Has no effect on chips prior to Tegra30.
+	 */
+	reg = readl(sb_ctrl);
+	reg |= 2;
+	writel(reg, sb_ctrl);
+	wmb();
+
+	is_enabled = true;
+}
+
+void __init tegra_cpu_reset_handler_init(void)
+{
+	unsigned long *cpu_reset_data_start, *cpu_reset_data_end;
+
+#ifdef CONFIG_SMP
+	__tegra_cpu_reset_handler_data[TEGRA_RESET_MASK_PRESENT] =
+		*((u32 *)cpu_present_mask);
+	__tegra_cpu_reset_handler_data[TEGRA_RESET_STARTUP_SECONDARY] =
+		virt_to_phys((void *)tegra_secondary_startup);
+#endif
+
+	tegra_cpu_reset_handler_enable();
+}
diff --git a/arch/arm/mach-tegra/reset.h b/arch/arm/mach-tegra/reset.h
new file mode 100644
index 0000000..de88bf8
--- /dev/null
+++ b/arch/arm/mach-tegra/reset.h
@@ -0,0 +1,50 @@
+/*
+ * arch/arm/mach-tegra/reset.h
+ *
+ * CPU reset dispatcher.
+ *
+ * Copyright (c) 2011, NVIDIA Corporation.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __MACH_TEGRA_RESET_H
+#define __MACH_TEGRA_RESET_H
+
+#define TEGRA_RESET_MASK_PRESENT	0
+#define TEGRA_RESET_MASK_LP1		1
+#define TEGRA_RESET_MASK_LP2		2
+#define TEGRA_RESET_STARTUP_SECONDARY	3
+#define TEGRA_RESET_STARTUP_LP2		4
+#define TEGRA_RESET_STARTUP_LP1		5
+#define TEGRA_RESET_DATA_SIZE		6
+
+#ifndef __ASSEMBLY__
+
+extern unsigned long __tegra_cpu_reset_handler_data[TEGRA_RESET_DATA_SIZE];
+
+void __tegra_cpu_reset_handler_start(void);
+void __tegra_cpu_reset_handler(void);
+void __tegra_cpu_reset_handler_end(void);
+void tegra_secondary_startup(void);
+
+#define tegra_cpu_reset_handler_offset \
+		((u32)__tegra_cpu_reset_handler - \
+		 (u32)__tegra_cpu_reset_handler_start)
+
+#define tegra_cpu_reset_handler_size \
+		(__tegra_cpu_reset_handler_end - \
+		 __tegra_cpu_reset_handler_start)
+
+void __init tegra_cpu_reset_handler_init(void);
+
+#endif
+#endif
-- 
1.7.7.rc0.72.g4b5ea.dirty


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

* [PATCH v1 4/8] ARM: tegra: prepare powergate.c for multiple variants
  2012-01-26 17:07 [PATCH v1 0/8] Support for secondary cores on Tegra30 Peter De Schrijver
                   ` (2 preceding siblings ...)
  2012-01-26 17:07 ` [PATCH v1 3/8] ARM: tegra: rework Tegra secondary CPU core bringup Peter De Schrijver
@ 2012-01-26 17:07 ` Peter De Schrijver
  2012-01-26 17:07 ` [PATCH v1 5/8] ARM: tegra: export tegra_powergate_is_powered() Peter De Schrijver
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 16+ messages in thread
From: Peter De Schrijver @ 2012-01-26 17:07 UTC (permalink / raw)
  To: Peter De Schrijver
  Cc: Colin Cross, Olof Johansson, Stephen Warren, Russell King,
	Gary King, Arnd Bergmann, linux-tegra, linux-arm-kernel,
	linux-kernel

Prepare the powergating code for other Tegra variants which have a different
number of powerdomains.

Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
---
 arch/arm/mach-tegra/include/mach/powergate.h |    1 -
 arch/arm/mach-tegra/powergate.c              |   33 +++++++++++++++++++++----
 2 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-tegra/include/mach/powergate.h b/arch/arm/mach-tegra/include/mach/powergate.h
index 39c396d..36846dc 100644
--- a/arch/arm/mach-tegra/include/mach/powergate.h
+++ b/arch/arm/mach-tegra/include/mach/powergate.h
@@ -27,7 +27,6 @@
 #define TEGRA_POWERGATE_VDEC	4
 #define TEGRA_POWERGATE_L2	5
 #define TEGRA_POWERGATE_MPE	6
-#define TEGRA_NUM_POWERGATE	7
 
 int tegra_powergate_power_on(int id);
 int tegra_powergate_power_off(int id);
diff --git a/arch/arm/mach-tegra/powergate.c b/arch/arm/mach-tegra/powergate.c
index 9483064..61734c0 100644
--- a/arch/arm/mach-tegra/powergate.c
+++ b/arch/arm/mach-tegra/powergate.c
@@ -31,6 +31,8 @@
 #include <mach/iomap.h>
 #include <mach/powergate.h>
 
+#include "chipid.h"
+
 #define PWRGATE_TOGGLE		0x30
 #define  PWRGATE_TOGGLE_START	(1 << 8)
 
@@ -38,6 +40,8 @@
 
 #define PWRGATE_STATUS		0x38
 
+static int tegra_num_powerdomains;
+
 static DEFINE_SPINLOCK(tegra_powergate_lock);
 
 static void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE);
@@ -75,7 +79,7 @@ static int tegra_powergate_set(int id, bool new_state)
 
 int tegra_powergate_power_on(int id)
 {
-	if (id < 0 || id >= TEGRA_NUM_POWERGATE)
+	if (id < 0 || id >= tegra_num_powerdomains)
 		return -EINVAL;
 
 	return tegra_powergate_set(id, true);
@@ -83,17 +87,18 @@ int tegra_powergate_power_on(int id)
 
 int tegra_powergate_power_off(int id)
 {
-	if (id < 0 || id >= TEGRA_NUM_POWERGATE)
+	if (id < 0 || id >= tegra_num_powerdomains)
 		return -EINVAL;
 
 	return tegra_powergate_set(id, false);
 }
 
-static bool tegra_powergate_is_powered(int id)
+static int tegra_powergate_is_powered(int id)
 {
 	u32 status;
 
-	WARN_ON(id < 0 || id >= TEGRA_NUM_POWERGATE);
+	if (id < 0 || id >= tegra_num_powerdomains)
+		return -EINVAL;
 
 	status = pmc_read(PWRGATE_STATUS) & (1 << id);
 	return !!status;
@@ -103,7 +108,7 @@ int tegra_powergate_remove_clamping(int id)
 {
 	u32 mask;
 
-	if (id < 0 || id >= TEGRA_NUM_POWERGATE)
+	if (id < 0 || id >= tegra_num_powerdomains)
 		return -EINVAL;
 
 	/*
@@ -156,6 +161,22 @@ err_power:
 	return ret;
 }
 
+int __init tegra_powergate_init(void)
+{
+	switch (tegra_get_chipid()) {
+	case TEGRA20:
+		tegra_num_powerdomains = 7;
+		break;
+	default:
+		/* Unknown Tegra variant. Disable powergating */
+		tegra_num_powerdomains = 0;
+		break;
+	}
+
+	return 0;
+}
+arch_initcall(tegra_powergate_init);
+
 #ifdef CONFIG_DEBUG_FS
 
 static const char * const powergate_name[] = {
@@ -175,7 +196,7 @@ static int powergate_show(struct seq_file *s, void *data)
 	seq_printf(s, " powergate powered\n");
 	seq_printf(s, "------------------\n");
 
-	for (i = 0; i < TEGRA_NUM_POWERGATE; i++)
+	for (i = 0; i < tegra_num_powerdomains; i++)
 		seq_printf(s, " %9s %7s\n", powergate_name[i],
 			tegra_powergate_is_powered(i) ? "yes" : "no");
 	return 0;
-- 
1.7.7.rc0.72.g4b5ea.dirty


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

* [PATCH v1 5/8] ARM: tegra: export tegra_powergate_is_powered()
  2012-01-26 17:07 [PATCH v1 0/8] Support for secondary cores on Tegra30 Peter De Schrijver
                   ` (3 preceding siblings ...)
  2012-01-26 17:07 ` [PATCH v1 4/8] ARM: tegra: prepare powergate.c for multiple variants Peter De Schrijver
@ 2012-01-26 17:07 ` Peter De Schrijver
  2012-01-26 17:07 ` [PATCH v1 6/8] ARM: tegra: add support for Tegra30 powerdomains Peter De Schrijver
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 16+ messages in thread
From: Peter De Schrijver @ 2012-01-26 17:07 UTC (permalink / raw)
  To: Peter De Schrijver
  Cc: Colin Cross, Olof Johansson, Stephen Warren, Russell King,
	Gary King, Arnd Bergmann, linux-tegra, linux-arm-kernel,
	linux-kernel

Export tegra_powergate_is_powered(). This function will be used by the Tegra30
code to bringup secondary CPU cores.

Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
---
 arch/arm/mach-tegra/include/mach/powergate.h |    1 +
 arch/arm/mach-tegra/powergate.c              |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-tegra/include/mach/powergate.h b/arch/arm/mach-tegra/include/mach/powergate.h
index 36846dc..0ec8ce1 100644
--- a/arch/arm/mach-tegra/include/mach/powergate.h
+++ b/arch/arm/mach-tegra/include/mach/powergate.h
@@ -28,6 +28,7 @@
 #define TEGRA_POWERGATE_L2	5
 #define TEGRA_POWERGATE_MPE	6
 
+int tegra_powergate_is_powered(int id);
 int tegra_powergate_power_on(int id);
 int tegra_powergate_power_off(int id);
 int tegra_powergate_remove_clamping(int id);
diff --git a/arch/arm/mach-tegra/powergate.c b/arch/arm/mach-tegra/powergate.c
index 61734c0..a9fd9b9 100644
--- a/arch/arm/mach-tegra/powergate.c
+++ b/arch/arm/mach-tegra/powergate.c
@@ -93,7 +93,7 @@ int tegra_powergate_power_off(int id)
 	return tegra_powergate_set(id, false);
 }
 
-static int tegra_powergate_is_powered(int id)
+int tegra_powergate_is_powered(int id)
 {
 	u32 status;
 
-- 
1.7.7.rc0.72.g4b5ea.dirty


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

* [PATCH v1 6/8] ARM: tegra: add support for Tegra30 powerdomains
  2012-01-26 17:07 [PATCH v1 0/8] Support for secondary cores on Tegra30 Peter De Schrijver
                   ` (4 preceding siblings ...)
  2012-01-26 17:07 ` [PATCH v1 5/8] ARM: tegra: export tegra_powergate_is_powered() Peter De Schrijver
@ 2012-01-26 17:07 ` Peter De Schrijver
  2012-01-26 17:07 ` [PATCH v1 7/8] ARM: tegra: support for Tegra30 CPU powerdomains Peter De Schrijver
  2012-01-26 17:07 ` [PATCH v1 8/8] ARM: tegra: support for secondary cores on Tegra30 Peter De Schrijver
  7 siblings, 0 replies; 16+ messages in thread
From: Peter De Schrijver @ 2012-01-26 17:07 UTC (permalink / raw)
  To: Peter De Schrijver
  Cc: Colin Cross, Olof Johansson, Stephen Warren, Russell King,
	Gary King, Arnd Bergmann, linux-tegra, linux-arm-kernel,
	linux-kernel

Add support for the new powerdomains in Tegra30 such as extra CPU cores and
the SATA domain.

Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
---
 arch/arm/mach-tegra/include/mach/powergate.h |   10 ++++++++++
 arch/arm/mach-tegra/powergate.c              |    3 +++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-tegra/include/mach/powergate.h b/arch/arm/mach-tegra/include/mach/powergate.h
index 0ec8ce1..ca41186 100644
--- a/arch/arm/mach-tegra/include/mach/powergate.h
+++ b/arch/arm/mach-tegra/include/mach/powergate.h
@@ -27,6 +27,16 @@
 #define TEGRA_POWERGATE_VDEC	4
 #define TEGRA_POWERGATE_L2	5
 #define TEGRA_POWERGATE_MPE	6
+#define TEGRA_POWERGATE_HEG	7
+#define TEGRA_POWERGATE_SATA	8
+#define TEGRA_POWERGATE_CPU1	9
+#define TEGRA_POWERGATE_CPU2	10
+#define TEGRA_POWERGATE_CPU3	11
+#define TEGRA_POWERGATE_CELP	12
+#define TEGRA_POWERGATE_3D1	13
+
+#define TEGRA_POWERGATE_CPU0	TEGRA_POWERGATE_CPU
+#define TEGRA_POWERGATE_3D0	TEGRA_POWERGATE_3D
 
 int tegra_powergate_is_powered(int id);
 int tegra_powergate_power_on(int id);
diff --git a/arch/arm/mach-tegra/powergate.c b/arch/arm/mach-tegra/powergate.c
index a9fd9b9..6c16681 100644
--- a/arch/arm/mach-tegra/powergate.c
+++ b/arch/arm/mach-tegra/powergate.c
@@ -167,6 +167,9 @@ int __init tegra_powergate_init(void)
 	case TEGRA20:
 		tegra_num_powerdomains = 7;
 		break;
+	case TEGRA30:
+		tegra_num_powerdomains = 14;
+		break;
 	default:
 		/* Unknown Tegra variant. Disable powergating */
 		tegra_num_powerdomains = 0;
-- 
1.7.7.rc0.72.g4b5ea.dirty


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

* [PATCH v1 7/8] ARM: tegra: support for Tegra30 CPU powerdomains
  2012-01-26 17:07 [PATCH v1 0/8] Support for secondary cores on Tegra30 Peter De Schrijver
                   ` (5 preceding siblings ...)
  2012-01-26 17:07 ` [PATCH v1 6/8] ARM: tegra: add support for Tegra30 powerdomains Peter De Schrijver
@ 2012-01-26 17:07 ` Peter De Schrijver
  2012-01-26 20:40   ` Stephen Warren
  2012-01-26 17:07 ` [PATCH v1 8/8] ARM: tegra: support for secondary cores on Tegra30 Peter De Schrijver
  7 siblings, 1 reply; 16+ messages in thread
From: Peter De Schrijver @ 2012-01-26 17:07 UTC (permalink / raw)
  To: Peter De Schrijver
  Cc: Colin Cross, Olof Johansson, Stephen Warren, Russell King,
	Gary King, Arnd Bergmann, linux-tegra, linux-arm-kernel,
	linux-kernel

Secondary CPU powerdomains can be powergated on Tegra30. Add the necessary
functions to do this. This will be used to boot the secondary CPUs later on.

Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
---
 arch/arm/mach-tegra/common.c                 |    3 +++
 arch/arm/mach-tegra/include/mach/powergate.h |    3 +++
 arch/arm/mach-tegra/powergate.c              |   21 +++++++++++++++++++--
 3 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c
index 1b1dee0..08c2617 100644
--- a/arch/arm/mach-tegra/common.c
+++ b/arch/arm/mach-tegra/common.c
@@ -28,6 +28,7 @@
 
 #include <mach/iomap.h>
 #include <mach/system.h>
+#include <mach/powergate.h>
 
 #include "board.h"
 #include "clock.h"
@@ -117,6 +118,7 @@ void __init tegra20_init_early(void)
 	tegra2_init_clocks();
 	tegra_clk_init_from_table(tegra20_clk_init_table);
 	tegra_init_cache(0x331, 0x441);
+	tegra_powergate_init();
 }
 #endif
 #ifdef CONFIG_ARCH_TEGRA_3x_SOC
@@ -124,5 +126,6 @@ void __init tegra30_init_early(void)
 {
 	tegra30_init_clocks();
 	tegra_init_cache(0x441, 0x551);
+	tegra_powergate_init();
 }
 #endif
diff --git a/arch/arm/mach-tegra/include/mach/powergate.h b/arch/arm/mach-tegra/include/mach/powergate.h
index ca41186..4752b1a 100644
--- a/arch/arm/mach-tegra/include/mach/powergate.h
+++ b/arch/arm/mach-tegra/include/mach/powergate.h
@@ -38,6 +38,9 @@
 #define TEGRA_POWERGATE_CPU0	TEGRA_POWERGATE_CPU
 #define TEGRA_POWERGATE_3D0	TEGRA_POWERGATE_3D
 
+int  __init tegra_powergate_init(void);
+
+int tegra_cpu_powergate_id(int cpuid);
 int tegra_powergate_is_powered(int id);
 int tegra_powergate_power_on(int id);
 int tegra_powergate_power_off(int id);
diff --git a/arch/arm/mach-tegra/powergate.c b/arch/arm/mach-tegra/powergate.c
index 6c16681..a0ffd6e 100644
--- a/arch/arm/mach-tegra/powergate.c
+++ b/arch/arm/mach-tegra/powergate.c
@@ -41,6 +41,14 @@
 #define PWRGATE_STATUS		0x38
 
 static int tegra_num_powerdomains;
+static int tegra_num_cpu_domains;
+static u8 *tegra_cpu_domains;
+static u8 tegra30_cpu_domains[] = {
+	TEGRA_POWERGATE_CPU0,
+	TEGRA_POWERGATE_CPU1,
+	TEGRA_POWERGATE_CPU2,
+	TEGRA_POWERGATE_CPU3,
+};
 
 static DEFINE_SPINLOCK(tegra_powergate_lock);
 
@@ -161,7 +169,15 @@ err_power:
 	return ret;
 }
 
-int __init tegra_powergate_init(void)
+int tegra_cpu_powergate_id(int cpuid)
+{
+	if (cpuid > 0 && cpuid < tegra_num_cpu_domains)
+		return tegra_cpu_domains[cpuid];
+
+	return -EINVAL;
+}
+
+int  __init tegra_powergate_init(void)
 {
 	switch (tegra_get_chipid()) {
 	case TEGRA20:
@@ -169,6 +185,8 @@ int __init tegra_powergate_init(void)
 		break;
 	case TEGRA30:
 		tegra_num_powerdomains = 14;
+		tegra_num_cpu_domains = 4;
+		tegra_cpu_domains = tegra30_cpu_domains;
 		break;
 	default:
 		/* Unknown Tegra variant. Disable powergating */
@@ -178,7 +196,6 @@ int __init tegra_powergate_init(void)
 
 	return 0;
 }
-arch_initcall(tegra_powergate_init);
 
 #ifdef CONFIG_DEBUG_FS
 
-- 
1.7.7.rc0.72.g4b5ea.dirty


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

* [PATCH v1 8/8] ARM: tegra: support for secondary cores on Tegra30
  2012-01-26 17:07 [PATCH v1 0/8] Support for secondary cores on Tegra30 Peter De Schrijver
                   ` (6 preceding siblings ...)
  2012-01-26 17:07 ` [PATCH v1 7/8] ARM: tegra: support for Tegra30 CPU powerdomains Peter De Schrijver
@ 2012-01-26 17:07 ` Peter De Schrijver
  2012-01-26 20:44   ` Stephen Warren
  2012-01-27  5:58   ` Murali N
  7 siblings, 2 replies; 16+ messages in thread
From: Peter De Schrijver @ 2012-01-26 17:07 UTC (permalink / raw)
  To: Peter De Schrijver
  Cc: Colin Cross, Olof Johansson, Stephen Warren, Russell King,
	Gary King, Arnd Bergmann, linux-tegra, linux-arm-kernel,
	linux-kernel

Add support for bringing up secondary cores on Tegra30. On Tegra30 secondary
CPU cores are powergated, so we need to turn on the domains before we can bring
the CPU cores online. Bringing secondary cores online happens early during the
ssytem boot, so we call powergating initialization from platform early_init
function.

Based on work by:

Scott Williams <scwilliams@nvidia.com>
Colin Cross <ccross@android.com>
Alex Frid <afrid@nvidia.com>

Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
---
 arch/arm/mach-tegra/headsmp.S |   32 +++++++++++++++++++++++++
 arch/arm/mach-tegra/platsmp.c |   52 ++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 83 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-tegra/headsmp.S b/arch/arm/mach-tegra/headsmp.S
index bb13e22..925c4a0 100644
--- a/arch/arm/mach-tegra/headsmp.S
+++ b/arch/arm/mach-tegra/headsmp.S
@@ -188,6 +188,38 @@ __die:
 	str	r1, [r7, #0x340]		@ CLK_RST_CPU_CMPLX_SET
 #endif
 1:
+#ifdef CONFIG_ARCH_TEGRA_3x_SOC
+	mov32	r6, TEGRA_FLOW_CTRL_BASE
+
+	cmp	r10, #0
+	moveq	r1, #FLOW_CTRL_HALT_CPU0_EVENTS
+	moveq	r2, #FLOW_CTRL_CPU0_CSR
+	movne	r1, r10, lsl #3
+	addne	r2, r1, #(FLOW_CTRL_CPU1_CSR-8)
+	addne	r1, r1, #(FLOW_CTRL_HALT_CPU1_EVENTS-8)
+
+	/* Clear CPU "event" and "interrupt" flags and power gate
+	   it when halting but not before it is in the "WFI" state. */
+	ldr	r0, [r6, +r2]
+	orr	r0, r0, #FLOW_CTRL_CSR_INTR_FLAG | FLOW_CTRL_CSR_EVENT_FLAG
+	orr	r0, r0, #FLOW_CTRL_CSR_ENABLE
+	str	r0, [r6, +r2]
+
+	/* Unconditionally halt this CPU */
+	mov	r0, #FLOW_CTRL_WAITEVENT
+	str	r0, [r6, +r1]
+	ldr	r0, [r6, +r1]			@ memory barrier
+
+	dsb
+	isb
+	wfi					@ CPU should be power gated here
+
+	/* If the CPU didn't power gate above just kill it's clock. */
+
+	mov	r0, r11, lsl #8
+	str	r0, [r7, #348]			@ CLK_CPU_CMPLX_SET
+#endif
+
 	/* If the CPU still isn't dead, just spin here. */
 	b	.
 ENDPROC(__tegra_cpu_reset_handler)
diff --git a/arch/arm/mach-tegra/platsmp.c b/arch/arm/mach-tegra/platsmp.c
index fa1178d..672a751 100644
--- a/arch/arm/mach-tegra/platsmp.c
+++ b/arch/arm/mach-tegra/platsmp.c
@@ -24,7 +24,9 @@
 #include <asm/mach-types.h>
 #include <asm/smp_scu.h>
 
+#include <mach/clk.h>
 #include <mach/iomap.h>
+#include <mach/powergate.h>
 
 #include "chipid.h"
 #include "flowctrl.h"
@@ -42,6 +44,8 @@ static void __iomem *scu_base = IO_ADDRESS(TEGRA_ARM_PERIF_BASE);
 	(IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x340)
 #define CLK_RST_CONTROLLER_RST_CPU_CMPLX_CLR \
 	(IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x344)
+#define CLK_RST_CONTROLLER_CLK_CPU_CMPLX_CLR \
+	(IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x34c)
 
 #define CPU_CLOCK(cpu)	(0x1<<(8+cpu))
 #define CPU_RESET(cpu)	(0x1111ul<<(cpu))
@@ -73,11 +77,54 @@ static int tegra20_power_up_cpu(unsigned int cpu)
 	return 0;
 }
 
+static int tegra30_power_up_cpu(unsigned int cpu)
+{
+	u32 reg;
+	int ret, pwrgateid;
+	unsigned long timeout;
+
+	pwrgateid = tegra_cpu_powergate_id(cpu);
+	if (pwrgateid < 0)
+		return pwrgateid;
+
+	/* If this is the first boot, toggle powergates directly. */
+	if (!tegra_powergate_is_powered(pwrgateid)) {
+		ret = tegra_powergate_power_on(pwrgateid);
+		if (ret)
+			return ret;
+
+		/* Wait for the power to come up. */
+		timeout = jiffies + 10*HZ;
+		do {
+			if (tegra_powergate_is_powered(pwrgateid))
+				goto remove_clamps;
+			udelay(10);
+		} while (time_before(jiffies, timeout));
+		return -ETIMEDOUT;
+	}
+
+remove_clamps:
+	/* CPU partition is powered. Enable the CPU clock. */
+	writel(CPU_CLOCK(cpu), CLK_RST_CONTROLLER_CLK_CPU_CMPLX_CLR);
+	reg = readl(CLK_RST_CONTROLLER_CLK_CPU_CMPLX_CLR);
+	udelay(10);
+
+	/* Remove I/O clamps. */
+	ret = tegra_powergate_remove_clamping(pwrgateid);
+	udelay(10);
+
+	/* Clear flow controller CSR. */
+	flowctrl_write_cpu_csr(cpu, 0);
+
+	return 0;
+}
+
 int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
 {
 	int status;
 
-	/* Force the CPU into reset. The CPU must remain in reset when the
+	/*
+	 * Force the CPU into reset. The CPU must remain in reset when the
 	 * flow controller state is cleared (which will cause the flow
 	 * controller to stop driving reset if the CPU has been power-gated
 	 * via the flow controller). This will have no effect on first boot
@@ -98,6 +145,9 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
 	case TEGRA20:
 		status = tegra20_power_up_cpu(cpu);
 		break;
+	case TEGRA30:
+		status = tegra30_power_up_cpu(cpu);
+		break;
 	default:
 		status = -EINVAL;
 		break;
-- 
1.7.7.rc0.72.g4b5ea.dirty


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

* RE: [PATCH v1 3/8] ARM: tegra: rework Tegra secondary CPU core bringup
  2012-01-26 17:07 ` [PATCH v1 3/8] ARM: tegra: rework Tegra secondary CPU core bringup Peter De Schrijver
@ 2012-01-26 20:25   ` Stephen Warren
  2012-01-27  8:18     ` Peter De Schrijver
  0 siblings, 1 reply; 16+ messages in thread
From: Stephen Warren @ 2012-01-26 20:25 UTC (permalink / raw)
  To: Peter De Schrijver
  Cc: Colin Cross, Olof Johansson, Russell King, Gary King,
	Arnd Bergmann, linux-tegra, linux-arm-kernel, linux-kernel

Peter De Schrijver wrote at Thursday, January 26, 2012 10:07 AM:
> Prepare the Tegra secondary CPU core bringup code for other Tegra variants.
> The reset handler is also generalized to allow for future introduction of
> powersaving modes which turn off the CPU cores.

> diff --git a/arch/arm/mach-tegra/headsmp.S b/arch/arm/mach-tegra/headsmp.S

>  ENTRY(tegra_secondary_startup)
...
> +	enable_coresight r0

> +ENTRY(__tegra_cpu_reset_handler)
> +
> +#if DEBUG_CPU_RESET_HANDLER
> +	enable_coresight r0
> +	b	.
> +#endif

I'm not sure why the macro call enable_coresight is ifdef'd in one place
but not the other... Should just the instruction "b ." be inside the
ifdef?

> diff --git a/arch/arm/mach-tegra/reset.c b/arch/arm/mach-tegra/reset.c

> +static void tegra_cpu_reset_handler_enable(void)

> +	/*
> +	 * Prevent further modifications to the physical reset vector.
> +	 *  NOTE: Has no effect on chips prior to Tegra30.
> +	 */
> +	reg = readl(sb_ctrl);
> +	reg |= 2;
> +	writel(reg, sb_ctrl);
> +	wmb();

Should we skip that on Tegra20 then?

> +void __init tegra_cpu_reset_handler_init(void)
> +{
> +	unsigned long *cpu_reset_data_start, *cpu_reset_data_end;

Those variables are unused.

-- 
nvpublic


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

* RE: [PATCH v1 7/8] ARM: tegra: support for Tegra30 CPU powerdomains
  2012-01-26 17:07 ` [PATCH v1 7/8] ARM: tegra: support for Tegra30 CPU powerdomains Peter De Schrijver
@ 2012-01-26 20:40   ` Stephen Warren
  0 siblings, 0 replies; 16+ messages in thread
From: Stephen Warren @ 2012-01-26 20:40 UTC (permalink / raw)
  To: Peter De Schrijver
  Cc: Colin Cross, Olof Johansson, Russell King, Gary King,
	Arnd Bergmann, linux-tegra, linux-arm-kernel, linux-kernel

Peter De Schrijver wrote at Thursday, January 26, 2012 10:07 AM:
> Secondary CPU powerdomains can be powergated on Tegra30. Add the necessary
> functions to do this. This will be used to boot the secondary CPUs later on.

> diff --git a/arch/arm/mach-tegra/powergate.c b/arch/arm/mach-tegra/powergate.c

> -int __init tegra_powergate_init(void)
...
> +int  __init tegra_powergate_init(void)

You added an extra space there; probably not really worth fixing unless
you repost for some other reason.

-- 
nvpublic


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

* RE: [PATCH v1 8/8] ARM: tegra: support for secondary cores on Tegra30
  2012-01-26 17:07 ` [PATCH v1 8/8] ARM: tegra: support for secondary cores on Tegra30 Peter De Schrijver
@ 2012-01-26 20:44   ` Stephen Warren
  2012-01-27  5:58   ` Murali N
  1 sibling, 0 replies; 16+ messages in thread
From: Stephen Warren @ 2012-01-26 20:44 UTC (permalink / raw)
  To: Peter De Schrijver
  Cc: Colin Cross, Olof Johansson, Russell King, Arnd Bergmann,
	linux-tegra, linux-arm-kernel, linux-kernel

Peter De Schrijver wrote at Thursday, January 26, 2012 10:07 AM:
> Add support for bringing up secondary cores on Tegra30. On Tegra30 secondary
> CPU cores are powergated, so we need to turn on the domains before we can bring
> the CPU cores online. Bringing secondary cores online happens early during the
> ssytem boot, so we call powergating initialization from platform early_init
> function.
> 
> Based on work by:
> 
> Scott Williams <scwilliams@nvidia.com>
> Colin Cross <ccross@android.com>
> Alex Frid <afrid@nvidia.com>
> 
> Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>

The series,

Acked-by: Stephen Warren <swarren@nvidia.com>

(I already saw this a few times before Peter posted it, so any concerns
I had have been fixed. Still, I'm not very familiar with this part of
the code, so it'd be awesome if e.g. Colin could review this too)

Tested-by: Stephen Warren <swarren@nvidia.com>

(Booted Tegra20 Harmony, validated 2 CPUs found in dmesg during boot,
validated top showed 2 CPUs being actively used. Booted Tegra30 Cardhu,
validated 4 CPUs found in dmesg during boot, but didn't validate anything
from user-space since the SD controller doesn't work yet and I don't have
an initrd set up to test with).

-- 
nvpublic


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

* Re: [PATCH v1 8/8] ARM: tegra: support for secondary cores on Tegra30
  2012-01-26 17:07 ` [PATCH v1 8/8] ARM: tegra: support for secondary cores on Tegra30 Peter De Schrijver
  2012-01-26 20:44   ` Stephen Warren
@ 2012-01-27  5:58   ` Murali N
  1 sibling, 0 replies; 16+ messages in thread
From: Murali N @ 2012-01-27  5:58 UTC (permalink / raw)
  To: Peter De Schrijver
  Cc: Russell King, Gary King, Arnd Bergmann, linux-kernel,
	linux-tegra, Colin Cross, Olof Johansson, Stephen Warren,
	linux-arm-kernel

On Thu, Jan 26, 2012 at 10:37 PM, Peter De Schrijver
<pdeschrijver@nvidia.com> wrote:
>
> Add support for bringing up secondary cores on Tegra30. On Tegra30 secondary
> CPU cores are powergated, so we need to turn on the domains before we can bring
> the CPU cores online. Bringing secondary cores online happens early during the
> ssytem boot, so we call powergating initialization from platform early_init

small spelling correction "system"

> function.
>
> Based on work by:
>
> Scott Williams <scwilliams@nvidia.com>
> Colin Cross <ccross@android.com>
> Alex Frid <afrid@nvidia.com>
>
> Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
> ---
>  arch/arm/mach-tegra/headsmp.S |   32 +++++++++++++++++++++++++
>  arch/arm/mach-tegra/platsmp.c |   52 ++++++++++++++++++++++++++++++++++++++++-
>  2 files changed, 83 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/mach-tegra/headsmp.S b/arch/arm/mach-tegra/headsmp.S
> index bb13e22..925c4a0 100644
> --- a/arch/arm/mach-tegra/headsmp.S
> +++ b/arch/arm/mach-tegra/headsmp.S
> @@ -188,6 +188,38 @@ __die:
>        str     r1, [r7, #0x340]                @ CLK_RST_CPU_CMPLX_SET
>  #endif
>  1:
> +#ifdef CONFIG_ARCH_TEGRA_3x_SOC
> +       mov32   r6, TEGRA_FLOW_CTRL_BASE
> +
> +       cmp     r10, #0
> +       moveq   r1, #FLOW_CTRL_HALT_CPU0_EVENTS
> +       moveq   r2, #FLOW_CTRL_CPU0_CSR
> +       movne   r1, r10, lsl #3
> +       addne   r2, r1, #(FLOW_CTRL_CPU1_CSR-8)
> +       addne   r1, r1, #(FLOW_CTRL_HALT_CPU1_EVENTS-8)
> +
> +       /* Clear CPU "event" and "interrupt" flags and power gate
> +          it when halting but not before it is in the "WFI" state. */
> +       ldr     r0, [r6, +r2]
> +       orr     r0, r0, #FLOW_CTRL_CSR_INTR_FLAG | FLOW_CTRL_CSR_EVENT_FLAG
> +       orr     r0, r0, #FLOW_CTRL_CSR_ENABLE
> +       str     r0, [r6, +r2]
> +
> +       /* Unconditionally halt this CPU */
> +       mov     r0, #FLOW_CTRL_WAITEVENT
> +       str     r0, [r6, +r1]
> +       ldr     r0, [r6, +r1]                   @ memory barrier
> +
> +       dsb
> +       isb
> +       wfi                                     @ CPU should be power gated here
> +
> +       /* If the CPU didn't power gate above just kill it's clock. */
> +
> +       mov     r0, r11, lsl #8
> +       str     r0, [r7, #348]                  @ CLK_CPU_CMPLX_SET
> +#endif
> +
>        /* If the CPU still isn't dead, just spin here. */
>        b       .
>  ENDPROC(__tegra_cpu_reset_handler)
> diff --git a/arch/arm/mach-tegra/platsmp.c b/arch/arm/mach-tegra/platsmp.c
> index fa1178d..672a751 100644
> --- a/arch/arm/mach-tegra/platsmp.c
> +++ b/arch/arm/mach-tegra/platsmp.c
> @@ -24,7 +24,9 @@
>  #include <asm/mach-types.h>
>  #include <asm/smp_scu.h>
>
> +#include <mach/clk.h>
>  #include <mach/iomap.h>
> +#include <mach/powergate.h>
>
>  #include "chipid.h"
>  #include "flowctrl.h"
> @@ -42,6 +44,8 @@ static void __iomem *scu_base = IO_ADDRESS(TEGRA_ARM_PERIF_BASE);
>        (IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x340)
>  #define CLK_RST_CONTROLLER_RST_CPU_CMPLX_CLR \
>        (IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x344)
> +#define CLK_RST_CONTROLLER_CLK_CPU_CMPLX_CLR \
> +       (IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x34c)
>
>  #define CPU_CLOCK(cpu) (0x1<<(8+cpu))
>  #define CPU_RESET(cpu) (0x1111ul<<(cpu))
> @@ -73,11 +77,54 @@ static int tegra20_power_up_cpu(unsigned int cpu)
>        return 0;
>  }
>
> +static int tegra30_power_up_cpu(unsigned int cpu)
> +{
> +       u32 reg;
> +       int ret, pwrgateid;
> +       unsigned long timeout;
> +
> +       pwrgateid = tegra_cpu_powergate_id(cpu);
> +       if (pwrgateid < 0)
> +               return pwrgateid;
> +
> +       /* If this is the first boot, toggle powergates directly. */
> +       if (!tegra_powergate_is_powered(pwrgateid)) {
> +               ret = tegra_powergate_power_on(pwrgateid);
> +               if (ret)
> +                       return ret;
> +
> +               /* Wait for the power to come up. */
> +               timeout = jiffies + 10*HZ;
> +               do {
> +                       if (tegra_powergate_is_powered(pwrgateid))
> +                               goto remove_clamps;
> +                       udelay(10);
> +               } while (time_before(jiffies, timeout));
> +               return -ETIMEDOUT;
> +       }
> +
> +remove_clamps:
> +       /* CPU partition is powered. Enable the CPU clock. */
> +       writel(CPU_CLOCK(cpu), CLK_RST_CONTROLLER_CLK_CPU_CMPLX_CLR);
> +       reg = readl(CLK_RST_CONTROLLER_CLK_CPU_CMPLX_CLR);
> +       udelay(10);
> +
> +       /* Remove I/O clamps. */
> +       ret = tegra_powergate_remove_clamping(pwrgateid);
> +       udelay(10);
> +
> +       /* Clear flow controller CSR. */
> +       flowctrl_write_cpu_csr(cpu, 0);
> +
> +       return 0;
> +}
> +
>  int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
>  {
>        int status;
>
> -       /* Force the CPU into reset. The CPU must remain in reset when the
> +       /*
> +        * Force the CPU into reset. The CPU must remain in reset when the
>         * flow controller state is cleared (which will cause the flow
>         * controller to stop driving reset if the CPU has been power-gated
>         * via the flow controller). This will have no effect on first boot
> @@ -98,6 +145,9 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
>        case TEGRA20:
>                status = tegra20_power_up_cpu(cpu);
>                break;
> +       case TEGRA30:
> +               status = tegra30_power_up_cpu(cpu);
> +               break;
>        default:
>                status = -EINVAL;
>                break;
> --
> 1.7.7.rc0.72.g4b5ea.dirty
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel




--
Regards,
Murali N

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

* Re: [PATCH v1 3/8] ARM: tegra: rework Tegra secondary CPU core bringup
  2012-01-26 20:25   ` Stephen Warren
@ 2012-01-27  8:18     ` Peter De Schrijver
  2012-02-02 17:32       ` Stephen Warren
  0 siblings, 1 reply; 16+ messages in thread
From: Peter De Schrijver @ 2012-01-27  8:18 UTC (permalink / raw)
  To: Stephen Warren
  Cc: Colin Cross, Olof Johansson, Russell King, Gary King,
	Arnd Bergmann, linux-tegra, linux-arm-kernel, linux-kernel

On Thu, Jan 26, 2012 at 09:25:53PM +0100, Stephen Warren wrote:
> Peter De Schrijver wrote at Thursday, January 26, 2012 10:07 AM:
> > Prepare the Tegra secondary CPU core bringup code for other Tegra variants.
> > The reset handler is also generalized to allow for future introduction of
> > powersaving modes which turn off the CPU cores.
> 
> > diff --git a/arch/arm/mach-tegra/headsmp.S b/arch/arm/mach-tegra/headsmp.S
> 
> >  ENTRY(tegra_secondary_startup)
> ...
> > +	enable_coresight r0
> 
> > +ENTRY(__tegra_cpu_reset_handler)
> > +
> > +#if DEBUG_CPU_RESET_HANDLER
> > +	enable_coresight r0
> > +	b	.
> > +#endif
> 
> I'm not sure why the macro call enable_coresight is ifdef'd in one place
> but not the other... Should just the instruction "b ." be inside the
> ifdef?
> 

This code path will also be used by LP2 and LP1 resume in the future, I'm not
sure we should unconditionally enable Coresight in that case.

> > diff --git a/arch/arm/mach-tegra/reset.c b/arch/arm/mach-tegra/reset.c
> 
> > +static void tegra_cpu_reset_handler_enable(void)
> 
> > +	/*
> > +	 * Prevent further modifications to the physical reset vector.
> > +	 *  NOTE: Has no effect on chips prior to Tegra30.
> > +	 */
> > +	reg = readl(sb_ctrl);
> > +	reg |= 2;
> > +	writel(reg, sb_ctrl);
> > +	wmb();
> 
> Should we skip that on Tegra20 then?
> 

Might make sense. OTOH the bit is just unused on Tegra20 so the write doesn't
cause any harm.

> > +void __init tegra_cpu_reset_handler_init(void)
> > +{
> > +	unsigned long *cpu_reset_data_start, *cpu_reset_data_end;
> 
> Those variables are unused.

Indeed... Leftover from the past...

Cheers,

Peter.

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

* Re: [PATCH v1 1/8] ARM: tegra: introduce support for reading chipid
  2012-01-26 17:07 ` [PATCH v1 1/8] ARM: tegra: introduce support for reading chipid Peter De Schrijver
@ 2012-01-27  8:19   ` Olof Johansson
  0 siblings, 0 replies; 16+ messages in thread
From: Olof Johansson @ 2012-01-27  8:19 UTC (permalink / raw)
  To: Peter De Schrijver
  Cc: Colin Cross, Stephen Warren, Russell King, Gary King,
	Arnd Bergmann, linux-tegra, linux-arm-kernel, linux-kernel

Hi,

On Thu, Jan 26, 2012 at 07:07:06PM +0200, Peter De Schrijver wrote:
> Introduce a function to read the Tegra chipid. This will be used by the SMP
> code to distinguish between Tegra variants.
> 
> ---
> 
> Should this be merged with the fuse reading code even though this is a
> hardwired register, not a fuse based register?

Well, it's part of a register that the fuse code already reads, i.e. in
tegra_get_revision(). I'd say add it there instead of create a separate
file for it.

There's actually an opencoded version of this in that very function
already that can be cleaned up at the same time (to check for A03p vs
A03 revisions).


-Olof


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

* RE: [PATCH v1 3/8] ARM: tegra: rework Tegra secondary CPU core bringup
  2012-01-27  8:18     ` Peter De Schrijver
@ 2012-02-02 17:32       ` Stephen Warren
  0 siblings, 0 replies; 16+ messages in thread
From: Stephen Warren @ 2012-02-02 17:32 UTC (permalink / raw)
  To: Peter De Schrijver
  Cc: Colin Cross, Olof Johansson, Russell King, Gary King,
	Arnd Bergmann, linux-tegra, linux-arm-kernel, linux-kernel

Peter De Schrijver wrote at Friday, January 27, 2012 1:18 AM:
> On Thu, Jan 26, 2012 at 09:25:53PM +0100, Stephen Warren wrote:
> > Peter De Schrijver wrote at Thursday, January 26, 2012 10:07 AM:
> > > Prepare the Tegra secondary CPU core bringup code for other Tegra variants.
> > > The reset handler is also generalized to allow for future introduction of
> > > powersaving modes which turn off the CPU cores.
> >
> > > diff --git a/arch/arm/mach-tegra/headsmp.S b/arch/arm/mach-tegra/headsmp.S
> >
> > >  ENTRY(tegra_secondary_startup)
> > ...
> > > +	enable_coresight r0
> >
> > > +ENTRY(__tegra_cpu_reset_handler)
> > > +
> > > +#if DEBUG_CPU_RESET_HANDLER
> > > +	enable_coresight r0
> > > +	b	.
> > > +#endif
> >
> > I'm not sure why the macro call enable_coresight is ifdef'd in one place
> > but not the other... Should just the instruction "b ." be inside the
> > ifdef?
> 
> This code path will also be used by LP2 and LP1 resume in the future, I'm not
> sure we should unconditionally enable Coresight in that case.

What I'm unclear on is why it's a good idea to unconditionally enable
coresight in tegra_secondary_startup if it's not a good idea to
unconditionally enable it in __tegra_cpu_reset_handler.

-- 
nvpublic


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

end of thread, other threads:[~2012-02-02 17:32 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-26 17:07 [PATCH v1 0/8] Support for secondary cores on Tegra30 Peter De Schrijver
2012-01-26 17:07 ` [PATCH v1 1/8] ARM: tegra: introduce support for reading chipid Peter De Schrijver
2012-01-27  8:19   ` Olof Johansson
2012-01-26 17:07 ` [PATCH v1 2/8] ARM: tegra: functions to access the flowcontroller Peter De Schrijver
2012-01-26 17:07 ` [PATCH v1 3/8] ARM: tegra: rework Tegra secondary CPU core bringup Peter De Schrijver
2012-01-26 20:25   ` Stephen Warren
2012-01-27  8:18     ` Peter De Schrijver
2012-02-02 17:32       ` Stephen Warren
2012-01-26 17:07 ` [PATCH v1 4/8] ARM: tegra: prepare powergate.c for multiple variants Peter De Schrijver
2012-01-26 17:07 ` [PATCH v1 5/8] ARM: tegra: export tegra_powergate_is_powered() Peter De Schrijver
2012-01-26 17:07 ` [PATCH v1 6/8] ARM: tegra: add support for Tegra30 powerdomains Peter De Schrijver
2012-01-26 17:07 ` [PATCH v1 7/8] ARM: tegra: support for Tegra30 CPU powerdomains Peter De Schrijver
2012-01-26 20:40   ` Stephen Warren
2012-01-26 17:07 ` [PATCH v1 8/8] ARM: tegra: support for secondary cores on Tegra30 Peter De Schrijver
2012-01-26 20:44   ` Stephen Warren
2012-01-27  5:58   ` Murali N

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).