mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-18 00:50:45 +07:00
1a59d1b8e0
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version 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 write to the free software foundation inc 59 temple place suite 330 boston ma 02111 1307 usa extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 1334 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Richard Fontana <rfontana@redhat.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070033.113240726@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
92 lines
2.7 KiB
ArmAsm
92 lines
2.7 KiB
ArmAsm
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
/*
|
|
* linux/arch/arm/mach-omap2/sleep.S
|
|
*
|
|
* (C) Copyright 2004
|
|
* Texas Instruments, <www.ti.com>
|
|
* Richard Woodruff <r-woodruff2@ti.com>
|
|
*
|
|
* (C) Copyright 2006 Nokia Corporation
|
|
* Fixed idle loop sleep
|
|
* Igor Stoppa <igor.stoppa@nokia.com>
|
|
*/
|
|
|
|
#include <linux/linkage.h>
|
|
#include <asm/assembler.h>
|
|
|
|
#include "omap24xx.h"
|
|
#include "sdrc.h"
|
|
|
|
/* First address of reserved address space? apparently valid for OMAP2 & 3 */
|
|
#define A_SDRC0_V (0xC0000000)
|
|
|
|
.text
|
|
|
|
/*
|
|
* omap24xx_cpu_suspend() - Forces OMAP into deep sleep state by completing
|
|
* SDRC shutdown then ARM shutdown. Upon wake MPU is back on so just restore
|
|
* SDRC.
|
|
*
|
|
* Input:
|
|
* R0 : DLL ctrl value pre-Sleep
|
|
* R1 : SDRC_DLLA_CTRL
|
|
* R2 : SDRC_POWER
|
|
*
|
|
* The if the DPLL is going to AutoIdle. It seems like the DPLL may be back on
|
|
* when we get called, but the DLL probably isn't. We will wait a bit more in
|
|
* case the DPLL isn't quite there yet. The code will wait on DLL for DDR even
|
|
* if in unlocked mode.
|
|
*
|
|
* For less than 242x-ES2.2 upon wake from a sleep mode where the external
|
|
* oscillator was stopped, a timing bug exists where a non-stabilized 12MHz
|
|
* clock can pass into the PRCM can cause problems at DSP and IVA.
|
|
* To work around this the code will switch to the 32kHz source prior to sleep.
|
|
* Post sleep we will shift back to using the DPLL. Apparently,
|
|
* CM_IDLEST_CLKGEN does not reflect the full clock change so you need to wait
|
|
* 3x12MHz + 3x32kHz clocks for a full switch.
|
|
*
|
|
* The DLL load value is not kept in RETENTION or OFF. It needs to be restored
|
|
* at wake
|
|
*/
|
|
.align 3
|
|
ENTRY(omap24xx_cpu_suspend)
|
|
stmfd sp!, {r0 - r12, lr} @ save registers on stack
|
|
mov r3, #0x0 @ clear for mcr call
|
|
mcr p15, 0, r3, c7, c10, 4 @ memory barrier, hope SDR/DDR finished
|
|
nop
|
|
nop
|
|
ldr r4, [r2] @ read SDRC_POWER
|
|
orr r4, r4, #0x40 @ enable self refresh on idle req
|
|
mov r5, #0x2000 @ set delay (DPLL relock + DLL relock)
|
|
str r4, [r2] @ make it so
|
|
nop
|
|
mcr p15, 0, r3, c7, c0, 4 @ wait for interrupt
|
|
nop
|
|
loop:
|
|
subs r5, r5, #0x1 @ awake, wait just a bit
|
|
bne loop
|
|
|
|
/* The DPLL has to be on before we take the DDR out of self refresh */
|
|
bic r4, r4, #0x40 @ now clear self refresh bit.
|
|
str r4, [r2] @ write to SDRC_POWER
|
|
ldr r4, A_SDRC0 @ make a clock happen
|
|
ldr r4, [r4] @ read A_SDRC0
|
|
nop @ start auto refresh only after clk ok
|
|
movs r0, r0 @ see if DDR or SDR
|
|
strne r0, [r1] @ rewrite DLLA to force DLL reload
|
|
addne r1, r1, #0x8 @ move to DLLB
|
|
strne r0, [r1] @ rewrite DLLB to force DLL reload
|
|
|
|
mov r5, #0x1000
|
|
loop2:
|
|
subs r5, r5, #0x1
|
|
bne loop2
|
|
/* resume*/
|
|
ldmfd sp!, {r0 - r12, pc} @ restore regs and return
|
|
|
|
A_SDRC0:
|
|
.word A_SDRC0_V
|
|
|
|
ENTRY(omap24xx_cpu_suspend_sz)
|
|
.word . - omap24xx_cpu_suspend
|