1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* linux/drivers/spi/spi_s3c24xx_fiq.S
4 * Copyright 2009 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
7 * S3C24XX SPI - FIQ pseudo-DMA transfer code
10 #include <linux/linkage.h>
11 #include <asm/assembler.h>
16 #include <linux/spi/s3c24xx-fiq.h>
18 #define S3C2410_SPTDAT (0x10)
19 #define S3C2410_SPRDAT (0x14)
23 @ entry to these routines is as follows, with the register names
24 @ defined in fiq.h so that they can be shared with the C files which
25 @ setup the calling registers.
27 @ fiq_rirq The base of the IRQ registers to find S3C2410_SRCPND
28 @ fiq_rtmp Temporary register to hold tx/rx data
29 @ fiq_rspi The base of the SPI register block
30 @ fiq_rtx The tx buffer pointer
31 @ fiq_rrx The rx buffer pointer
32 @ fiq_rcount The number of bytes to move
34 @ each entry starts with a word entry of how long it is
35 @ and an offset to the irq acknowledgment word
37 ENTRY(s3c24xx_spi_fiq_rx)
39 .word fiq_rx_end - fiq_rx_start
40 .word fiq_rx_irq_ack - fiq_rx_start
42 ldr fiq_rtmp, fiq_rx_irq_ack
43 str fiq_rtmp, [ fiq_rirq, # S3C2410_SRCPND - S3C24XX_VA_IRQ ]
45 ldrb fiq_rtmp, [ fiq_rspi, # S3C2410_SPRDAT ]
46 strb fiq_rtmp, [ fiq_rrx ], #1
49 strb fiq_rtmp, [ fiq_rspi, # S3C2410_SPTDAT ]
51 subs fiq_rcount, fiq_rcount, #1
52 subnes pc, lr, #4 @@ return, still have work to do
54 @@ set IRQ controller so that next op will trigger IRQ
56 str fiq_rtmp, [ fiq_rirq, # S3C2410_INTMOD - S3C24XX_VA_IRQ ]
63 ENTRY(s3c24xx_spi_fiq_txrx)
65 .word fiq_txrx_end - fiq_txrx_start
66 .word fiq_txrx_irq_ack - fiq_txrx_start
69 ldrb fiq_rtmp, [ fiq_rspi, # S3C2410_SPRDAT ]
70 strb fiq_rtmp, [ fiq_rrx ], #1
72 ldr fiq_rtmp, fiq_txrx_irq_ack
73 str fiq_rtmp, [ fiq_rirq, # S3C2410_SRCPND - S3C24XX_VA_IRQ ]
75 ldrb fiq_rtmp, [ fiq_rtx ], #1
76 strb fiq_rtmp, [ fiq_rspi, # S3C2410_SPTDAT ]
78 subs fiq_rcount, fiq_rcount, #1
79 subnes pc, lr, #4 @@ return, still have work to do
82 str fiq_rtmp, [ fiq_rirq, # S3C2410_INTMOD - S3C24XX_VA_IRQ ]
90 ENTRY(s3c24xx_spi_fiq_tx)
92 .word fiq_tx_end - fiq_tx_start
93 .word fiq_tx_irq_ack - fiq_tx_start
95 ldrb fiq_rtmp, [ fiq_rspi, # S3C2410_SPRDAT ]
97 ldr fiq_rtmp, fiq_tx_irq_ack
98 str fiq_rtmp, [ fiq_rirq, # S3C2410_SRCPND - S3C24XX_VA_IRQ ]
100 ldrb fiq_rtmp, [ fiq_rtx ], #1
101 strb fiq_rtmp, [ fiq_rspi, # S3C2410_SPTDAT ]
103 subs fiq_rcount, fiq_rcount, #1
104 subnes pc, lr, #4 @@ return, still have work to do
107 str fiq_rtmp, [ fiq_rirq, # S3C2410_INTMOD - S3C24XX_VA_IRQ ]