Path: blob/master/arch/powerpc/platforms/pasemi/powersave.S
10819 views
/*1* Copyright (C) 2006-2007 PA Semi, Inc2*3* Maintained by: Olof Johansson <[email protected]>4*5* This program is free software; you can redistribute it and/or modify6* it under the terms of the GNU General Public License version 2 as7* published by the Free Software Foundation.8*9* This program is distributed in the hope that it will be useful,10* but WITHOUT ANY WARRANTY; without even the implied warranty of11* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12* GNU General Public License for more details.13*14* You should have received a copy of the GNU General Public License15* along with this program; if not, write to the Free Software16* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA17*18*/1920#include <asm/processor.h>21#include <asm/page.h>22#include <asm/ppc_asm.h>23#include <asm/cputable.h>24#include <asm/cache.h>25#include <asm/thread_info.h>26#include <asm/asm-offsets.h>2728/* Power savings opcodes since not all binutils have them at this time */29#define DOZE .long 0x4c00032430#define NAP .long 0x4c00036431#define SLEEP .long 0x4c0003a432#define RVW .long 0x4c0003e43334/* Common sequence to do before going to any of the35* powersavings modes.36*/3738#define PRE_SLEEP_SEQUENCE \39std r3,8(r1); \40ptesync ; \41ld r3,8(r1); \421: cmpd r3,r3; \43bne 1b4445_doze:46PRE_SLEEP_SEQUENCE47DOZE48b .495051_GLOBAL(idle_spin)52blr5354_GLOBAL(idle_doze)55LOAD_REG_ADDR(r3, _doze)56b sleep_common5758/* Add more modes here later */5960sleep_common:61mflr r062std r0, 16(r1)63stdu r1,-64(r1)64#ifdef CONFIG_PPC_PASEMI_CPUFREQ65std r3, 48(r1)6667/* Only do power savings when in astate 0 */68bl .check_astate69cmpwi r3,070bne 1f7172ld r3, 48(r1)73#endif74LOAD_REG_IMMEDIATE(r6,MSR_DR|MSR_IR|MSR_ME|MSR_EE)75mfmsr r476andc r5,r4,r677mtmsrd r5,07879mtctr r380bctrl8182mtmsrd r4,083841: addi r1,r1,6485ld r0,16(r1)86mtlr r087blr88899091