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