blob: 04372525cc2470f8bb0141945e6675e7863a9d57 [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 Frysinger9c46e712009-08-24 20:48:04 -040015#ifndef CONFIG_BFIN_SCRATCH_REG
16# define CONFIG_BFIN_SCRATCH_REG retn
17#endif
18
Mike Frysingerf348ab82009-04-24 17:22:40 -040019/* Make sure the structure is properly aligned */
20#if ((CONFIG_SYS_GBL_DATA_ADDR & -4) != CONFIG_SYS_GBL_DATA_ADDR)
21# error CONFIG_SYS_GBL_DATA_ADDR: must be 4 byte aligned
22#endif
23
24/* Set default CONFIG_VCO_HZ if need be */
25#if !defined(CONFIG_VCO_HZ)
26# if (CONFIG_CLKIN_HALF == 0)
27# define CONFIG_VCO_HZ (CONFIG_CLKIN_HZ * CONFIG_VCO_MULT)
28# else
29# define CONFIG_VCO_HZ ((CONFIG_CLKIN_HZ * CONFIG_VCO_MULT) / 2)
30# endif
31#endif
32
33/* Set default CONFIG_CCLK_HZ if need be */
34#if !defined(CONFIG_CCLK_HZ)
35# if (CONFIG_PLL_BYPASS == 0)
36# define CONFIG_CCLK_HZ (CONFIG_VCO_HZ / CONFIG_CCLK_DIV)
37# else
38# define CONFIG_CCLK_HZ CONFIG_CLKIN_HZ
39# endif
40#endif
41
42/* Set default CONFIG_SCLK_HZ if need be */
43#if !defined(CONFIG_SCLK_HZ)
44# if (CONFIG_PLL_BYPASS == 0)
45# define CONFIG_SCLK_HZ (CONFIG_VCO_HZ / CONFIG_SCLK_DIV)
46# else
47# define CONFIG_SCLK_HZ CONFIG_CLKIN_HZ
48# endif
49#endif
50
51/* Since we use these to program PLL registers directly,
52 * make sure the values are sane and won't screw us up.
53 */
54#if (CONFIG_VCO_MULT & 0x3F) != CONFIG_VCO_MULT
55# error CONFIG_VCO_MULT: Invalid value: must fit in 6 bits (0 - 63)
56#endif
57#if (CONFIG_CLKIN_HALF & 0x1) != CONFIG_CLKIN_HALF
58# error CONFIG_CLKIN_HALF: Invalid value: must be 0 or 1
59#endif
60#if (CONFIG_PLL_BYPASS & 0x1) != CONFIG_PLL_BYPASS
61# error CONFIG_PLL_BYPASS: Invalid value: must be 0 or 1
62#endif
63
Robin Getzf19fd872009-12-21 16:35:48 -050064/* If we are using KGDB, make sure we defer exceptions */
65#ifdef CONFIG_CMD_KGDB
66# define CONFIG_EXCEPTION_DEFER 1
67#endif
68
Mike Frysingerf348ab82009-04-24 17:22:40 -040069/* 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
72#endif
73#ifndef CONFIG_LINUX_CMDLINE_SIZE
74# define CONFIG_LINUX_CMDLINE_SIZE L1_SRAM_SCRATCH_SIZE
75#endif
76
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
80#endif
81
Mike Frysinger76d82182009-07-21 22:17:36 -040082/* We need envcrc to embed the env into LDRs */
83#ifdef CONFIG_ENV_IS_EMBEDDED_IN_LDR
84# define CONFIG_BUILD_ENVCRC
85#endif
86
Mike Frysingerf348ab82009-04-24 17:22:40 -040087/* Default/common Blackfin memory layout */
88#ifndef CONFIG_SYS_SDRAM_BASE
89# define CONFIG_SYS_SDRAM_BASE 0
90#endif
91#ifndef CONFIG_SYS_MAX_RAM_SIZE
92# define CONFIG_SYS_MAX_RAM_SIZE (CONFIG_MEM_SIZE * 1024 * 1024)
93#endif
94#ifndef CONFIG_SYS_MONITOR_BASE
Mike Frysinger7527fee2009-11-09 19:38:23 -050095# if CONFIG_SYS_MAX_RAM_SIZE
96# define CONFIG_SYS_MONITOR_BASE (CONFIG_SYS_MAX_RAM_SIZE - CONFIG_SYS_MONITOR_LEN)
97# else
98# define CONFIG_SYS_MONITOR_BASE 0
99# endif
Mike Frysingerf348ab82009-04-24 17:22:40 -0400100#endif
101#ifndef CONFIG_SYS_MALLOC_BASE
102# define CONFIG_SYS_MALLOC_BASE (CONFIG_SYS_MONITOR_BASE - CONFIG_SYS_MALLOC_LEN)
103#endif
Mike Frysingerf348ab82009-04-24 17:22:40 -0400104#ifndef CONFIG_SYS_GBL_DATA_ADDR
Wolfgang Denk25ddd1f2010-10-26 14:34:52 +0200105# define CONFIG_SYS_GBL_DATA_ADDR (CONFIG_SYS_MALLOC_BASE - GENERATED_GBL_DATA_SIZE)
Mike Frysingerf348ab82009-04-24 17:22:40 -0400106#endif
107#ifndef CONFIG_STACKBASE
108# define CONFIG_STACKBASE (CONFIG_SYS_GBL_DATA_ADDR - 4)
109#endif
110#ifndef CONFIG_SYS_MEMTEST_START
111# define CONFIG_SYS_MEMTEST_START 0
112#endif
113#ifndef CONFIG_SYS_MEMTEST_END
114# define CONFIG_SYS_MEMTEST_END (CONFIG_STACKBASE - 8192 + 4)
115#endif
116
117/* Check to make sure everything fits in external RAM */
Mike Frysinger7527fee2009-11-09 19:38:23 -0500118#if CONFIG_SYS_MAX_RAM_SIZE && \
119 ((CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN) > CONFIG_SYS_MAX_RAM_SIZE)
Mike Frysingerf348ab82009-04-24 17:22:40 -0400120# error Memory Map does not fit into configuration
121#endif
122
123/* Default/common Blackfin environment settings */
124#ifndef CONFIG_LOADADDR
125# define CONFIG_LOADADDR 0x1000000
126#endif
127#ifndef CONFIG_SYS_LOAD_ADDR
128# define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
129#endif
130#ifndef CONFIG_SYS_BOOTM_LEN
131# define CONFIG_SYS_BOOTM_LEN 0x4000000
132#endif
133#ifndef CONFIG_SYS_PROMPT
134# define CONFIG_SYS_PROMPT "bfin> "
135#endif
136#ifndef CONFIG_SYS_CBSIZE
Mike Frysinger69a25ce2009-08-24 20:36:25 -0400137# define CONFIG_SYS_CBSIZE 1024
Robin Getzf19fd872009-12-21 16:35:48 -0500138#elif defined(CONFIG_CMD_KGDB) && CONFIG_SYS_CBSIZE < 1024
139# error "kgdb needs cbsize to be >= 1024"
Mike Frysingerf348ab82009-04-24 17:22:40 -0400140#endif
141#ifndef CONFIG_SYS_BARGSIZE
142# define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
143#endif
144#ifndef CONFIG_SYS_PBSIZE
145# define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
146#endif
147#ifndef CONFIG_SYS_MAXARGS
148# define CONFIG_SYS_MAXARGS 16
149#endif
150#if defined(CONFIG_SYS_HZ)
151# if (CONFIG_SYS_HZ != 1000)
152# warning "CONFIG_SYS_HZ must always be 1000"
153# endif
154# undef CONFIG_SYS_HZ
155#endif
156#define CONFIG_SYS_HZ 1000
157#ifndef CONFIG_SYS_BAUDRATE_TABLE
158# define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
159#endif
Kumar Gala47d41cc2009-02-05 20:40:57 -0600160
161#endif