irq-s3c24xx-fiq.S 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 <[email protected]>
  6. *
  7. * S3C24XX SPI - FIQ pseudo-DMA transfer code
  8. */
  9. #include <linux/linkage.h>
  10. #include <asm/assembler.h>
  11. #include "map.h"
  12. #include "regs-irq.h"
  13. #include <linux/spi/s3c24xx-fiq.h>
  14. #define S3C2410_SPTDAT (0x10)
  15. #define S3C2410_SPRDAT (0x14)
  16. .text
  17. @ entry to these routines is as follows, with the register names
  18. @ defined in fiq.h so that they can be shared with the C files which
  19. @ setup the calling registers.
  20. @
  21. @ fiq_rirq The base of the IRQ registers to find S3C2410_SRCPND
  22. @ fiq_rtmp Temporary register to hold tx/rx data
  23. @ fiq_rspi The base of the SPI register block
  24. @ fiq_rtx The tx buffer pointer
  25. @ fiq_rrx The rx buffer pointer
  26. @ fiq_rcount The number of bytes to move
  27. @ each entry starts with a word entry of how long it is
  28. @ and an offset to the irq acknowledgment word
  29. ENTRY(s3c24xx_spi_fiq_rx)
  30. .word fiq_rx_end - fiq_rx_start
  31. .word fiq_rx_irq_ack - fiq_rx_start
  32. fiq_rx_start:
  33. ldr fiq_rtmp, fiq_rx_irq_ack
  34. str fiq_rtmp, [ fiq_rirq, # S3C2410_SRCPND - S3C24XX_VA_IRQ ]
  35. ldrb fiq_rtmp, [ fiq_rspi, # S3C2410_SPRDAT ]
  36. strb fiq_rtmp, [ fiq_rrx ], #1
  37. mov fiq_rtmp, #0xff
  38. strb fiq_rtmp, [ fiq_rspi, # S3C2410_SPTDAT ]
  39. subs fiq_rcount, fiq_rcount, #1
  40. subsne pc, lr, #4 @@ return, still have work to do
  41. @@ set IRQ controller so that next op will trigger IRQ
  42. mov fiq_rtmp, #0
  43. str fiq_rtmp, [ fiq_rirq, # S3C2410_INTMOD - S3C24XX_VA_IRQ ]
  44. subs pc, lr, #4
  45. fiq_rx_irq_ack:
  46. .word 0
  47. fiq_rx_end:
  48. ENTRY(s3c24xx_spi_fiq_txrx)
  49. .word fiq_txrx_end - fiq_txrx_start
  50. .word fiq_txrx_irq_ack - fiq_txrx_start
  51. fiq_txrx_start:
  52. ldrb fiq_rtmp, [ fiq_rspi, # S3C2410_SPRDAT ]
  53. strb fiq_rtmp, [ fiq_rrx ], #1
  54. ldr fiq_rtmp, fiq_txrx_irq_ack
  55. str fiq_rtmp, [ fiq_rirq, # S3C2410_SRCPND - S3C24XX_VA_IRQ ]
  56. ldrb fiq_rtmp, [ fiq_rtx ], #1
  57. strb fiq_rtmp, [ fiq_rspi, # S3C2410_SPTDAT ]
  58. subs fiq_rcount, fiq_rcount, #1
  59. subsne pc, lr, #4 @@ return, still have work to do
  60. mov fiq_rtmp, #0
  61. str fiq_rtmp, [ fiq_rirq, # S3C2410_INTMOD - S3C24XX_VA_IRQ ]
  62. subs pc, lr, #4
  63. fiq_txrx_irq_ack:
  64. .word 0
  65. fiq_txrx_end:
  66. ENTRY(s3c24xx_spi_fiq_tx)
  67. .word fiq_tx_end - fiq_tx_start
  68. .word fiq_tx_irq_ack - fiq_tx_start
  69. fiq_tx_start:
  70. ldrb fiq_rtmp, [ fiq_rspi, # S3C2410_SPRDAT ]
  71. ldr fiq_rtmp, fiq_tx_irq_ack
  72. str fiq_rtmp, [ fiq_rirq, # S3C2410_SRCPND - S3C24XX_VA_IRQ ]
  73. ldrb fiq_rtmp, [ fiq_rtx ], #1
  74. strb fiq_rtmp, [ fiq_rspi, # S3C2410_SPTDAT ]
  75. subs fiq_rcount, fiq_rcount, #1
  76. subsne pc, lr, #4 @@ return, still have work to do
  77. mov fiq_rtmp, #0
  78. str fiq_rtmp, [ fiq_rirq, # S3C2410_INTMOD - S3C24XX_VA_IRQ ]
  79. subs pc, lr, #4
  80. fiq_tx_irq_ack:
  81. .word 0
  82. fiq_tx_end:
  83. .end