diff options
author | Joseph Lo <josephl@nvidia.com> | 2013-08-12 05:40:06 -0400 |
---|---|---|
committer | Stephen Warren <swarren@nvidia.com> | 2013-08-12 15:30:12 -0400 |
commit | e9f624499cc84a625648ccfbd550b74d17d52fb2 (patch) | |
tree | 5076ecac1bd3a76a902e27535d5bd499d25deb73 | |
parent | 731a9274382f8e6f4961df79fe12ebcc5431a5df (diff) |
ARM: tegra: add LP1 suspend support for Tegra114
The LP1 suspend mode will power off the CPU, clock gated the PLLs and put
SDRAM to self-refresh mode. Any interrupt can wake up device from LP1. The
sequence when LP1 suspending:
* tunning off L1 data cache and the MMU
* storing some EMC registers, DPD (deep power down) status, clk source of
mselect and SCLK burst policy
* putting SDRAM into self-refresh
* switching CPU to CLK_M (12MHz OSC)
* tunning off PLLM, PLLP, PLLA, PLLC and PLLX
* switching SCLK to CLK_S (32KHz OSC)
* shutting off the CPU rail
The sequence of LP1 resuming:
* re-enabling PLLM, PLLP, PLLA, PLLC and PLLX
* restoring the clk source of mselect and SCLK burst policy
* setting up CCLK burst policy to PLLX
* restoring DPD status and some EMC registers
* resuming SDRAM to normal mode
* jumping to the "tegra_resume" from PMC_SCRATCH41
Due to the SDRAM will be put into self-refresh mode, the low level
procedures of LP1 suspending and resuming should be copied to
TEGRA_IRAM_CODE_AREA (TEGRA_IRAM_BASE + SZ_4K) when suspending. Before
restoring the CPU context when resuming, the SDRAM needs to be switched
back to normal mode. And the PLLs need to be re-enabled, SCLK burst policy
be restored. Then jumping to "tegra_resume" that was expected to be stored
in PMC_SCRATCH41 to restore CPU context and back to kernel.
Based on the work by: Bo Yan <byan@nvidia.com>
Signed-off-by: Joseph Lo <josephl@nvidia.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
-rw-r--r-- | arch/arm/mach-tegra/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-tegra/iomap.h | 6 | ||||
-rw-r--r-- | arch/arm/mach-tegra/pm.c | 8 | ||||
-rw-r--r-- | arch/arm/mach-tegra/sleep-tegra30.S | 141 |
4 files changed, 141 insertions, 15 deletions
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile index a3fe22d5b06a..f4e70631626f 100644 --- a/arch/arm/mach-tegra/Makefile +++ b/arch/arm/mach-tegra/Makefile | |||
@@ -33,6 +33,7 @@ obj-$(CONFIG_TEGRA_PCI) += pcie.o | |||
33 | 33 | ||
34 | obj-$(CONFIG_ARCH_TEGRA_114_SOC) += tegra114_speedo.o | 34 | obj-$(CONFIG_ARCH_TEGRA_114_SOC) += tegra114_speedo.o |
35 | obj-$(CONFIG_ARCH_TEGRA_114_SOC) += sleep-tegra30.o | 35 | obj-$(CONFIG_ARCH_TEGRA_114_SOC) += sleep-tegra30.o |
36 | obj-$(CONFIG_ARCH_TEGRA_114_SOC) += pm-tegra30.o | ||
36 | ifeq ($(CONFIG_CPU_IDLE),y) | 37 | ifeq ($(CONFIG_CPU_IDLE),y) |
37 | obj-$(CONFIG_ARCH_TEGRA_114_SOC) += cpuidle-tegra114.o | 38 | obj-$(CONFIG_ARCH_TEGRA_114_SOC) += cpuidle-tegra114.o |
38 | endif | 39 | endif |
diff --git a/arch/arm/mach-tegra/iomap.h b/arch/arm/mach-tegra/iomap.h index f2bdcb4eac94..aba36291d98c 100644 --- a/arch/arm/mach-tegra/iomap.h +++ b/arch/arm/mach-tegra/iomap.h | |||
@@ -239,6 +239,12 @@ | |||
239 | #define TEGRA_KFUSE_BASE 0x7000FC00 | 239 | #define TEGRA_KFUSE_BASE 0x7000FC00 |
240 | #define TEGRA_KFUSE_SIZE SZ_1K | 240 | #define TEGRA_KFUSE_SIZE SZ_1K |
241 | 241 | ||
242 | #define TEGRA_EMC0_BASE 0x7001A000 | ||
243 | #define TEGRA_EMC0_SIZE SZ_2K | ||
244 | |||
245 | #define TEGRA_EMC1_BASE 0x7001A800 | ||
246 | #define TEGRA_EMC1_SIZE SZ_2K | ||
247 | |||
242 | #define TEGRA_CSITE_BASE 0x70040000 | 248 | #define TEGRA_CSITE_BASE 0x70040000 |
243 | #define TEGRA_CSITE_SIZE SZ_256K | 249 | #define TEGRA_CSITE_SIZE SZ_256K |
244 | 250 | ||
diff --git a/arch/arm/mach-tegra/pm.c b/arch/arm/mach-tegra/pm.c index e718350367e4..eaf6bd372ee1 100644 --- a/arch/arm/mach-tegra/pm.c +++ b/arch/arm/mach-tegra/pm.c | |||
@@ -215,7 +215,9 @@ static bool tegra_lp1_iram_hook(void) | |||
215 | tegra20_lp1_iram_hook(); | 215 | tegra20_lp1_iram_hook(); |
216 | break; | 216 | break; |
217 | case TEGRA30: | 217 | case TEGRA30: |
218 | if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC)) | 218 | case TEGRA114: |
219 | if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) || | ||
220 | IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC)) | ||
219 | tegra30_lp1_iram_hook(); | 221 | tegra30_lp1_iram_hook(); |
220 | break; | 222 | break; |
221 | default: | 223 | default: |
@@ -241,7 +243,9 @@ static bool tegra_sleep_core_init(void) | |||
241 | tegra20_sleep_core_init(); | 243 | tegra20_sleep_core_init(); |
242 | break; | 244 | break; |
243 | case TEGRA30: | 245 | case TEGRA30: |
244 | if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC)) | 246 | case TEGRA114: |
247 | if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) || | ||
248 | IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC)) | ||
245 | tegra30_sleep_core_init(); | 249 | tegra30_sleep_core_init(); |
246 | break; | 250 | break; |
247 | default: | 251 | default: |
diff --git a/arch/arm/mach-tegra/sleep-tegra30.S b/arch/arm/mach-tegra/sleep-tegra30.S index 2be7f70e19cb..63fa91b5fafb 100644 --- a/arch/arm/mach-tegra/sleep-tegra30.S +++ b/arch/arm/mach-tegra/sleep-tegra30.S | |||
@@ -65,6 +65,10 @@ | |||
65 | #define CLK_RESET_PLLA_MISC 0xbc | 65 | #define CLK_RESET_PLLA_MISC 0xbc |
66 | #define CLK_RESET_PLLX_BASE 0xe0 | 66 | #define CLK_RESET_PLLX_BASE 0xe0 |
67 | #define CLK_RESET_PLLX_MISC 0xe4 | 67 | #define CLK_RESET_PLLX_MISC 0xe4 |
68 | #define CLK_RESET_PLLX_MISC3 0x518 | ||
69 | #define CLK_RESET_PLLX_MISC3_IDDQ 3 | ||
70 | #define CLK_RESET_PLLM_MISC_IDDQ 5 | ||
71 | #define CLK_RESET_PLLC_MISC_IDDQ 26 | ||
68 | 72 | ||
69 | #define CLK_RESET_CLK_SOURCE_MSELECT 0x3b4 | 73 | #define CLK_RESET_CLK_SOURCE_MSELECT 0x3b4 |
70 | 74 | ||
@@ -114,6 +118,18 @@ | |||
114 | beq 1b | 118 | beq 1b |
115 | .endm | 119 | .endm |
116 | 120 | ||
121 | .macro pll_iddq_exit, rd, car, iddq, iddq_bit | ||
122 | ldr \rd, [\car, #\iddq] | ||
123 | bic \rd, \rd, #(1<<\iddq_bit) | ||
124 | str \rd, [\car, #\iddq] | ||
125 | .endm | ||
126 | |||
127 | .macro pll_iddq_entry, rd, car, iddq, iddq_bit | ||
128 | ldr \rd, [\car, #\iddq] | ||
129 | orr \rd, \rd, #(1<<\iddq_bit) | ||
130 | str \rd, [\car, #\iddq] | ||
131 | .endm | ||
132 | |||
117 | #if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_PM_SLEEP) | 133 | #if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_PM_SLEEP) |
118 | /* | 134 | /* |
119 | * tegra30_hotplug_shutdown(void) | 135 | * tegra30_hotplug_shutdown(void) |
@@ -315,6 +331,32 @@ ENTRY(tegra30_lp1_reset) | |||
315 | str r1, [r0, #CLK_RESET_CCLK_DIVIDER] | 331 | str r1, [r0, #CLK_RESET_CCLK_DIVIDER] |
316 | str r1, [r0, #CLK_RESET_SCLK_DIVIDER] | 332 | str r1, [r0, #CLK_RESET_SCLK_DIVIDER] |
317 | 333 | ||
334 | tegra_get_soc_id TEGRA_APB_MISC_BASE, r10 | ||
335 | cmp r10, #TEGRA30 | ||
336 | beq _no_pll_iddq_exit | ||
337 | |||
338 | pll_iddq_exit r1, r0, CLK_RESET_PLLM_MISC, CLK_RESET_PLLM_MISC_IDDQ | ||
339 | pll_iddq_exit r1, r0, CLK_RESET_PLLC_MISC, CLK_RESET_PLLC_MISC_IDDQ | ||
340 | pll_iddq_exit r1, r0, CLK_RESET_PLLX_MISC3, CLK_RESET_PLLX_MISC3_IDDQ | ||
341 | |||
342 | mov32 r7, TEGRA_TMRUS_BASE | ||
343 | ldr r1, [r7] | ||
344 | add r1, r1, #2 | ||
345 | wait_until r1, r7, r3 | ||
346 | |||
347 | /* enable PLLM via PMC */ | ||
348 | mov32 r2, TEGRA_PMC_BASE | ||
349 | ldr r1, [r2, #PMC_PLLP_WB0_OVERRIDE] | ||
350 | orr r1, r1, #(1 << 12) | ||
351 | str r1, [r2, #PMC_PLLP_WB0_OVERRIDE] | ||
352 | |||
353 | pll_enable r1, r0, CLK_RESET_PLLM_BASE, 0 | ||
354 | pll_enable r1, r0, CLK_RESET_PLLC_BASE, 0 | ||
355 | pll_enable r1, r0, CLK_RESET_PLLX_BASE, 0 | ||
356 | |||
357 | b _pll_m_c_x_done | ||
358 | |||
359 | _no_pll_iddq_exit: | ||
318 | /* enable PLLM via PMC */ | 360 | /* enable PLLM via PMC */ |
319 | mov32 r2, TEGRA_PMC_BASE | 361 | mov32 r2, TEGRA_PMC_BASE |
320 | ldr r1, [r2, #PMC_PLLP_WB0_OVERRIDE] | 362 | ldr r1, [r2, #PMC_PLLP_WB0_OVERRIDE] |
@@ -322,11 +364,13 @@ ENTRY(tegra30_lp1_reset) | |||
322 | str r1, [r2, #PMC_PLLP_WB0_OVERRIDE] | 364 | str r1, [r2, #PMC_PLLP_WB0_OVERRIDE] |
323 | 365 | ||
324 | pll_enable r1, r0, CLK_RESET_PLLM_BASE, CLK_RESET_PLLM_MISC | 366 | pll_enable r1, r0, CLK_RESET_PLLM_BASE, CLK_RESET_PLLM_MISC |
325 | pll_enable r1, r0, CLK_RESET_PLLP_BASE, CLK_RESET_PLLP_MISC | ||
326 | pll_enable r1, r0, CLK_RESET_PLLA_BASE, CLK_RESET_PLLA_MISC | ||
327 | pll_enable r1, r0, CLK_RESET_PLLC_BASE, CLK_RESET_PLLC_MISC | 367 | pll_enable r1, r0, CLK_RESET_PLLC_BASE, CLK_RESET_PLLC_MISC |
328 | pll_enable r1, r0, CLK_RESET_PLLX_BASE, CLK_RESET_PLLX_MISC | 368 | pll_enable r1, r0, CLK_RESET_PLLX_BASE, CLK_RESET_PLLX_MISC |
329 | 369 | ||
370 | _pll_m_c_x_done: | ||
371 | pll_enable r1, r0, CLK_RESET_PLLP_BASE, CLK_RESET_PLLP_MISC | ||
372 | pll_enable r1, r0, CLK_RESET_PLLA_BASE, CLK_RESET_PLLA_MISC | ||
373 | |||
330 | pll_locked r1, r0, CLK_RESET_PLLM_BASE | 374 | pll_locked r1, r0, CLK_RESET_PLLM_BASE |
331 | pll_locked r1, r0, CLK_RESET_PLLP_BASE | 375 | pll_locked r1, r0, CLK_RESET_PLLP_BASE |
332 | pll_locked r1, r0, CLK_RESET_PLLA_BASE | 376 | pll_locked r1, r0, CLK_RESET_PLLA_BASE |
@@ -346,7 +390,11 @@ ENTRY(tegra30_lp1_reset) | |||
346 | ldr r4, [r5, #0x1C] @ restore SCLK_BURST | 390 | ldr r4, [r5, #0x1C] @ restore SCLK_BURST |
347 | str r4, [r0, #CLK_RESET_SCLK_BURST] | 391 | str r4, [r0, #CLK_RESET_SCLK_BURST] |
348 | 392 | ||
349 | mov32 r4, ((1 << 28) | (0x8)) @ burst policy is PLLX | 393 | cmp r10, #TEGRA30 |
394 | movweq r4, #:lower16:((1 << 28) | (0x8)) @ burst policy is PLLX | ||
395 | movteq r4, #:upper16:((1 << 28) | (0x8)) | ||
396 | movwne r4, #:lower16:((1 << 28) | (0xe)) | ||
397 | movtne r4, #:upper16:((1 << 28) | (0xe)) | ||
350 | str r4, [r0, #CLK_RESET_CCLK_BURST] | 398 | str r4, [r0, #CLK_RESET_CCLK_BURST] |
351 | 399 | ||
352 | /* Restore pad power state to normal */ | 400 | /* Restore pad power state to normal */ |
@@ -356,8 +404,13 @@ ENTRY(tegra30_lp1_reset) | |||
356 | orr r1, r1, #(1 << 30) | 404 | orr r1, r1, #(1 << 30) |
357 | str r1, [r2, #PMC_IO_DPD_REQ] @ DPD_OFF | 405 | str r1, [r2, #PMC_IO_DPD_REQ] @ DPD_OFF |
358 | 406 | ||
359 | mov32 r0, TEGRA_EMC_BASE @ r0 reserved for emc base | 407 | cmp r10, #TEGRA30 |
408 | movweq r0, #:lower16:TEGRA_EMC_BASE @ r0 reserved for emc base | ||
409 | movteq r0, #:upper16:TEGRA_EMC_BASE | ||
410 | movwne r0, #:lower16:TEGRA_EMC0_BASE | ||
411 | movtne r0, #:upper16:TEGRA_EMC0_BASE | ||
360 | 412 | ||
413 | exit_self_refresh: | ||
361 | ldr r1, [r5, #0xC] @ restore EMC_XM2VTTGENPADCTRL | 414 | ldr r1, [r5, #0xC] @ restore EMC_XM2VTTGENPADCTRL |
362 | str r1, [r0, #EMC_XM2VTTGENPADCTRL] | 415 | str r1, [r0, #EMC_XM2VTTGENPADCTRL] |
363 | ldr r1, [r5, #0x10] @ restore EMC_XM2VTTGENPADCTRL2 | 416 | ldr r1, [r5, #0x10] @ restore EMC_XM2VTTGENPADCTRL2 |
@@ -372,8 +425,14 @@ ENTRY(tegra30_lp1_reset) | |||
372 | 425 | ||
373 | emc_timing_update r1, r0 | 426 | emc_timing_update r1, r0 |
374 | 427 | ||
428 | cmp r10, #TEGRA114 | ||
429 | movweq r1, #:lower16:TEGRA_EMC1_BASE | ||
430 | movteq r1, #:upper16:TEGRA_EMC1_BASE | ||
431 | cmpeq r0, r1 | ||
432 | |||
375 | ldr r1, [r0, #EMC_AUTO_CAL_CONFIG] | 433 | ldr r1, [r0, #EMC_AUTO_CAL_CONFIG] |
376 | orr r1, r1, #(1 << 31) @ set AUTO_CAL_ACTIVE | 434 | orr r1, r1, #(1 << 31) @ set AUTO_CAL_ACTIVE |
435 | orreq r1, r1, #(1 << 27) @ set slave mode for channel 1 | ||
377 | str r1, [r0, #EMC_AUTO_CAL_CONFIG] | 436 | str r1, [r0, #EMC_AUTO_CAL_CONFIG] |
378 | 437 | ||
379 | emc_wait_auto_cal_onetime: | 438 | emc_wait_auto_cal_onetime: |
@@ -388,9 +447,10 @@ emc_wait_auto_cal_onetime: | |||
388 | mov r1, #0 | 447 | mov r1, #0 |
389 | str r1, [r0, #EMC_SELF_REF] @ take DRAM out of self refresh | 448 | str r1, [r0, #EMC_SELF_REF] @ take DRAM out of self refresh |
390 | mov r1, #1 | 449 | mov r1, #1 |
391 | str r1, [r0, #EMC_NOP] | 450 | cmp r10, #TEGRA30 |
392 | str r1, [r0, #EMC_NOP] | 451 | streq r1, [r0, #EMC_NOP] |
393 | str r1, [r0, #EMC_REFRESH] | 452 | streq r1, [r0, #EMC_NOP] |
453 | streq r1, [r0, #EMC_REFRESH] | ||
394 | 454 | ||
395 | emc_device_mask r1, r0 | 455 | emc_device_mask r1, r0 |
396 | 456 | ||
@@ -452,6 +512,16 @@ zcal_done: | |||
452 | ldr r1, [r5, #0x0] @ restore EMC_CFG | 512 | ldr r1, [r5, #0x0] @ restore EMC_CFG |
453 | str r1, [r0, #EMC_CFG] | 513 | str r1, [r0, #EMC_CFG] |
454 | 514 | ||
515 | /* Tegra114 had dual EMC channel, now config the other one */ | ||
516 | cmp r10, #TEGRA114 | ||
517 | bne __no_dual_emc_chanl | ||
518 | mov32 r1, TEGRA_EMC1_BASE | ||
519 | cmp r0, r1 | ||
520 | movne r0, r1 | ||
521 | addne r5, r5, #0x20 | ||
522 | bne exit_self_refresh | ||
523 | __no_dual_emc_chanl: | ||
524 | |||
455 | mov32 r0, TEGRA_PMC_BASE | 525 | mov32 r0, TEGRA_PMC_BASE |
456 | ldr r0, [r0, #PMC_SCRATCH41] | 526 | ldr r0, [r0, #PMC_SCRATCH41] |
457 | mov pc, r0 @ jump to tegra_resume | 527 | mov pc, r0 @ jump to tegra_resume |
@@ -468,12 +538,30 @@ tegra30_sdram_pad_address: | |||
468 | .word TEGRA_CLK_RESET_BASE + CLK_RESET_CLK_SOURCE_MSELECT @0x18 | 538 | .word TEGRA_CLK_RESET_BASE + CLK_RESET_CLK_SOURCE_MSELECT @0x18 |
469 | .word TEGRA_CLK_RESET_BASE + CLK_RESET_SCLK_BURST @0x1c | 539 | .word TEGRA_CLK_RESET_BASE + CLK_RESET_SCLK_BURST @0x1c |
470 | 540 | ||
541 | tegra114_sdram_pad_address: | ||
542 | .word TEGRA_EMC0_BASE + EMC_CFG @0x0 | ||
543 | .word TEGRA_EMC0_BASE + EMC_ZCAL_INTERVAL @0x4 | ||
544 | .word TEGRA_EMC0_BASE + EMC_AUTO_CAL_INTERVAL @0x8 | ||
545 | .word TEGRA_EMC0_BASE + EMC_XM2VTTGENPADCTRL @0xc | ||
546 | .word TEGRA_EMC0_BASE + EMC_XM2VTTGENPADCTRL2 @0x10 | ||
547 | .word TEGRA_PMC_BASE + PMC_IO_DPD_STATUS @0x14 | ||
548 | .word TEGRA_CLK_RESET_BASE + CLK_RESET_CLK_SOURCE_MSELECT @0x18 | ||
549 | .word TEGRA_CLK_RESET_BASE + CLK_RESET_SCLK_BURST @0x1c | ||
550 | .word TEGRA_EMC1_BASE + EMC_CFG @0x20 | ||
551 | .word TEGRA_EMC1_BASE + EMC_ZCAL_INTERVAL @0x24 | ||
552 | .word TEGRA_EMC1_BASE + EMC_AUTO_CAL_INTERVAL @0x28 | ||
553 | .word TEGRA_EMC1_BASE + EMC_XM2VTTGENPADCTRL @0x2c | ||
554 | .word TEGRA_EMC1_BASE + EMC_XM2VTTGENPADCTRL2 @0x30 | ||
555 | |||
471 | tegra30_sdram_pad_size: | 556 | tegra30_sdram_pad_size: |
472 | .word tegra30_sdram_pad_size - tegra30_sdram_pad_address | 557 | .word tegra114_sdram_pad_address - tegra30_sdram_pad_address |
558 | |||
559 | tegra114_sdram_pad_size: | ||
560 | .word tegra30_sdram_pad_size - tegra114_sdram_pad_address | ||
473 | 561 | ||
474 | .type tegra30_sdram_pad_save, %object | 562 | .type tegra30_sdram_pad_save, %object |
475 | tegra30_sdram_pad_save: | 563 | tegra30_sdram_pad_save: |
476 | .rept (tegra30_sdram_pad_size - tegra30_sdram_pad_address) / 4 | 564 | .rept (tegra30_sdram_pad_size - tegra114_sdram_pad_address) / 4 |
477 | .long 0 | 565 | .long 0 |
478 | .endr | 566 | .endr |
479 | 567 | ||
@@ -497,6 +585,7 @@ tegra30_tear_down_core: | |||
497 | * r5 = TEGRA_CLK_RESET_BASE | 585 | * r5 = TEGRA_CLK_RESET_BASE |
498 | * r6 = TEGRA_FLOW_CTRL_BASE | 586 | * r6 = TEGRA_FLOW_CTRL_BASE |
499 | * r7 = TEGRA_TMRUS_BASE | 587 | * r7 = TEGRA_TMRUS_BASE |
588 | * r10= SoC ID | ||
500 | */ | 589 | */ |
501 | tegra30_switch_cpu_to_clk32k: | 590 | tegra30_switch_cpu_to_clk32k: |
502 | /* | 591 | /* |
@@ -543,6 +632,11 @@ tegra30_switch_cpu_to_clk32k: | |||
543 | bic r0, r0, #(1 << 30) | 632 | bic r0, r0, #(1 << 30) |
544 | str r0, [r5, #CLK_RESET_PLLX_BASE] | 633 | str r0, [r5, #CLK_RESET_PLLX_BASE] |
545 | 634 | ||
635 | cmp r10, #TEGRA30 | ||
636 | beq _no_pll_in_iddq | ||
637 | pll_iddq_entry r1, r5, CLK_RESET_PLLX_MISC3, CLK_RESET_PLLX_MISC3_IDDQ | ||
638 | _no_pll_in_iddq: | ||
639 | |||
546 | /* switch to CLKS */ | 640 | /* switch to CLKS */ |
547 | mov r0, #0 /* brust policy = 32KHz */ | 641 | mov r0, #0 /* brust policy = 32KHz */ |
548 | str r0, [r5, #CLK_RESET_SCLK_BURST] | 642 | str r0, [r5, #CLK_RESET_SCLK_BURST] |
@@ -594,14 +688,19 @@ halted: | |||
594 | * r5 = TEGRA_CLK_RESET_BASE | 688 | * r5 = TEGRA_CLK_RESET_BASE |
595 | * r6 = TEGRA_FLOW_CTRL_BASE | 689 | * r6 = TEGRA_FLOW_CTRL_BASE |
596 | * r7 = TEGRA_TMRUS_BASE | 690 | * r7 = TEGRA_TMRUS_BASE |
691 | * r10= SoC ID | ||
597 | */ | 692 | */ |
598 | tegra30_sdram_self_refresh: | 693 | tegra30_sdram_self_refresh: |
599 | 694 | ||
600 | adr r2, tegra30_sdram_pad_address | ||
601 | adr r8, tegra30_sdram_pad_save | 695 | adr r8, tegra30_sdram_pad_save |
696 | tegra_get_soc_id TEGRA_APB_MISC_BASE, r10 | ||
697 | cmp r10, #TEGRA30 | ||
698 | adreq r2, tegra30_sdram_pad_address | ||
699 | ldreq r3, tegra30_sdram_pad_size | ||
700 | adrne r2, tegra114_sdram_pad_address | ||
701 | ldrne r3, tegra114_sdram_pad_size | ||
602 | mov r9, #0 | 702 | mov r9, #0 |
603 | 703 | ||
604 | ldr r3, tegra30_sdram_pad_size | ||
605 | padsave: | 704 | padsave: |
606 | ldr r0, [r2, r9] @ r0 is the addr in the pad_address | 705 | ldr r0, [r2, r9] @ r0 is the addr in the pad_address |
607 | 706 | ||
@@ -615,13 +714,18 @@ padsave_done: | |||
615 | 714 | ||
616 | dsb | 715 | dsb |
617 | 716 | ||
618 | mov32 r0, TEGRA_EMC_BASE @ r0 reserved for emc base addr | 717 | cmp r10, #TEGRA30 |
718 | ldreq r0, =TEGRA_EMC_BASE @ r0 reserved for emc base addr | ||
719 | ldrne r0, =TEGRA_EMC0_BASE | ||
619 | 720 | ||
721 | enter_self_refresh: | ||
722 | cmp r10, #TEGRA30 | ||
620 | mov r1, #0 | 723 | mov r1, #0 |
621 | str r1, [r0, #EMC_ZCAL_INTERVAL] | 724 | str r1, [r0, #EMC_ZCAL_INTERVAL] |
622 | str r1, [r0, #EMC_AUTO_CAL_INTERVAL] | 725 | str r1, [r0, #EMC_AUTO_CAL_INTERVAL] |
623 | ldr r1, [r0, #EMC_CFG] | 726 | ldr r1, [r0, #EMC_CFG] |
624 | bic r1, r1, #(1 << 28) | 727 | bic r1, r1, #(1 << 28) |
728 | bicne r1, r1, #(1 << 29) | ||
625 | str r1, [r0, #EMC_CFG] @ disable DYN_SELF_REF | 729 | str r1, [r0, #EMC_CFG] @ disable DYN_SELF_REF |
626 | 730 | ||
627 | emc_timing_update r1, r0 | 731 | emc_timing_update r1, r0 |
@@ -660,11 +764,22 @@ emcself: | |||
660 | and r1, r1, r2 | 764 | and r1, r1, r2 |
661 | str r1, [r0, #EMC_XM2VTTGENPADCTRL] | 765 | str r1, [r0, #EMC_XM2VTTGENPADCTRL] |
662 | ldr r1, [r0, #EMC_XM2VTTGENPADCTRL2] | 766 | ldr r1, [r0, #EMC_XM2VTTGENPADCTRL2] |
663 | orr r1, r1, #7 @ set E_NO_VTTGEN | 767 | cmp r10, #TEGRA30 |
768 | orreq r1, r1, #7 @ set E_NO_VTTGEN | ||
769 | orrne r1, r1, #0x3f | ||
664 | str r1, [r0, #EMC_XM2VTTGENPADCTRL2] | 770 | str r1, [r0, #EMC_XM2VTTGENPADCTRL2] |
665 | 771 | ||
666 | emc_timing_update r1, r0 | 772 | emc_timing_update r1, r0 |
667 | 773 | ||
774 | /* Tegra114 had dual EMC channel, now config the other one */ | ||
775 | cmp r10, #TEGRA114 | ||
776 | bne no_dual_emc_chanl | ||
777 | mov32 r1, TEGRA_EMC1_BASE | ||
778 | cmp r0, r1 | ||
779 | movne r0, r1 | ||
780 | bne enter_self_refresh | ||
781 | no_dual_emc_chanl: | ||
782 | |||
668 | ldr r1, [r4, #PMC_CTRL] | 783 | ldr r1, [r4, #PMC_CTRL] |
669 | tst r1, #PMC_CTRL_SIDE_EFFECT_LP0 | 784 | tst r1, #PMC_CTRL_SIDE_EFFECT_LP0 |
670 | bne pmc_io_dpd_skip | 785 | bne pmc_io_dpd_skip |