config.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. /*
  2. * config.h - setup common defines for Blackfin boards based on config.h
  3. *
  4. * Copyright (c) 2007-2009 Analog Devices Inc.
  5. *
  6. * Licensed under the GPL-2 or later.
  7. */
  8. #ifndef __ASM_BLACKFIN_CONFIG_POST_H__
  9. #define __ASM_BLACKFIN_CONFIG_POST_H__
  10. /* Some of our defines use this (like CONFIG_SYS_GBL_DATA_ADDR) */
  11. #include <asm-offsets.h>
  12. /* Sanity check CONFIG_BFIN_CPU */
  13. #ifndef CONFIG_BFIN_CPU
  14. # error CONFIG_BFIN_CPU: your board config needs to define this
  15. #endif
  16. #ifndef CONFIG_BFIN_SCRATCH_REG
  17. # define CONFIG_BFIN_SCRATCH_REG retn
  18. #endif
  19. /* U-Boot wants this config name */
  20. #define CONFIG_SYS_CACHELINE_SIZE L1_CACHE_BYTES
  21. /* Make sure the structure is properly aligned */
  22. #if ((CONFIG_SYS_GBL_DATA_ADDR & -4) != CONFIG_SYS_GBL_DATA_ADDR)
  23. # error CONFIG_SYS_GBL_DATA_ADDR: must be 4 byte aligned
  24. #endif
  25. /* Set default CONFIG_VCO_HZ if need be */
  26. #if !defined(CONFIG_VCO_HZ)
  27. # if (CONFIG_CLKIN_HALF == 0)
  28. # define CONFIG_VCO_HZ (CONFIG_CLKIN_HZ * CONFIG_VCO_MULT)
  29. # else
  30. # define CONFIG_VCO_HZ ((CONFIG_CLKIN_HZ * CONFIG_VCO_MULT) / 2)
  31. # endif
  32. #endif
  33. /* Set default CONFIG_CCLK_HZ if need be */
  34. #if !defined(CONFIG_CCLK_HZ)
  35. # if (CONFIG_PLL_BYPASS == 0)
  36. # define CONFIG_CCLK_HZ (CONFIG_VCO_HZ / CONFIG_CCLK_DIV)
  37. # else
  38. # define CONFIG_CCLK_HZ CONFIG_CLKIN_HZ
  39. # endif
  40. #endif
  41. /* Set default CONFIG_SCLK_HZ if need be */
  42. #if !defined(CONFIG_SCLK_HZ)
  43. # if (CONFIG_PLL_BYPASS == 0)
  44. # define CONFIG_SCLK_HZ (CONFIG_VCO_HZ / CONFIG_SCLK_DIV)
  45. # else
  46. # define CONFIG_SCLK_HZ CONFIG_CLKIN_HZ
  47. # endif
  48. #endif
  49. /* Since we use these to program PLL registers directly,
  50. * make sure the values are sane and won't screw us up.
  51. */
  52. #if (CONFIG_VCO_MULT & 0x3F) != CONFIG_VCO_MULT
  53. # error CONFIG_VCO_MULT: Invalid value: must fit in 6 bits (0 - 63)
  54. #endif
  55. #if (CONFIG_CLKIN_HALF & 0x1) != CONFIG_CLKIN_HALF
  56. # error CONFIG_CLKIN_HALF: Invalid value: must be 0 or 1
  57. #endif
  58. #if (CONFIG_PLL_BYPASS & 0x1) != CONFIG_PLL_BYPASS
  59. # error CONFIG_PLL_BYPASS: Invalid value: must be 0 or 1
  60. #endif
  61. /* If we are using KGDB, make sure we defer exceptions */
  62. #ifdef CONFIG_CMD_KGDB
  63. # define CONFIG_EXCEPTION_DEFER 1
  64. #endif
  65. /* Using L1 scratch pad makes sense for everyone by default. */
  66. #ifndef CONFIG_LINUX_CMDLINE_ADDR
  67. # define CONFIG_LINUX_CMDLINE_ADDR L1_SRAM_SCRATCH
  68. #endif
  69. #ifndef CONFIG_LINUX_CMDLINE_SIZE
  70. # define CONFIG_LINUX_CMDLINE_SIZE L1_SRAM_SCRATCH_SIZE
  71. #endif
  72. /* Set default SPI flash CS to the one we boot from */
  73. #if defined(CONFIG_ENV_IS_IN_SPI_FLASH) && !defined(CONFIG_ENV_SPI_CS)
  74. # define CONFIG_ENV_SPI_CS BFIN_BOOT_SPI_SSEL
  75. #endif
  76. /* We need envcrc to embed the env into LDRs */
  77. #ifdef CONFIG_ENV_IS_EMBEDDED_IN_LDR
  78. # define CONFIG_BUILD_ENVCRC
  79. #endif
  80. /* Default/common Blackfin memory layout */
  81. #ifndef CONFIG_SYS_SDRAM_BASE
  82. # define CONFIG_SYS_SDRAM_BASE 0
  83. #endif
  84. #ifndef CONFIG_SYS_MAX_RAM_SIZE
  85. # define CONFIG_SYS_MAX_RAM_SIZE (CONFIG_MEM_SIZE * 1024 * 1024)
  86. #endif
  87. #ifndef CONFIG_SYS_MONITOR_BASE
  88. # if CONFIG_SYS_MAX_RAM_SIZE
  89. # define CONFIG_SYS_MONITOR_BASE (CONFIG_SYS_MAX_RAM_SIZE - CONFIG_SYS_MONITOR_LEN)
  90. # else
  91. # define CONFIG_SYS_MONITOR_BASE 0
  92. # endif
  93. #endif
  94. #ifndef CONFIG_SYS_MALLOC_BASE
  95. # define CONFIG_SYS_MALLOC_BASE (CONFIG_SYS_MONITOR_BASE - CONFIG_SYS_MALLOC_LEN)
  96. #endif
  97. #ifndef CONFIG_STACKBASE
  98. # define CONFIG_STACKBASE (CONFIG_SYS_MALLOC_BASE - 4)
  99. #endif
  100. #ifndef CONFIG_SYS_MEMTEST_START
  101. # define CONFIG_SYS_MEMTEST_START 0
  102. #endif
  103. #ifndef CONFIG_SYS_MEMTEST_END
  104. # define CONFIG_SYS_MEMTEST_END (CONFIG_STACKBASE - 8192 + 4)
  105. #endif
  106. #ifndef CONFIG_SYS_POST_WORD_ADDR
  107. # define CONFIG_SYS_POST_WORD_ADDR (L1_DATA_B_SRAM + L1_DATA_B_SRAM_SIZE - 4)
  108. #endif
  109. /* Check to make sure everything fits in external RAM */
  110. #if CONFIG_SYS_MAX_RAM_SIZE && \
  111. ((CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN) > CONFIG_SYS_MAX_RAM_SIZE)
  112. # error Memory Map does not fit into configuration
  113. #endif
  114. /* Default/common Blackfin environment settings */
  115. #ifndef CONFIG_LOADADDR
  116. # define CONFIG_LOADADDR 0x1000000
  117. #endif
  118. #ifndef CONFIG_SYS_LOAD_ADDR
  119. # define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
  120. #endif
  121. #ifndef CONFIG_SYS_BOOTM_LEN
  122. # define CONFIG_SYS_BOOTM_LEN 0x4000000
  123. #endif
  124. #ifndef CONFIG_SYS_CBSIZE
  125. # define CONFIG_SYS_CBSIZE 1024
  126. #elif defined(CONFIG_CMD_KGDB) && CONFIG_SYS_CBSIZE < 1024
  127. # error "kgdb needs cbsize to be >= 1024"
  128. #endif
  129. #ifndef CONFIG_SYS_BARGSIZE
  130. # define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
  131. #endif
  132. #ifndef CONFIG_SYS_PBSIZE
  133. # define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
  134. #endif
  135. #ifndef CONFIG_SYS_MAXARGS
  136. # define CONFIG_SYS_MAXARGS 16
  137. #endif
  138. /* Blackfin POST tests */
  139. #ifdef CONFIG_POST_BSPEC1_GPIO_LEDS
  140. # define CONFIG_POST_BSPEC1 \
  141. { \
  142. "LED test", "led", "This test verifies LEDs on the board.", \
  143. POST_MEM | POST_ALWAYS, &led_post_test, NULL, NULL, \
  144. CONFIG_SYS_POST_BSPEC1, \
  145. }
  146. #endif
  147. #ifdef CONFIG_POST_BSPEC2_GPIO_BUTTONS
  148. # define CONFIG_POST_BSPEC2 \
  149. { \
  150. "Button test", "button", "This test verifies buttons on the board.", \
  151. POST_MEM | POST_ALWAYS, &button_post_test, NULL, NULL, \
  152. CONFIG_SYS_POST_BSPEC2, \
  153. }
  154. #endif
  155. #define CONFIG_CPU CONFIG_BFIN_CPU
  156. #endif