From: Joseph Lo <josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> To: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, Joseph Lo <josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> Subject: [PATCH 6/6] ARM: tegra114: add CPU hotplug support Date: Wed, 15 May 2013 18:27:24 +0800 [thread overview] Message-ID: <1368613644-11863-7-git-send-email-josephl@nvidia.com> (raw) In-Reply-To: <1368613644-11863-1-git-send-email-josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> The Tegra114 is a quad cores SoC. Each core can be hotplugged including CPU0. The hotplug sequence can be controlled by setting event trigger in flow controller. Then the flow controller will take care all the power sequence that include CPU up and down. Signed-off-by: Joseph Lo <josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> --- arch/arm/mach-tegra/Makefile | 1 + arch/arm/mach-tegra/hotplug.c | 2 ++ arch/arm/mach-tegra/reset-handler.S | 11 ++++++++++- arch/arm/mach-tegra/sleep-tegra30.S | 27 +++++++++++++++++++++++---- arch/arm/mach-tegra/sleep.h | 2 ++ 5 files changed, 38 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile index d011f0a..98b184e 100644 --- a/arch/arm/mach-tegra/Makefile +++ b/arch/arm/mach-tegra/Makefile @@ -30,6 +30,7 @@ obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o obj-$(CONFIG_TEGRA_PCI) += pcie.o obj-$(CONFIG_ARCH_TEGRA_114_SOC) += tegra114_speedo.o +obj-$(CONFIG_ARCH_TEGRA_114_SOC) += sleep-tegra30.o ifeq ($(CONFIG_CPU_IDLE),y) obj-$(CONFIG_ARCH_TEGRA_114_SOC) += cpuidle-tegra114.o endif diff --git a/arch/arm/mach-tegra/hotplug.c b/arch/arm/mach-tegra/hotplug.c index 184914a..d07f152 100644 --- a/arch/arm/mach-tegra/hotplug.c +++ b/arch/arm/mach-tegra/hotplug.c @@ -55,4 +55,6 @@ void __init tegra_hotplug_init(void) tegra_hotplug_shutdown = tegra20_hotplug_shutdown; if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) && tegra_chip_id == TEGRA30) tegra_hotplug_shutdown = tegra30_hotplug_shutdown; + if (IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) && tegra_chip_id == TEGRA114) + tegra_hotplug_shutdown = tegra30_hotplug_shutdown; } diff --git a/arch/arm/mach-tegra/reset-handler.S b/arch/arm/mach-tegra/reset-handler.S index 893f6b7..5af3a7d 100644 --- a/arch/arm/mach-tegra/reset-handler.S +++ b/arch/arm/mach-tegra/reset-handler.S @@ -38,18 +38,24 @@ * CPU boot vector when restarting the a CPU following * an LP2 transition. Also branched to by LP0 and LP1 resume after * re-enabling sdram. + * + * r6: SoC ID << 8 */ ENTRY(tegra_resume) bl v7_invalidate_l1 cpu_id r0 + tegra_check_soc_id TEGRA114, TEGRA_APB_MISC_BASE, r6, r7 + beq no_cpu0_chk + cmp r0, #0 @ CPU0? THUMB( it ne ) bne cpu_resume @ no +no_cpu0_chk: #ifndef CONFIG_ARCH_TEGRA_2x_SOC /* Are we on Tegra20? */ - tegra_check_soc_id TEGRA20, TEGRA_APB_MISC_BASE, r6, r7 + cmp r6, #(TEGRA20 << 8) beq 1f @ Yes /* Clear the flow controller flags for this CPU. */ cpu_to_csr_req r1, r0 @@ -186,8 +192,11 @@ __is_not_lp2: * Can only be secondary boot (initial or hotplug) but CPU 0 * cannot be here. */ + cmp r6, #(TEGRA114 <<8) + beq __no_cpu0_chk cmp r10, #0 bleq __die @ CPU0 cannot be here +__no_cpu0_chk: ldr lr, [r12, #RESET_DATA(STARTUP_SECONDARY)] cmp lr, #0 bleq __die @ no secondary startup handler diff --git a/arch/arm/mach-tegra/sleep-tegra30.S b/arch/arm/mach-tegra/sleep-tegra30.S index d29dfcc..ae36fbb 100644 --- a/arch/arm/mach-tegra/sleep-tegra30.S +++ b/arch/arm/mach-tegra/sleep-tegra30.S @@ -19,6 +19,7 @@ #include <asm/assembler.h> #include <asm/asm-offsets.h> +#include "fuse.h" #include "sleep.h" #include "flowctrl.h" @@ -45,12 +46,17 @@ ENDPROC(tegra30_hotplug_shutdown) * and powergates it -- flags (in R0) indicate the request type. * Must never be called for CPU 0. * - * corrupts r0-r4, r12 + * r10 = SoC ID << 8 + * corrupts r0-r4, r10-r12 */ ENTRY(tegra30_cpu_shutdown) cpu_id r3 + tegra_check_soc_id TEGRA30, TEGRA_APB_MISC_VIRT, r10, r11 + bne _no_cpu0_chk @ It's not Tegra30 + cmp r3, #0 moveq pc, lr @ Must never be called for CPU 0 +_no_cpu0_chk: ldr r12, =TEGRA_FLOW_CTRL_VIRT cpu_to_csr_reg r1, r3 @@ -65,7 +71,9 @@ ENTRY(tegra30_cpu_shutdown) movw r12, \ FLOW_CTRL_CSR_INTR_FLAG | FLOW_CTRL_CSR_EVENT_FLAG | \ FLOW_CTRL_CSR_ENABLE - mov r4, #(1 << 4) + cmp r10, #(TEGRA30 << 8) + moveq r4, #(1 << 4) @ wfe bitmap + movne r4, #(1 << 8) @ wfi bitmap ARM( orr r12, r12, r4, lsl r3 ) THUMB( lsl r4, r4, r3 ) THUMB( orr r12, r12, r4 ) @@ -79,9 +87,19 @@ delay_1: cpsid a @ disable imprecise aborts. ldr r3, [r1] @ read CSR str r3, [r1] @ clear CSR + tst r0, #TEGRA30_POWER_HOTPLUG_SHUTDOWN + beq flow_ctrl_setting_for_lp2 + + /* flow controller set up for hotplug */ + mov r3, #FLOW_CTRL_WAITEVENT @ For hotplug + b flow_ctrl_done +flow_ctrl_setting_for_lp2: + /* flow controller set up for LP2 */ + cmp r10, #(TEGRA30 << 8) moveq r3, #FLOW_CTRL_WAIT_FOR_INTERRUPT @ For LP2 - movne r3, #FLOW_CTRL_WAITEVENT @ For hotplug +flow_ctrl_done: + cmp r10, #(TEGRA30 << 8) str r3, [r2] ldr r0, [r2] b wfe_war @@ -89,7 +107,8 @@ delay_1: __cpu_reset_again: dsb .align 5 - wfe @ CPU should be power gated here + wfeeq @ CPU should be power gated here + wfine wfe_war: b __cpu_reset_again diff --git a/arch/arm/mach-tegra/sleep.h b/arch/arm/mach-tegra/sleep.h index c2cac9a..92a3f0c 100644 --- a/arch/arm/mach-tegra/sleep.h +++ b/arch/arm/mach-tegra/sleep.h @@ -25,6 +25,8 @@ + IO_PPSB_VIRT) #define TEGRA_CLK_RESET_VIRT (TEGRA_CLK_RESET_BASE - IO_PPSB_PHYS \ + IO_PPSB_VIRT) +#define TEGRA_APB_MISC_VIRT (TEGRA_APB_MISC_BASE - IO_APB_PHYS \ + + IO_APB_VIRT) #define TEGRA_PMC_VIRT (TEGRA_PMC_BASE - IO_APB_PHYS + IO_APB_VIRT) /* PMC_SCRATCH37-39 and 41 are used for tegra_pen_lock and idle */ -- 1.8.2.2
WARNING: multiple messages have this Message-ID (diff)
From: josephl@nvidia.com (Joseph Lo) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 6/6] ARM: tegra114: add CPU hotplug support Date: Wed, 15 May 2013 18:27:24 +0800 [thread overview] Message-ID: <1368613644-11863-7-git-send-email-josephl@nvidia.com> (raw) In-Reply-To: <1368613644-11863-1-git-send-email-josephl@nvidia.com> The Tegra114 is a quad cores SoC. Each core can be hotplugged including CPU0. The hotplug sequence can be controlled by setting event trigger in flow controller. Then the flow controller will take care all the power sequence that include CPU up and down. Signed-off-by: Joseph Lo <josephl@nvidia.com> --- arch/arm/mach-tegra/Makefile | 1 + arch/arm/mach-tegra/hotplug.c | 2 ++ arch/arm/mach-tegra/reset-handler.S | 11 ++++++++++- arch/arm/mach-tegra/sleep-tegra30.S | 27 +++++++++++++++++++++++---- arch/arm/mach-tegra/sleep.h | 2 ++ 5 files changed, 38 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile index d011f0a..98b184e 100644 --- a/arch/arm/mach-tegra/Makefile +++ b/arch/arm/mach-tegra/Makefile @@ -30,6 +30,7 @@ obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o obj-$(CONFIG_TEGRA_PCI) += pcie.o obj-$(CONFIG_ARCH_TEGRA_114_SOC) += tegra114_speedo.o +obj-$(CONFIG_ARCH_TEGRA_114_SOC) += sleep-tegra30.o ifeq ($(CONFIG_CPU_IDLE),y) obj-$(CONFIG_ARCH_TEGRA_114_SOC) += cpuidle-tegra114.o endif diff --git a/arch/arm/mach-tegra/hotplug.c b/arch/arm/mach-tegra/hotplug.c index 184914a..d07f152 100644 --- a/arch/arm/mach-tegra/hotplug.c +++ b/arch/arm/mach-tegra/hotplug.c @@ -55,4 +55,6 @@ void __init tegra_hotplug_init(void) tegra_hotplug_shutdown = tegra20_hotplug_shutdown; if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) && tegra_chip_id == TEGRA30) tegra_hotplug_shutdown = tegra30_hotplug_shutdown; + if (IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) && tegra_chip_id == TEGRA114) + tegra_hotplug_shutdown = tegra30_hotplug_shutdown; } diff --git a/arch/arm/mach-tegra/reset-handler.S b/arch/arm/mach-tegra/reset-handler.S index 893f6b7..5af3a7d 100644 --- a/arch/arm/mach-tegra/reset-handler.S +++ b/arch/arm/mach-tegra/reset-handler.S @@ -38,18 +38,24 @@ * CPU boot vector when restarting the a CPU following * an LP2 transition. Also branched to by LP0 and LP1 resume after * re-enabling sdram. + * + * r6: SoC ID << 8 */ ENTRY(tegra_resume) bl v7_invalidate_l1 cpu_id r0 + tegra_check_soc_id TEGRA114, TEGRA_APB_MISC_BASE, r6, r7 + beq no_cpu0_chk + cmp r0, #0 @ CPU0? THUMB( it ne ) bne cpu_resume @ no +no_cpu0_chk: #ifndef CONFIG_ARCH_TEGRA_2x_SOC /* Are we on Tegra20? */ - tegra_check_soc_id TEGRA20, TEGRA_APB_MISC_BASE, r6, r7 + cmp r6, #(TEGRA20 << 8) beq 1f @ Yes /* Clear the flow controller flags for this CPU. */ cpu_to_csr_req r1, r0 @@ -186,8 +192,11 @@ __is_not_lp2: * Can only be secondary boot (initial or hotplug) but CPU 0 * cannot be here. */ + cmp r6, #(TEGRA114 <<8) + beq __no_cpu0_chk cmp r10, #0 bleq __die @ CPU0 cannot be here +__no_cpu0_chk: ldr lr, [r12, #RESET_DATA(STARTUP_SECONDARY)] cmp lr, #0 bleq __die @ no secondary startup handler diff --git a/arch/arm/mach-tegra/sleep-tegra30.S b/arch/arm/mach-tegra/sleep-tegra30.S index d29dfcc..ae36fbb 100644 --- a/arch/arm/mach-tegra/sleep-tegra30.S +++ b/arch/arm/mach-tegra/sleep-tegra30.S @@ -19,6 +19,7 @@ #include <asm/assembler.h> #include <asm/asm-offsets.h> +#include "fuse.h" #include "sleep.h" #include "flowctrl.h" @@ -45,12 +46,17 @@ ENDPROC(tegra30_hotplug_shutdown) * and powergates it -- flags (in R0) indicate the request type. * Must never be called for CPU 0. * - * corrupts r0-r4, r12 + * r10 = SoC ID << 8 + * corrupts r0-r4, r10-r12 */ ENTRY(tegra30_cpu_shutdown) cpu_id r3 + tegra_check_soc_id TEGRA30, TEGRA_APB_MISC_VIRT, r10, r11 + bne _no_cpu0_chk @ It's not Tegra30 + cmp r3, #0 moveq pc, lr @ Must never be called for CPU 0 +_no_cpu0_chk: ldr r12, =TEGRA_FLOW_CTRL_VIRT cpu_to_csr_reg r1, r3 @@ -65,7 +71,9 @@ ENTRY(tegra30_cpu_shutdown) movw r12, \ FLOW_CTRL_CSR_INTR_FLAG | FLOW_CTRL_CSR_EVENT_FLAG | \ FLOW_CTRL_CSR_ENABLE - mov r4, #(1 << 4) + cmp r10, #(TEGRA30 << 8) + moveq r4, #(1 << 4) @ wfe bitmap + movne r4, #(1 << 8) @ wfi bitmap ARM( orr r12, r12, r4, lsl r3 ) THUMB( lsl r4, r4, r3 ) THUMB( orr r12, r12, r4 ) @@ -79,9 +87,19 @@ delay_1: cpsid a @ disable imprecise aborts. ldr r3, [r1] @ read CSR str r3, [r1] @ clear CSR + tst r0, #TEGRA30_POWER_HOTPLUG_SHUTDOWN + beq flow_ctrl_setting_for_lp2 + + /* flow controller set up for hotplug */ + mov r3, #FLOW_CTRL_WAITEVENT @ For hotplug + b flow_ctrl_done +flow_ctrl_setting_for_lp2: + /* flow controller set up for LP2 */ + cmp r10, #(TEGRA30 << 8) moveq r3, #FLOW_CTRL_WAIT_FOR_INTERRUPT @ For LP2 - movne r3, #FLOW_CTRL_WAITEVENT @ For hotplug +flow_ctrl_done: + cmp r10, #(TEGRA30 << 8) str r3, [r2] ldr r0, [r2] b wfe_war @@ -89,7 +107,8 @@ delay_1: __cpu_reset_again: dsb .align 5 - wfe @ CPU should be power gated here + wfeeq @ CPU should be power gated here + wfine wfe_war: b __cpu_reset_again diff --git a/arch/arm/mach-tegra/sleep.h b/arch/arm/mach-tegra/sleep.h index c2cac9a..92a3f0c 100644 --- a/arch/arm/mach-tegra/sleep.h +++ b/arch/arm/mach-tegra/sleep.h @@ -25,6 +25,8 @@ + IO_PPSB_VIRT) #define TEGRA_CLK_RESET_VIRT (TEGRA_CLK_RESET_BASE - IO_PPSB_PHYS \ + IO_PPSB_VIRT) +#define TEGRA_APB_MISC_VIRT (TEGRA_APB_MISC_BASE - IO_APB_PHYS \ + + IO_APB_VIRT) #define TEGRA_PMC_VIRT (TEGRA_PMC_BASE - IO_APB_PHYS + IO_APB_VIRT) /* PMC_SCRATCH37-39 and 41 are used for tegra_pen_lock and idle */ -- 1.8.2.2
next prev parent reply other threads:[~2013-05-15 10:27 UTC|newest] Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-05-15 10:27 [PATCH 0/6] ARM: tegra114: add CPU hotplug support Joseph Lo 2013-05-15 10:27 ` Joseph Lo [not found] ` <1368613644-11863-1-git-send-email-josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 2013-05-15 10:27 ` [PATCH 1/6] ARM: tegra: add an assembly marco to check Tegra SoC ID Joseph Lo 2013-05-15 10:27 ` Joseph Lo [not found] ` <1368613644-11863-2-git-send-email-josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 2013-05-15 22:43 ` Stephen Warren 2013-05-15 22:43 ` Stephen Warren [not found] ` <51940FA4.6050609-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> 2013-05-16 10:09 ` Joseph Lo 2013-05-16 10:09 ` Joseph Lo [not found] ` <1368698988.7403.25.camel-yx3yKKdKkHfc7b1ADBJPm0n48jw8i0AO@public.gmane.org> 2013-05-16 18:21 ` Stephen Warren 2013-05-16 18:21 ` Stephen Warren 2013-05-15 10:27 ` [PATCH 2/6] ARM: tegra: skip SCU and PL310 code when CPU is not Cortex-A9 Joseph Lo 2013-05-15 10:27 ` Joseph Lo [not found] ` <1368613644-11863-3-git-send-email-josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 2013-05-15 22:48 ` Stephen Warren 2013-05-15 22:48 ` Stephen Warren [not found] ` <519410D7.9060201-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> 2013-05-16 10:13 ` Joseph Lo 2013-05-16 10:13 ` Joseph Lo 2013-05-15 10:27 ` [PATCH 3/6] ARM: tegra: make tegra_resume can work for Tegra114 Joseph Lo 2013-05-15 10:27 ` Joseph Lo [not found] ` <1368613644-11863-4-git-send-email-josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 2013-05-15 22:57 ` Stephen Warren 2013-05-15 22:57 ` Stephen Warren [not found] ` <519412E9.2080905-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> 2013-05-16 10:35 ` Joseph Lo 2013-05-16 10:35 ` Joseph Lo [not found] ` <1368700533.7403.47.camel-yx3yKKdKkHfc7b1ADBJPm0n48jw8i0AO@public.gmane.org> 2013-05-16 18:24 ` Stephen Warren 2013-05-16 18:24 ` Stephen Warren 2013-05-15 10:27 ` [PATCH 4/6] ARM: tegra114: add power up sequence for warm boot CPU Joseph Lo 2013-05-15 10:27 ` Joseph Lo 2013-05-15 10:27 ` [PATCH 5/6] clk: tegra114: implement wait_for_reset and disable_clock for tegra_cpu_car_ops Joseph Lo 2013-05-15 10:27 ` Joseph Lo [not found] ` <1368613644-11863-6-git-send-email-josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 2013-05-15 23:02 ` Stephen Warren 2013-05-15 23:02 ` Stephen Warren 2013-05-16 19:17 ` Mike Turquette 2013-05-16 19:17 ` Mike Turquette 2013-05-15 10:27 ` Joseph Lo [this message] 2013-05-15 10:27 ` [PATCH 6/6] ARM: tegra114: add CPU hotplug support Joseph Lo [not found] ` <1368613644-11863-7-git-send-email-josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 2013-05-15 23:11 ` Stephen Warren 2013-05-15 23:11 ` Stephen Warren [not found] ` <5194162D.7010007-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> 2013-05-16 11:14 ` Joseph Lo 2013-05-16 11:14 ` Joseph Lo [not found] ` <1368702862.7403.86.camel-yx3yKKdKkHfc7b1ADBJPm0n48jw8i0AO@public.gmane.org> 2013-05-16 18:26 ` Stephen Warren 2013-05-16 18:26 ` Stephen Warren 2013-05-15 23:38 ` [PATCH 0/6] " Stephen Warren 2013-05-15 23:38 ` Stephen Warren [not found] ` <51941C58.9060002-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> 2013-05-16 9:53 ` Joseph Lo 2013-05-16 9:53 ` Joseph Lo [not found] ` <1368698019.7403.10.camel-yx3yKKdKkHfc7b1ADBJPm0n48jw8i0AO@public.gmane.org> 2013-05-16 18:19 ` Stephen Warren 2013-05-16 18:19 ` Stephen Warren [not found] ` <51952344.1090003-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> 2013-05-17 10:15 ` Joseph Lo 2013-05-17 10:15 ` Joseph Lo 2013-05-17 10:27 ` Russell King - ARM Linux 2013-05-17 10:27 ` Russell King - ARM Linux 2013-05-17 10:23 ` Russell King - ARM Linux 2013-05-17 10:23 ` Russell King - ARM Linux
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1368613644-11863-7-git-send-email-josephl@nvidia.com \ --to=josephl-ddmlm1+adcrqt0dzr+alfa@public.gmane.org \ --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \ --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.