cpu.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * (C) Copyright 2002
  4. * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
  5. * Marius Groeger <mgroeger@sysgo.de>
  6. *
  7. * (C) Copyright 2002
  8. * Gary Jennejohn, DENX Software Engineering, <gj@denx.de>
  9. *
  10. * Copyright (C) 2011 Andes Technology Corporation
  11. * Shawn Lin, Andes Technology Corporation <nobuhiro@andestech.com>
  12. * Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com>
  13. */
  14. /* CPU specific code */
  15. #include <common.h>
  16. #include <command.h>
  17. #include <watchdog.h>
  18. #include <asm/cache.h>
  19. #include <faraday/ftwdt010_wdt.h>
  20. /*
  21. * cleanup_before_linux() is called just before we call linux
  22. * it prepares the processor for linux
  23. *
  24. * we disable interrupt and caches.
  25. */
  26. int cleanup_before_linux(void)
  27. {
  28. disable_interrupts();
  29. /* turn off I/D-cache */
  30. cache_flush();
  31. icache_disable();
  32. dcache_disable();
  33. return 0;
  34. }
  35. int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  36. {
  37. disable_interrupts();
  38. /*
  39. * reset to the base addr of andesboot.
  40. * currently no ROM loader at addr 0.
  41. * do not use reset_cpu(0);
  42. */
  43. #ifdef CONFIG_FTWDT010_WATCHDOG
  44. /*
  45. * workaround: if we use CONFIG_HW_WATCHDOG with ftwdt010, will lead
  46. * automatic hardware reset when booting Linux.
  47. * Please do not use CONFIG_HW_WATCHDOG and WATCHDOG_RESET() here.
  48. */
  49. ftwdt010_wdt_reset();
  50. while (1)
  51. ;
  52. #endif /* CONFIG_FTWDT010_WATCHDOG */
  53. /*NOTREACHED*/
  54. }