2017-12-25 20:54:32 +01:00
/* SPDX-License-Identifier: GPL-2.0+ */
/ *
2007-02-11 18:31:01 +01:00
* Copyright ( c ) 2 0 0 4 S i m t e c E l e c t r o n i c s
* Ben D o o k s < b e n @simtec.co.uk>
*
* S3 C 2 4 1 0 P o w e r M a n a g e r ( S u s p e n d - T o - R A M ) s u p p o r t
*
* Based o n P X A / S A 1 1 0 0 s l e e p c o d e b y :
* Nicolas P i t r e , ( c ) 2 0 0 2 M o n t a V i s t a S o f t w a r e I n c
* Cliff B r a k e , ( c ) 2 0 0 1
2017-12-25 20:54:32 +01:00
* /
2007-02-11 18:31:01 +01:00
# include < l i n u x / l i n k a g e . h >
2014-02-14 10:32:45 +09:00
# include < l i n u x / s e r i a l _ s3 c . h >
2007-02-11 18:31:01 +01:00
# include < a s m / a s s e m b l e r . h >
2008-08-05 16:14:15 +01:00
# include < m a c h / h a r d w a r e . h >
# include < m a c h / m a p . h >
2007-02-11 18:31:01 +01:00
2008-08-05 16:14:15 +01:00
# include < m a c h / r e g s - g p i o . h >
# include < m a c h / r e g s - c l o c k . h >
2007-02-11 18:31:01 +01:00
2017-07-17 07:48:09 +02:00
/ *
* S3 C 2 4 X X _ D E B U G _ R E S U M E i s d a n g e r o u s i f y o u r b o o t l o a d e r d o e s n o t
2007-02-11 18:31:01 +01:00
* reset t h e U A R T c o n f i g u r a t i o n , o n l y e n a b l e i f y o u r e a l l y n e e d t h i s !
2017-07-17 07:48:09 +02:00
* /
/ / # define S 3 C 2 4 X X _ D E B U G _ R E S U M E
2007-02-11 18:31:01 +01:00
.text
2007-09-30 09:59:15 +01:00
/ * sleep m a g i c , t o a l l o w t h e b o o t l o a d e r t o c h e c k f o r a n v a l i d
* image t o r e s u m e t o . M u s t b e t h e f i r s t w o r d b e f o r e t h e
2008-12-12 00:24:19 +00:00
* s3 c _ c p u _ r e s u m e e n t r y .
2007-09-30 09:59:15 +01:00
* /
.word 0x2bedf00d
2008-12-12 00:24:19 +00:00
/ * s3 c _ c p u _ r e s u m e
2007-02-11 18:31:01 +01:00
*
* resume c o d e e n t r y f o r b o o t l o a d e r t o c a l l
* /
2008-12-12 00:24:19 +00:00
ENTRY( s3 c _ c p u _ r e s u m e )
2007-02-11 18:31:01 +01:00
mov r0 , #P S R _ I _ B I T | P S R _ F _ B I T | S V C _ M O D E
msr c p s r _ c , r0
@@ load UART to allow us to print the two characters for
@@ resume debug
mov r2 , #S 3 C 2 4 X X _ P A _ U A R T & 0 x f f00 0 0 0 0
orr r2 , r2 , #S 3 C 2 4 X X _ P A _ U A R T & 0 x f f00 0
# if 0
/* SMDK2440 LED set */
mov r14 , #S 3 C 2 4 X X _ P A _ G P I O
ldr r12 , [ r14 , #0x54 ]
bic r12 , r12 , #3 < < 4
orr r12 , r12 , #1 < < 7
str r12 , [ r14 , #0x54 ]
# endif
2017-07-17 07:48:09 +02:00
# ifdef S 3 C 2 4 X X _ D E B U G _ R E S U M E
2007-02-11 18:31:01 +01:00
mov r3 , #' L '
strb r3 , [ r2 , #S 3 C 2 4 1 0 _ U T X H ]
1001 :
ldrb r14 , [ r3 , #S 3 C 2 4 1 0 _ U T R S T A T ]
tst r14 , #S 3 C 2 4 1 0 _ U T R S T A T _ T X E
beq 1 0 0 1 b
2017-07-17 07:48:09 +02:00
# endif / * S 3 C 2 4 X X _ D E B U G _ R E S U M E * /
2007-02-11 18:31:01 +01:00
2011-02-06 17:39:31 +00:00
b c p u _ r e s u m e