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