spi-s3c24xx-fiq.S 2.8 KB

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