config.h 4.5 KB

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