2011-04-29 00:28:08 +07:00
|
|
|
/*
|
|
|
|
* sh7372 lowlevel sleep code for "Core Standby Mode"
|
|
|
|
*
|
|
|
|
* Copyright (C) 2011 Magnus Damm
|
|
|
|
*
|
|
|
|
* In "Core Standby Mode" the ARM core is off, but L2 cache is still on
|
|
|
|
*
|
|
|
|
* Based on mach-omap2/sleep34xx.S
|
|
|
|
*
|
|
|
|
* (C) Copyright 2007 Texas Instruments
|
|
|
|
* Karthik Dasu <karthik-dp@ti.com>
|
|
|
|
*
|
|
|
|
* (C) Copyright 2004 Texas Instruments, <www.ti.com>
|
|
|
|
* Richard Woodruff <r-woodruff2@ti.com>
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/linkage.h>
|
2011-09-26 04:18:42 +07:00
|
|
|
#include <linux/init.h>
|
|
|
|
#include <asm/memory.h>
|
2011-04-29 00:28:08 +07:00
|
|
|
#include <asm/assembler.h>
|
|
|
|
|
2011-09-26 04:21:02 +07:00
|
|
|
#if defined(CONFIG_SUSPEND) || defined(CONFIG_CPU_IDLE)
|
2011-04-29 00:28:08 +07:00
|
|
|
.align 12
|
|
|
|
.text
|
2011-12-23 07:23:07 +07:00
|
|
|
.global sh7372_resume_core_standby_sysc
|
|
|
|
sh7372_resume_core_standby_sysc:
|
2011-09-26 04:18:42 +07:00
|
|
|
ldr pc, 1f
|
2013-06-05 14:45:53 +07:00
|
|
|
|
2013-07-10 08:56:37 +07:00
|
|
|
.align 2
|
2013-06-05 14:45:53 +07:00
|
|
|
.globl sh7372_cpu_resume
|
|
|
|
sh7372_cpu_resume:
|
|
|
|
1: .space 4
|
2011-09-26 04:20:49 +07:00
|
|
|
|
2011-12-23 07:23:07 +07:00
|
|
|
#define SPDCR 0xe6180008
|
|
|
|
|
|
|
|
/* A3SM & A4S power down */
|
|
|
|
.global sh7372_do_idle_sysc
|
|
|
|
sh7372_do_idle_sysc:
|
|
|
|
mov r8, r0 /* sleep mode passed in r0 */
|
|
|
|
|
2011-09-26 04:20:49 +07:00
|
|
|
/*
|
|
|
|
* Clear the SCTLR.C bit to prevent further data cache
|
|
|
|
* allocation. Clearing SCTLR.C would make all the data accesses
|
|
|
|
* strongly ordered and would not hit the cache.
|
|
|
|
*/
|
|
|
|
mrc p15, 0, r0, c1, c0, 0
|
|
|
|
bic r0, r0, #(1 << 2) @ Disable the C bit
|
|
|
|
mcr p15, 0, r0, c1, c0, 0
|
|
|
|
isb
|
|
|
|
|
2012-12-28 18:32:54 +07:00
|
|
|
/*
|
|
|
|
* Clean and invalidate data cache again.
|
|
|
|
*/
|
|
|
|
ldr r1, kernel_flush
|
|
|
|
blx r1
|
|
|
|
|
2011-09-26 04:20:49 +07:00
|
|
|
/* disable L2 cache in the aux control register */
|
|
|
|
mrc p15, 0, r10, c1, c0, 1
|
|
|
|
bic r10, r10, #2
|
|
|
|
mcr p15, 0, r10, c1, c0, 1
|
2012-12-28 18:32:54 +07:00
|
|
|
isb
|
2011-09-26 04:20:49 +07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* The kernel doesn't interwork: v7_flush_dcache_all in particluar will
|
|
|
|
* always return in Thumb state when CONFIG_THUMB2_KERNEL is enabled.
|
|
|
|
* This sequence switches back to ARM. Note that .align may insert a
|
|
|
|
* nop: bx pc needs to be word-aligned in order to work.
|
|
|
|
*/
|
|
|
|
THUMB( .thumb )
|
|
|
|
THUMB( .align )
|
|
|
|
THUMB( bx pc )
|
|
|
|
THUMB( nop )
|
|
|
|
.arm
|
|
|
|
|
|
|
|
/* Data memory barrier and Data sync barrier */
|
|
|
|
dsb
|
|
|
|
dmb
|
|
|
|
|
2011-12-23 07:23:07 +07:00
|
|
|
/* SYSC power down */
|
2011-09-26 04:20:49 +07:00
|
|
|
ldr r0, =SPDCR
|
2011-12-23 07:23:07 +07:00
|
|
|
str r8, [r0]
|
2011-09-26 04:20:49 +07:00
|
|
|
1:
|
|
|
|
b 1b
|
|
|
|
|
2013-07-10 08:56:37 +07:00
|
|
|
.align 2
|
2011-09-26 04:20:49 +07:00
|
|
|
kernel_flush:
|
|
|
|
.word v7_flush_dcache_all
|
2011-09-26 04:21:02 +07:00
|
|
|
#endif
|