samsung.S 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright 2005, 2007 Simtec Electronics
  4. * http://armlinux.simtec.co.uk/
  5. * Ben Dooks <ben@simtec.co.uk>
  6. */
  7. #include <linux/serial_s3c.h>
  8. /* The S5PV210/S5PC110 implementations are as belows. */
  9. .macro fifo_level_s5pv210 rd, rx
  10. ldr \rd, [\rx, # S3C2410_UFSTAT]
  11. ARM_BE8(rev \rd, \rd)
  12. and \rd, \rd, #S5PV210_UFSTAT_TXMASK
  13. .endm
  14. .macro fifo_full_s5pv210 rd, rx
  15. ldr \rd, [\rx, # S3C2410_UFSTAT]
  16. ARM_BE8(rev \rd, \rd)
  17. tst \rd, #S5PV210_UFSTAT_TXFULL
  18. .endm
  19. /* The S3C2440 implementations are used by default as they are the
  20. * most widely re-used */
  21. .macro fifo_level_s3c2440 rd, rx
  22. ldr \rd, [\rx, # S3C2410_UFSTAT]
  23. ARM_BE8(rev \rd, \rd)
  24. and \rd, \rd, #S3C2440_UFSTAT_TXMASK
  25. .endm
  26. #ifndef fifo_level
  27. #define fifo_level fifo_level_s3c2440
  28. #endif
  29. .macro fifo_full_s3c2440 rd, rx
  30. ldr \rd, [\rx, # S3C2410_UFSTAT]
  31. ARM_BE8(rev \rd, \rd)
  32. tst \rd, #S3C2440_UFSTAT_TXFULL
  33. .endm
  34. #ifndef fifo_full
  35. #define fifo_full fifo_full_s3c2440
  36. #endif
  37. .macro senduart,rd,rx
  38. strb \rd, [\rx, # S3C2410_UTXH]
  39. .endm
  40. .macro busyuart, rd, rx
  41. ldr \rd, [\rx, # S3C2410_UFCON]
  42. ARM_BE8(rev \rd, \rd)
  43. tst \rd, #S3C2410_UFCON_FIFOMODE @ fifo enabled?
  44. beq 1001f @
  45. @ FIFO enabled...
  46. 1003:
  47. fifo_full \rd, \rx
  48. bne 1003b
  49. b 1002f
  50. 1001:
  51. @ busy waiting for non fifo
  52. ldr \rd, [\rx, # S3C2410_UTRSTAT]
  53. ARM_BE8(rev \rd, \rd)
  54. tst \rd, #S3C2410_UTRSTAT_TXFE
  55. beq 1001b
  56. 1002: @ exit busyuart
  57. .endm
  58. .macro waituart,rd,rx
  59. ldr \rd, [\rx, # S3C2410_UFCON]
  60. ARM_BE8(rev \rd, \rd)
  61. tst \rd, #S3C2410_UFCON_FIFOMODE @ fifo enabled?
  62. beq 1001f @
  63. @ FIFO enabled...
  64. 1003:
  65. fifo_level \rd, \rx
  66. teq \rd, #0
  67. bne 1003b
  68. b 1002f
  69. 1001:
  70. @ idle waiting for non fifo
  71. ldr \rd, [\rx, # S3C2410_UTRSTAT]
  72. ARM_BE8(rev \rd, \rd)
  73. tst \rd, #S3C2410_UTRSTAT_TXFE
  74. beq 1001b
  75. 1002: @ exit busyuart
  76. .endm