cache.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. #include <common.h>
  27. #include <command.h>
  28. #include <asm/hardware.h>
  29. static void s3c44b0_flush_cache(void)
  30. {
  31. volatile int i;
  32. /* flush cycle */
  33. for(i=0x10002000;i<0x10004800;i+=16)
  34. {
  35. *((int *)i)=0x0;
  36. }
  37. }
  38. void icache_enable (void)
  39. {
  40. ulong reg;
  41. s3c44b0_flush_cache();
  42. /*
  43. Init cache
  44. Non-cacheable area (everything outside RAM)
  45. 0x0000:0000 - 0x0C00:0000
  46. */
  47. NCACHBE0 = 0xC0000000;
  48. NCACHBE1 = 0x00000000;
  49. /*
  50. Enable chache
  51. */
  52. reg = SYSCFG;
  53. reg |= 0x00000006; /* 8kB */
  54. SYSCFG = reg;
  55. }
  56. void icache_disable (void)
  57. {
  58. ulong reg;
  59. reg = SYSCFG;
  60. reg &= ~0x00000006; /* 8kB */
  61. SYSCFG = reg;
  62. }
  63. int icache_status (void)
  64. {
  65. return 0;
  66. }
  67. void dcache_enable (void)
  68. {
  69. icache_enable();
  70. }
  71. void dcache_disable (void)
  72. {
  73. icache_disable();
  74. }
  75. int dcache_status (void)
  76. {
  77. return dcache_status();
  78. }