blob: 89814cd5853b11bc9f59519c827027359e9b11a5 [file] [log] [blame]
Kumar Gala47d41cc2009-02-05 20:40:57 -06001/*
Mike Frysingerf348ab82009-04-24 17:22:40 -04002 * config.h - setup common defines for Blackfin boards based on config.h
Kumar Gala47d41cc2009-02-05 20:40:57 -06003 *
Mike Frysingerf348ab82009-04-24 17:22:40 -04004 * Copyright (c) 2007-2009 Analog Devices Inc.
Kumar Gala47d41cc2009-02-05 20:40:57 -06005 *
Mike Frysingerf348ab82009-04-24 17:22:40 -04006 * Licensed under the GPL-2 or later.
Kumar Gala47d41cc2009-02-05 20:40:57 -06007 */
8
Mike Frysingerf348ab82009-04-24 17:22:40 -04009#ifndef __ASM_BLACKFIN_CONFIG_POST_H__
10#define __ASM_BLACKFIN_CONFIG_POST_H__
11
Mike Frysinger1fde3eb2010-10-27 21:10:58 -040012/* Some of our defines use this (like CONFIG_SYS_GBL_DATA_ADDR) */
13#include <asm-offsets.h>
14
Mike Frysingerfbcf8e82010-12-23 14:58:37 -050015/* 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 Frysinger9c46e712009-08-24 20:48:04 -040020#ifndef CONFIG_BFIN_SCRATCH_REG
21# define CONFIG_BFIN_SCRATCH_REG retn
22#endif
23
Mike Frysingerf348ab82009-04-24 17:22:40 -040024/* 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
27#endif
28
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)
33# else
34# define CONFIG_VCO_HZ ((CONFIG_CLKIN_HZ * CONFIG_VCO_MULT) / 2)
35# endif
36#endif
37
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)
42# else
43# define CONFIG_CCLK_HZ CONFIG_CLKIN_HZ
44# endif
45#endif
46
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)
51# else
52# define CONFIG_SCLK_HZ CONFIG_CLKIN_HZ
53# endif
54#endif
55
56/* Since we use these to program PLL registers directly,
57 * make sure the values are sane and won't screw us up.
58 */
59#if (CONFIG_VCO_MULT & 0x3F) != CONFIG_VCO_MULT
60# error CONFIG_VCO_MULT: Invalid value: must fit in 6 bits (0 - 63)
61#endif
62#if (CONFIG_CLKIN_HALF & 0x1) != CONFIG_CLKIN_HALF
63# error CONFIG_CLKIN_HALF: Invalid value: must be 0 or 1
64#endif
65#if (CONFIG_PLL_BYPASS & 0x1) != CONFIG_PLL_BYPASS
66# error CONFIG_PLL_BYPASS: Invalid value: must be 0 or 1
67#endif
68
Robin Getzf19fd872009-12-21 16:35:48 -050069/* If we are using KGDB, make sure we defer exceptions */
70#ifdef CONFIG_CMD_KGDB
71# define CONFIG_EXCEPTION_DEFER 1
72#endif
73
Mike Frysingerf348ab82009-04-24 17:22:40 -040074/* Using L1 scratch pad makes sense for everyone by default. */
75#ifndef CONFIG_LINUX_CMDLINE_ADDR
76# define CONFIG_LINUX_CMDLINE_ADDR L1_SRAM_SCRATCH
77#endif
78#ifndef CONFIG_LINUX_CMDLINE_SIZE
79# define CONFIG_LINUX_CMDLINE_SIZE L1_SRAM_SCRATCH_SIZE
80#endif
81
82/* Set default SPI flash CS to the one we boot from */
83#if defined(CONFIG_ENV_IS_IN_SPI_FLASH) && !defined(CONFIG_ENV_SPI_CS)
84# define CONFIG_ENV_SPI_CS BFIN_BOOT_SPI_SSEL
85#endif
86
Mike Frysinger76d82182009-07-21 22:17:36 -040087/* We need envcrc to embed the env into LDRs */
88#ifdef CONFIG_ENV_IS_EMBEDDED_IN_LDR
89# define CONFIG_BUILD_ENVCRC
90#endif
91
Mike Frysingerf348ab82009-04-24 17:22:40 -040092/* Default/common Blackfin memory layout */
93#ifndef CONFIG_SYS_SDRAM_BASE
94# define CONFIG_SYS_SDRAM_BASE 0
95#endif
96#ifndef CONFIG_SYS_MAX_RAM_SIZE
97# define CONFIG_SYS_MAX_RAM_SIZE (CONFIG_MEM_SIZE * 1024 * 1024)
98#endif
99#ifndef CONFIG_SYS_MONITOR_BASE
Mike Frysinger7527fee2009-11-09 19:38:23 -0500100# if CONFIG_SYS_MAX_RAM_SIZE
101# define CONFIG_SYS_MONITOR_BASE (CONFIG_SYS_MAX_RAM_SIZE - CONFIG_SYS_MONITOR_LEN)
102# else
103# define CONFIG_SYS_MONITOR_BASE 0
104# endif
Mike Frysingerf348ab82009-04-24 17:22:40 -0400105#endif
106#ifndef CONFIG_SYS_MALLOC_BASE
107# define CONFIG_SYS_MALLOC_BASE (CONFIG_SYS_MONITOR_BASE - CONFIG_SYS_MALLOC_LEN)
108#endif
Mike Frysingerf348ab82009-04-24 17:22:40 -0400109#ifndef CONFIG_SYS_GBL_DATA_ADDR
Wolfgang Denk25ddd1f2010-10-26 14:34:52 +0200110# define CONFIG_SYS_GBL_DATA_ADDR (CONFIG_SYS_MALLOC_BASE - GENERATED_GBL_DATA_SIZE)
Mike Frysingerf348ab82009-04-24 17:22:40 -0400111#endif
Mike Frysinger5a9a2c52010-12-24 12:48:16 -0500112#ifndef CONFIG_SYS_BD_INFO_ADDR
113# define CONFIG_SYS_BD_INFO_ADDR (CONFIG_SYS_GBL_DATA_ADDR - GENERATED_BD_INFO_SIZE)
114#endif
Mike Frysingerf348ab82009-04-24 17:22:40 -0400115#ifndef CONFIG_STACKBASE
Mike Frysinger5a9a2c52010-12-24 12:48:16 -0500116# define CONFIG_STACKBASE (CONFIG_SYS_BD_INFO_ADDR - 4)
Mike Frysingerf348ab82009-04-24 17:22:40 -0400117#endif
118#ifndef CONFIG_SYS_MEMTEST_START
119# define CONFIG_SYS_MEMTEST_START 0
120#endif
121#ifndef CONFIG_SYS_MEMTEST_END
122# define CONFIG_SYS_MEMTEST_END (CONFIG_STACKBASE - 8192 + 4)
123#endif
124
125/* Check to make sure everything fits in external RAM */
Mike Frysinger7527fee2009-11-09 19:38:23 -0500126#if CONFIG_SYS_MAX_RAM_SIZE && \
127 ((CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN) > CONFIG_SYS_MAX_RAM_SIZE)
Mike Frysingerf348ab82009-04-24 17:22:40 -0400128# error Memory Map does not fit into configuration
129#endif
130
131/* Default/common Blackfin environment settings */
132#ifndef CONFIG_LOADADDR
133# define CONFIG_LOADADDR 0x1000000
134#endif
135#ifndef CONFIG_SYS_LOAD_ADDR
136# define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
137#endif
138#ifndef CONFIG_SYS_BOOTM_LEN
139# define CONFIG_SYS_BOOTM_LEN 0x4000000
140#endif
141#ifndef CONFIG_SYS_PROMPT
142# define CONFIG_SYS_PROMPT "bfin> "
143#endif
144#ifndef CONFIG_SYS_CBSIZE
Mike Frysinger69a25ce2009-08-24 20:36:25 -0400145# define CONFIG_SYS_CBSIZE 1024
Robin Getzf19fd872009-12-21 16:35:48 -0500146#elif defined(CONFIG_CMD_KGDB) && CONFIG_SYS_CBSIZE < 1024
147# error "kgdb needs cbsize to be >= 1024"
Mike Frysingerf348ab82009-04-24 17:22:40 -0400148#endif
149#ifndef CONFIG_SYS_BARGSIZE
150# define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
151#endif
152#ifndef CONFIG_SYS_PBSIZE
153# define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
154#endif
155#ifndef CONFIG_SYS_MAXARGS
156# define CONFIG_SYS_MAXARGS 16
157#endif
158#if defined(CONFIG_SYS_HZ)
159# if (CONFIG_SYS_HZ != 1000)
160# warning "CONFIG_SYS_HZ must always be 1000"
161# endif
162# undef CONFIG_SYS_HZ
163#endif
164#define CONFIG_SYS_HZ 1000
165#ifndef CONFIG_SYS_BAUDRATE_TABLE
166# define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
167#endif
Kumar Gala47d41cc2009-02-05 20:40:57 -0600168
169#endif