2 * config.h - setup common defines for Blackfin boards based on config.h
4 * Copyright (c) 2007-2009 Analog Devices Inc.
6 * Licensed under the GPL-2 or later.
9 #ifndef __ASM_BLACKFIN_CONFIG_POST_H__
10 #define __ASM_BLACKFIN_CONFIG_POST_H__
12 /* Sanity check CONFIG_BFIN_CPU */
13 #ifndef CONFIG_BFIN_CPU
14 # error CONFIG_BFIN_CPU: your board config needs to define this
17 #ifndef CONFIG_BFIN_SCRATCH_REG
18 # define CONFIG_BFIN_SCRATCH_REG retn
21 /* Relocation to SDRAM works on all Blackfin boards */
22 #define CONFIG_RELOC_FIXUP_WORKS
24 /* Make sure the structure is properly aligned */
25 #if ((CONFIG_SYS_GBL_DATA_ADDR & -4) != CONFIG_SYS_GBL_DATA_ADDR)
26 # error CONFIG_SYS_GBL_DATA_ADDR: must be 4 byte aligned
29 /* Set default CONFIG_VCO_HZ if need be */
30 #if !defined(CONFIG_VCO_HZ)
31 # if (CONFIG_CLKIN_HALF == 0)
32 # define CONFIG_VCO_HZ (CONFIG_CLKIN_HZ * CONFIG_VCO_MULT)
34 # define CONFIG_VCO_HZ ((CONFIG_CLKIN_HZ * CONFIG_VCO_MULT) / 2)
38 /* Set default CONFIG_CCLK_HZ if need be */
39 #if !defined(CONFIG_CCLK_HZ)
40 # if (CONFIG_PLL_BYPASS == 0)
41 # define CONFIG_CCLK_HZ (CONFIG_VCO_HZ / CONFIG_CCLK_DIV)
43 # define CONFIG_CCLK_HZ CONFIG_CLKIN_HZ
47 /* Set default CONFIG_SCLK_HZ if need be */
48 #if !defined(CONFIG_SCLK_HZ)
49 # if (CONFIG_PLL_BYPASS == 0)
50 # define CONFIG_SCLK_HZ (CONFIG_VCO_HZ / CONFIG_SCLK_DIV)
52 # define CONFIG_SCLK_HZ CONFIG_CLKIN_HZ
56 /* Since we use these to program PLL registers directly,
57 * make sure the values are sane and won't screw us up.
59 #if (CONFIG_VCO_MULT & 0x3F) != CONFIG_VCO_MULT
60 # error CONFIG_VCO_MULT: Invalid value: must fit in 6 bits (0 - 63)
62 #if (CONFIG_CLKIN_HALF & 0x1) != CONFIG_CLKIN_HALF
63 # error CONFIG_CLKIN_HALF: Invalid value: must be 0 or 1
65 #if (CONFIG_PLL_BYPASS & 0x1) != CONFIG_PLL_BYPASS
66 # error CONFIG_PLL_BYPASS: Invalid value: must be 0 or 1
69 /* Using L1 scratch pad makes sense for everyone by default. */
70 #ifndef CONFIG_LINUX_CMDLINE_ADDR
71 # define CONFIG_LINUX_CMDLINE_ADDR L1_SRAM_SCRATCH
73 #ifndef CONFIG_LINUX_CMDLINE_SIZE
74 # define CONFIG_LINUX_CMDLINE_SIZE L1_SRAM_SCRATCH_SIZE
77 /* Set default SPI flash CS to the one we boot from */
78 #if defined(CONFIG_ENV_IS_IN_SPI_FLASH) && !defined(CONFIG_ENV_SPI_CS)
79 # define CONFIG_ENV_SPI_CS BFIN_BOOT_SPI_SSEL
82 /* Default/common Blackfin memory layout */
83 #ifndef CONFIG_SYS_SDRAM_BASE
84 # define CONFIG_SYS_SDRAM_BASE 0
86 #ifndef CONFIG_SYS_MAX_RAM_SIZE
87 # define CONFIG_SYS_MAX_RAM_SIZE (CONFIG_MEM_SIZE * 1024 * 1024)
89 #ifndef CONFIG_SYS_MONITOR_BASE
90 # define CONFIG_SYS_MONITOR_BASE (CONFIG_SYS_MAX_RAM_SIZE - CONFIG_SYS_MONITOR_LEN)
92 #ifndef CONFIG_SYS_MALLOC_BASE
93 # define CONFIG_SYS_MALLOC_BASE (CONFIG_SYS_MONITOR_BASE - CONFIG_SYS_MALLOC_LEN)
95 #ifndef CONFIG_SYS_GBL_DATA_SIZE
96 # define CONFIG_SYS_GBL_DATA_SIZE (128)
98 #ifndef CONFIG_SYS_GBL_DATA_ADDR
99 # define CONFIG_SYS_GBL_DATA_ADDR (CONFIG_SYS_MALLOC_BASE - CONFIG_SYS_GBL_DATA_SIZE)
101 #ifndef CONFIG_STACKBASE
102 # define CONFIG_STACKBASE (CONFIG_SYS_GBL_DATA_ADDR - 4)
104 #ifndef CONFIG_SYS_MEMTEST_START
105 # define CONFIG_SYS_MEMTEST_START 0
107 #ifndef CONFIG_SYS_MEMTEST_END
108 # define CONFIG_SYS_MEMTEST_END (CONFIG_STACKBASE - 8192 + 4)
111 /* Check to make sure everything fits in external RAM */
112 #if ((CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN) > CONFIG_SYS_MAX_RAM_SIZE)
113 # error Memory Map does not fit into configuration
116 /* Default/common Blackfin environment settings */
117 #ifndef CONFIG_LOADADDR
118 # define CONFIG_LOADADDR 0x1000000
120 #ifndef CONFIG_SYS_LOAD_ADDR
121 # define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
123 #ifndef CONFIG_SYS_BOOTM_LEN
124 # define CONFIG_SYS_BOOTM_LEN 0x4000000
126 #ifndef CONFIG_SYS_PROMPT
127 # define CONFIG_SYS_PROMPT "bfin> "
129 #ifndef CONFIG_SYS_CBSIZE
130 # define CONFIG_SYS_CBSIZE 1024
132 #ifndef CONFIG_SYS_BARGSIZE
133 # define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
135 #ifndef CONFIG_SYS_PBSIZE
136 # define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
138 #ifndef CONFIG_SYS_MAXARGS
139 # define CONFIG_SYS_MAXARGS 16
141 #if defined(CONFIG_SYS_HZ)
142 # if (CONFIG_SYS_HZ != 1000)
143 # warning "CONFIG_SYS_HZ must always be 1000"
145 # undef CONFIG_SYS_HZ
147 #define CONFIG_SYS_HZ 1000
148 #ifndef CONFIG_SYS_BAUDRATE_TABLE
149 # define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }