debug-macro.S 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /* linux/include/asm-arm/arch-s3c2410/debug-macro.S
  2. *
  3. * Debugging macro include header
  4. *
  5. * Copyright (C) 1994-1999 Russell King
  6. * Copyright (C) 2005 Simtec Electronics
  7. *
  8. * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #include <asm/arch/map.h>
  15. #include <asm/arch/regs-serial.h>
  16. #include <asm/arch/regs-gpio.h>
  17. #define S3C2410_UART1_OFF (0x4000)
  18. #define SHIFT_2440TXF (14-9)
  19. .macro addruart, rx
  20. mrc p15, 0, \rx, c1, c0
  21. tst \rx, #1
  22. ldreq \rx, = S3C24XX_PA_UART
  23. ldrne \rx, = S3C24XX_VA_UART
  24. #if CONFIG_DEBUG_S3C2410_UART != 0
  25. add \rx, \rx, #(S3C2410_UART1_OFF * CONFIG_DEBUG_S3C2410_UART)
  26. #endif
  27. .endm
  28. .macro senduart,rd,rx
  29. strb \rd, [\rx, # S3C2410_UTXH ]
  30. .endm
  31. .macro busyuart, rd, rx
  32. ldr \rd, [ \rx, # S3C2410_UFCON ]
  33. tst \rd, #S3C2410_UFCON_FIFOMODE @ fifo enabled?
  34. beq 1001f @
  35. @ FIFO enabled...
  36. 1003:
  37. @ check for arm920 vs arm926. currently assume all arm926
  38. @ devices have an 64 byte FIFO identical to the s3c2440
  39. mrc p15, 0, \rd, c0, c0
  40. and \rd, \rd, #0xff0
  41. teq \rd, #0x260
  42. beq 1004f
  43. mrc p15, 0, \rd, c1, c0
  44. tst \rd, #1
  45. addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART)
  46. addne \rd, \rx, #(S3C24XX_VA_GPIO - S3C24XX_VA_UART)
  47. bic \rd, \rd, #0xff000
  48. ldr \rd, [ \rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0) ]
  49. and \rd, \rd, #0x00ff0000
  50. teq \rd, #0x00440000 @ is it 2440?
  51. 1004:
  52. ldr \rd, [ \rx, # S3C2410_UFSTAT ]
  53. moveq \rd, \rd, lsr #SHIFT_2440TXF
  54. tst \rd, #S3C2410_UFSTAT_TXFULL
  55. bne 1003b
  56. b 1002f
  57. 1001:
  58. @ busy waiting for non fifo
  59. ldr \rd, [ \rx, # S3C2410_UTRSTAT ]
  60. tst \rd, #S3C2410_UTRSTAT_TXFE
  61. beq 1001b
  62. 1002: @ exit busyuart
  63. .endm
  64. .macro waituart,rd,rx
  65. ldr \rd, [ \rx, # S3C2410_UFCON ]
  66. tst \rd, #S3C2410_UFCON_FIFOMODE @ fifo enabled?
  67. beq 1001f @
  68. @ FIFO enabled...
  69. 1003:
  70. mrc p15, 0, \rd, c1, c0
  71. tst \rd, #1
  72. addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART)
  73. addne \rd, \rx, #(S3C24XX_VA_GPIO - S3C24XX_VA_UART)
  74. bic \rd, \rd, #0xff000
  75. ldr \rd, [ \rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0) ]
  76. and \rd, \rd, #0x00ff0000
  77. teq \rd, #0x00440000 @ is it 2440?
  78. ldr \rd, [ \rx, # S3C2410_UFSTAT ]
  79. andne \rd, \rd, #S3C2410_UFSTAT_TXMASK
  80. andeq \rd, \rd, #S3C2440_UFSTAT_TXMASK
  81. teq \rd, #0
  82. bne 1003b
  83. b 1002f
  84. 1001:
  85. @ idle waiting for non fifo
  86. ldr \rd, [ \rx, # S3C2410_UTRSTAT ]
  87. tst \rd, #S3C2410_UTRSTAT_TXFE
  88. beq 1001b
  89. 1002: @ exit busyuart
  90. .endm