Blame view

arch/arm/mach-shmobile/sleep-sh7372.S 2.55 KB
97991657b   Magnus Damm   ARM: mach-shmobil...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
  /*
   * 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>
06b841666   Magnus Damm   ARM: mach-shmobil...
33
34
  #include <linux/init.h>
  #include <asm/memory.h>
97991657b   Magnus Damm   ARM: mach-shmobil...
35
  #include <asm/assembler.h>
a0089bd61   Magnus Damm   ARM: mach-shmobil...
36
  #if defined(CONFIG_SUSPEND) || defined(CONFIG_CPU_IDLE)
97991657b   Magnus Damm   ARM: mach-shmobil...
37
38
  	.align	12
  	.text
f7dadb379   Magnus Damm   PM / shmobile: Ad...
39
40
  	.global sh7372_resume_core_standby_sysc
  sh7372_resume_core_standby_sysc:
06b841666   Magnus Damm   ARM: mach-shmobil...
41
42
  	ldr     pc, 1f
  1:	.long   cpu_resume - PAGE_OFFSET + PLAT_PHYS_OFFSET
cf33835c5   Magnus Damm   ARM: mach-shmobil...
43

f7dadb379   Magnus Damm   PM / shmobile: Ad...
44
45
46
47
48
49
  #define SPDCR 0xe6180008
  
  	/* A3SM & A4S power down */
  	.global	sh7372_do_idle_sysc
  sh7372_do_idle_sysc:
  	mov	r8, r0 /* sleep mode passed in r0 */
cf33835c5   Magnus Damm   ARM: mach-shmobil...
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
  	/*
  	 * 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
  
  	/* 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
  
  	/*
  	 * Invalidate data cache again.
  	 */
  	ldr	r1, kernel_flush
  	blx	r1
  	/*
  	 * 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
f7dadb379   Magnus Damm   PM / shmobile: Ad...
85
  	/* SYSC power down */
cf33835c5   Magnus Damm   ARM: mach-shmobil...
86
  	ldr     r0, =SPDCR
f7dadb379   Magnus Damm   PM / shmobile: Ad...
87
  	str     r8, [r0]
cf33835c5   Magnus Damm   ARM: mach-shmobil...
88
89
90
91
92
  1:
  	b      1b
  
  kernel_flush:
  	.word v7_flush_dcache_all
a0089bd61   Magnus Damm   ARM: mach-shmobil...
93
  #endif