cpu.c 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * (C) Copyright 2002
  3. * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
  4. * Marius Groeger <mgroeger@sysgo.de>
  5. *
  6. * (C) Copyright 2002
  7. * Gary Jennejohn, DENX Software Engineering, <gj@denx.de>
  8. *
  9. * Copyright (C) 2011 Andes Technology Corporation
  10. * Shawn Lin, Andes Technology Corporation <nobuhiro@andestech.com>
  11. * Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com>
  12. *
  13. * See file CREDITS for list of people who contributed to this
  14. * project.
  15. *
  16. * This program is free software; you can redistribute it and/or
  17. * modify it under the terms of the GNU General Public License as
  18. * published by the Free Software Foundation; either version 2 of
  19. * the License, or (at your option) any later version.
  20. *
  21. * This program is distributed in the hope that it will be useful,
  22. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24. * GNU General Public License for more details.
  25. *
  26. * You should have received a copy of the GNU General Public License
  27. * along with this program; if not, write to the Free Software
  28. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  29. * MA 02111-1307 USA
  30. */
  31. /* CPU specific code */
  32. #include <common.h>
  33. #include <command.h>
  34. #include <watchdog.h>
  35. #include <asm/cache.h>
  36. #include <faraday/ftwdt010_wdt.h>
  37. /*
  38. * cleanup_before_linux() is called just before we call linux
  39. * it prepares the processor for linux
  40. *
  41. * we disable interrupt and caches.
  42. */
  43. int cleanup_before_linux(void)
  44. {
  45. disable_interrupts();
  46. #ifdef CONFIG_MMU
  47. /* turn off I/D-cache */
  48. icache_disable();
  49. dcache_disable();
  50. /* flush I/D-cache */
  51. invalidate_icac();
  52. invalidate_dcac();
  53. #endif
  54. return 0;
  55. }
  56. int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  57. {
  58. disable_interrupts();
  59. /*
  60. * reset to the base addr of andesboot.
  61. * currently no ROM loader at addr 0.
  62. * do not use reset_cpu(0);
  63. */
  64. #ifdef CONFIG_FTWDT010_WATCHDOG
  65. /*
  66. * workaround: if we use CONFIG_HW_WATCHDOG with ftwdt010, will lead
  67. * automatic hardware reset when booting Linux.
  68. * Please do not use CONFIG_HW_WATCHDOG and WATCHDOG_RESET() here.
  69. */
  70. ftwdt010_wdt_reset();
  71. #endif /* CONFIG_FTWDT010_WATCHDOG */
  72. hang();
  73. /*NOTREACHED*/
  74. }