cpu.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /*
  2. * (C) Copyright 2004
  3. * DAVE Srl
  4. * http://www.dave-tech.it
  5. * http://www.wawnet.biz
  6. * mailto:info@wawnet.biz
  7. *
  8. * See file CREDITS for list of people who contributed to this
  9. * project.
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License as
  13. * published by the Free Software Foundation; either version 2 of
  14. * the License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  24. * MA 02111-1307 USA
  25. */
  26. /*
  27. * S3C44B0 CPU specific code
  28. */
  29. #include <common.h>
  30. #include <command.h>
  31. #include <asm/hardware.h>
  32. static void s3c44b0_flush_cache(void)
  33. {
  34. volatile int i;
  35. /* flush cycle */
  36. for(i=0x10002000;i<0x10004800;i+=16)
  37. {
  38. *((int *)i)=0x0;
  39. }
  40. }
  41. int cpu_init (void)
  42. {
  43. icache_enable();
  44. return 0;
  45. }
  46. int cleanup_before_linux (void)
  47. {
  48. /*
  49. cache memory should be enabled before calling
  50. Linux to make the kernel uncompression faster
  51. */
  52. icache_enable();
  53. disable_interrupts ();
  54. return 0;
  55. }
  56. void reset_cpu (ulong addr)
  57. {
  58. /*
  59. reset the cpu using watchdog
  60. */
  61. /* Disable the watchdog.*/
  62. WTCON&=~(1<<5);
  63. /* set the timeout value to a short time... */
  64. WTCNT = 0x1;
  65. /* Enable the watchdog. */
  66. WTCON|=1;
  67. WTCON|=(1<<5);
  68. while(1) {
  69. /*NOP*/
  70. }
  71. }
  72. int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
  73. {
  74. disable_interrupts ();
  75. reset_cpu (0);
  76. /*NOTREACHED*/
  77. return (0);
  78. }
  79. void icache_enable (void)
  80. {
  81. ulong reg;
  82. s3c44b0_flush_cache();
  83. /*
  84. Init cache
  85. Non-cacheable area (everything outside RAM)
  86. 0x0000:0000 - 0x0C00:0000
  87. */
  88. NCACHBE0 = 0xC0000000;
  89. NCACHBE1 = 0x00000000;
  90. /*
  91. Enable chache
  92. */
  93. reg = SYSCFG;
  94. reg |= 0x00000006; /* 8kB */
  95. SYSCFG = reg;
  96. }
  97. void icache_disable (void)
  98. {
  99. ulong reg;
  100. reg = SYSCFG;
  101. reg &= ~0x00000006; /* 8kB */
  102. SYSCFG = reg;
  103. }
  104. int icache_status (void)
  105. {
  106. return 0;
  107. }
  108. void dcache_enable (void)
  109. {
  110. icache_enable();
  111. }
  112. void dcache_disable (void)
  113. {
  114. icache_disable();
  115. }
  116. int dcache_status (void)
  117. {
  118. return dcache_status();
  119. }