blackfin-config-post.h 4.2 KB

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