1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* linux/drivers/spi/spi_s3c24xx_fiq.S 3 * 4 * Copyright 2009 Simtec Electronics 5 * Ben Dooks <ben@simtec.co.uk> 6 * 7 * S3C24XX SPI - FIQ pseudo-DMA transfer code 8*/ 9 10#include <linux/linkage.h> 11#include <asm/assembler.h> 12 13#include "map.h" 14#include "regs-irq.h" 15 16#include <linux/spi/s3c24xx-fiq.h> 17 18#define S3C2410_SPTDAT (0x10) 19#define S3C2410_SPRDAT (0x14) 20 21 .text 22 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. 26 @ 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 33 34 @ each entry starts with a word entry of how long it is 35 @ and an offset to the irq acknowledgment word 36 37ENTRY(s3c24xx_spi_fiq_rx) 38 .word fiq_rx_end - fiq_rx_start 39 .word fiq_rx_irq_ack - fiq_rx_start 40fiq_rx_start: 41 ldr fiq_rtmp, fiq_rx_irq_ack 42 str fiq_rtmp, [ fiq_rirq, # S3C2410_SRCPND - S3C24XX_VA_IRQ ] 43 44 ldrb fiq_rtmp, [ fiq_rspi, # S3C2410_SPRDAT ] 45 strb fiq_rtmp, [ fiq_rrx ], #1 46 47 mov fiq_rtmp, #0xff 48 strb fiq_rtmp, [ fiq_rspi, # S3C2410_SPTDAT ] 49 50 subs fiq_rcount, fiq_rcount, #1 51 subsne pc, lr, #4 @@ return, still have work to do 52 53 @@ set IRQ controller so that next op will trigger IRQ 54 mov fiq_rtmp, #0 55 str fiq_rtmp, [ fiq_rirq, # S3C2410_INTMOD - S3C24XX_VA_IRQ ] 56 subs pc, lr, #4 57 58fiq_rx_irq_ack: 59 .word 0 60fiq_rx_end: 61 62ENTRY(s3c24xx_spi_fiq_txrx) 63 .word fiq_txrx_end - fiq_txrx_start 64 .word fiq_txrx_irq_ack - fiq_txrx_start 65fiq_txrx_start: 66 67 ldrb fiq_rtmp, [ fiq_rspi, # S3C2410_SPRDAT ] 68 strb fiq_rtmp, [ fiq_rrx ], #1 69 70 ldr fiq_rtmp, fiq_txrx_irq_ack 71 str fiq_rtmp, [ fiq_rirq, # S3C2410_SRCPND - S3C24XX_VA_IRQ ] 72 73 ldrb fiq_rtmp, [ fiq_rtx ], #1 74 strb fiq_rtmp, [ fiq_rspi, # S3C2410_SPTDAT ] 75 76 subs fiq_rcount, fiq_rcount, #1 77 subsne pc, lr, #4 @@ return, still have work to do 78 79 mov fiq_rtmp, #0 80 str fiq_rtmp, [ fiq_rirq, # S3C2410_INTMOD - S3C24XX_VA_IRQ ] 81 subs pc, lr, #4 82 83fiq_txrx_irq_ack: 84 .word 0 85 86fiq_txrx_end: 87 88ENTRY(s3c24xx_spi_fiq_tx) 89 .word fiq_tx_end - fiq_tx_start 90 .word fiq_tx_irq_ack - fiq_tx_start 91fiq_tx_start: 92 ldrb fiq_rtmp, [ fiq_rspi, # S3C2410_SPRDAT ] 93 94 ldr fiq_rtmp, fiq_tx_irq_ack 95 str fiq_rtmp, [ fiq_rirq, # S3C2410_SRCPND - S3C24XX_VA_IRQ ] 96 97 ldrb fiq_rtmp, [ fiq_rtx ], #1 98 strb fiq_rtmp, [ fiq_rspi, # S3C2410_SPTDAT ] 99 100 subs fiq_rcount, fiq_rcount, #1 101 subsne pc, lr, #4 @@ return, still have work to do 102 103 mov fiq_rtmp, #0 104 str fiq_rtmp, [ fiq_rirq, # S3C2410_INTMOD - S3C24XX_VA_IRQ ] 105 subs pc, lr, #4 106 107fiq_tx_irq_ack: 108 .word 0 109 110fiq_tx_end: 111 112 .end 113