cpu.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 <cpu_func.h>
  18. #include <watchdog.h>
  19. #include <asm/cache.h>
  20. #include <faraday/ftwdt010_wdt.h>
  21. /*
  22. * cleanup_before_linux() is called just before we call linux
  23. * it prepares the processor for linux
  24. *
  25. * we disable interrupt and caches.
  26. */
  27. int cleanup_before_linux(void)
  28. {
  29. disable_interrupts();
  30. /* turn off I/D-cache */
  31. cache_flush();
  32. icache_disable();
  33. dcache_disable();
  34. return 0;
  35. }
  36. int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  37. {
  38. disable_interrupts();
  39. /*
  40. * reset to the base addr of andesboot.
  41. * currently no ROM loader at addr 0.
  42. * do not use reset_cpu(0);
  43. */
  44. #ifdef CONFIG_FTWDT010_WATCHDOG
  45. /*
  46. * workaround: if we use CONFIG_HW_WATCHDOG with ftwdt010, will lead
  47. * automatic hardware reset when booting Linux.
  48. * Please do not use CONFIG_HW_WATCHDOG and WATCHDOG_RESET() here.
  49. */
  50. ftwdt010_wdt_reset();
  51. while (1)
  52. ;
  53. #endif /* CONFIG_FTWDT010_WATCHDOG */
  54. /*NOTREACHED*/
  55. }