watchdog.S 751 B

1234567891011121314151617181920212223242526272829303132
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (C) 2011 Andes Technology Corporation
  4. * Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com>
  5. */
  6. #include <asm/arch-ag101/ag101.h>
  7. #include <linux/linkage.h>
  8. .text
  9. #ifndef CONFIG_SKIP_TRUNOFF_WATCHDOG
  10. ENTRY(turnoff_watchdog)
  11. #define WD_CR 0xC
  12. #define WD_ENABLE 0x1
  13. ! Turn off the watchdog, according to Faraday FTWDT010 spec
  14. li $p0, (CONFIG_FTWDT010_BASE+WD_CR) ! Get the addr of WD CR
  15. lwi $p1, [$p0] ! Get the config of WD
  16. andi $p1, $p1, 0x1f ! Wipe out useless bits
  17. li $r0, ~WD_ENABLE
  18. and $p1, $p1, $r0 ! Set WD disable
  19. sw $p1, [$p0] ! Write back to WD CR
  20. ! Disable Interrupts by clear GIE in $PSW reg
  21. setgie.d
  22. ret
  23. ENDPROC(turnoff_watchdog)
  24. #endif