2009-11-25 16:41:04 +01: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
imx_ssi_fiq_start :
ldr r12 , i m x _ s s i _ f i q _ b a s e
/* TX */
ldr r11 , i m x _ s s i _ f i q _ t x _ b u f f e r
/* shall we send? */
ldr r13 , [ r12 , #S S I _ S I E R ]
tst r13 , #S S I _ S I E R _ T F E 0 _ E N
beq 1 f
/* TX FIFO empty? */
ldr r13 , [ r12 , #S S I _ S I S R ]
tst r13 , #S S I _ S I S R _ T F E 0
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 * /
add r11 , r11 , r10
ldrh r13 , [ r11 ]
strh r13 , [ r12 , #S S I _ S T X 0 ]
ldrh r13 , [ r11 , #2 ]
strh r13 , [ r12 , #S S I _ S T X 0 ]
ldrh r13 , [ r11 , #4 ]
strh r13 , [ r12 , #S S I _ S T X 0 ]
ldrh r13 , [ r11 , #6 ]
strh r13 , [ r12 , #S S I _ S T X 0 ]
add r10 , #8
lsr r13 , r8 , #16 / * r13 : b u f f e r s i z e * /
cmp r10 , r13
lslgt r8 , r13 , #16
addle r8 , #8
1 :
/* RX */
/* shall we receive? */
ldr r13 , [ r12 , #S S I _ S I E R ]
tst r13 , #S S I _ S I E R _ R F F 0 _ E N
beq 1 f
/* RX FIFO full? */
ldr r13 , [ r12 , #S S I _ S I S R ]
tst r13 , #S S I _ S I S R _ R F F 0
beq 1 f
ldr r11 , i m x _ s s i _ f i q _ r x _ b u f f e r
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 * /
add r11 , r11 , r10
ldr r13 , [ r12 , #S S I _ S A C N T ]
tst r13 , #S S I _ S A C N T _ A C 97 E N
ldr r13 , [ r12 , #S S I _ S R X 0 ]
strh r13 , [ r11 ]
ldr r13 , [ r12 , #S S I _ S R X 0 ]
strh r13 , [ r11 , #2 ]
/* dummy read to skip slot 12 */
ldrne r13 , [ r12 , #S S I _ S R X 0 ]
ldr r13 , [ r12 , #S S I _ S R X 0 ]
strh r13 , [ r11 , #4 ]
ldr r13 , [ r12 , #S S I _ S R X 0 ]
strh r13 , [ r11 , #6 ]
/* dummy read to skip slot 12 */
ldrne r13 , [ r12 , #S S I _ S R X 0 ]
add r10 , #8
lsr r13 , r9 , #16 / * r13 : b u f f e r s i z e * /
cmp r10 , r13
lslgt r9 , r13 , #16
addle r9 , #8
1 :
@ return from FIQ
subs p c , l r , #4
2010-11-16 13:13:37 +00:00
.align
2009-11-25 16:41:04 +01:00
imx_ssi_fiq_base :
.word 0x0
imx_ssi_fiq_rx_buffer :
.word 0x0
imx_ssi_fiq_tx_buffer :
.word 0x0
imx_ssi_fiq_end :