cacheinit.S 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /*
  2. * File: arch/blackfin/mach-common/cacheinit.S
  3. * Based on:
  4. * Author: LG Soft India
  5. *
  6. * Created: ?
  7. * Description: cache initialization
  8. *
  9. * Modified:
  10. * Copyright 2004-2006 Analog Devices Inc.
  11. *
  12. * Bugs: Enter bugs at http://blackfin.uclinux.org/
  13. *
  14. * This program is free software; you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License as published by
  16. * the Free Software Foundation; either version 2 of the License, or
  17. * (at your option) any later version.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License
  25. * along with this program; if not, see the file COPYING, or write
  26. * to the Free Software Foundation, Inc.,
  27. * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  28. */
  29. /* This function sets up the data and instruction cache. The
  30. * tables like icplb table, dcplb table and Page Descriptor table
  31. * are defined in cplbtab.h. You can configure those tables for
  32. * your suitable requirements
  33. */
  34. #include <linux/linkage.h>
  35. #include <asm/blackfin.h>
  36. .text
  37. #if defined(CONFIG_BLKFIN_CACHE)
  38. ENTRY(_bfin_icache_init)
  39. /* Initialize Instruction CPLBS */
  40. I0.L = (ICPLB_ADDR0 & 0xFFFF);
  41. I0.H = (ICPLB_ADDR0 >> 16);
  42. I1.L = (ICPLB_DATA0 & 0xFFFF);
  43. I1.H = (ICPLB_DATA0 >> 16);
  44. I2.L = _icplb_table;
  45. I2.H = _icplb_table;
  46. r1 = -1; /* end point comparison */
  47. r3 = 15; /* max counter */
  48. /* read entries from table */
  49. .Lread_iaddr:
  50. R0 = [I2++];
  51. CC = R0 == R1;
  52. IF CC JUMP .Lidone;
  53. [I0++] = R0;
  54. .Lread_idata:
  55. R2 = [I2++];
  56. [I1++] = R2;
  57. R3 = R3 + R1;
  58. CC = R3 == R1;
  59. IF !CC JUMP .Lread_iaddr;
  60. .Lidone:
  61. /* Enable Instruction Cache */
  62. P0.l = (IMEM_CONTROL & 0xFFFF);
  63. P0.h = (IMEM_CONTROL >> 16);
  64. R1 = [P0];
  65. R0 = (IMC | ENICPLB);
  66. R0 = R0 | R1;
  67. /* Anomaly 05000125 */
  68. CLI R2;
  69. SSYNC; /* SSYNC required before writing to IMEM_CONTROL. */
  70. .align 8;
  71. [P0] = R0;
  72. SSYNC;
  73. STI R2;
  74. RTS;
  75. #endif
  76. #if defined(CONFIG_BLKFIN_DCACHE)
  77. ENTRY(_bfin_dcache_init)
  78. /* Initialize Data CPLBS */
  79. I0.L = (DCPLB_ADDR0 & 0xFFFF);
  80. I0.H = (DCPLB_ADDR0 >> 16);
  81. I1.L = (DCPLB_DATA0 & 0xFFFF);
  82. I1.H = (DCPLB_DATA0 >> 16);
  83. I2.L = _dcplb_table;
  84. I2.H = _dcplb_table;
  85. R1 = -1; /* end point comparison */
  86. R3 = 15; /* max counter */
  87. /* read entries from table */
  88. .Lread_daddr:
  89. R0 = [I2++];
  90. cc = R0 == R1;
  91. IF CC JUMP .Lddone;
  92. [I0++] = R0;
  93. .Lread_ddata:
  94. R2 = [I2++];
  95. [I1++] = R2;
  96. R3 = R3 + R1;
  97. CC = R3 == R1;
  98. IF !CC JUMP .Lread_daddr;
  99. .Lddone:
  100. P0.L = (DMEM_CONTROL & 0xFFFF);
  101. P0.H = (DMEM_CONTROL >> 16);
  102. R1 = [P0];
  103. R0 = DMEM_CNTR;
  104. R0 = R0 | R1;
  105. /* Anomaly 05000125 */
  106. CLI R2;
  107. SSYNC; /* SSYNC required before writing to DMEM_CONTROL. */
  108. .align 8;
  109. [P0] = R0;
  110. SSYNC;
  111. STI R2;
  112. RTS;
  113. #endif