RTEMS 6.1-rc5
Loading...
Searching...
No Matches
hwreg_vals.h
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/*
4 * RTEMS generic MPC83xx BSP
5 *
6 * This file contains board specific definitions.
7 */
8
9/*
10 * Copyright (c) 2007 embedded brains GmbH & Co. KG
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 */
33
34#ifndef __GEN83xx_HWREG_VALS_h
35#define __GEN83xx_HWREG_VALS_h
36
37#include <mpc83xx/mpc83xx.h>
38#include <bsp.h>
39
40#ifdef MPC83XX_HAS_NAND_LP_FLASH_ON_CS0
41 #define MPC83XX_RCWHR_BOOT_DEVICE (RCWHR_ROMLOC_LB08 | RCWHR_RLEXT_NAND)
42#else
43 #define MPC83XX_RCWHR_BOOT_DEVICE (RCWHR_ROMLOC_LB16 | RCWHR_RLEXT_LGCY)
44#endif
45
46/*
47 * distinguish board characteristics
48 */
49#if defined(MPC83XX_BOARD_MPC8349EAMDS)
50/*
51 * for Freescale MPC8349 EAMDS
52 */
53/*
54 * two DUART channels supported
55 */
56#define GEN83xx_DUART_AVAIL_MASK 0x03
57
58/* we need the low level initialization in start.S*/
59#define NEED_LOW_LEVEL_INIT
60/*
61 * clocking infos
62 */
63#define BSP_CLKIN_FRQ 66000000L
64#define RCFG_SYSPLL_MF 4
65#define RCFG_COREPLL_MF 4
66
67/*
68 * Reset configuration words
69 */
70#define RESET_CONF_WRD_L (RCWLR_LBIUCM_1_1 | \
71 RCWLR_DDRCM_1_1 | \
72 RCWLR_SPMF(RCFG_SYSPLL_MF) | \
73 RCWLR_COREPLL(RCFG_COREPLL_MF))
74
75#define RESET_CONF_WRD_H (RCWHR_PCI_HOST | \
76 RCWHR_PCI_32 | \
77 RCWHR_PCI1ARB_EN | \
78 RCWHR_PCI2ARB_EN | \
79 RCWHR_CORE_EN | \
80 RCWHR_BMS_LOW | \
81 RCWHR_BOOTSEQ_NONE | \
82 RCWHR_SW_DIS | \
83 MPC83XX_RCWHR_BOOT_DEVICE | \
84 RCWHR_TSEC1M_GMII | \
85 RCWHR_TSEC2M_GMII | \
86 RCWHR_ENDIAN_BIG | \
87 RCWHR_LALE_NORM | \
88 RCWHR_LDP_PAR)
89#elif defined(MPC83XX_BOARD_HSC_CM01)
90/*
91 * for JPK HSC_CM01
92 */
93/*
94 * one DUART channel (UART1) supported
95 */
96#define GEN83xx_DUART_AVAIL_MASK 0x01
97
98/* we need the low level initialization in start.S*/
99#define NEED_LOW_LEVEL_INIT
100/*
101 * clocking infos
102 */
103#define BSP_CLKIN_FRQ 30000000L
104#define RCFG_SYSPLL_MF 11
105#define RCFG_COREPLL_MF 4
106/*
107 * Reset configuration words
108 */
109#define RESET_CONF_WRD_L (RCWLR_LBIUCM_1_1 | \
110 RCWLR_DDRCM_1_1 | \
111 RCWLR_SPMF(RCFG_SYSPLL_MF) | \
112 RCWLR_COREPLL(RCFG_COREPLL_MF))
113
114#define RESET_CONF_WRD_H (RCWHR_PCI_HOST | \
115 RCWHR_PCI_32 | \
116 RCWHR_PCI1ARB_DIS | \
117 RCWHR_PCI2ARB_DIS | \
118 RCWHR_CORE_EN | \
119 RCWHR_BMS_LOW | \
120 RCWHR_BOOTSEQ_NONE | \
121 RCWHR_SW_DIS | \
122 MPC83XX_RCWHR_BOOT_DEVICE | \
123 RCWHR_TSEC1M_RGMII | \
124 RCWHR_TSEC2M_GMII | \
125 RCWHR_ENDIAN_BIG | \
126 RCWHR_LALE_EARLY | \
127 RCWHR_LDP_SPC)
128
129#elif defined(MPC83XX_BOARD_BR_UID)
130/*
131 * for BR UID
132 */
133/*
134 * one DUART channel (UART1) supported
135 */
136#define GEN83xx_DUART_AVAIL_MASK 0x01
137
138/* we need the low level initialization in start.S*/
139#define NEED_LOW_LEVEL_INIT
140/*
141 * clocking infos
142 */
143#define BSP_CLKIN_FRQ 25000000L
144#define RCFG_SYSPLL_MF 5
145#define RCFG_COREPLL_MF 5
146/*
147 * Reset configuration words
148 */
149#define RESET_CONF_WRD_L \
150 (RCWLR_LBIUCM_1_1 \
151 | RCWLR_DDRCM_2_1 \
152 | RCWLR_SPMF(RCFG_SYSPLL_MF) \
153 | RCWLR_COREPLL(RCFG_COREPLL_MF) \
154 | RCWLR_CEVCOD_1_2 \
155 | RCWLR_CEPMF(8) \
156 )
157
158#define RESET_CONF_WRD_H (RCWHR_PCI_HOST | \
159 RCWHR_PCI_32 | \
160 RCWHR_PCI1ARB_DIS | \
161 RCWHR_CORE_EN | \
162 RCWHR_BMS_LOW | \
163 RCWHR_BOOTSEQ_NONE | \
164 RCWHR_SW_DIS | \
165 MPC83XX_RCWHR_BOOT_DEVICE | \
166 RCWHR_ENDIAN_BIG)
167
168#elif defined( HAS_UBOOT)
169
170/* TODO */
171
172#else
173
174#error "board type not defined"
175
176#endif
177
178#if defined(MPC83XX_BOARD_MPC8349EAMDS)
179/**************************
180 * for Freescale MPC83XX_BOARD_MPC8349EAMDS
181 */
182
183/*
184 * working values for various registers, used in start/start.S
185 */
186
187/*
188 * Local Access Windows
189 * FIXME: decode bit settings
190 */
191#define LBLAWBAR0_VAL 0xFE000000
192#define LBLAWAR0_VAL 0x80000016
193#define LBLAWBAR1_VAL 0xF8000000
194#define LBLAWAR1_VAL 0x8000000E
195#define LBLAWBAR2_VAL 0xF0000000
196#define LBLAWAR2_VAL 0x80000019
197#define DDRLAWBAR0_VAL 0x00000000
198#define DDRLAWAR0_VAL 0x8000001B
199/*
200 * Local Bus (Memory) Controller
201 * FIXME: decode bit settings
202 */
203#define BR0_VAL 0xFE001001
204#define OR0_VAL 0xFF806FF7
205#define BR1_VAL 0xF8000801
206#define OR1_VAL 0xFFFFE8F0
207#define BR2_VAL 0xF0001861
208#define OR2_VAL 0xFC006901
209/*
210 * SDRAM registers
211 * FIXME: decode bit settings
212 */
213#define MRPTR_VAL 0x20000000
214#define LSRT_VAL 0x32000000
215#define LSDMR_VAL 0x4062D733
216#define LCRR_VAL 0x80000004
217
218/*
219 * DDR-SDRAM registers
220 * FIXME: decode bit settings
221 */
222#define CS2_BNDS_VAL 0x00000007
223#define CS3_BNDS_VAL 0x0008000F
224#define CS2_CONFIG_VAL 0x80000101
225#define CS3_CONFIG_VAL 0x80000101
226#define TIMING_CFG_1_VAL 0x36333321
227#define TIMING_CFG_2_VAL 0x00000800
228#define DDR_SDRAM_CFG_VAL 0xC2000000
229#define DDR_SDRAM_MODE_VAL 0x00000022
230#define DDR_SDRAM_INTTVL_VAL 0x045B0100
231#define DDR_SDRAM_CLK_CNTL_VAL 0x00000000
232
233#elif defined(MPC83XX_BOARD_HSC_CM01)
234/**************************
235 * for JPK HSC_CM01
236 */
237
238/*
239 * working values for various registers, used in start/start.S
240 */
241
242/* fpga config 16 MB size */
243#define FPGA_CONFIG_START 0xF8000000
244#define FPGA_CONFIG_SIZE 0x01000000
245/* fpga register 8 MB size */
246#define FPGA_REGISTER_START 0xF9000000
247#define FPGA_REGISTER_SIZE 0x00800000
248/* fpga fifo 8 MB size */
249#define FPGA_FIFO_START 0xF9800000
250#define FPGA_FIFO_SIZE 0x00800000
251
252#define FPGA_START (FPGA_CONFIG_START)
253// fpga window size 32 MByte
254#define FPGA_SIZE (0x02000000)
255#define FPGA_END (FPGA_START+FPGA_SIZE-1)
256
257/*
258 * Local Access Windows
259 * FIXME: decode bit settings
260 */
261
262#define LBLAWBAR0_VAL bsp_rom_start
263#define LBLAWAR0_VAL 0x80000018
264#define LBLAWBAR1_VAL (FPGA_CONFIG_START)
265#define LBLAWAR1_VAL 0x80000018
266#define DDRLAWBAR0_VAL bsp_ram_start
267#define DDRLAWAR0_VAL 0x8000001B
268/*
269 * Local Bus (Memory) Controller
270 * FIXME: decode bit settings
271 */
272#define BR0_VAL (0xFE000000 | 0x01001)
273#define OR0_VAL 0xFE000E54
274// fpga config access range (UPM_A) (32 kByte)
275#define BR2_VAL (FPGA_CONFIG_START | 0x01881)
276#define OR2_VAL 0xFFFF9100
277
278// fpga register access range (UPM_B) (8 MByte)
279#define BR3_VAL (FPGA_REGISTER_START | 0x018A1)
280#define OR3_VAL 0xFF801100
281
282// fpga fifo access range (UPM_C) (8 MByte)
283#define BR4_VAL (FPGA_FIFO_START | 0x018C1)
284#define OR4_VAL 0xFF801100
285
286/*
287 * SDRAM registers
288 */
289#define MRPTR_VAL 0x20000000
290#define LSRT_VAL 0x32000000
291#define LSDMR_VAL 0x4062D733
292#define LCRR_VAL 0x80010004
293
294/*
295 * DDR-SDRAM registers
296 * FIXME: decode bit settings
297 */
298#define DDRCDR_VAL 0x00000001
299#define CS0_BNDS_VAL 0x0000000F
300#define CS0_CONFIG_VAL 0x80810102
301#define TIMING_CFG_0_VAL 0x00420802
302#define TIMING_CFG_1_VAL 0x3735A322
303#define TIMING_CFG_2_VAL 0x2F9044C7
304#define DDR_SDRAM_CFG_2_VAL 0x00401000
305#define DDR_SDRAM_MODE_VAL 0x44521632
306#define DDR_SDRAM_CLK_CNTL_VAL 0x01800000
307#define DDR_SDRAM_CFG_VAL 0x63000008
308
309#define DDR_ERR_DISABLE_VAL 0x0000008D
310#define DDR_ERR_DISABLE_VAL2 0x00000089
311#define DDR_SDRAM_DATA_INIT_VAL 0xC01DCAFE
312#define DDR_SDRAM_INIT_ADDR_VAL 0
313#define DDR_SDRAM_INTERVAL_VAL 0x05080000
314
315#elif defined(MPC83XX_BOARD_BR_UID)
316/**************************
317 * for BR UID
318 */
319
320/*
321 * working values for various registers, used in start/start.S
322 */
323
324/*
325 * Local Access Windows
326 * FIXME: decode bit settings
327 */
328
329#define LBLAWBAR0_VAL bsp_rom_start
330#define LBLAWAR0_VAL 0x80000018
331#define DDRLAWBAR0_VAL bsp_ram_start
332#define DDRLAWAR0_VAL 0x8000001B
333
334
335/*
336 * clocking for local bus:
337 * ALE active for 1 clock
338 * local bus clock = 1/2 csb clock
339 */
340#define LCRR_VAL 0x80010002
341
342/*
343 * DDR-SDRAM registers
344 * FIXME: decode bit settings
345 */
346#define DDRCDR_VAL 0x00000001
347#define CS0_BNDS_VAL 0x0000000F
348#define CS0_CONFIG_VAL 0x80014202
349#define TIMING_CFG_0_VAL 0x00220802
350#define TIMING_CFG_1_VAL 0x26259222
351#define TIMING_CFG_2_VAL 0x111048C7
352#define DDR_SDRAM_CFG_2_VAL 0x00401000
353#define DDR_SDRAM_MODE_VAL 0x200F1632
354#define DDR_SDRAM_MODE_2_VAL 0x40006000
355#define DDR_SDRAM_CLK_CNTL_VAL 0x01800000
356#define DDR_SDRAM_CFG_VAL 0x43100008
357
358#define DDR_ERR_DISABLE_VAL 0x0000008D
359#define DDR_ERR_DISABLE_VAL2 0x00000089
360#define DDR_SDRAM_DATA_INIT_VAL 0xC01DCAFE
361#define DDR_SDRAM_INIT_ADDR_VAL 0
362#define DDR_SDRAM_INTERVAL_VAL 0x01E8222E
363
364#elif defined( HAS_UBOOT)
365
366/* TODO */
367
368#else
369
370#error "board type not defined"
371
372#endif
373
374/**************************
375 * derived values for all boards
376 */
377/* value of input clock divider (derived from pll mode reg) */
378#if MPC83XX_CHIP_TYPE != 8309
379 #define BSP_SYSPLL_CKID (((mpc83xx.clk.spmr>>(31-8))&0x01)+1)
380#else
381 /* On the MPC8309 this bit is reserved */
382 #define BSP_SYSPLL_CKID 1
383#endif
384/* value of system pll (derived from pll mode reg) */
385#define BSP_SYSPLL_MF ((mpc83xx.clk.spmr>>(31-7))&0x0f)
386/* value of system pll (derived from pll mode reg) */
387#define BSP_COREPLL_MF ((mpc83xx.clk.spmr>>(31-15))&0x7f)
388
389#endif /* __GEN83xx_HWREG_VALS_h */