samsung.S 2.0 KB

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