1 | /*===============================================================*\ |
---|
2 | | Project: RTEMS generic MPC83xx BSP | |
---|
3 | +-----------------------------------------------------------------+ |
---|
4 | | Copyright (c) 2007 | |
---|
5 | | Embedded Brains GmbH | |
---|
6 | | Obere Lagerstr. 30 | |
---|
7 | | D-82178 Puchheim | |
---|
8 | | Germany | |
---|
9 | | rtems@embedded-brains.de | |
---|
10 | +-----------------------------------------------------------------+ |
---|
11 | | The license and distribution terms for this file may be | |
---|
12 | | found in the file LICENSE in this distribution or at | |
---|
13 | | | |
---|
14 | | http://www.rtems.com/license/LICENSE. | |
---|
15 | | | |
---|
16 | +-----------------------------------------------------------------+ |
---|
17 | | this file contains board specific definitions | |
---|
18 | \*===============================================================*/ |
---|
19 | |
---|
20 | #ifndef __GEN83xx_BSP_h |
---|
21 | #define __GEN83xx_BSP_h |
---|
22 | |
---|
23 | /* |
---|
24 | * distinguish board characteristics |
---|
25 | */ |
---|
26 | /* |
---|
27 | * for Freescale MPC8349 EAMDS |
---|
28 | */ |
---|
29 | #if defined(MPC8349EAMDS) |
---|
30 | /* |
---|
31 | * two DUART channels supported |
---|
32 | */ |
---|
33 | #define GEN83xx_DUART_AVAIL_MASK 0x03 |
---|
34 | |
---|
35 | /* we need the low level initialization in start.S*/ |
---|
36 | #define NEED_LOW_LEVEL_INIT |
---|
37 | /* |
---|
38 | * clocking infos |
---|
39 | */ |
---|
40 | #define BSP_CLKIN_FRQ 66000000L |
---|
41 | #define BSP_SYSPLL_MF 4 /* FIXME: derive from clock register */ |
---|
42 | |
---|
43 | /* |
---|
44 | * address range definitions |
---|
45 | */ |
---|
46 | /* ROM definitions (2 MB) */ |
---|
47 | #define ROM_START 0xFFE00000 |
---|
48 | #define ROM_SIZE 0x00200000 |
---|
49 | #define ROM_END (ROM_START+ROM_SIZE-1) |
---|
50 | #define BOOT_START ROM_START |
---|
51 | #define BOOT_END ROM_END |
---|
52 | |
---|
53 | /* SDRAM definitions (256 MB) */ |
---|
54 | #define RAM_START 0x00000000 |
---|
55 | #define RAM_SIZE 0x10000000 |
---|
56 | #define RAM_END (RAM_START+RAM_SIZE-1) |
---|
57 | |
---|
58 | /* working internal memory map base address */ |
---|
59 | #define IMMRBAR 0xE0000000 |
---|
60 | |
---|
61 | /* |
---|
62 | * working values for various registers, used in start/start.S |
---|
63 | */ |
---|
64 | /* |
---|
65 | * Local Access Windows |
---|
66 | * FIXME: decode bit settings |
---|
67 | */ |
---|
68 | #define LBLAWBAR0_VAL 0xFE000000 |
---|
69 | #define LBLAWAR0_VAL 0x80000016 |
---|
70 | #define LBLAWBAR1_VAL 0xF8000000 |
---|
71 | #define LBLAWAR1_VAL 0x8000000E |
---|
72 | #define LBLAWBAR2_VAL 0xF0000000 |
---|
73 | #define LBLAWAR2_VAL 0x80000019 |
---|
74 | #define DDRLAWBAR0_VAL 0x00000000 |
---|
75 | #define DDRLAWAR0_VAL 0x8000001B |
---|
76 | /* |
---|
77 | * Local Bus (Memory) Controller |
---|
78 | * FIXME: decode bit settings |
---|
79 | */ |
---|
80 | #define BR0_VAL 0xFE001001 |
---|
81 | #define OR0_VAL 0xFF806FF7 |
---|
82 | #define BR1_VAL 0xF8000801 |
---|
83 | #define OR1_VAL 0xFFFFE8F0 |
---|
84 | #define BR2_VAL 0xF0001861 |
---|
85 | #define OR2_VAL 0xFC006901 |
---|
86 | /* |
---|
87 | * SDRAM registers |
---|
88 | * FIXME: decode bit settings |
---|
89 | */ |
---|
90 | #define MRPTR_VAL 0x20000000 |
---|
91 | #define LSRT_VAL 0x32000000 |
---|
92 | #define LSDMR_VAL 0x4062D733 |
---|
93 | #define LCRR_VAL 0x80000004 |
---|
94 | |
---|
95 | /* |
---|
96 | * DDR-SDRAM registers |
---|
97 | * FIXME: decode bit settings |
---|
98 | */ |
---|
99 | #define CS2_BNDS_VAL 0x00000007 |
---|
100 | #define CS3_BNDS_VAL 0x0008000F |
---|
101 | #define CS2_CONFIG_VAL 0x80000101 |
---|
102 | #define CS3_CONFIG_VAL 0x80000101 |
---|
103 | #define TIMING_CFG_1_VAL 0x36333321 |
---|
104 | #define TIMING_CFG_2_VAL 0x00000800 |
---|
105 | #define DDR_SDRAM_CFG_VAL 0xC2000000 |
---|
106 | #define DDR_SDRAM_MODE_VAL 0x00000022 |
---|
107 | #define DDR_SDRAM_INTTVL_VAL 0x045B0100 |
---|
108 | #define DDR_SDRAM_CLK_CNTL_VAL 0x00000000 |
---|
109 | |
---|
110 | #else |
---|
111 | #error "board type not defined" |
---|
112 | #endif |
---|
113 | |
---|
114 | #ifndef ASM |
---|
115 | |
---|
116 | #ifdef __cplusplus |
---|
117 | extern "C" { |
---|
118 | #endif |
---|
119 | |
---|
120 | #include "bspopts.h" |
---|
121 | |
---|
122 | #include <rtems.h> |
---|
123 | #include <rtems/console.h> |
---|
124 | #include <rtems/clockdrv.h> |
---|
125 | #include <bsp/irq.h> |
---|
126 | #include <bsp/vectors.h> |
---|
127 | |
---|
128 | /* |
---|
129 | * Network driver configuration |
---|
130 | */ |
---|
131 | struct rtems_bsdnet_ifconfig; |
---|
132 | extern int rtems_mpc83xx_tsec_driver_attach_detach (struct rtems_bsdnet_ifconfig *config, int attaching); |
---|
133 | #define RTEMS_BSP_NETWORK_DRIVER_NAME "tsec1" |
---|
134 | #define RTEMS_BSP_NETWORK_DRIVER_ATTACH rtems_mpc83xx_tsec_driver_attach_detach |
---|
135 | |
---|
136 | /* miscellaneous stuff assumed to exist */ |
---|
137 | |
---|
138 | extern rtems_configuration_table BSP_Configuration; |
---|
139 | /* |
---|
140 | * We need to decide how much memory will be non-cacheable. This |
---|
141 | * will mainly be memory that will be used in DMA (network and serial |
---|
142 | * buffers). |
---|
143 | */ |
---|
144 | /* |
---|
145 | * Stuff for Time Test 27 |
---|
146 | */ |
---|
147 | #define MUST_WAIT_FOR_INTERRUPT 0 |
---|
148 | |
---|
149 | /* |
---|
150 | * Device Driver Table Entries |
---|
151 | */ |
---|
152 | |
---|
153 | /* |
---|
154 | * NOTE: Use the standard Console driver entry |
---|
155 | */ |
---|
156 | #define BSP_UART1_MINOR 0 |
---|
157 | #define BSP_UART2_MINOR 1 |
---|
158 | |
---|
159 | /* |
---|
160 | * NOTE: Use the standard Clock driver entry |
---|
161 | */ |
---|
162 | |
---|
163 | /* |
---|
164 | * indicate, that BSP has no IDE driver |
---|
165 | */ |
---|
166 | #undef RTEMS_BSP_HAS_IDE_DRIVER |
---|
167 | |
---|
168 | /* |
---|
169 | * How many libio files we want |
---|
170 | */ |
---|
171 | #define BSP_LIBIO_MAX_FDS 20 |
---|
172 | |
---|
173 | /* misc macros */ |
---|
174 | #define BSP_ARRAY_CNT(arr) (sizeof(arr)/sizeof(arr[0])) |
---|
175 | |
---|
176 | /* functions */ |
---|
177 | |
---|
178 | void bsp_cleanup(void); |
---|
179 | |
---|
180 | /* console modes (only termios) */ |
---|
181 | #ifdef PRINTK_MINOR |
---|
182 | #undef PRINTK_MINOR |
---|
183 | #endif |
---|
184 | #define PRINTK_MINOR BSP_UART1_MINOR |
---|
185 | |
---|
186 | #define SINGLE_CHAR_MODE |
---|
187 | #define UARTS_USE_TERMIOS_INT 1 |
---|
188 | |
---|
189 | /* |
---|
190 | * Convert decrement value to tenths of microsecnds (used by |
---|
191 | * shared timer driver). |
---|
192 | * |
---|
193 | * + CPU has a csb_clock bus, |
---|
194 | * + There are 4 bus cycles per click |
---|
195 | * + We return value in 1/10 microsecond units. |
---|
196 | * Modified following equation to integer equation to remove |
---|
197 | * floating point math. |
---|
198 | * (int) ((float)(_value) / ((XLB_CLOCK/1000000 * 0.1) / 4.0)) |
---|
199 | */ |
---|
200 | #define BSP_CSB_CLK_FRQ (BSP_CLKIN_FRQ * BSP_SYSPLL_MF) |
---|
201 | #define BSP_Convert_decrementer( _value ) \ |
---|
202 | (int) (((_value) * 4000) / (BSP_CSB_CLK_FRQ/10000)) |
---|
203 | |
---|
204 | /* |
---|
205 | * Network driver configuration |
---|
206 | */ |
---|
207 | struct rtems_bsdnet_ifconfig; |
---|
208 | extern int BSP_tsec_attach(struct rtems_bsdnet_ifconfig *config,int attaching); |
---|
209 | #define RTEMS_BSP_NETWORK_DRIVER_NAME "tsec1" |
---|
210 | #define RTEMS_BSP_NETWORK_DRIVER_ATTACH BSP_tsec_attach |
---|
211 | |
---|
212 | #define RTEMS_BSP_NETWORK_DRIVER_NAME2 "tsec2" |
---|
213 | |
---|
214 | #ifdef __cplusplus |
---|
215 | } |
---|
216 | #endif |
---|
217 | |
---|
218 | #endif /* ASM */ |
---|
219 | |
---|
220 | #endif /* GEN83xx */ |
---|