cpu.c 1.4 KB

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