Uwe Kleine-König | 5886269 | 2007-05-09 07:51:49 +0200 | [diff] [blame] | 1 | /* linux/arch/arm/mach-s3c2410/sleep.S |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | * |
| 3 | * Copyright (c) 2004 Simtec Electronics |
| 4 | * Ben Dooks <ben@simtec.co.uk> |
| 5 | * |
| 6 | * S3C2410 Power Manager (Suspend-To-RAM) support |
| 7 | * |
| 8 | * Based on PXA/SA1100 sleep code by: |
| 9 | * Nicolas Pitre, (c) 2002 Monta Vista Software Inc |
| 10 | * Cliff Brake, (c) 2001 |
| 11 | * |
| 12 | * This program is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License as published by |
| 14 | * the Free Software Foundation; either version 2 of the License, or |
| 15 | * (at your option) any later version. |
| 16 | * |
| 17 | * This program is distributed in the hope that it will be useful, |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | * GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License |
| 23 | * along with this program; if not, write to the Free Software |
| 24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 25 | */ |
| 26 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | #include <linux/linkage.h> |
Tushar Behera | 334a1c7 | 2014-02-14 10:32:45 +0900 | [diff] [blame] | 28 | #include <linux/serial_s3c.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | #include <asm/assembler.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 30 | #include <mach/hardware.h> |
| 31 | #include <mach/map.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 33 | #include <mach/regs-gpio.h> |
| 34 | #include <mach/regs-clock.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | |
Kukjin Kim | 37c3adc | 2013-02-03 17:00:11 -0800 | [diff] [blame] | 36 | #include "regs-mem.h" |
| 37 | |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 38 | /* s3c2410_cpu_suspend |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | * |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 40 | * put the cpu into sleep mode |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | */ |
| 42 | |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 43 | ENTRY(s3c2410_cpu_suspend) |
| 44 | @@ prepare cpu to sleep |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 46 | ldr r4, =S3C2410_REFRESH |
| 47 | ldr r5, =S3C24XX_MISCCR |
| 48 | ldr r6, =S3C2410_CLKCON |
Arnd Bergmann | 2815774 | 2013-01-08 21:58:31 +0000 | [diff] [blame] | 49 | ldr r7, [r4] @ get REFRESH (and ensure in TLB) |
| 50 | ldr r8, [r5] @ get MISCCR (and ensure in TLB) |
| 51 | ldr r9, [r6] @ get CLKCON (and ensure in TLB) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 53 | orr r7, r7, #S3C2410_REFRESH_SELF @ SDRAM sleep command |
| 54 | orr r8, r8, #S3C2410_MISCCR_SDSLEEP @ SDRAM power-down signals |
| 55 | orr r9, r9, #S3C2410_CLKCON_POWER @ power down command |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 57 | teq pc, #0 @ first as a trial-run to load cache |
| 58 | bl s3c2410_do_sleep |
| 59 | teq r0, r0 @ now do it for real |
| 60 | b s3c2410_do_sleep @ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 62 | @@ align next bit of code to cache line |
Matt Reimer | 4b210fa | 2007-02-12 21:00:32 +0100 | [diff] [blame] | 63 | .align 5 |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 64 | s3c2410_do_sleep: |
Arnd Bergmann | 2815774 | 2013-01-08 21:58:31 +0000 | [diff] [blame] | 65 | streq r7, [r4] @ SDRAM sleep command |
| 66 | streq r8, [r5] @ SDRAM power-down config |
| 67 | streq r9, [r6] @ CPU sleep |
Ben Dooks | a21765a | 2007-02-11 18:31:01 +0100 | [diff] [blame] | 68 | 1: beq 1b |
Russell King | 6ebbf2c | 2014-06-30 16:29:12 +0100 | [diff] [blame] | 69 | ret lr |