cpu.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
  8. * Alex Zuepke <azu@sysgo.de>
  9. *
  10. * SPDX-License-Identifier: GPL-2.0+
  11. */
  12. /*
  13. * CPU specific code
  14. */
  15. #include <common.h>
  16. #include <command.h>
  17. #include <netdev.h>
  18. #include <asm/arch/ixp425.h>
  19. #include <asm/system.h>
  20. static void cache_flush(void);
  21. #if defined(CONFIG_DISPLAY_CPUINFO)
  22. int print_cpuinfo (void)
  23. {
  24. unsigned long id;
  25. int speed = 0;
  26. asm ("mrc p15, 0, %0, c0, c0, 0":"=r" (id));
  27. puts("CPU: Intel IXP425 at ");
  28. switch ((id & 0x000003f0) >> 4) {
  29. case 0x1c:
  30. speed = 533;
  31. break;
  32. case 0x1d:
  33. speed = 400;
  34. break;
  35. case 0x1f:
  36. speed = 266;
  37. break;
  38. }
  39. if (speed)
  40. printf("%d MHz\n", speed);
  41. else
  42. puts("unknown revision\n");
  43. return 0;
  44. }
  45. #endif /* CONFIG_DISPLAY_CPUINFO */
  46. int cleanup_before_linux (void)
  47. {
  48. /*
  49. * this function is called just before we call linux
  50. * it prepares the processor for linux
  51. *
  52. * just disable everything that can disturb booting linux
  53. */
  54. disable_interrupts ();
  55. /* turn off I-cache */
  56. icache_disable();
  57. dcache_disable();
  58. /* flush I-cache */
  59. cache_flush();
  60. return 0;
  61. }
  62. /* flush I/D-cache */
  63. static void cache_flush (void)
  64. {
  65. unsigned long i = 0;
  66. asm ("mcr p15, 0, %0, c7, c5, 0": :"r" (i));
  67. }
  68. /* FIXME */
  69. /*
  70. void pci_init(void)
  71. {
  72. return;
  73. }
  74. */
  75. int cpu_eth_init(bd_t *bis)
  76. {
  77. #ifdef CONFIG_IXP4XX_NPE
  78. npe_initialize(bis);
  79. #endif
  80. return 0;
  81. }