cpu.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 <asm/nios2.h>
  9. #include <asm/cache.h>
  10. DECLARE_GLOBAL_DATA_PTR;
  11. #if defined (CONFIG_SYS_NIOS_SYSID_BASE)
  12. extern void display_sysid (void);
  13. #endif /* CONFIG_SYS_NIOS_SYSID_BASE */
  14. #ifdef CONFIG_DISPLAY_CPUINFO
  15. int print_cpuinfo(void)
  16. {
  17. printf ("CPU : Nios-II\n");
  18. #if !defined(CONFIG_SYS_NIOS_SYSID_BASE)
  19. printf ("SYSID : <unknown>\n");
  20. #else
  21. display_sysid ();
  22. #endif
  23. return (0);
  24. }
  25. #endif /* CONFIG_DISPLAY_CPUINFO */
  26. int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  27. {
  28. disable_interrupts();
  29. /* indirect call to go beyond 256MB limitation of toolchain */
  30. nios2_callr(CONFIG_SYS_RESET_ADDR);
  31. return 0;
  32. }
  33. int dcache_status(void)
  34. {
  35. return 1;
  36. }
  37. void dcache_enable(void)
  38. {
  39. flush_dcache(CONFIG_SYS_DCACHE_SIZE, CONFIG_SYS_DCACHELINE_SIZE);
  40. }
  41. void dcache_disable(void)
  42. {
  43. flush_dcache(CONFIG_SYS_DCACHE_SIZE, CONFIG_SYS_DCACHELINE_SIZE);
  44. }
  45. int arch_cpu_init(void)
  46. {
  47. gd->cpu_clk = CONFIG_SYS_CLK_FREQ;
  48. gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
  49. return 0;
  50. }