blob: 21abd724fbed8fddaf112c58e485411fac00190f [file] [log] [blame]
Mike Frysinger66c4cf42008-02-04 19:26:55 -05001/*
2 * blackfin-config-post.h - setup common defines for Blackfin boards based on config.h
3 *
Mike Frysinger6010bfc2008-08-07 13:22:37 -04004 * Copyright (c) 2007-2008 Analog Devices Inc.
Mike Frysinger66c4cf42008-02-04 19:26:55 -05005 *
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
Mike Frysinger94bae5c2008-03-30 15:46:13 -040012/* Sanity check CONFIG_BFIN_CPU */
13#ifndef CONFIG_BFIN_CPU
14# error CONFIG_BFIN_CPU: your board config needs to define this
Mike Frysinger66c4cf42008-02-04 19:26:55 -050015#endif
16
17/* Make sure the structure is properly aligned */
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020018#if ((CONFIG_SYS_GBL_DATA_ADDR & -4) != CONFIG_SYS_GBL_DATA_ADDR)
19# error CONFIG_SYS_GBL_DATA_ADDR: must be 4 byte aligned
Mike Frysinger66c4cf42008-02-04 19:26:55 -050020#endif
21
22/* Set default CONFIG_VCO_HZ if need be */
23#if !defined(CONFIG_VCO_HZ)
24# if (CONFIG_CLKIN_HALF == 0)
25# define CONFIG_VCO_HZ (CONFIG_CLKIN_HZ * CONFIG_VCO_MULT)
26# else
27# define CONFIG_VCO_HZ ((CONFIG_CLKIN_HZ * CONFIG_VCO_MULT) / 2)
28# endif
29#endif
30
31/* Set default CONFIG_CCLK_HZ if need be */
32#if !defined(CONFIG_CCLK_HZ)
33# if (CONFIG_PLL_BYPASS == 0)
34# define CONFIG_CCLK_HZ (CONFIG_VCO_HZ / CONFIG_CCLK_DIV)
35# else
36# define CONFIG_CCLK_HZ CONFIG_CLKIN_HZ
37# endif
38#endif
39
40/* Set default CONFIG_SCLK_HZ if need be */
41#if !defined(CONFIG_SCLK_HZ)
42# if (CONFIG_PLL_BYPASS == 0)
43# define CONFIG_SCLK_HZ (CONFIG_VCO_HZ / CONFIG_SCLK_DIV)
44# else
45# define CONFIG_SCLK_HZ CONFIG_CLKIN_HZ
46# endif
47#endif
48
49/* Since we use these to program PLL registers directly,
50 * make sure the values are sane and won't screw us up.
51 */
52#if (CONFIG_VCO_MULT & 0x3F) != CONFIG_VCO_MULT
53# error CONFIG_VCO_MULT: Invalid value: must fit in 6 bits (0 - 63)
54#endif
55#if (CONFIG_CLKIN_HALF & 0x1) != CONFIG_CLKIN_HALF
56# error CONFIG_CLKIN_HALF: Invalid value: must be 0 or 1
57#endif
58#if (CONFIG_PLL_BYPASS & 0x1) != CONFIG_PLL_BYPASS
59# error CONFIG_PLL_BYPASS: Invalid value: must be 0 or 1
60#endif
61
62/* Using L1 scratch pad makes sense for everyone by default. */
Mike Frysingerc94fde22008-08-07 15:24:59 -040063#ifndef CONFIG_LINUX_CMDLINE_ADDR
64# define CONFIG_LINUX_CMDLINE_ADDR L1_SRAM_SCRATCH
65#endif
66#ifndef CONFIG_LINUX_CMDLINE_SIZE
67# define CONFIG_LINUX_CMDLINE_SIZE L1_SRAM_SCRATCH_SIZE
Mike Frysinger66c4cf42008-02-04 19:26:55 -050068#endif
69
Mike Frysinger6010bfc2008-08-07 13:22:37 -040070/* Default/common Blackfin memory layout */
71#ifndef CONFIG_SYS_SDRAM_BASE
72# define CONFIG_SYS_SDRAM_BASE 0
73#endif
74#ifndef CONFIG_SYS_MAX_RAM_SIZE
75# define CONFIG_SYS_MAX_RAM_SIZE (CONFIG_MEM_SIZE * 1024 * 1024)
76#endif
77#ifndef CONFIG_SYS_MONITOR_BASE
78# define CONFIG_SYS_MONITOR_BASE (CONFIG_SYS_MAX_RAM_SIZE - CONFIG_SYS_MONITOR_LEN)
79#endif
80#ifndef CONFIG_SYS_MALLOC_BASE
81# define CONFIG_SYS_MALLOC_BASE (CONFIG_SYS_MONITOR_BASE - CONFIG_SYS_MALLOC_LEN)
82#endif
83#ifndef CONFIG_SYS_GBL_DATA_SIZE
84# define CONFIG_SYS_GBL_DATA_SIZE (128)
85#endif
86#ifndef CONFIG_SYS_GBL_DATA_ADDR
87# define CONFIG_SYS_GBL_DATA_ADDR (CONFIG_SYS_MALLOC_BASE - CONFIG_SYS_GBL_DATA_SIZE)
88#endif
89#ifndef CONFIG_STACKBASE
90# define CONFIG_STACKBASE (CONFIG_SYS_GBL_DATA_ADDR - 4)
91#endif
92#ifndef CONFIG_SYS_MEMTEST_START
93# define CONFIG_SYS_MEMTEST_START 0
94#endif
95#ifndef CONFIG_SYS_MEMTEST_END
96# define CONFIG_SYS_MEMTEST_END (CONFIG_STACKBASE - 8192 + 4)
97#endif
98
99/* Check to make sure everything fits in external RAM */
100#if ((CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN) > CONFIG_SYS_MAX_RAM_SIZE)
101# error Memory Map does not fit into configuration
102#endif
103
104/* Default/common Blackfin environment settings */
105#ifndef CONFIG_LOADADDR
106# define CONFIG_LOADADDR 0x1000000
107#endif
108#ifndef CONFIG_SYS_LOAD_ADDR
109# define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
110#endif
111#ifndef CONFIG_SYS_BOOTM_LEN
112# define CONFIG_SYS_BOOTM_LEN 0x4000000
113#endif
114#ifndef CONFIG_SYS_PROMPT
115# define CONFIG_SYS_PROMPT "bfin> "
116#endif
117#ifndef CONFIG_SYS_CBSIZE
118# ifdef CONFIG_CMD_KGDB
119# define CONFIG_SYS_CBSIZE 1024
120# else
121# define CONFIG_SYS_CBSIZE 256
122# endif
123#endif
124#ifndef CONFIG_SYS_BARGSIZE
125# define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
126#endif
127#ifndef CONFIG_SYS_PBSIZE
128# define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
129#endif
130#ifndef CONFIG_SYS_MAXARGS
131# define CONFIG_SYS_MAXARGS 16
132#endif
133#ifndef CONFIG_SYS_HZ
134# define CONFIG_SYS_HZ 1000
135#endif
136#ifndef CONFIG_SYS_BAUDRATE_TABLE
137# define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
138#endif
139
Mike Frysinger66c4cf42008-02-04 19:26:55 -0500140#endif