cplbinit.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. /*
  2. * File: include/asm-blackfin/cplbinit.h
  3. * Based on:
  4. * Author:
  5. *
  6. * Created:
  7. * Description:
  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. #include <asm/blackfin.h>
  30. #include <asm/cplb.h>
  31. #define INITIAL_T 0x1
  32. #define SWITCH_T 0x2
  33. #define I_CPLB 0x4
  34. #define D_CPLB 0x8
  35. #define IN_KERNEL 1
  36. enum
  37. {ZERO_P, L1I_MEM, L1D_MEM, SDRAM_KERN , SDRAM_RAM_MTD, SDRAM_DMAZ, RES_MEM, ASYNC_MEM, L2_MEM};
  38. struct cplb_desc {
  39. u32 start; /* start address */
  40. u32 end; /* end address */
  41. u32 psize; /* prefered size if any otherwise 1MB or 4MB*/
  42. u16 attr;/* attributes */
  43. u16 i_conf;/* I-CPLB DATA */
  44. u16 d_conf;/* D-CPLB DATA */
  45. u16 valid;/* valid */
  46. const s8 name[30];/* name */
  47. };
  48. struct cplb_tab {
  49. u_long *tab;
  50. u16 pos;
  51. u16 size;
  52. };
  53. u_long icplb_table[MAX_CPLBS+1];
  54. u_long dcplb_table[MAX_CPLBS+1];
  55. /* Till here we are discussing about the static memory management model.
  56. * However, the operating envoronments commonly define more CPLB
  57. * descriptors to cover the entire addressable memory than will fit into
  58. * the available on-chip 16 CPLB MMRs. When this happens, the below table
  59. * will be used which will hold all the potentially required CPLB descriptors
  60. *
  61. * This is how Page descriptor Table is implemented in uClinux/Blackfin.
  62. */
  63. #ifdef CONFIG_CPLB_SWITCH_TAB_L1
  64. u_long ipdt_table[MAX_SWITCH_I_CPLBS+1]__attribute__((l1_data));
  65. u_long dpdt_table[MAX_SWITCH_D_CPLBS+1]__attribute__((l1_data));
  66. #ifdef CONFIG_CPLB_INFO
  67. u_long ipdt_swapcount_table[MAX_SWITCH_I_CPLBS]__attribute__((l1_data));
  68. u_long dpdt_swapcount_table[MAX_SWITCH_D_CPLBS]__attribute__((l1_data));
  69. #endif /* CONFIG_CPLB_INFO */
  70. #else
  71. u_long ipdt_table[MAX_SWITCH_I_CPLBS+1];
  72. u_long dpdt_table[MAX_SWITCH_D_CPLBS+1];
  73. #ifdef CONFIG_CPLB_INFO
  74. u_long ipdt_swapcount_table[MAX_SWITCH_I_CPLBS];
  75. u_long dpdt_swapcount_table[MAX_SWITCH_D_CPLBS];
  76. #endif /* CONFIG_CPLB_INFO */
  77. #endif /*CONFIG_CPLB_SWITCH_TAB_L1*/
  78. struct s_cplb {
  79. struct cplb_tab init_i;
  80. struct cplb_tab init_d;
  81. struct cplb_tab switch_i;
  82. struct cplb_tab switch_d;
  83. };
  84. #if defined(CONFIG_BLKFIN_DCACHE) || defined(CONFIG_BLKFIN_CACHE)
  85. static struct cplb_desc cplb_data[] = {
  86. {
  87. .start = 0,
  88. .end = SIZE_4K,
  89. .psize = SIZE_4K,
  90. .attr = INITIAL_T | SWITCH_T | I_CPLB | D_CPLB,
  91. .i_conf = SDRAM_OOPS,
  92. .d_conf = SDRAM_OOPS,
  93. #if defined(CONFIG_DEBUG_HUNT_FOR_ZERO)
  94. .valid = 1,
  95. #else
  96. .valid = 0,
  97. #endif
  98. .name = "ZERO Pointer Saveguard",
  99. },
  100. {
  101. .start = L1_CODE_START,
  102. .end = L1_CODE_START + L1_CODE_LENGTH,
  103. .psize = SIZE_4M,
  104. .attr = INITIAL_T | SWITCH_T | I_CPLB,
  105. .i_conf = L1_IMEMORY,
  106. .d_conf = 0,
  107. .valid = 1,
  108. .name = "L1 I-Memory",
  109. },
  110. {
  111. .start = L1_DATA_A_START,
  112. .end = L1_DATA_B_START + L1_DATA_B_LENGTH,
  113. .psize = SIZE_4M,
  114. .attr = INITIAL_T | SWITCH_T | D_CPLB,
  115. .i_conf = 0,
  116. .d_conf = L1_DMEMORY,
  117. #if ((L1_DATA_A_LENGTH > 0) || (L1_DATA_B_LENGTH > 0))
  118. .valid = 1,
  119. #else
  120. .valid = 0,
  121. #endif
  122. .name = "L1 D-Memory",
  123. },
  124. {
  125. .start = 0,
  126. .end = 0, /* dynamic */
  127. .psize = 0,
  128. .attr = INITIAL_T | SWITCH_T | I_CPLB | D_CPLB,
  129. .i_conf = SDRAM_IGENERIC,
  130. .d_conf = SDRAM_DGENERIC,
  131. .valid = 1,
  132. .name = "SDRAM Kernel",
  133. },
  134. {
  135. .start = 0, /* dynamic */
  136. .end = 0, /* dynamic */
  137. .psize = 0,
  138. .attr = INITIAL_T | SWITCH_T | D_CPLB,
  139. .i_conf = SDRAM_IGENERIC,
  140. .d_conf = SDRAM_DNON_CHBL,
  141. .valid = 1,
  142. .name = "SDRAM RAM MTD",
  143. },
  144. {
  145. .start = 0, /* dynamic */
  146. .end = 0, /* dynamic */
  147. .psize = SIZE_1M,
  148. .attr = INITIAL_T | SWITCH_T | D_CPLB,
  149. .d_conf = SDRAM_DNON_CHBL,
  150. .valid = 1,//(DMA_UNCACHED_REGION > 0),
  151. .name = "SDRAM Uncached DMA ZONE",
  152. },
  153. {
  154. .start = 0, /* dynamic */
  155. .end = 0, /* dynamic */
  156. .psize = 0,
  157. .attr = SWITCH_T | D_CPLB,
  158. .i_conf = 0, /* dynamic */
  159. .d_conf = 0, /* dynamic */
  160. .valid = 1,
  161. .name = "SDRAM Reserved Memory",
  162. },
  163. {
  164. .start = ASYNC_BANK0_BASE,
  165. .end = ASYNC_BANK3_BASE + ASYNC_BANK3_SIZE,
  166. .psize = 0,
  167. .attr = SWITCH_T | D_CPLB,
  168. .d_conf = SDRAM_EBIU,
  169. .valid = 1,
  170. .name = "ASYNC Memory",
  171. },
  172. {
  173. #if defined(CONFIG_BF561)
  174. .start = L2_SRAM,
  175. .end = L2_SRAM_END,
  176. .psize = SIZE_1M,
  177. .attr = SWITCH_T | D_CPLB,
  178. .i_conf = L2_MEMORY,
  179. .d_conf = L2_MEMORY,
  180. .valid = 1,
  181. #else
  182. .valid = 0,
  183. #endif
  184. .name = "L2 Memory",
  185. }
  186. };
  187. #endif