2009-11-25 18:41:04 +03:00
/ *
* Copyright ( C ) 2 0 0 9 S a s c h a H a u e r < s . h a u e r @pengutronix.de>
*
* 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 .
* /
# include < l i n u x / l i n k a g e . h >
# include < a s m / a s s e m b l e r . h >
/ *
* r8 = b i t 0 - 1 5 : t x o f f s e t , b i t 1 6 - 3 1 : t x b u f f e r s i z e
* r9 = b i t 0 - 1 5 : r x o f f s e t , b i t 1 6 - 3 1 : r x b u f f e r s i z e
* /
# define S S I _ S T X 0 0 x00
# define S S I _ S R X 0 0 x08
# define S S I _ S I S R 0 x14
# define S S I _ S I E R 0 x18
# define S S I _ S A C N T 0 x38
# define S S I _ S A C N T _ A C 9 7 E N ( 1 < < 0 )
# define S S I _ S I E R _ T F E 0 _ E N ( 1 < < 0 )
# define S S I _ S I S R _ T F E 0 ( 1 < < 0 )
# define S S I _ S I S R _ R F F 0 ( 1 < < 2 )
# define S S I _ S I E R _ R F F 0 _ E N ( 1 < < 2 )
.text
.global imx_ssi_fiq_start
.global imx_ssi_fiq_end
.global imx_ssi_fiq_base
.global imx_ssi_fiq_rx_buffer
.global imx_ssi_fiq_tx_buffer
2012-08-10 15:53:24 +04:00
/ *
* imx_ s s i _ f i q _ s t a r t i s _ i n t e n t i o n a l l y _ n o t m a r k e d a s a f u n c t i o n s y m b o l
* using E N D P R O C ( ) . i m x _ s s i _ f i q _ s t a r t a n d i m x _ s s i _ f i q _ e n d a r e u s e d t o
* mark t h e f u n c t i o n b o d y s o t h a t i t c a n b e c o p i e d t o t h e F I Q v e c t o r i n
* the v e c t o r s p a g e . i m x _ s s i _ f i q _ s t a r t s h o u l d o n l y b e c a l l e d a s t h e r e s u l t
* of a n F I Q : c a l l i n g i t d i r e c t l y w i l l n o t w o r k .
* /
2009-11-25 18:41:04 +03:00
imx_ssi_fiq_start :
2012-08-10 15:53:24 +04:00
ldr r12 , . L _ i m x _ s s i _ f i q _ b a s e
2009-11-25 18:41:04 +03:00
/* TX */
2012-08-10 15:53:24 +04:00
ldr r13 , . L _ i m x _ s s i _ f i q _ t x _ b u f f e r
2009-11-25 18:41:04 +03:00
/* shall we send? */
2012-08-10 15:53:24 +04:00
ldr r11 , [ r12 , #S S I _ S I E R ]
tst r11 , #S S I _ S I E R _ T F E 0 _ E N
2009-11-25 18:41:04 +03:00
beq 1 f
/* TX FIFO empty? */
2012-08-10 15:53:24 +04:00
ldr r11 , [ r12 , #S S I _ S I S R ]
tst r11 , #S S I _ S I S R _ T F E 0
2009-11-25 18:41:04 +03:00
beq 1 f
mov r10 , #0x10000
sub r10 , #1
and r10 , r10 , r8 / * r10 : c u r r e n t b u f f e r o f f s e t * /
2012-08-10 15:53:24 +04:00
add r13 , r13 , r10
2009-11-25 18:41:04 +03:00
2012-08-10 15:53:24 +04:00
ldrh r11 , [ r13 ]
strh r11 , [ r12 , #S S I _ S T X 0 ]
2009-11-25 18:41:04 +03:00
2012-08-10 15:53:24 +04:00
ldrh r11 , [ r13 , #2 ]
strh r11 , [ r12 , #S S I _ S T X 0 ]
2009-11-25 18:41:04 +03:00
2012-08-10 15:53:24 +04:00
ldrh r11 , [ r13 , #4 ]
strh r11 , [ r12 , #S S I _ S T X 0 ]
2009-11-25 18:41:04 +03:00
2012-08-10 15:53:24 +04:00
ldrh r11 , [ r13 , #6 ]
strh r11 , [ r12 , #S S I _ S T X 0 ]
2009-11-25 18:41:04 +03:00
add r10 , #8
2012-08-10 15:53:24 +04:00
lsr r11 , r8 , #16 / * r11 : b u f f e r s i z e * /
cmp r10 , r11
lslgt r8 , r11 , #16
2009-11-25 18:41:04 +03:00
addle r8 , #8
1 :
/* RX */
/* shall we receive? */
2012-08-10 15:53:24 +04:00
ldr r11 , [ r12 , #S S I _ S I E R ]
tst r11 , #S S I _ S I E R _ R F F 0 _ E N
2009-11-25 18:41:04 +03:00
beq 1 f
/* RX FIFO full? */
2012-08-10 15:53:24 +04:00
ldr r11 , [ r12 , #S S I _ S I S R ]
tst r11 , #S S I _ S I S R _ R F F 0
2009-11-25 18:41:04 +03:00
beq 1 f
2012-08-10 15:53:24 +04:00
ldr r13 , . L _ i m x _ s s i _ f i q _ r x _ b u f f e r
2009-11-25 18:41:04 +03:00
mov r10 , #0x10000
sub r10 , #1
and r10 , r10 , r9 / * r10 : c u r r e n t b u f f e r o f f s e t * /
2012-08-10 15:53:24 +04:00
add r13 , r13 , r10
2009-11-25 18:41:04 +03:00
2012-08-10 15:53:24 +04:00
ldr r11 , [ r12 , #S S I _ S A C N T ]
tst r11 , #S S I _ S A C N T _ A C 97 E N
2009-11-25 18:41:04 +03:00
2012-08-10 15:53:24 +04:00
ldr r11 , [ r12 , #S S I _ S R X 0 ]
strh r11 , [ r13 ]
2009-11-25 18:41:04 +03:00
2012-08-10 15:53:24 +04:00
ldr r11 , [ r12 , #S S I _ S R X 0 ]
strh r11 , [ r13 , #2 ]
2009-11-25 18:41:04 +03:00
/* dummy read to skip slot 12 */
2012-08-10 15:53:24 +04:00
ldrne r11 , [ r12 , #S S I _ S R X 0 ]
2009-11-25 18:41:04 +03:00
2012-08-10 15:53:24 +04:00
ldr r11 , [ r12 , #S S I _ S R X 0 ]
strh r11 , [ r13 , #4 ]
2009-11-25 18:41:04 +03:00
2012-08-10 15:53:24 +04:00
ldr r11 , [ r12 , #S S I _ S R X 0 ]
strh r11 , [ r13 , #6 ]
2009-11-25 18:41:04 +03:00
/* dummy read to skip slot 12 */
2012-08-10 15:53:24 +04:00
ldrne r11 , [ r12 , #S S I _ S R X 0 ]
2009-11-25 18:41:04 +03:00
add r10 , #8
2012-08-10 15:53:24 +04:00
lsr r11 , r9 , #16 / * r11 : b u f f e r s i z e * /
cmp r10 , r11
lslgt r9 , r11 , #16
2009-11-25 18:41:04 +03:00
addle r9 , #8
1 :
@ return from FIQ
subs p c , l r , #4
2010-11-16 16:13:37 +03:00
.align
2012-08-10 15:53:24 +04:00
.L_imx_ssi_fiq_base :
2009-11-25 18:41:04 +03:00
imx_ssi_fiq_base :
.word 0x0
2012-08-10 15:53:24 +04:00
.L_imx_ssi_fiq_rx_buffer :
2009-11-25 18:41:04 +03:00
imx_ssi_fiq_rx_buffer :
.word 0x0
2012-08-10 15:53:24 +04:00
.L_imx_ssi_fiq_tx_buffer :
2009-11-25 18:41:04 +03:00
imx_ssi_fiq_tx_buffer :
.word 0x0
2012-08-10 15:53:24 +04:00
.L_imx_ssi_fiq_end :
2009-11-25 18:41:04 +03:00
imx_ssi_fiq_end :