2019-06-04 11:11:33 +03:00
/* SPDX-License-Identifier: GPL-2.0-only */
2009-12-15 09:20:24 +03:00
/ * linux/ d r i v e r s / s p i / s p i _ s3 c24 x x _ f i q . S
*
* Copyright 2 0 0 9 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 X X S P I - F I Q p s e u d o - D M A t r a n s f e r c o d e
* /
# 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 >
# include < m a c h / m a p . h >
# include < m a c h / r e g s - i r q . h >
# include < p l a t / r e g s - s p i . h >
2011-06-06 11:16:30 +04:00
# include " s p i - s3 c24 x x - f i q . h "
2009-12-15 09:20:24 +03:00
.text
@ entry to these routines is as follows, with the register names
@ defined in fiq.h so that they can be shared with the C files which
@ setup the calling registers.
@
@ fiq_rirq The base of the IRQ registers to find S3C2410_SRCPND
@ fiq_rtmp Temporary register to hold tx/rx data
@ fiq_rspi The base of the SPI register block
@ fiq_rtx The tx buffer pointer
@ fiq_rrx The rx buffer pointer
@ fiq_rcount The number of bytes to move
@ each entry starts with a word entry of how long it is
@ and an offset to the irq acknowledgment word
ENTRY( s3 c24 x x _ s p i _ f i q _ r x )
s3c24xx_spi_fix_rx :
.word fiq_rx_end - fiq_ r x _ s t a r t
.word fiq_rx_irq_ack - fiq_ r x _ s t a r t
fiq_rx_start :
ldr f i q _ r t m p , f i q _ r x _ i r q _ a c k
str f i q _ r t m p , [ f i q _ r i r q , # S 3 C 2 4 1 0 _ S R C P N D - S 3 C 2 4 X X _ V A _ I R Q ]
ldrb f i q _ r t m p , [ f i q _ r s p i , # S 3 C 2 4 1 0 _ S P R D A T ]
strb f i q _ r t m p , [ f i q _ r r x ] , #1
mov f i q _ r t m p , #0xff
strb f i q _ r t m p , [ f i q _ r s p i , # S 3 C 2 4 1 0 _ S P T D A T ]
subs f i q _ r c o u n t , f i q _ r c o u n t , #1
subnes p c , l r , #4 @@ return, still have work to do
@@ set IRQ controller so that next op will trigger IRQ
mov f i q _ r t m p , #0
str f i q _ r t m p , [ f i q _ r i r q , # S 3 C 2 4 1 0 _ I N T M O D - S 3 C 2 4 X X _ V A _ I R Q ]
subs p c , l r , #4
fiq_rx_irq_ack :
.word 0
fiq_rx_end :
ENTRY( s3 c24 x x _ s p i _ f i q _ t x r x )
s3c24xx_spi_fiq_txrx :
.word fiq_txrx_end - fiq_ t x r x _ s t a r t
.word fiq_txrx_irq_ack - fiq_ t x r x _ s t a r t
fiq_txrx_start :
ldrb f i q _ r t m p , [ f i q _ r s p i , # S 3 C 2 4 1 0 _ S P R D A T ]
strb f i q _ r t m p , [ f i q _ r r x ] , #1
ldr f i q _ r t m p , f i q _ t x r x _ i r q _ a c k
str f i q _ r t m p , [ f i q _ r i r q , # S 3 C 2 4 1 0 _ S R C P N D - S 3 C 2 4 X X _ V A _ I R Q ]
ldrb f i q _ r t m p , [ f i q _ r t x ] , #1
strb f i q _ r t m p , [ f i q _ r s p i , # S 3 C 2 4 1 0 _ S P T D A T ]
subs f i q _ r c o u n t , f i q _ r c o u n t , #1
subnes p c , l r , #4 @@ return, still have work to do
mov f i q _ r t m p , #0
str f i q _ r t m p , [ f i q _ r i r q , # S 3 C 2 4 1 0 _ I N T M O D - S 3 C 2 4 X X _ V A _ I R Q ]
subs p c , l r , #4
fiq_txrx_irq_ack :
.word 0
fiq_txrx_end :
ENTRY( s3 c24 x x _ s p i _ f i q _ t x )
s3c24xx_spi_fix_tx :
.word fiq_tx_end - fiq_ t x _ s t a r t
.word fiq_tx_irq_ack - fiq_ t x _ s t a r t
fiq_tx_start :
ldrb f i q _ r t m p , [ f i q _ r s p i , # S 3 C 2 4 1 0 _ S P R D A T ]
ldr f i q _ r t m p , f i q _ t x _ i r q _ a c k
str f i q _ r t m p , [ f i q _ r i r q , # S 3 C 2 4 1 0 _ S R C P N D - S 3 C 2 4 X X _ V A _ I R Q ]
ldrb f i q _ r t m p , [ f i q _ r t x ] , #1
strb f i q _ r t m p , [ f i q _ r s p i , # S 3 C 2 4 1 0 _ S P T D A T ]
subs f i q _ r c o u n t , f i q _ r c o u n t , #1
subnes p c , l r , #4 @@ return, still have work to do
mov f i q _ r t m p , #0
str f i q _ r t m p , [ f i q _ r i r q , # S 3 C 2 4 1 0 _ I N T M O D - S 3 C 2 4 X X _ V A _ I R Q ]
subs p c , l r , #4
fiq_tx_irq_ack :
.word 0
fiq_tx_end :
.end