reset.S 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * Processor reset using WDT for TI TMS320DM644x SoC.
  3. *
  4. * Copyright (C) 2007 Sergey Kubushyn <ksi@koi8.net>
  5. *
  6. * -----------------------------------------------------
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. .globl reset_cpu
  24. reset_cpu:
  25. ldr r0, WDT_TGCR
  26. mov r1, $0x08
  27. str r1, [r0]
  28. ldr r1, [r0]
  29. orr r1, r1, $0x03
  30. str r1, [r0]
  31. mov r1, $0
  32. ldr r0, WDT_TIM12
  33. str r1, [r0]
  34. ldr r0, WDT_TIM34
  35. str r1, [r0]
  36. ldr r0, WDT_PRD12
  37. str r1, [r0]
  38. ldr r0, WDT_PRD34
  39. str r1, [r0]
  40. ldr r0, WDT_TCR
  41. ldr r1, [r0]
  42. orr r1, r1, $0x40
  43. str r1, [r0]
  44. ldr r0, WDT_WDTCR
  45. ldr r1, [r0]
  46. orr r1, r1, $0x4000
  47. str r1, [r0]
  48. ldr r1, WDTCR_VAL1
  49. str r1, [r0]
  50. ldr r1, WDTCR_VAL2
  51. str r1, [r0]
  52. /* Write an invalid value to the WDKEY field to trigger
  53. * an immediate watchdog reset */
  54. mov r1, $0x4000
  55. str r1, [r0]
  56. nop
  57. nop
  58. nop
  59. nop
  60. reset_cpu_loop:
  61. b reset_cpu_loop
  62. WDT_TGCR:
  63. .word 0x01c21c24
  64. WDT_TIM12:
  65. .word 0x01c21c10
  66. WDT_TIM34:
  67. .word 0x01c21c14
  68. WDT_PRD12:
  69. .word 0x01c21c18
  70. WDT_PRD34:
  71. .word 0x01c21c1c
  72. WDT_TCR:
  73. .word 0x01c21c20
  74. WDT_WDTCR:
  75. .word 0x01c21c28
  76. WDTCR_VAL1:
  77. .word 0xa5c64000
  78. WDTCR_VAL2:
  79. .word 0xda7e4000