incaip_wdt.S 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * INCA-IP Watchdog timer management code.
  3. *
  4. * Copyright (c) 2003 Wolfgang Denk <wd@denx.de>
  5. *
  6. * See file CREDITS for list of people who contributed to this
  7. * project.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License as
  11. * published by the Free Software Foundation; either version 2 of
  12. * the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  22. * MA 02111-1307 USA
  23. */
  24. #include <config.h>
  25. #include <asm/regdef.h>
  26. #define WD_BASE 0xb8000000
  27. #define WD_CON0(value) 0x0020(value)
  28. #define WD_CON1(value) 0x0024(value)
  29. #define WD_DISABLE 0x00000008
  30. #define WD_ENABLE 0x00000000
  31. #define WD_WRITE_PW 0xFFFC00F8
  32. #define WD_WRITE_ENDINIT 0xFFFC00F3
  33. #define WD_WRITE_INIT 0xFFFC00F2
  34. .globl disable_incaip_wdt
  35. disable_incaip_wdt:
  36. li t0, WD_BASE
  37. /* Calculate password.
  38. */
  39. lw t2, WD_CON1(t0)
  40. and t2, 0xC
  41. lw t3, WD_CON0(t0)
  42. and t3, 0xFFFFFF01
  43. or t3, t2
  44. or t3, 0xF0
  45. sw t3, WD_CON0(t0) /* write password */
  46. /* Clear ENDINIT.
  47. */
  48. li t1, WD_WRITE_INIT
  49. sw t1, WD_CON0(t0)
  50. li t1, WD_DISABLE
  51. sw t1, WD_CON1(t0) /* disable watchdog */
  52. li t1, WD_WRITE_PW
  53. sw t1, WD_CON0(t0) /* write password */
  54. li t1, WD_WRITE_ENDINIT
  55. sw t1, WD_CON0(t0) /* end command */
  56. jr ra
  57. nop