spi_s3c24xx_fiq.S 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. s3c24xx_spi_fix_rx:
  33. .word fiq_rx_end - fiq_rx_start
  34. .word fiq_rx_irq_ack - fiq_rx_start
  35. fiq_rx_start:
  36. ldr fiq_rtmp, fiq_rx_irq_ack
  37. str fiq_rtmp, [ fiq_rirq, # S3C2410_SRCPND - S3C24XX_VA_IRQ ]
  38. ldrb fiq_rtmp, [ fiq_rspi, # S3C2410_SPRDAT ]
  39. strb fiq_rtmp, [ fiq_rrx ], #1
  40. mov fiq_rtmp, #0xff
  41. strb fiq_rtmp, [ fiq_rspi, # S3C2410_SPTDAT ]
  42. subs fiq_rcount, fiq_rcount, #1
  43. subnes pc, lr, #4 @@ return, still have work to do
  44. @@ set IRQ controller so that next op will trigger IRQ
  45. mov fiq_rtmp, #0
  46. str fiq_rtmp, [ fiq_rirq, # S3C2410_INTMOD - S3C24XX_VA_IRQ ]
  47. subs pc, lr, #4
  48. fiq_rx_irq_ack:
  49. .word 0
  50. fiq_rx_end:
  51. ENTRY(s3c24xx_spi_fiq_txrx)
  52. s3c24xx_spi_fiq_txrx:
  53. .word fiq_txrx_end - fiq_txrx_start
  54. .word fiq_txrx_irq_ack - fiq_txrx_start
  55. fiq_txrx_start:
  56. ldrb fiq_rtmp, [ fiq_rspi, # S3C2410_SPRDAT ]
  57. strb fiq_rtmp, [ fiq_rrx ], #1
  58. ldr fiq_rtmp, fiq_txrx_irq_ack
  59. str fiq_rtmp, [ fiq_rirq, # S3C2410_SRCPND - S3C24XX_VA_IRQ ]
  60. ldrb fiq_rtmp, [ fiq_rtx ], #1
  61. strb fiq_rtmp, [ fiq_rspi, # S3C2410_SPTDAT ]
  62. subs fiq_rcount, fiq_rcount, #1
  63. subnes pc, lr, #4 @@ return, still have work to do
  64. mov fiq_rtmp, #0
  65. str fiq_rtmp, [ fiq_rirq, # S3C2410_INTMOD - S3C24XX_VA_IRQ ]
  66. subs pc, lr, #4
  67. fiq_txrx_irq_ack:
  68. .word 0
  69. fiq_txrx_end:
  70. ENTRY(s3c24xx_spi_fiq_tx)
  71. s3c24xx_spi_fix_tx:
  72. .word fiq_tx_end - fiq_tx_start
  73. .word fiq_tx_irq_ack - fiq_tx_start
  74. fiq_tx_start:
  75. ldrb fiq_rtmp, [ fiq_rspi, # S3C2410_SPRDAT ]
  76. ldr fiq_rtmp, fiq_tx_irq_ack
  77. str fiq_rtmp, [ fiq_rirq, # S3C2410_SRCPND - S3C24XX_VA_IRQ ]
  78. ldrb fiq_rtmp, [ fiq_rtx ], #1
  79. strb fiq_rtmp, [ fiq_rspi, # S3C2410_SPTDAT ]
  80. subs fiq_rcount, fiq_rcount, #1
  81. subnes pc, lr, #4 @@ return, still have work to do
  82. mov fiq_rtmp, #0
  83. str fiq_rtmp, [ fiq_rirq, # S3C2410_INTMOD - S3C24XX_VA_IRQ ]
  84. subs pc, lr, #4
  85. fiq_tx_irq_ack:
  86. .word 0
  87. fiq_tx_end:
  88. .end