config.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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. #ifndef CONFIG_BFIN_SCRATCH_REG
  11. # define CONFIG_BFIN_SCRATCH_REG retn
  12. #endif
  13. /* Relocation to SDRAM works on all Blackfin boards */
  14. #define CONFIG_RELOC_FIXUP_WORKS
  15. /* Make sure the structure is properly aligned */
  16. #if ((CONFIG_SYS_GBL_DATA_ADDR & -4) != CONFIG_SYS_GBL_DATA_ADDR)
  17. # error CONFIG_SYS_GBL_DATA_ADDR: must be 4 byte aligned
  18. #endif
  19. /* Set default CONFIG_VCO_HZ if need be */
  20. #if !defined(CONFIG_VCO_HZ)
  21. # if (CONFIG_CLKIN_HALF == 0)
  22. # define CONFIG_VCO_HZ (CONFIG_CLKIN_HZ * CONFIG_VCO_MULT)
  23. # else
  24. # define CONFIG_VCO_HZ ((CONFIG_CLKIN_HZ * CONFIG_VCO_MULT) / 2)
  25. # endif
  26. #endif
  27. /* Set default CONFIG_CCLK_HZ if need be */
  28. #if !defined(CONFIG_CCLK_HZ)
  29. # if (CONFIG_PLL_BYPASS == 0)
  30. # define CONFIG_CCLK_HZ (CONFIG_VCO_HZ / CONFIG_CCLK_DIV)
  31. # else
  32. # define CONFIG_CCLK_HZ CONFIG_CLKIN_HZ
  33. # endif
  34. #endif
  35. /* Set default CONFIG_SCLK_HZ if need be */
  36. #if !defined(CONFIG_SCLK_HZ)
  37. # if (CONFIG_PLL_BYPASS == 0)
  38. # define CONFIG_SCLK_HZ (CONFIG_VCO_HZ / CONFIG_SCLK_DIV)
  39. # else
  40. # define CONFIG_SCLK_HZ CONFIG_CLKIN_HZ
  41. # endif
  42. #endif
  43. /* Since we use these to program PLL registers directly,
  44. * make sure the values are sane and won't screw us up.
  45. */
  46. #if (CONFIG_VCO_MULT & 0x3F) != CONFIG_VCO_MULT
  47. # error CONFIG_VCO_MULT: Invalid value: must fit in 6 bits (0 - 63)
  48. #endif
  49. #if (CONFIG_CLKIN_HALF & 0x1) != CONFIG_CLKIN_HALF
  50. # error CONFIG_CLKIN_HALF: Invalid value: must be 0 or 1
  51. #endif
  52. #if (CONFIG_PLL_BYPASS & 0x1) != CONFIG_PLL_BYPASS
  53. # error CONFIG_PLL_BYPASS: Invalid value: must be 0 or 1
  54. #endif
  55. /* If we are using KGDB, make sure we defer exceptions */
  56. #ifdef CONFIG_CMD_KGDB
  57. # define CONFIG_EXCEPTION_DEFER 1
  58. #endif
  59. /* Using L1 scratch pad makes sense for everyone by default. */
  60. #ifndef CONFIG_LINUX_CMDLINE_ADDR
  61. # define CONFIG_LINUX_CMDLINE_ADDR L1_SRAM_SCRATCH
  62. #endif
  63. #ifndef CONFIG_LINUX_CMDLINE_SIZE
  64. # define CONFIG_LINUX_CMDLINE_SIZE L1_SRAM_SCRATCH_SIZE
  65. #endif
  66. /* Set default SPI flash CS to the one we boot from */
  67. #if defined(CONFIG_ENV_IS_IN_SPI_FLASH) && !defined(CONFIG_ENV_SPI_CS)
  68. # define CONFIG_ENV_SPI_CS BFIN_BOOT_SPI_SSEL
  69. #endif
  70. /* We need envcrc to embed the env into LDRs */
  71. #ifdef CONFIG_ENV_IS_EMBEDDED_IN_LDR
  72. # define CONFIG_BUILD_ENVCRC
  73. #endif
  74. /* Default/common Blackfin memory layout */
  75. #ifndef CONFIG_SYS_SDRAM_BASE
  76. # define CONFIG_SYS_SDRAM_BASE 0
  77. #endif
  78. #ifndef CONFIG_SYS_MAX_RAM_SIZE
  79. # define CONFIG_SYS_MAX_RAM_SIZE (CONFIG_MEM_SIZE * 1024 * 1024)
  80. #endif
  81. #ifndef CONFIG_SYS_MONITOR_BASE
  82. # if CONFIG_SYS_MAX_RAM_SIZE
  83. # define CONFIG_SYS_MONITOR_BASE (CONFIG_SYS_MAX_RAM_SIZE - CONFIG_SYS_MONITOR_LEN)
  84. # else
  85. # define CONFIG_SYS_MONITOR_BASE 0
  86. # endif
  87. #endif
  88. #ifndef CONFIG_SYS_MALLOC_BASE
  89. # define CONFIG_SYS_MALLOC_BASE (CONFIG_SYS_MONITOR_BASE - CONFIG_SYS_MALLOC_LEN)
  90. #endif
  91. #ifndef CONFIG_SYS_GBL_DATA_SIZE
  92. # define CONFIG_SYS_GBL_DATA_SIZE (128)
  93. #endif
  94. #ifndef CONFIG_SYS_GBL_DATA_ADDR
  95. # define CONFIG_SYS_GBL_DATA_ADDR (CONFIG_SYS_MALLOC_BASE - CONFIG_SYS_GBL_DATA_SIZE)
  96. #endif
  97. #ifndef CONFIG_STACKBASE
  98. # define CONFIG_STACKBASE (CONFIG_SYS_GBL_DATA_ADDR - 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. /* Check to make sure everything fits in external RAM */
  107. #if CONFIG_SYS_MAX_RAM_SIZE && \
  108. ((CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN) > CONFIG_SYS_MAX_RAM_SIZE)
  109. # error Memory Map does not fit into configuration
  110. #endif
  111. /* Default/common Blackfin environment settings */
  112. #ifndef CONFIG_LOADADDR
  113. # define CONFIG_LOADADDR 0x1000000
  114. #endif
  115. #ifndef CONFIG_SYS_LOAD_ADDR
  116. # define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
  117. #endif
  118. #ifndef CONFIG_SYS_BOOTM_LEN
  119. # define CONFIG_SYS_BOOTM_LEN 0x4000000
  120. #endif
  121. #ifndef CONFIG_SYS_PROMPT
  122. # define CONFIG_SYS_PROMPT "bfin> "
  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. #if defined(CONFIG_SYS_HZ)
  139. # if (CONFIG_SYS_HZ != 1000)
  140. # warning "CONFIG_SYS_HZ must always be 1000"
  141. # endif
  142. # undef CONFIG_SYS_HZ
  143. #endif
  144. #define CONFIG_SYS_HZ 1000
  145. #ifndef CONFIG_SYS_BAUDRATE_TABLE
  146. # define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
  147. #endif
  148. #endif