2008-08-05 16:14:15 +01:00
/ * arch/ a r m / m a c h - s3 c24 1 0 / i n c l u d e / m a c h / d e b u g - m a c r o . S
2005-04-16 15:20:36 -07:00
*
* Debugging m a c r o i n c l u d e h e a d e r
*
* Copyright ( C ) 1 9 9 4 - 1 9 9 9 R u s s e l l K i n g
* Copyright ( C ) 2 0 0 5 S i m t e c E l e c t r o n i c s
*
* Moved f r o m l i n u x / a r c h / a r m / k e r n e l / d e b u g . S b y B e n D o o k s
*
* This p r o g r a m i s f r e e s o f t w a r e ; you can redistribute it and/or modify
* it u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e v e r s i o n 2 a s
* published b y t h e F r e e S o f t w a r e F o u n d a t i o n .
* /
2008-08-05 16:14:15 +01:00
# include < m a c h / m a p . h >
# include < m a c h / r e g s - g p i o . h >
2007-07-22 16:08:48 +01:00
# include < a s m / p l a t - s3 c / r e g s - s e r i a l . h >
2005-04-16 15:20:36 -07:00
# define S 3 C 2 4 1 0 _ U A R T 1 _ O F F ( 0 x40 0 0 )
# define S H I F T _ 2 4 4 0 T X F ( 1 4 - 9 )
2007-07-22 16:08:48 +01:00
.macro addruart, r x
2005-04-16 15:20:36 -07:00
mrc p15 , 0 , \ r x , c1 , c0
tst \ r x , #1
2006-01-26 15:20:50 +00:00
ldreq \ r x , = S 3 C 2 4 X X _ P A _ U A R T
2005-04-16 15:20:36 -07:00
ldrne \ r x , = S 3 C 2 4 X X _ V A _ U A R T
2007-07-22 16:12:04 +01:00
# if C O N F I G _ D E B U G _ S 3 C _ U A R T ! = 0
add \ r x , \ r x , #( S 3 C 2 4 1 0 _ U A R T 1 _ O F F * C O N F I G _ D E B U G _ S 3 C _ U A R T )
2005-04-16 15:20:36 -07:00
# endif
2007-07-22 16:08:48 +01:00
.endm
2005-04-16 15:20:36 -07:00
2007-07-22 16:10:23 +01:00
.macro fifo_full_s3c24xx rd, r x
2006-06-24 21:21:27 +01:00
@ check for arm920 vs arm926. currently assume all arm926
@ devices have an 64 byte FIFO identical to the s3c2440
mrc p15 , 0 , \ r d , c0 , c0
and \ r d , \ r d , #0xff0
teq \ r d , #0x260
beq 1 0 0 4 f
2005-04-16 15:20:36 -07:00
mrc p15 , 0 , \ r d , c1 , c0
tst \ r d , #1
2006-01-26 15:20:50 +00:00
addeq \ r d , \ r x , #( S 3 C 2 4 X X _ P A _ G P I O - S 3 C 2 4 X X _ P A _ U A R T )
2005-04-16 15:20:36 -07:00
addne \ r d , \ r x , #( S 3 C 2 4 X X _ V A _ G P I O - S 3 C 2 4 X X _ V A _ U A R T )
bic \ r d , \ r d , #0xff000
ldr \ r d , [ \ r d , # S 3 C 2 4 1 0 _ G S T A T U S 1 - S 3 C 2 4 1 0 _ G P I O R E G ( 0 ) ]
and \ r d , \ r d , #0x00ff0000
teq \ r d , #0x00440000 @ is it 2440?
2006-06-24 21:21:27 +01:00
1004 :
2005-04-16 15:20:36 -07:00
ldr \ r d , [ \ r x , # S 3 C 2 4 1 0 _ U F S T A T ]
moveq \ r d , \ r d , l s r #S H I F T _ 2440 T X F
tst \ r d , #S 3 C 2 4 1 0 _ U F S T A T _ T X F U L L
2007-07-22 16:08:48 +01:00
.endm
2005-04-16 15:20:36 -07:00
2007-07-22 16:10:23 +01:00
.macro fifo_full_s3c2410 rd, r x
ldr \ r d , [ \ r x , # S 3 C 2 4 1 0 _ U F S T A T ]
tst \ r d , #S 3 C 2 4 1 0 _ U F S T A T _ T X F U L L
.endm
/* fifo level reading */
.macro fifo_level_s3c24xx rd, r x
2007-07-22 16:15:44 +01:00
@ check for arm920 vs arm926. currently assume all arm926
@ devices have an 64 byte FIFO identical to the s3c2440
mrc p15 , 0 , \ r d , c0 , c0
and \ r d , \ r d , #0xff0
teq \ r d , #0x260
beq 1 0 0 0 0 f
2005-04-16 15:20:36 -07:00
mrc p15 , 0 , \ r d , c1 , c0
tst \ r d , #1
2006-01-26 15:20:50 +00:00
addeq \ r d , \ r x , #( S 3 C 2 4 X X _ P A _ G P I O - S 3 C 2 4 X X _ P A _ U A R T )
2005-04-16 15:20:36 -07:00
addne \ r d , \ r x , #( S 3 C 2 4 X X _ V A _ G P I O - S 3 C 2 4 X X _ V A _ U A R T )
bic \ r d , \ r d , #0xff000
ldr \ r d , [ \ r d , # S 3 C 2 4 1 0 _ G S T A T U S 1 - S 3 C 2 4 1 0 _ G P I O R E G ( 0 ) ]
and \ r d , \ r d , #0x00ff0000
teq \ r d , #0x00440000 @ is it 2440?
2007-07-22 16:15:44 +01:00
10000 :
2005-04-16 15:20:36 -07:00
ldr \ r d , [ \ r x , # S 3 C 2 4 1 0 _ U F S T A T ]
andne \ r d , \ r d , #S 3 C 2 4 1 0 _ U F S T A T _ T X M A S K
andeq \ r d , \ r d , #S 3 C 2 4 4 0 _ U F S T A T _ T X M A S K
2007-07-22 16:08:48 +01:00
.endm
2007-07-22 16:10:23 +01:00
.macro fifo_level_s3c2410 rd, r x
ldr \ r d , [ \ r x , # S 3 C 2 4 1 0 _ U F S T A T ]
and \ r d , \ r d , #S 3 C 2 4 1 0 _ U F S T A T _ T X M A S K
.endm
/ * Select t h e c o r r e c t i m p l e m e n t a t i o n d e p e n d i n g o n t h e c o n f i g u r a t i o n . T h e
* S3 C 2 4 4 0 w i l l g e t s e l e c t e d b y d e f a u l t , a s t h e s e a r e t h e m o s t w i d e l y
* used v a r i a n t s o f t h e s e
* /
# if d e f i n e d ( C O N F I G _ C P U _ L L S E R I A L _ S 3 C 2 4 1 0 _ O N L Y )
# define f i f o _ f u l l f i f o _ f u l l _ s3 c24 1 0
# define f i f o _ l e v e l f i f o _ l e v e l _ s3 c24 1 0
# elif ! d e f i n e d ( C O N F I G _ C P U _ L L S E R I A L _ S 3 C 2 4 4 0 _ O N L Y )
# define f i f o _ f u l l f i f o _ f u l l _ s3 c24 x x
# define f i f o _ l e v e l f i f o _ l e v e l _ s3 c24 x x
# endif
/* include the reset of the code which will do the work */
# include < a s m / p l a t - s3 c / d e b u g - m a c r o . S >