bf548.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. /*
  2. * File: include/asm-blackfin/mach-bf548/bf548.h
  3. * Based on:
  4. * Author:
  5. *
  6. * Created:
  7. * Description: System MMR register and memory map for ADSP-BF548
  8. *
  9. * Modified:
  10. * Copyright 2004-2007 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. #ifndef __MACH_BF548_H__
  30. #define __MACH_BF548_H__
  31. #define SUPPORTED_REVID 0
  32. #define OFFSET_(x) ((x) & 0x0000FFFF)
  33. /*some misc defines*/
  34. #define IMASK_IVG15 0x8000
  35. #define IMASK_IVG14 0x4000
  36. #define IMASK_IVG13 0x2000
  37. #define IMASK_IVG12 0x1000
  38. #define IMASK_IVG11 0x0800
  39. #define IMASK_IVG10 0x0400
  40. #define IMASK_IVG9 0x0200
  41. #define IMASK_IVG8 0x0100
  42. #define IMASK_IVG7 0x0080
  43. #define IMASK_IVGTMR 0x0040
  44. #define IMASK_IVGHW 0x0020
  45. /***************************/
  46. #define BLKFIN_DSUBBANKS 4
  47. #define BLKFIN_DWAYS 2
  48. #define BLKFIN_DLINES 64
  49. #define BLKFIN_ISUBBANKS 4
  50. #define BLKFIN_IWAYS 4
  51. #define BLKFIN_ILINES 32
  52. #define WAY0_L 0x1
  53. #define WAY1_L 0x2
  54. #define WAY01_L 0x3
  55. #define WAY2_L 0x4
  56. #define WAY02_L 0x5
  57. #define WAY12_L 0x6
  58. #define WAY012_L 0x7
  59. #define WAY3_L 0x8
  60. #define WAY03_L 0x9
  61. #define WAY13_L 0xA
  62. #define WAY013_L 0xB
  63. #define WAY32_L 0xC
  64. #define WAY320_L 0xD
  65. #define WAY321_L 0xE
  66. #define WAYALL_L 0xF
  67. #define DMC_ENABLE (2<<2) /*yes, 2, not 1 */
  68. /********************************* EBIU Settings ************************************/
  69. #define AMBCTL0VAL ((CONFIG_BANK_1 << 16) | CONFIG_BANK_0)
  70. #define AMBCTL1VAL ((CONFIG_BANK_3 << 16) | CONFIG_BANK_2)
  71. #ifdef CONFIG_C_AMBEN_ALL
  72. #define V_AMBEN AMBEN_ALL
  73. #endif
  74. #ifdef CONFIG_C_AMBEN
  75. #define V_AMBEN 0x0
  76. #endif
  77. #ifdef CONFIG_C_AMBEN_B0
  78. #define V_AMBEN AMBEN_B0
  79. #endif
  80. #ifdef CONFIG_C_AMBEN_B0_B1
  81. #define V_AMBEN AMBEN_B0_B1
  82. #endif
  83. #ifdef CONFIG_C_AMBEN_B0_B1_B2
  84. #define V_AMBEN AMBEN_B0_B1_B2
  85. #endif
  86. #ifdef CONFIG_C_AMCKEN
  87. #define V_AMCKEN AMCKEN
  88. #else
  89. #define V_AMCKEN 0x0
  90. #endif
  91. #define AMGCTLVAL (V_AMBEN | V_AMCKEN)
  92. #define MAX_VC 650000000
  93. #define MIN_VC 50000000
  94. /********************************PLL Settings **************************************/
  95. #ifdef CONFIG_BFIN_KERNEL_CLOCK
  96. #if (CONFIG_VCO_MULT < 0)
  97. #error "VCO Multiplier is less than 0. Please select a different value"
  98. #endif
  99. #if (CONFIG_VCO_MULT == 0)
  100. #error "VCO Multiplier should be greater than 0. Please select a different value"
  101. #endif
  102. #if (CONFIG_VCO_MULT > 64)
  103. #error "VCO Multiplier is more than 64. Please select a different value"
  104. #endif
  105. #ifndef CONFIG_CLKIN_HALF
  106. #define CONFIG_VCO_HZ (CONFIG_CLKIN_HZ * CONFIG_VCO_MULT)
  107. #else
  108. #define CONFIG_VCO_HZ ((CONFIG_CLKIN_HZ * CONFIG_VCO_MULT)/2)
  109. #endif
  110. #ifndef CONFIG_PLL_BYPASS
  111. #define CONFIG_CCLK_HZ (CONFIG_VCO_HZ/CONFIG_CCLK_DIV)
  112. #define CONFIG_SCLK_HZ (CONFIG_VCO_HZ/CONFIG_SCLK_DIV)
  113. #else
  114. #define CONFIG_CCLK_HZ CONFIG_CLKIN_HZ
  115. #define CONFIG_SCLK_HZ CONFIG_CLKIN_HZ
  116. #endif
  117. #if (CONFIG_SCLK_DIV < 1)
  118. #error "SCLK DIV cannot be less than 1 or more than 15. Please select a proper value"
  119. #endif
  120. #if (CONFIG_SCLK_DIV > 15)
  121. #error "SCLK DIV cannot be less than 1 or more than 15. Please select a proper value"
  122. #endif
  123. #if (CONFIG_CCLK_DIV != 1)
  124. #if (CONFIG_CCLK_DIV != 2)
  125. #if (CONFIG_CCLK_DIV != 4)
  126. #if (CONFIG_CCLK_DIV != 8)
  127. #error "CCLK DIV can be 1,2,4 or 8 only. Please select a proper value"
  128. #endif
  129. #endif
  130. #endif
  131. #endif
  132. #if (CONFIG_VCO_HZ > MAX_VC)
  133. #error "VCO selected is more than maximum value. Please change the VCO multipler"
  134. #endif
  135. #if (CONFIG_SCLK_HZ > 133000000)
  136. #error "Sclk value selected is more than maximum. Please select a proper value for SCLK multiplier"
  137. #endif
  138. #if (CONFIG_SCLK_HZ < 27000000)
  139. #error "Sclk value selected is less than minimum. Please select a proper value for SCLK multiplier"
  140. #endif
  141. #if (CONFIG_SCLK_HZ >= CONFIG_CCLK_HZ)
  142. #if (CONFIG_SCLK_HZ != CONFIG_CLKIN_HZ)
  143. #if (CONFIG_CCLK_HZ != CONFIG_CLKIN_HZ)
  144. #error "Please select sclk less than cclk"
  145. #endif
  146. #endif
  147. #endif
  148. #if (CONFIG_CCLK_DIV == 1)
  149. #define CONFIG_CCLK_ACT_DIV CCLK_DIV1
  150. #endif
  151. #if (CONFIG_CCLK_DIV == 2)
  152. #define CONFIG_CCLK_ACT_DIV CCLK_DIV2
  153. #endif
  154. #if (CONFIG_CCLK_DIV == 4)
  155. #define CONFIG_CCLK_ACT_DIV CCLK_DIV4
  156. #endif
  157. #if (CONFIG_CCLK_DIV == 8)
  158. #define CONFIG_CCLK_ACT_DIV CCLK_DIV8
  159. #endif
  160. #ifndef CONFIG_CCLK_ACT_DIV
  161. #define CONFIG_CCLK_ACT_DIV CONFIG_CCLK_DIV_not_defined_properly
  162. #endif
  163. #endif /* CONFIG_BFIN_KERNEL_CLOCK */
  164. #ifdef CONFIG_BF542
  165. #define CPU "BF542"
  166. #define CPUID 0x027c8000
  167. #endif
  168. #ifdef CONFIG_BF544
  169. #define CPU "BF544"
  170. #define CPUID 0x027c8000
  171. #endif
  172. #ifdef CONFIG_BF548
  173. #define CPU "BF548"
  174. #define CPUID 0x027c6000
  175. #endif
  176. #ifdef CONFIG_BF549
  177. #define CPU "BF549"
  178. #endif
  179. #ifndef CPU
  180. #define CPU "UNKNOWN"
  181. #define CPUID 0x0
  182. #endif
  183. #if (CONFIG_MEM_SIZE % 4)
  184. #error "SDRAM mem size must be multible of 4MB"
  185. #endif
  186. #define SDRAM_IGENERIC (CPLB_L1_CHBL | CPLB_USER_RD | CPLB_VALID | CPLB_PORTPRIO)
  187. #define SDRAM_IKERNEL (SDRAM_IGENERIC | CPLB_LOCK)
  188. #define L1_IMEMORY ( CPLB_USER_RD | CPLB_VALID | CPLB_LOCK)
  189. #define SDRAM_INON_CHBL ( CPLB_USER_RD | CPLB_VALID)
  190. /*Use the menuconfig cache policy here - CONFIG_BLKFIN_WT/CONFIG_BLKFIN_WB*/
  191. #define ANOMALY_05000158_WORKAROUND 0x200
  192. #ifdef CONFIG_BLKFIN_WB /*Write Back Policy */
  193. #define SDRAM_DGENERIC (CPLB_L1_CHBL | CPLB_DIRTY \
  194. | CPLB_SUPV_WR | CPLB_USER_WR | CPLB_USER_RD | CPLB_VALID | ANOMALY_05000158_WORKAROUND)
  195. #else /*Write Through */
  196. #define SDRAM_DGENERIC (CPLB_L1_CHBL | CPLB_WT | CPLB_L1_AOW \
  197. | CPLB_SUPV_WR | CPLB_USER_WR | CPLB_USER_RD | CPLB_VALID | ANOMALY_05000158_WORKAROUND | CPLB_DIRTY )
  198. #endif
  199. #define L1_DMEMORY (CPLB_SUPV_WR | CPLB_USER_WR | CPLB_USER_RD | CPLB_VALID | ANOMALY_05000158_WORKAROUND | CPLB_LOCK | CPLB_DIRTY )
  200. #define SDRAM_DNON_CHBL (CPLB_SUPV_WR | CPLB_USER_WR | CPLB_USER_RD | CPLB_VALID | ANOMALY_05000158_WORKAROUND | CPLB_DIRTY )
  201. #define SDRAM_EBIU (CPLB_SUPV_WR | CPLB_USER_WR | CPLB_USER_RD | CPLB_VALID | ANOMALY_05000158_WORKAROUND | CPLB_DIRTY )
  202. #define SDRAM_OOPS (CPLB_VALID | ANOMALY_05000158_WORKAROUND | CPLB_LOCK | CPLB_DIRTY )
  203. #define SIZE_1K 0x00000400 /* 1K */
  204. #define SIZE_4K 0x00001000 /* 4K */
  205. #define SIZE_1M 0x00100000 /* 1M */
  206. #define SIZE_4M 0x00400000 /* 4M */
  207. #define MAX_CPLBS (16 * 2)
  208. /*
  209. * Number of required data CPLB switchtable entries
  210. * MEMSIZE / 4 (we mostly install 4M page size CPLBs
  211. * approx 16 for smaller 1MB page size CPLBs for allignment purposes
  212. * 1 for L1 Data Memory
  213. * 1 for CONFIG_DEBUG_HUNT_FOR_ZERO
  214. * 1 for ASYNC Memory
  215. */
  216. #define MAX_SWITCH_D_CPLBS (((CONFIG_MEM_SIZE / 4) + 16 + 1 + 1 + 1) * 2)
  217. /*
  218. * Number of required instruction CPLB switchtable entries
  219. * MEMSIZE / 4 (we mostly install 4M page size CPLBs
  220. * approx 12 for smaller 1MB page size CPLBs for allignment purposes
  221. * 1 for L1 Instruction Memory
  222. * 1 for CONFIG_DEBUG_HUNT_FOR_ZERO
  223. */
  224. #define MAX_SWITCH_I_CPLBS (((CONFIG_MEM_SIZE / 4) + 12 + 1 + 1) * 2)
  225. #endif /* __MACH_BF48_H__ */