bf561.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. /*
  2. * File: include/asm-blackfin/mach-bf561/bf561.h
  3. * Based on:
  4. * Author:
  5. *
  6. * Created:
  7. * Description: SYSTEM MMR REGISTER AND MEMORY MAP FOR ADSP-BF561
  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. #ifndef __MACH_BF561_H__
  30. #define __MACH_BF561_H__
  31. #define SUPPORTED_REVID 0x3
  32. #define OFFSET_(x) ((x) & 0x0000FFFF)
  33. #define L1_ISRAM 0xFFA00000
  34. #define L1_ISRAM_END 0xFFA04000
  35. #define DATA_BANKA_SRAM 0xFF800000
  36. #define DATA_BANKA_SRAM_END 0xFF804000
  37. #define DATA_BANKB_SRAM 0xFF900000
  38. #define DATA_BANKB_SRAM_END 0xFF904000
  39. #define L1_DSRAMA 0xFF800000
  40. #define L1_DSRAMA_END 0xFF804000
  41. #define L1_DSRAMB 0xFF900000
  42. #define L1_DSRAMB_END 0xFF904000
  43. #define L2_SRAM 0xFEB00000
  44. #define L2_SRAM_END 0xFEB20000
  45. #define AMB_FLASH 0x20000000
  46. #define AMB_FLASH_END 0x21000000
  47. #define AMB_FLASH_LENGTH 0x01000000
  48. #define L1_ISRAM_LENGTH 0x4000
  49. #define L1_DSRAMA_LENGTH 0x4000
  50. #define L1_DSRAMB_LENGTH 0x4000
  51. #define L2_SRAM_LENGTH 0x20000
  52. /*some misc defines*/
  53. #define IMASK_IVG15 0x8000
  54. #define IMASK_IVG14 0x4000
  55. #define IMASK_IVG13 0x2000
  56. #define IMASK_IVG12 0x1000
  57. #define IMASK_IVG11 0x0800
  58. #define IMASK_IVG10 0x0400
  59. #define IMASK_IVG9 0x0200
  60. #define IMASK_IVG8 0x0100
  61. #define IMASK_IVG7 0x0080
  62. #define IMASK_IVGTMR 0x0040
  63. #define IMASK_IVGHW 0x0020
  64. /***************************
  65. * Blackfin Cache setup
  66. */
  67. #define BLKFIN_ISUBBANKS 4
  68. #define BLKFIN_IWAYS 4
  69. #define BLKFIN_ILINES 32
  70. #define BLKFIN_DSUBBANKS 4
  71. #define BLKFIN_DWAYS 2
  72. #define BLKFIN_DLINES 64
  73. #define WAY0_L 0x1
  74. #define WAY1_L 0x2
  75. #define WAY01_L 0x3
  76. #define WAY2_L 0x4
  77. #define WAY02_L 0x5
  78. #define WAY12_L 0x6
  79. #define WAY012_L 0x7
  80. #define WAY3_L 0x8
  81. #define WAY03_L 0x9
  82. #define WAY13_L 0xA
  83. #define WAY013_L 0xB
  84. #define WAY32_L 0xC
  85. #define WAY320_L 0xD
  86. #define WAY321_L 0xE
  87. #define WAYALL_L 0xF
  88. #define DMC_ENABLE (2<<2) /*yes, 2, not 1 */
  89. /* IAR0 BIT FIELDS */
  90. #define PLL_WAKEUP_BIT 0xFFFFFFFF
  91. #define DMA1_ERROR_BIT 0xFFFFFF0F
  92. #define DMA2_ERROR_BIT 0xFFFFF0FF
  93. #define IMDMA_ERROR_BIT 0xFFFF0FFF
  94. #define PPI1_ERROR_BIT 0xFFF0FFFF
  95. #define PPI2_ERROR_BIT 0xFF0FFFFF
  96. #define SPORT0_ERROR_BIT 0xF0FFFFFF
  97. #define SPORT1_ERROR_BIT 0x0FFFFFFF
  98. /* IAR1 BIT FIELDS */
  99. #define SPI_ERROR_BIT 0xFFFFFFFF
  100. #define UART_ERROR_BIT 0xFFFFFF0F
  101. #define RESERVED_ERROR_BIT 0xFFFFF0FF
  102. #define DMA1_0_BIT 0xFFFF0FFF
  103. #define DMA1_1_BIT 0xFFF0FFFF
  104. #define DMA1_2_BIT 0xFF0FFFFF
  105. #define DMA1_3_BIT 0xF0FFFFFF
  106. #define DMA1_4_BIT 0x0FFFFFFF
  107. /* IAR2 BIT FIELDS */
  108. #define DMA1_5_BIT 0xFFFFFFFF
  109. #define DMA1_6_BIT 0xFFFFFF0F
  110. #define DMA1_7_BIT 0xFFFFF0FF
  111. #define DMA1_8_BIT 0xFFFF0FFF
  112. #define DMA1_9_BIT 0xFFF0FFFF
  113. #define DMA1_10_BIT 0xFF0FFFFF
  114. #define DMA1_11_BIT 0xF0FFFFFF
  115. #define DMA2_0_BIT 0x0FFFFFFF
  116. /* IAR3 BIT FIELDS */
  117. #define DMA2_1_BIT 0xFFFFFFFF
  118. #define DMA2_2_BIT 0xFFFFFF0F
  119. #define DMA2_3_BIT 0xFFFFF0FF
  120. #define DMA2_4_BIT 0xFFFF0FFF
  121. #define DMA2_5_BIT 0xFFF0FFFF
  122. #define DMA2_6_BIT 0xFF0FFFFF
  123. #define DMA2_7_BIT 0xF0FFFFFF
  124. #define DMA2_8_BIT 0x0FFFFFFF
  125. /* IAR4 BIT FIELDS */
  126. #define DMA2_9_BIT 0xFFFFFFFF
  127. #define DMA2_10_BIT 0xFFFFFF0F
  128. #define DMA2_11_BIT 0xFFFFF0FF
  129. #define TIMER0_BIT 0xFFFF0FFF
  130. #define TIMER1_BIT 0xFFF0FFFF
  131. #define TIMER2_BIT 0xFF0FFFFF
  132. #define TIMER3_BIT 0xF0FFFFFF
  133. #define TIMER4_BIT 0x0FFFFFFF
  134. /* IAR5 BIT FIELDS */
  135. #define TIMER5_BIT 0xFFFFFFFF
  136. #define TIMER6_BIT 0xFFFFFF0F
  137. #define TIMER7_BIT 0xFFFFF0FF
  138. #define TIMER8_BIT 0xFFFF0FFF
  139. #define TIMER9_BIT 0xFFF0FFFF
  140. #define TIMER10_BIT 0xFF0FFFFF
  141. #define TIMER11_BIT 0xF0FFFFFF
  142. #define PROG0_INTA_BIT 0x0FFFFFFF
  143. /* IAR6 BIT FIELDS */
  144. #define PROG0_INTB_BIT 0xFFFFFFFF
  145. #define PROG1_INTA_BIT 0xFFFFFF0F
  146. #define PROG1_INTB_BIT 0xFFFFF0FF
  147. #define PROG2_INTA_BIT 0xFFFF0FFF
  148. #define PROG2_INTB_BIT 0xFFF0FFFF
  149. #define DMA1_WRRD0_BIT 0xFF0FFFFF
  150. #define DMA1_WRRD1_BIT 0xF0FFFFFF
  151. #define DMA2_WRRD0_BIT 0x0FFFFFFF
  152. /* IAR7 BIT FIELDS */
  153. #define DMA2_WRRD1_BIT 0xFFFFFFFF
  154. #define IMDMA_WRRD0_BIT 0xFFFFFF0F
  155. #define IMDMA_WRRD1_BIT 0xFFFFF0FF
  156. #define WATCH_BIT 0xFFFF0FFF
  157. #define RESERVED_1_BIT 0xFFF0FFFF
  158. #define RESERVED_2_BIT 0xFF0FFFFF
  159. #define SUPPLE_0_BIT 0xF0FFFFFF
  160. #define SUPPLE_1_BIT 0x0FFFFFFF
  161. /* Miscellaneous Values */
  162. /****************************** EBIU Settings ********************************/
  163. #define AMBCTL0VAL ((CONFIG_BANK_1 << 16) | CONFIG_BANK_0)
  164. #define AMBCTL1VAL ((CONFIG_BANK_3 << 16) | CONFIG_BANK_2)
  165. #if defined(CONFIG_C_AMBEN_ALL)
  166. #define V_AMBEN AMBEN_ALL
  167. #elif defined(CONFIG_C_AMBEN)
  168. #define V_AMBEN 0x0
  169. #elif defined(CONFIG_C_AMBEN_B0)
  170. #define V_AMBEN AMBEN_B0
  171. #elif defined(CONFIG_C_AMBEN_B0_B1)
  172. #define V_AMBEN AMBEN_B0_B1
  173. #elif defined(CONFIG_C_AMBEN_B0_B1_B2)
  174. #define V_AMBEN AMBEN_B0_B1_B2
  175. #endif
  176. #ifdef CONFIG_C_AMCKEN
  177. #define V_AMCKEN AMCKEN
  178. #else
  179. #define V_AMCKEN 0x0
  180. #endif
  181. #ifdef CONFIG_C_B0PEN
  182. #define V_B0PEN 0x10
  183. #else
  184. #define V_B0PEN 0x00
  185. #endif
  186. #ifdef CONFIG_C_B1PEN
  187. #define V_B1PEN 0x20
  188. #else
  189. #define V_B1PEN 0x00
  190. #endif
  191. #ifdef CONFIG_C_B2PEN
  192. #define V_B2PEN 0x40
  193. #else
  194. #define V_B2PEN 0x00
  195. #endif
  196. #ifdef CONFIG_C_B3PEN
  197. #define V_B3PEN 0x80
  198. #else
  199. #define V_B3PEN 0x00
  200. #endif
  201. #ifdef CONFIG_C_CDPRIO
  202. #define V_CDPRIO 0x100
  203. #else
  204. #define V_CDPRIO 0x0
  205. #endif
  206. #define AMGCTLVAL (V_AMBEN | V_AMCKEN | V_CDPRIO | V_B0PEN | V_B1PEN | V_B2PEN | V_B3PEN | 0x0002)
  207. #define MAX_VC 600000000
  208. #define MIN_VC 50000000
  209. /******************************* PLL Settings ********************************/
  210. #ifdef CONFIG_BFIN_KERNEL_CLOCK
  211. #if (CONFIG_VCO_MULT < 0)
  212. #error "VCO Multiplier is less than 0. Please select a different value"
  213. #endif
  214. #if (CONFIG_VCO_MULT == 0)
  215. #error "VCO Multiplier should be greater than 0. Please select a different value"
  216. #endif
  217. #ifndef CONFIG_CLKIN_HALF
  218. #define CONFIG_VCO_HZ (CONFIG_CLKIN_HZ * CONFIG_VCO_MULT)
  219. #else
  220. #define CONFIG_VCO_HZ ((CONFIG_CLKIN_HZ * CONFIG_VCO_MULT)/2)
  221. #endif
  222. #ifndef CONFIG_PLL_BYPASS
  223. #define CONFIG_CCLK_HZ (CONFIG_VCO_HZ/CONFIG_CCLK_DIV)
  224. #define CONFIG_SCLK_HZ (CONFIG_VCO_HZ/CONFIG_SCLK_DIV)
  225. #else
  226. #define CONFIG_CCLK_HZ CONFIG_CLKIN_HZ
  227. #define CONFIG_SCLK_HZ CONFIG_CLKIN_HZ
  228. #endif
  229. #if (CONFIG_SCLK_DIV < 1)
  230. #error "SCLK DIV cannot be less than 1 or more than 15. Please select a proper value"
  231. #endif
  232. #if (CONFIG_SCLK_DIV > 15)
  233. #error "SCLK DIV cannot be less than 1 or more than 15. Please select a proper value"
  234. #endif
  235. #if (CONFIG_CCLK_DIV != 1)
  236. #if (CONFIG_CCLK_DIV != 2)
  237. #if (CONFIG_CCLK_DIV != 4)
  238. #if (CONFIG_CCLK_DIV != 8)
  239. #error "CCLK DIV can be 1,2,4 or 8 only. Please select a proper value"
  240. #endif
  241. #endif
  242. #endif
  243. #endif
  244. #if (CONFIG_VCO_HZ > MAX_VC)
  245. #error "VCO selected is more than maximum value. Please change the VCO multipler"
  246. #endif
  247. #if (CONFIG_SCLK_HZ > 133000000)
  248. #error "Sclk value selected is more than maximum. Please select a proper value for SCLK multiplier"
  249. #endif
  250. #if (CONFIG_SCLK_HZ < 27000000)
  251. #error "Sclk value selected is less than minimum. Please select a proper value for SCLK multiplier"
  252. #endif
  253. #if (CONFIG_SCLK_HZ >= CONFIG_CCLK_HZ)
  254. #if (CONFIG_SCLK_HZ != CONFIG_CLKIN_HZ)
  255. #if (CONFIG_CCLK_HZ != CONFIG_CLKIN_HZ)
  256. #error "Please select sclk less than cclk"
  257. #endif
  258. #endif
  259. #endif
  260. #if (CONFIG_CCLK_DIV == 1)
  261. #define CONFIG_CCLK_ACT_DIV CCLK_DIV1
  262. #endif
  263. #if (CONFIG_CCLK_DIV == 2)
  264. #define CONFIG_CCLK_ACT_DIV CCLK_DIV2
  265. #endif
  266. #if (CONFIG_CCLK_DIV == 4)
  267. #define CONFIG_CCLK_ACT_DIV CCLK_DIV4
  268. #endif
  269. #if (CONFIG_CCLK_DIV == 8)
  270. #define CONFIG_CCLK_ACT_DIV CCLK_DIV8
  271. #endif
  272. #ifndef CONFIG_CCLK_ACT_DIV
  273. #define CONFIG_CCLK_ACT_DIV CONFIG_CCLK_DIV_not_defined_properly
  274. #endif
  275. #if defined(ANOMALY_05000273) && (CONFIG_CCLK_DIV == 1)
  276. #error ANOMALY 05000273, please make sure CCLK is at least 2x SCLK
  277. #endif
  278. #endif /* CONFIG_BFIN_KERNEL_CLOCK */
  279. #ifdef CONFIG_BF561
  280. #define CPU "BF561"
  281. #define CPUID 0x027bb000
  282. #endif
  283. #ifndef CPU
  284. #define CPU "UNKNOWN"
  285. #define CPUID 0x0
  286. #endif
  287. #if (CONFIG_MEM_SIZE % 4)
  288. #error "SDRAM memory size must be a multiple of 4MB!"
  289. #endif
  290. #define SDRAM_IGENERIC (CPLB_L1_CHBL | CPLB_USER_RD | CPLB_VALID | CPLB_PORTPRIO)
  291. #define SDRAM_IKERNEL (SDRAM_IGENERIC | CPLB_LOCK)
  292. #define L1_IMEMORY ( CPLB_USER_RD | CPLB_VALID | CPLB_LOCK)
  293. #define SDRAM_INON_CHBL ( CPLB_USER_RD | CPLB_VALID)
  294. /*Use the menuconfig cache policy here - CONFIG_BLKFIN_WT/CONFIG_BLKFIN_WB*/
  295. #define ANOMALY_05000158_WORKAROUND 0x200
  296. #ifdef CONFIG_BLKFIN_WB /*Write Back Policy */
  297. #define SDRAM_DGENERIC (CPLB_L1_CHBL | CPLB_DIRTY \
  298. | CPLB_SUPV_WR | CPLB_USER_WR | CPLB_USER_RD | CPLB_VALID | ANOMALY_05000158_WORKAROUND)
  299. #else /*Write Through */
  300. #define SDRAM_DGENERIC (CPLB_L1_CHBL | CPLB_WT | CPLB_L1_AOW | CPLB_DIRTY \
  301. | CPLB_SUPV_WR | CPLB_USER_WR | CPLB_USER_RD | CPLB_VALID | ANOMALY_05000158_WORKAROUND)
  302. #endif
  303. #define L1_DMEMORY (CPLB_SUPV_WR | CPLB_USER_WR | CPLB_USER_RD | CPLB_VALID | ANOMALY_05000158_WORKAROUND | CPLB_LOCK | CPLB_DIRTY)
  304. #define SDRAM_DNON_CHBL (CPLB_SUPV_WR | CPLB_USER_WR | CPLB_USER_RD | CPLB_VALID | ANOMALY_05000158_WORKAROUND | CPLB_DIRTY)
  305. #define SDRAM_EBIU (CPLB_SUPV_WR | CPLB_USER_WR | CPLB_USER_RD | CPLB_VALID | ANOMALY_05000158_WORKAROUND | CPLB_DIRTY)
  306. #define SDRAM_OOPS (CPLB_VALID | ANOMALY_05000158_WORKAROUND | CPLB_LOCK | CPLB_DIRTY)
  307. #define L2_MEMORY (CPLB_SUPV_WR | CPLB_USER_WR | CPLB_USER_RD | CPLB_VALID | ANOMALY_05000158_WORKAROUND | CPLB_DIRTY)
  308. #define SIZE_1K 0x00000400 /* 1K */
  309. #define SIZE_4K 0x00001000 /* 4K */
  310. #define SIZE_1M 0x00100000 /* 1M */
  311. #define SIZE_4M 0x00400000 /* 4M */
  312. #define MAX_CPLBS (16 * 2)
  313. /*
  314. * Number of required data CPLB switchtable entries
  315. * MEMSIZE / 4 (we mostly install 4M page size CPLBs
  316. * approx 16 for smaller 1MB page size CPLBs for allignment purposes
  317. * 1 for L1 Data Memory
  318. * 1 for L2 Data Memory
  319. * 1 for CONFIG_DEBUG_HUNT_FOR_ZERO
  320. * 64 for ASYNC Memory
  321. */
  322. #define MAX_SWITCH_D_CPLBS (((CONFIG_MEM_SIZE / 4) + 16 + 1 + 1 + 1 + 64) * 2)
  323. /*
  324. * Number of required instruction CPLB switchtable entries
  325. * MEMSIZE / 4 (we mostly install 4M page size CPLBs
  326. * approx 12 for smaller 1MB page size CPLBs for allignment purposes
  327. * 1 for L1 Instruction Memory
  328. * 1 for L2 Instruction Memory
  329. * 1 for CONFIG_DEBUG_HUNT_FOR_ZERO
  330. */
  331. #define MAX_SWITCH_I_CPLBS (((CONFIG_MEM_SIZE / 4) + 12 + 1 + 1 + 1) * 2)
  332. #if 0 /* comment by mhfan */
  333. /* Event Vector Table Address */
  334. #define EVT_EMULATION_ADDR 0xffe02000
  335. #define EVT_RESET_ADDR 0xffe02004
  336. #define EVT_NMI_ADDR 0xffe02008
  337. #define EVT_EXCEPTION_ADDR 0xffe0200c
  338. #define EVT_GLOBAL_INT_ENB_ADDR 0xffe02010
  339. #define EVT_HARDWARE_ERROR_ADDR 0xffe02014
  340. #define EVT_TIMER_ADDR 0xffe02018
  341. #define EVT_IVG7_ADDR 0xffe0201c
  342. #define EVT_IVG8_ADDR 0xffe02020
  343. #define EVT_IVG9_ADDR 0xffe02024
  344. #define EVT_IVG10_ADDR 0xffe02028
  345. #define EVT_IVG11_ADDR 0xffe0202c
  346. #define EVT_IVG12_ADDR 0xffe02030
  347. #define EVT_IVG13_ADDR 0xffe02034
  348. #define EVT_IVG14_ADDR 0xffe02038
  349. #define EVT_IVG15_ADDR 0xffe0203c
  350. #define EVT_OVERRIDE_ADDR 0xffe02100
  351. #endif /* comment by mhfan */
  352. #endif /* __MACH_BF561_H__ */