1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup RTEMSBSPsPowerPCGen5200 |
---|
5 | * |
---|
6 | * @brief Global BSP definitions. |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * RTEMS generic MPC5200 BSP |
---|
11 | * |
---|
12 | * This file contains board specific definitions. |
---|
13 | */ |
---|
14 | |
---|
15 | /* |
---|
16 | * Copyright (c) 2005 embedded brains GmbH. All rights reserved. |
---|
17 | * |
---|
18 | * The license and distribution terms for this file may be |
---|
19 | * found in the file LICENSE in this distribution or at |
---|
20 | * http://www.rtems.org/license/LICENSE. |
---|
21 | */ |
---|
22 | |
---|
23 | #ifndef LIBBSP_POWERPC_GEN5200_BSP_H |
---|
24 | #define LIBBSP_POWERPC_GEN5200_BSP_H |
---|
25 | |
---|
26 | /** |
---|
27 | * @defgroup RTEMSBSPsPowerPCGen5200 NXP MPC5200 |
---|
28 | * |
---|
29 | * @ingroup RTEMSBSPsPowerPC |
---|
30 | * |
---|
31 | * @brief NXP MPC5200 Board Support Package. |
---|
32 | * |
---|
33 | * @{ |
---|
34 | */ |
---|
35 | |
---|
36 | #include <bspopts.h> |
---|
37 | |
---|
38 | #include <libcpu/powerpc-utility.h> |
---|
39 | |
---|
40 | /* |
---|
41 | * Some symbols defined in the linker command file. |
---|
42 | */ |
---|
43 | |
---|
44 | LINKER_SYMBOL(bsp_ram_start); |
---|
45 | LINKER_SYMBOL(bsp_ram_end); |
---|
46 | LINKER_SYMBOL(bsp_ram_size); |
---|
47 | |
---|
48 | LINKER_SYMBOL(bsp_rom_start); |
---|
49 | LINKER_SYMBOL(bsp_rom_end); |
---|
50 | LINKER_SYMBOL(bsp_rom_size); |
---|
51 | |
---|
52 | LINKER_SYMBOL(bsp_dpram_start); |
---|
53 | LINKER_SYMBOL(bsp_dpram_end); |
---|
54 | LINKER_SYMBOL(bsp_dpram_size); |
---|
55 | |
---|
56 | LINKER_SYMBOL(bsp_section_text_start); |
---|
57 | LINKER_SYMBOL(bsp_section_text_end); |
---|
58 | LINKER_SYMBOL(bsp_section_text_size); |
---|
59 | |
---|
60 | LINKER_SYMBOL(bsp_section_data_start); |
---|
61 | LINKER_SYMBOL(bsp_section_data_end); |
---|
62 | LINKER_SYMBOL(bsp_section_data_size); |
---|
63 | |
---|
64 | LINKER_SYMBOL(bsp_section_bss_start); |
---|
65 | LINKER_SYMBOL(bsp_section_bss_end); |
---|
66 | LINKER_SYMBOL(bsp_section_bss_size); |
---|
67 | |
---|
68 | LINKER_SYMBOL(bsp_work_area_start); |
---|
69 | |
---|
70 | LINKER_SYMBOL(MBAR); |
---|
71 | |
---|
72 | /* Provide legacy defines */ |
---|
73 | |
---|
74 | #ifdef MPC5200_BOARD_PM520_ZE30 |
---|
75 | #define PM520_ZE30 |
---|
76 | #endif |
---|
77 | |
---|
78 | #ifdef MPC5200_BOARD_PM520_CR825 |
---|
79 | #define PM520_CR825 |
---|
80 | #endif |
---|
81 | |
---|
82 | #ifdef MPC5200_BOARD_ICECUBE |
---|
83 | #define icecube |
---|
84 | #endif |
---|
85 | |
---|
86 | #ifdef MPC5200_BOARD_BRS5L |
---|
87 | #define BRS5L |
---|
88 | #endif |
---|
89 | |
---|
90 | /* |
---|
91 | * distinguish board characteristics |
---|
92 | */ |
---|
93 | /* |
---|
94 | * for PM520 mdule on a ZE30 carrier |
---|
95 | */ |
---|
96 | #if defined(MPC5200_BOARD_PM520_ZE30) |
---|
97 | #define PM520 |
---|
98 | #endif |
---|
99 | /* |
---|
100 | * for PM520 mdule on a CR825 carrier |
---|
101 | */ |
---|
102 | #if defined(MPC5200_BOARD_PM520_CR825) |
---|
103 | #define PM520 |
---|
104 | #endif |
---|
105 | |
---|
106 | #if !defined(HAS_UBOOT) |
---|
107 | /* we need the low level initialization in start.S*/ |
---|
108 | #define NEED_LOW_LEVEL_INIT |
---|
109 | #endif |
---|
110 | |
---|
111 | #if defined(MPC5200_BOARD_BRS5L) |
---|
112 | /* |
---|
113 | * IMD Custom Board BRS5L |
---|
114 | */ |
---|
115 | |
---|
116 | #define HAS_NVRAM_93CXX |
---|
117 | |
---|
118 | #elif defined(MPC5200_BOARD_BRS6L) |
---|
119 | #define MPC5200_BRS6L_FPGA_BEGIN 0x800000 |
---|
120 | #define MPC5200_BRS6L_FPGA_SIZE (64 * 1024) |
---|
121 | #define MPC5200_BRS6L_FPGA_END \ |
---|
122 | (MPC5200_BRS6L_FPGA_BEGIN + MPC5200_BRS6L_FPGA_SIZE) |
---|
123 | |
---|
124 | #define MPC5200_BRS6L_MRAM_BEGIN 0xff000000 |
---|
125 | #define MPC5200_BRS6L_MRAM_SIZE (4 * 1024 * 1024) |
---|
126 | #define MPC5200_BRS6L_MRAM_END \ |
---|
127 | (MPC5200_BRS6L_MRAM_BEGIN + MPC5200_BRS6L_MRAM_SIZE) |
---|
128 | #elif defined (PM520) |
---|
129 | |
---|
130 | /* Nothing special */ |
---|
131 | |
---|
132 | #elif defined (MPC5200_BOARD_ICECUBE) |
---|
133 | /* |
---|
134 | * Codename: IceCube |
---|
135 | * Compatible Boards: |
---|
136 | * Freescape MPC5200LITE |
---|
137 | * Embedded Planet EP5200 |
---|
138 | */ |
---|
139 | |
---|
140 | #elif defined (MPC5200_BOARD_DP2) |
---|
141 | |
---|
142 | /* Nothing special */ |
---|
143 | |
---|
144 | #else |
---|
145 | #error "board type not defined" |
---|
146 | #endif |
---|
147 | |
---|
148 | #ifndef ASM |
---|
149 | |
---|
150 | #include <rtems.h> |
---|
151 | #include <bsp/i2cdrv.h> |
---|
152 | #include <bsp/irq.h> |
---|
153 | #include <bsp/vectors.h> |
---|
154 | #include <bsp/u-boot.h> |
---|
155 | #include <bsp/default-initial-extension.h> |
---|
156 | |
---|
157 | #ifdef __cplusplus |
---|
158 | extern "C" { |
---|
159 | #endif |
---|
160 | |
---|
161 | /* |
---|
162 | * Network driver configuration |
---|
163 | */ |
---|
164 | struct rtems_bsdnet_ifconfig; |
---|
165 | extern int rtems_mpc5200_fec_driver_attach_detach (struct rtems_bsdnet_ifconfig *config, int attaching); |
---|
166 | #define RTEMS_BSP_NETWORK_DRIVER_NAME "eth1" |
---|
167 | #define RTEMS_BSP_NETWORK_DRIVER_ATTACH rtems_mpc5200_fec_driver_attach_detach |
---|
168 | |
---|
169 | /* miscellaneous stuff assumed to exist */ |
---|
170 | |
---|
171 | /* |
---|
172 | * We need to decide how much memory will be non-cacheable. This |
---|
173 | * will mainly be memory that will be used in DMA (network and serial |
---|
174 | * buffers). |
---|
175 | */ |
---|
176 | /* |
---|
177 | #define NOCACHE_MEM_SIZE 512*1024 |
---|
178 | */ |
---|
179 | |
---|
180 | /* |
---|
181 | * Device Driver Table Entries |
---|
182 | */ |
---|
183 | |
---|
184 | #ifdef HAS_NVRAM_93CXX |
---|
185 | #define NVRAM_DRIVER_TABLE_ENTRY \ |
---|
186 | { nvram_driver_initialize, nvram_driver_open, nvram_driver_close, \ |
---|
187 | nvram_driver_read, nvram_driver_write, NULL } |
---|
188 | #endif |
---|
189 | |
---|
190 | /* |
---|
191 | * indicate, that BSP has IDE driver |
---|
192 | */ |
---|
193 | #define RTEMS_BSP_HAS_IDE_DRIVER |
---|
194 | |
---|
195 | /* functions */ |
---|
196 | |
---|
197 | /* #define SHOW_MORE_INIT_SETTINGS 1 */ |
---|
198 | |
---|
199 | /* ata modes */ |
---|
200 | /* #undef ATA_USE_INT */ |
---|
201 | #define ATA_USE_INT |
---|
202 | |
---|
203 | /* clock settings */ |
---|
204 | #if defined(HAS_UBOOT) |
---|
205 | #define IPB_CLOCK (bsp_uboot_board_info.bi_ipbfreq) |
---|
206 | #define XLB_CLOCK (bsp_uboot_board_info.bi_busfreq) |
---|
207 | #define G2_CLOCK (bsp_uboot_board_info.bi_intfreq) |
---|
208 | #elif defined(MPC5200_BOARD_BRS5L) || defined(MPC5200_BOARD_BRS6L) |
---|
209 | #define IPB_CLOCK 66000000 /* 66 MHz */ |
---|
210 | #define XLB_CLOCK 132000000 /* 132 MHz */ |
---|
211 | #define G2_CLOCK 396000000 /* 396 MHz */ |
---|
212 | #else |
---|
213 | #define IPB_CLOCK 33000000 /* 33 MHz */ |
---|
214 | #define XLB_CLOCK 66000000 /* 66 MHz */ |
---|
215 | #define G2_CLOCK 231000000 /* 231 MHz */ |
---|
216 | #endif |
---|
217 | |
---|
218 | #if defined(HAS_UBOOT) |
---|
219 | #define GEN5200_CONSOLE_BAUD (bsp_uboot_board_info.bi_baudrate) |
---|
220 | #else |
---|
221 | #define GEN5200_CONSOLE_BAUD 115200 |
---|
222 | #endif |
---|
223 | |
---|
224 | /* |
---|
225 | * Convert decrement value to tenths of microsecnds (used by |
---|
226 | * shared timer driver). |
---|
227 | * |
---|
228 | * + CPU has a XLB_CLOCK bus, |
---|
229 | * + There are 4 bus cycles per click |
---|
230 | * + We return value in 1/10 microsecond units. |
---|
231 | * Modified following equation to integer equation to remove |
---|
232 | * floating point math. |
---|
233 | * (int) ((float)(_value) / ((XLB_CLOCK/1000000 * 0.1) / 4.0)) |
---|
234 | */ |
---|
235 | |
---|
236 | #define BSP_Convert_decrementer( _value ) \ |
---|
237 | (int) (((_value) * 4000) / (XLB_CLOCK/10000)) |
---|
238 | |
---|
239 | /* slicetimer settings */ |
---|
240 | #define USE_SLICETIMER_0 TRUE |
---|
241 | #define USE_SLICETIMER_1 FALSE |
---|
242 | |
---|
243 | void *bsp_idle_thread( uintptr_t ignored ); |
---|
244 | #define BSP_IDLE_TASK_BODY bsp_idle_thread |
---|
245 | |
---|
246 | /* BSP specific IRQ Benchmarking support */ |
---|
247 | void BSP_IRQ_Benchmarking_Reset(void); |
---|
248 | void BSP_IRQ_Benchmarking_Report(void); |
---|
249 | |
---|
250 | #if defined(HAS_UBOOT) |
---|
251 | /* Routine to obtain U-Boot environment variables */ |
---|
252 | const char *bsp_uboot_getenv( |
---|
253 | const char *name |
---|
254 | ); |
---|
255 | #endif |
---|
256 | |
---|
257 | void cpu_init(void); |
---|
258 | |
---|
259 | int mpc5200_eth_mii_read( |
---|
260 | int phyAddr, |
---|
261 | void *arg, |
---|
262 | unsigned regAddr, |
---|
263 | uint32_t *retVal |
---|
264 | ); |
---|
265 | |
---|
266 | #ifdef __cplusplus |
---|
267 | } |
---|
268 | #endif |
---|
269 | |
---|
270 | #endif /* ASM */ |
---|
271 | |
---|
272 | /** @} */ |
---|
273 | |
---|
274 | #endif /* GEN5200 */ |
---|