Path: blob/master/arch/powerpc/platforms/pasemi/powersave.S
26489 views
/* SPDX-License-Identifier: GPL-2.0-only */1/*2* Copyright (C) 2006-2007 PA Semi, Inc3*4* Maintained by: Olof Johansson <[email protected]>5*/67#include <asm/processor.h>8#include <asm/page.h>9#include <asm/ppc_asm.h>10#include <asm/cputable.h>11#include <asm/cache.h>12#include <asm/thread_info.h>13#include <asm/asm-offsets.h>1415/* Power savings opcodes since not all binutils have them at this time */16#define DOZE .long 0x4c00032417#define NAP .long 0x4c00036418#define SLEEP .long 0x4c0003a419#define RVW .long 0x4c0003e42021/* Common sequence to do before going to any of the22* powersavings modes.23*/2425#define PRE_SLEEP_SEQUENCE \26std r3,8(r1); \27ptesync ; \28ld r3,8(r1); \291: cmpd r3,r3; \30bne 1b3132_doze:33PRE_SLEEP_SEQUENCE34DOZE35b .363738_GLOBAL(idle_spin)39blr4041_GLOBAL(idle_doze)42LOAD_REG_ADDR(r3, _doze)43b sleep_common4445/* Add more modes here later */4647sleep_common:48mflr r049std r0, 16(r1)50stdu r1,-64(r1)51#ifdef CONFIG_PPC_PASEMI_CPUFREQ52std r3, 48(r1)5354/* Only do power savings when in astate 0 */55bl check_astate56cmpwi r3,057bne 1f5859ld r3, 48(r1)60#endif61LOAD_REG_IMMEDIATE(r6,MSR_DR|MSR_IR|MSR_ME|MSR_EE)62mfmsr r463andc r5,r4,r664mtmsrd r5,06566mtctr r367bctrl6869mtmsrd r4,070711: addi r1,r1,6472ld r0,16(r1)73mtlr r074blr75767778