Kumar Gala | 47d41cc | 2009-02-05 20:40:57 -0600 | [diff] [blame] | 1 | /* |
Mike Frysinger | f348ab8 | 2009-04-24 17:22:40 -0400 | [diff] [blame] | 2 | * config.h - setup common defines for Blackfin boards based on config.h |
Kumar Gala | 47d41cc | 2009-02-05 20:40:57 -0600 | [diff] [blame] | 3 | * |
Mike Frysinger | f348ab8 | 2009-04-24 17:22:40 -0400 | [diff] [blame] | 4 | * Copyright (c) 2007-2009 Analog Devices Inc. |
Kumar Gala | 47d41cc | 2009-02-05 20:40:57 -0600 | [diff] [blame] | 5 | * |
Mike Frysinger | f348ab8 | 2009-04-24 17:22:40 -0400 | [diff] [blame] | 6 | * Licensed under the GPL-2 or later. |
Kumar Gala | 47d41cc | 2009-02-05 20:40:57 -0600 | [diff] [blame] | 7 | */ |
| 8 | |
Mike Frysinger | f348ab8 | 2009-04-24 17:22:40 -0400 | [diff] [blame] | 9 | #ifndef __ASM_BLACKFIN_CONFIG_POST_H__ |
| 10 | #define __ASM_BLACKFIN_CONFIG_POST_H__ |
| 11 | |
Mike Frysinger | 1fde3eb | 2010-10-27 21:10:58 -0400 | [diff] [blame] | 12 | /* Some of our defines use this (like CONFIG_SYS_GBL_DATA_ADDR) */ |
| 13 | #include <asm-offsets.h> |
| 14 | |
Mike Frysinger | fbcf8e8 | 2010-12-23 14:58:37 -0500 | [diff] [blame] | 15 | /* Sanity check CONFIG_BFIN_CPU */ |
| 16 | #ifndef CONFIG_BFIN_CPU |
| 17 | # error CONFIG_BFIN_CPU: your board config needs to define this |
| 18 | #endif |
| 19 | |
Mike Frysinger | 9c46e71 | 2009-08-24 20:48:04 -0400 | [diff] [blame] | 20 | #ifndef CONFIG_BFIN_SCRATCH_REG |
| 21 | # define CONFIG_BFIN_SCRATCH_REG retn |
| 22 | #endif |
| 23 | |
Mike Frysinger | 8e5c1ed | 2011-10-12 20:16:31 -0400 | [diff] [blame] | 24 | /* U-Boot wants this config name */ |
| 25 | #define CONFIG_SYS_CACHELINE_SIZE L1_CACHE_BYTES |
| 26 | |
Mike Frysinger | f348ab8 | 2009-04-24 17:22:40 -0400 | [diff] [blame] | 27 | /* Make sure the structure is properly aligned */ |
| 28 | #if ((CONFIG_SYS_GBL_DATA_ADDR & -4) != CONFIG_SYS_GBL_DATA_ADDR) |
| 29 | # error CONFIG_SYS_GBL_DATA_ADDR: must be 4 byte aligned |
| 30 | #endif |
| 31 | |
| 32 | /* Set default CONFIG_VCO_HZ if need be */ |
| 33 | #if !defined(CONFIG_VCO_HZ) |
| 34 | # if (CONFIG_CLKIN_HALF == 0) |
| 35 | # define CONFIG_VCO_HZ (CONFIG_CLKIN_HZ * CONFIG_VCO_MULT) |
| 36 | # else |
| 37 | # define CONFIG_VCO_HZ ((CONFIG_CLKIN_HZ * CONFIG_VCO_MULT) / 2) |
| 38 | # endif |
| 39 | #endif |
| 40 | |
| 41 | /* Set default CONFIG_CCLK_HZ if need be */ |
| 42 | #if !defined(CONFIG_CCLK_HZ) |
| 43 | # if (CONFIG_PLL_BYPASS == 0) |
| 44 | # define CONFIG_CCLK_HZ (CONFIG_VCO_HZ / CONFIG_CCLK_DIV) |
| 45 | # else |
| 46 | # define CONFIG_CCLK_HZ CONFIG_CLKIN_HZ |
| 47 | # endif |
| 48 | #endif |
| 49 | |
| 50 | /* Set default CONFIG_SCLK_HZ if need be */ |
| 51 | #if !defined(CONFIG_SCLK_HZ) |
| 52 | # if (CONFIG_PLL_BYPASS == 0) |
| 53 | # define CONFIG_SCLK_HZ (CONFIG_VCO_HZ / CONFIG_SCLK_DIV) |
| 54 | # else |
| 55 | # define CONFIG_SCLK_HZ CONFIG_CLKIN_HZ |
| 56 | # endif |
| 57 | #endif |
| 58 | |
| 59 | /* Since we use these to program PLL registers directly, |
| 60 | * make sure the values are sane and won't screw us up. |
| 61 | */ |
| 62 | #if (CONFIG_VCO_MULT & 0x3F) != CONFIG_VCO_MULT |
| 63 | # error CONFIG_VCO_MULT: Invalid value: must fit in 6 bits (0 - 63) |
| 64 | #endif |
| 65 | #if (CONFIG_CLKIN_HALF & 0x1) != CONFIG_CLKIN_HALF |
| 66 | # error CONFIG_CLKIN_HALF: Invalid value: must be 0 or 1 |
| 67 | #endif |
| 68 | #if (CONFIG_PLL_BYPASS & 0x1) != CONFIG_PLL_BYPASS |
| 69 | # error CONFIG_PLL_BYPASS: Invalid value: must be 0 or 1 |
| 70 | #endif |
| 71 | |
Robin Getz | f19fd87 | 2009-12-21 16:35:48 -0500 | [diff] [blame] | 72 | /* If we are using KGDB, make sure we defer exceptions */ |
| 73 | #ifdef CONFIG_CMD_KGDB |
| 74 | # define CONFIG_EXCEPTION_DEFER 1 |
| 75 | #endif |
| 76 | |
Mike Frysinger | f348ab8 | 2009-04-24 17:22:40 -0400 | [diff] [blame] | 77 | /* Using L1 scratch pad makes sense for everyone by default. */ |
| 78 | #ifndef CONFIG_LINUX_CMDLINE_ADDR |
| 79 | # define CONFIG_LINUX_CMDLINE_ADDR L1_SRAM_SCRATCH |
| 80 | #endif |
| 81 | #ifndef CONFIG_LINUX_CMDLINE_SIZE |
| 82 | # define CONFIG_LINUX_CMDLINE_SIZE L1_SRAM_SCRATCH_SIZE |
| 83 | #endif |
| 84 | |
| 85 | /* Set default SPI flash CS to the one we boot from */ |
| 86 | #if defined(CONFIG_ENV_IS_IN_SPI_FLASH) && !defined(CONFIG_ENV_SPI_CS) |
| 87 | # define CONFIG_ENV_SPI_CS BFIN_BOOT_SPI_SSEL |
| 88 | #endif |
| 89 | |
Mike Frysinger | 76d8218 | 2009-07-21 22:17:36 -0400 | [diff] [blame] | 90 | /* We need envcrc to embed the env into LDRs */ |
| 91 | #ifdef CONFIG_ENV_IS_EMBEDDED_IN_LDR |
| 92 | # define CONFIG_BUILD_ENVCRC |
| 93 | #endif |
| 94 | |
Mike Frysinger | f348ab8 | 2009-04-24 17:22:40 -0400 | [diff] [blame] | 95 | /* Default/common Blackfin memory layout */ |
| 96 | #ifndef CONFIG_SYS_SDRAM_BASE |
| 97 | # define CONFIG_SYS_SDRAM_BASE 0 |
| 98 | #endif |
| 99 | #ifndef CONFIG_SYS_MAX_RAM_SIZE |
| 100 | # define CONFIG_SYS_MAX_RAM_SIZE (CONFIG_MEM_SIZE * 1024 * 1024) |
| 101 | #endif |
| 102 | #ifndef CONFIG_SYS_MONITOR_BASE |
Mike Frysinger | 7527fee | 2009-11-09 19:38:23 -0500 | [diff] [blame] | 103 | # if CONFIG_SYS_MAX_RAM_SIZE |
| 104 | # define CONFIG_SYS_MONITOR_BASE (CONFIG_SYS_MAX_RAM_SIZE - CONFIG_SYS_MONITOR_LEN) |
| 105 | # else |
| 106 | # define CONFIG_SYS_MONITOR_BASE 0 |
| 107 | # endif |
Mike Frysinger | f348ab8 | 2009-04-24 17:22:40 -0400 | [diff] [blame] | 108 | #endif |
| 109 | #ifndef CONFIG_SYS_MALLOC_BASE |
| 110 | # define CONFIG_SYS_MALLOC_BASE (CONFIG_SYS_MONITOR_BASE - CONFIG_SYS_MALLOC_LEN) |
| 111 | #endif |
Mike Frysinger | f348ab8 | 2009-04-24 17:22:40 -0400 | [diff] [blame] | 112 | #ifndef CONFIG_SYS_GBL_DATA_ADDR |
Wolfgang Denk | 25ddd1f | 2010-10-26 14:34:52 +0200 | [diff] [blame] | 113 | # define CONFIG_SYS_GBL_DATA_ADDR (CONFIG_SYS_MALLOC_BASE - GENERATED_GBL_DATA_SIZE) |
Mike Frysinger | f348ab8 | 2009-04-24 17:22:40 -0400 | [diff] [blame] | 114 | #endif |
Mike Frysinger | 5a9a2c5 | 2010-12-24 12:48:16 -0500 | [diff] [blame] | 115 | #ifndef CONFIG_SYS_BD_INFO_ADDR |
| 116 | # define CONFIG_SYS_BD_INFO_ADDR (CONFIG_SYS_GBL_DATA_ADDR - GENERATED_BD_INFO_SIZE) |
| 117 | #endif |
Mike Frysinger | f348ab8 | 2009-04-24 17:22:40 -0400 | [diff] [blame] | 118 | #ifndef CONFIG_STACKBASE |
Mike Frysinger | 5a9a2c5 | 2010-12-24 12:48:16 -0500 | [diff] [blame] | 119 | # define CONFIG_STACKBASE (CONFIG_SYS_BD_INFO_ADDR - 4) |
Mike Frysinger | f348ab8 | 2009-04-24 17:22:40 -0400 | [diff] [blame] | 120 | #endif |
| 121 | #ifndef CONFIG_SYS_MEMTEST_START |
| 122 | # define CONFIG_SYS_MEMTEST_START 0 |
| 123 | #endif |
| 124 | #ifndef CONFIG_SYS_MEMTEST_END |
| 125 | # define CONFIG_SYS_MEMTEST_END (CONFIG_STACKBASE - 8192 + 4) |
| 126 | #endif |
Mike Frysinger | 272d2fc | 2011-05-09 19:37:55 -0400 | [diff] [blame] | 127 | #ifndef CONFIG_SYS_POST_WORD_ADDR |
| 128 | # define CONFIG_SYS_POST_WORD_ADDR (L1_DATA_B_SRAM + L1_DATA_B_SRAM_SIZE - 4) |
| 129 | #endif |
Mike Frysinger | f348ab8 | 2009-04-24 17:22:40 -0400 | [diff] [blame] | 130 | |
| 131 | /* Check to make sure everything fits in external RAM */ |
Mike Frysinger | 7527fee | 2009-11-09 19:38:23 -0500 | [diff] [blame] | 132 | #if CONFIG_SYS_MAX_RAM_SIZE && \ |
| 133 | ((CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN) > CONFIG_SYS_MAX_RAM_SIZE) |
Mike Frysinger | f348ab8 | 2009-04-24 17:22:40 -0400 | [diff] [blame] | 134 | # error Memory Map does not fit into configuration |
| 135 | #endif |
| 136 | |
| 137 | /* Default/common Blackfin environment settings */ |
| 138 | #ifndef CONFIG_LOADADDR |
| 139 | # define CONFIG_LOADADDR 0x1000000 |
| 140 | #endif |
| 141 | #ifndef CONFIG_SYS_LOAD_ADDR |
| 142 | # define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR |
| 143 | #endif |
| 144 | #ifndef CONFIG_SYS_BOOTM_LEN |
| 145 | # define CONFIG_SYS_BOOTM_LEN 0x4000000 |
| 146 | #endif |
| 147 | #ifndef CONFIG_SYS_PROMPT |
| 148 | # define CONFIG_SYS_PROMPT "bfin> " |
| 149 | #endif |
| 150 | #ifndef CONFIG_SYS_CBSIZE |
Mike Frysinger | 69a25ce | 2009-08-24 20:36:25 -0400 | [diff] [blame] | 151 | # define CONFIG_SYS_CBSIZE 1024 |
Robin Getz | f19fd87 | 2009-12-21 16:35:48 -0500 | [diff] [blame] | 152 | #elif defined(CONFIG_CMD_KGDB) && CONFIG_SYS_CBSIZE < 1024 |
| 153 | # error "kgdb needs cbsize to be >= 1024" |
Mike Frysinger | f348ab8 | 2009-04-24 17:22:40 -0400 | [diff] [blame] | 154 | #endif |
| 155 | #ifndef CONFIG_SYS_BARGSIZE |
| 156 | # define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE |
| 157 | #endif |
| 158 | #ifndef CONFIG_SYS_PBSIZE |
| 159 | # define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16) |
| 160 | #endif |
| 161 | #ifndef CONFIG_SYS_MAXARGS |
| 162 | # define CONFIG_SYS_MAXARGS 16 |
| 163 | #endif |
| 164 | #if defined(CONFIG_SYS_HZ) |
| 165 | # if (CONFIG_SYS_HZ != 1000) |
| 166 | # warning "CONFIG_SYS_HZ must always be 1000" |
| 167 | # endif |
| 168 | # undef CONFIG_SYS_HZ |
| 169 | #endif |
| 170 | #define CONFIG_SYS_HZ 1000 |
| 171 | #ifndef CONFIG_SYS_BAUDRATE_TABLE |
| 172 | # define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 } |
| 173 | #endif |
Kumar Gala | 47d41cc | 2009-02-05 20:40:57 -0600 | [diff] [blame] | 174 | |
Mike Frysinger | 2151374 | 2011-05-10 16:22:25 -0400 | [diff] [blame] | 175 | /* Blackfin POST tests */ |
| 176 | #ifdef CONFIG_POST_BSPEC1_GPIO_LEDS |
| 177 | # define CONFIG_POST_BSPEC1 \ |
| 178 | { \ |
| 179 | "LED test", "led", "This test verifies LEDs on the board.", \ |
| 180 | POST_MEM | POST_ALWAYS, &led_post_test, NULL, NULL, \ |
| 181 | CONFIG_SYS_POST_BSPEC1, \ |
| 182 | } |
| 183 | #endif |
| 184 | #ifdef CONFIG_POST_BSPEC2_GPIO_BUTTONS |
| 185 | # define CONFIG_POST_BSPEC2 \ |
| 186 | { \ |
| 187 | "Button test", "button", "This test verifies buttons on the board.", \ |
| 188 | POST_MEM | POST_ALWAYS, &button_post_test, NULL, NULL, \ |
| 189 | CONFIG_SYS_POST_BSPEC2, \ |
| 190 | } |
| 191 | #endif |
| 192 | |
Kumar Gala | 47d41cc | 2009-02-05 20:40:57 -0600 | [diff] [blame] | 193 | #endif |