blob: 25794dd4bf024a8b19834da0c307953b1e978aaa [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
12/* Sanity check CONFIG_BFIN_CPU */
13#ifndef CONFIG_BFIN_CPU
14# error CONFIG_BFIN_CPU: your board config needs to define this
15#endif
16
Mike Frysinger9c46e712009-08-24 20:48:04 -040017#ifndef CONFIG_BFIN_SCRATCH_REG
18# define CONFIG_BFIN_SCRATCH_REG retn
19#endif
20
Mike Frysingerf348ab82009-04-24 17:22:40 -040021/* Make sure the structure is properly aligned */
22#if ((CONFIG_SYS_GBL_DATA_ADDR & -4) != CONFIG_SYS_GBL_DATA_ADDR)
23# error CONFIG_SYS_GBL_DATA_ADDR: must be 4 byte aligned
24#endif
25
26/* Set default CONFIG_VCO_HZ if need be */
27#if !defined(CONFIG_VCO_HZ)
28# if (CONFIG_CLKIN_HALF == 0)
29# define CONFIG_VCO_HZ (CONFIG_CLKIN_HZ * CONFIG_VCO_MULT)
30# else
31# define CONFIG_VCO_HZ ((CONFIG_CLKIN_HZ * CONFIG_VCO_MULT) / 2)
32# endif
33#endif
34
35/* Set default CONFIG_CCLK_HZ if need be */
36#if !defined(CONFIG_CCLK_HZ)
37# if (CONFIG_PLL_BYPASS == 0)
38# define CONFIG_CCLK_HZ (CONFIG_VCO_HZ / CONFIG_CCLK_DIV)
39# else
40# define CONFIG_CCLK_HZ CONFIG_CLKIN_HZ
41# endif
42#endif
43
44/* Set default CONFIG_SCLK_HZ if need be */
45#if !defined(CONFIG_SCLK_HZ)
46# if (CONFIG_PLL_BYPASS == 0)
47# define CONFIG_SCLK_HZ (CONFIG_VCO_HZ / CONFIG_SCLK_DIV)
48# else
49# define CONFIG_SCLK_HZ CONFIG_CLKIN_HZ
50# endif
51#endif
52
53/* Since we use these to program PLL registers directly,
54 * make sure the values are sane and won't screw us up.
55 */
56#if (CONFIG_VCO_MULT & 0x3F) != CONFIG_VCO_MULT
57# error CONFIG_VCO_MULT: Invalid value: must fit in 6 bits (0 - 63)
58#endif
59#if (CONFIG_CLKIN_HALF & 0x1) != CONFIG_CLKIN_HALF
60# error CONFIG_CLKIN_HALF: Invalid value: must be 0 or 1
61#endif
62#if (CONFIG_PLL_BYPASS & 0x1) != CONFIG_PLL_BYPASS
63# error CONFIG_PLL_BYPASS: Invalid value: must be 0 or 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/* Default/common Blackfin memory layout */
80#ifndef CONFIG_SYS_SDRAM_BASE
81# define CONFIG_SYS_SDRAM_BASE 0
82#endif
83#ifndef CONFIG_SYS_MAX_RAM_SIZE
84# define CONFIG_SYS_MAX_RAM_SIZE (CONFIG_MEM_SIZE * 1024 * 1024)
85#endif
86#ifndef CONFIG_SYS_MONITOR_BASE
87# define CONFIG_SYS_MONITOR_BASE (CONFIG_SYS_MAX_RAM_SIZE - CONFIG_SYS_MONITOR_LEN)
88#endif
89#ifndef CONFIG_SYS_MALLOC_BASE
90# define CONFIG_SYS_MALLOC_BASE (CONFIG_SYS_MONITOR_BASE - CONFIG_SYS_MALLOC_LEN)
91#endif
92#ifndef CONFIG_SYS_GBL_DATA_SIZE
93# define CONFIG_SYS_GBL_DATA_SIZE (128)
94#endif
95#ifndef CONFIG_SYS_GBL_DATA_ADDR
96# define CONFIG_SYS_GBL_DATA_ADDR (CONFIG_SYS_MALLOC_BASE - CONFIG_SYS_GBL_DATA_SIZE)
97#endif
98#ifndef CONFIG_STACKBASE
99# define CONFIG_STACKBASE (CONFIG_SYS_GBL_DATA_ADDR - 4)
100#endif
101#ifndef CONFIG_SYS_MEMTEST_START
102# define CONFIG_SYS_MEMTEST_START 0
103#endif
104#ifndef CONFIG_SYS_MEMTEST_END
105# define CONFIG_SYS_MEMTEST_END (CONFIG_STACKBASE - 8192 + 4)
106#endif
107
108/* Check to make sure everything fits in external RAM */
109#if ((CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN) > CONFIG_SYS_MAX_RAM_SIZE)
110# error Memory Map does not fit into configuration
111#endif
112
113/* Default/common Blackfin environment settings */
114#ifndef CONFIG_LOADADDR
115# define CONFIG_LOADADDR 0x1000000
116#endif
117#ifndef CONFIG_SYS_LOAD_ADDR
118# define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
119#endif
120#ifndef CONFIG_SYS_BOOTM_LEN
121# define CONFIG_SYS_BOOTM_LEN 0x4000000
122#endif
123#ifndef CONFIG_SYS_PROMPT
124# define CONFIG_SYS_PROMPT "bfin> "
125#endif
126#ifndef CONFIG_SYS_CBSIZE
Mike Frysinger69a25ce2009-08-24 20:36:25 -0400127# define CONFIG_SYS_CBSIZE 1024
Mike Frysingerf348ab82009-04-24 17:22:40 -0400128#endif
129#ifndef CONFIG_SYS_BARGSIZE
130# define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
131#endif
132#ifndef CONFIG_SYS_PBSIZE
133# define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
134#endif
135#ifndef CONFIG_SYS_MAXARGS
136# define CONFIG_SYS_MAXARGS 16
137#endif
138#if defined(CONFIG_SYS_HZ)
139# if (CONFIG_SYS_HZ != 1000)
140# warning "CONFIG_SYS_HZ must always be 1000"
141# endif
142# undef CONFIG_SYS_HZ
143#endif
144#define CONFIG_SYS_HZ 1000
145#ifndef CONFIG_SYS_BAUDRATE_TABLE
146# define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
147#endif
Kumar Gala47d41cc2009-02-05 20:40:57 -0600148
149#endif