cpu.c 966 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * (C) Copyright 2004, Psyent Corporation <www.psyent.com>
  3. * Scott McNutt <smcnutt@psyent.com>
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #include <common.h>
  8. #include <nios2.h>
  9. #include <nios2-io.h>
  10. #include <asm/cache.h>
  11. #if defined (CONFIG_SYS_NIOS_SYSID_BASE)
  12. extern void display_sysid (void);
  13. #endif /* CONFIG_SYS_NIOS_SYSID_BASE */
  14. int checkcpu (void)
  15. {
  16. printf ("CPU : Nios-II\n");
  17. #if !defined(CONFIG_SYS_NIOS_SYSID_BASE)
  18. printf ("SYSID : <unknown>\n");
  19. #else
  20. display_sysid ();
  21. #endif
  22. return (0);
  23. }
  24. int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  25. {
  26. disable_interrupts();
  27. /* indirect call to go beyond 256MB limitation of toolchain */
  28. nios2_callr(CONFIG_SYS_RESET_ADDR);
  29. return 0;
  30. }
  31. int dcache_status(void)
  32. {
  33. return 1;
  34. }
  35. void dcache_enable(void)
  36. {
  37. flush_dcache(CONFIG_SYS_DCACHE_SIZE, CONFIG_SYS_DCACHELINE_SIZE);
  38. }
  39. void dcache_disable(void)
  40. {
  41. flush_dcache(CONFIG_SYS_DCACHE_SIZE, CONFIG_SYS_DCACHELINE_SIZE);
  42. }