debug-macro.S 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. * Modifications:
  15. * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA
  16. */
  17. #include <asm/arch/map.h>
  18. #include <asm/arch/regs-serial.h>
  19. #include <asm/arch/regs-gpio.h>
  20. #define S3C2410_UART1_OFF (0x4000)
  21. #define SHIFT_2440TXF (14-9)
  22. .macro addruart, rx
  23. mrc p15, 0, \rx, c1, c0
  24. tst \rx, #1
  25. ldreq \rx, = S3C24XX_PA_UART
  26. ldrne \rx, = S3C24XX_VA_UART
  27. #if CONFIG_DEBUG_S3C2410_UART != 0
  28. add \rx, \rx, #(S3C2410_UART1_OFF * CONFIG_DEBUG_S3C2410_UART)
  29. #endif
  30. .endm
  31. .macro senduart,rd,rx
  32. strb \rd, [\rx, # S3C2410_UTXH ]
  33. .endm
  34. .macro busyuart, rd, rx
  35. ldr \rd, [ \rx, # S3C2410_UFCON ]
  36. tst \rd, #S3C2410_UFCON_FIFOMODE @ fifo enabled?
  37. beq 1001f @
  38. @ FIFO enabled...
  39. 1003:
  40. @ check for arm920 vs arm926. currently assume all arm926
  41. @ devices have an 64 byte FIFO identical to the s3c2440
  42. mrc p15, 0, \rd, c0, c0
  43. and \rd, \rd, #0xff0
  44. teq \rd, #0x260
  45. beq 1004f
  46. mrc p15, 0, \rd, c1, c0
  47. tst \rd, #1
  48. addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART)
  49. addne \rd, \rx, #(S3C24XX_VA_GPIO - S3C24XX_VA_UART)
  50. bic \rd, \rd, #0xff000
  51. ldr \rd, [ \rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0) ]
  52. and \rd, \rd, #0x00ff0000
  53. teq \rd, #0x00440000 @ is it 2440?
  54. 1004:
  55. ldr \rd, [ \rx, # S3C2410_UFSTAT ]
  56. moveq \rd, \rd, lsr #SHIFT_2440TXF
  57. tst \rd, #S3C2410_UFSTAT_TXFULL
  58. bne 1003b
  59. b 1002f
  60. 1001:
  61. @ busy waiting for non fifo
  62. ldr \rd, [ \rx, # S3C2410_UTRSTAT ]
  63. tst \rd, #S3C2410_UTRSTAT_TXFE
  64. beq 1001b
  65. 1002: @ exit busyuart
  66. .endm
  67. .macro waituart,rd,rx
  68. ldr \rd, [ \rx, # S3C2410_UFCON ]
  69. tst \rd, #S3C2410_UFCON_FIFOMODE @ fifo enabled?
  70. beq 1001f @
  71. @ FIFO enabled...
  72. 1003:
  73. mrc p15, 0, \rd, c1, c0
  74. tst \rd, #1
  75. addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART)
  76. addne \rd, \rx, #(S3C24XX_VA_GPIO - S3C24XX_VA_UART)
  77. bic \rd, \rd, #0xff000
  78. ldr \rd, [ \rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0) ]
  79. and \rd, \rd, #0x00ff0000
  80. teq \rd, #0x00440000 @ is it 2440?
  81. ldr \rd, [ \rx, # S3C2410_UFSTAT ]
  82. andne \rd, \rd, #S3C2410_UFSTAT_TXMASK
  83. andeq \rd, \rd, #S3C2440_UFSTAT_TXMASK
  84. teq \rd, #0
  85. bne 1003b
  86. b 1002f
  87. 1001:
  88. @ idle waiting for non fifo
  89. ldr \rd, [ \rx, # S3C2410_UTRSTAT ]
  90. tst \rd, #S3C2410_UTRSTAT_TXFE
  91. beq 1001b
  92. 1002: @ exit busyuart
  93. .endm