Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:53

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /*
0004  * RTEMS generic MPC83xx BSP
0005  *
0006  * This file contains board specific definitions.
0007  */
0008 
0009 /*
0010  * Copyright (c) 2007 embedded brains GmbH & Co. KG
0011  *
0012  * Redistribution and use in source and binary forms, with or without
0013  * modification, are permitted provided that the following conditions
0014  * are met:
0015  * 1. Redistributions of source code must retain the above copyright
0016  *    notice, this list of conditions and the following disclaimer.
0017  * 2. Redistributions in binary form must reproduce the above copyright
0018  *    notice, this list of conditions and the following disclaimer in the
0019  *    documentation and/or other materials provided with the distribution.
0020  *
0021  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0022  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0023  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0024  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0025  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0026  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0027  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0028  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0029  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0030  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0031  * POSSIBILITY OF SUCH DAMAGE.
0032  */
0033 
0034 #ifndef __GEN83xx_HWREG_VALS_h
0035 #define __GEN83xx_HWREG_VALS_h
0036 
0037 #include <mpc83xx/mpc83xx.h>
0038 #include <bsp.h>
0039 
0040 #ifdef MPC83XX_HAS_NAND_LP_FLASH_ON_CS0
0041   #define MPC83XX_RCWHR_BOOT_DEVICE (RCWHR_ROMLOC_LB08 | RCWHR_RLEXT_NAND)
0042 #else
0043   #define MPC83XX_RCWHR_BOOT_DEVICE (RCWHR_ROMLOC_LB16 | RCWHR_RLEXT_LGCY)
0044 #endif
0045 
0046 /*
0047  * distinguish board characteristics
0048  */
0049 #if defined(MPC83XX_BOARD_MPC8349EAMDS)
0050 /*
0051  * for Freescale MPC8349 EAMDS
0052  */
0053 /*
0054  * two DUART channels supported
0055  */
0056 #define GEN83xx_DUART_AVAIL_MASK 0x03
0057 
0058 /* we need the low level initialization in start.S*/
0059 #define NEED_LOW_LEVEL_INIT
0060 /*
0061  * clocking infos
0062  */
0063 #define BSP_CLKIN_FRQ 66000000L
0064 #define RCFG_SYSPLL_MF 4
0065 #define RCFG_COREPLL_MF 4
0066 
0067 /*
0068  * Reset configuration words
0069  */
0070 #define RESET_CONF_WRD_L (RCWLR_LBIUCM_1_1 |    \
0071               RCWLR_DDRCM_1_1  |    \
0072               RCWLR_SPMF(RCFG_SYSPLL_MF)    |   \
0073               RCWLR_COREPLL(RCFG_COREPLL_MF))
0074 
0075 #define RESET_CONF_WRD_H (RCWHR_PCI_HOST     |  \
0076               RCWHR_PCI_32       |  \
0077               RCWHR_PCI1ARB_EN   |  \
0078               RCWHR_PCI2ARB_EN   |  \
0079               RCWHR_CORE_EN      |  \
0080               RCWHR_BMS_LOW      |  \
0081               RCWHR_BOOTSEQ_NONE |  \
0082               RCWHR_SW_DIS       |  \
0083               MPC83XX_RCWHR_BOOT_DEVICE | \
0084               RCWHR_TSEC1M_GMII  |  \
0085               RCWHR_TSEC2M_GMII  |  \
0086               RCWHR_ENDIAN_BIG   |  \
0087               RCWHR_LALE_NORM    |  \
0088               RCWHR_LDP_PAR)
0089 #elif defined(MPC83XX_BOARD_HSC_CM01)
0090 /*
0091  * for JPK HSC_CM01
0092  */
0093 /*
0094  * one DUART channel (UART1) supported
0095  */
0096 #define GEN83xx_DUART_AVAIL_MASK 0x01
0097 
0098 /* we need the low level initialization in start.S*/
0099 #define NEED_LOW_LEVEL_INIT
0100 /*
0101  * clocking infos
0102  */
0103 #define BSP_CLKIN_FRQ 30000000L
0104 #define RCFG_SYSPLL_MF 11
0105 #define RCFG_COREPLL_MF 4
0106 /*
0107  * Reset configuration words
0108  */
0109 #define RESET_CONF_WRD_L (RCWLR_LBIUCM_1_1 |    \
0110               RCWLR_DDRCM_1_1  |    \
0111               RCWLR_SPMF(RCFG_SYSPLL_MF)    |   \
0112               RCWLR_COREPLL(RCFG_COREPLL_MF))
0113 
0114 #define RESET_CONF_WRD_H (RCWHR_PCI_HOST     |  \
0115               RCWHR_PCI_32       |  \
0116               RCWHR_PCI1ARB_DIS  |  \
0117               RCWHR_PCI2ARB_DIS  |  \
0118               RCWHR_CORE_EN      |  \
0119               RCWHR_BMS_LOW      |  \
0120               RCWHR_BOOTSEQ_NONE |  \
0121               RCWHR_SW_DIS       |  \
0122               MPC83XX_RCWHR_BOOT_DEVICE | \
0123               RCWHR_TSEC1M_RGMII |  \
0124               RCWHR_TSEC2M_GMII  |  \
0125               RCWHR_ENDIAN_BIG   |  \
0126               RCWHR_LALE_EARLY   |  \
0127               RCWHR_LDP_SPC)
0128 
0129 #elif defined(MPC83XX_BOARD_BR_UID)
0130 /*
0131  * for BR UID
0132  */
0133 /*
0134  * one DUART channel (UART1) supported
0135  */
0136 #define GEN83xx_DUART_AVAIL_MASK 0x01
0137 
0138 /* we need the low level initialization in start.S*/
0139 #define NEED_LOW_LEVEL_INIT
0140 /*
0141  * clocking infos
0142  */
0143 #define BSP_CLKIN_FRQ 25000000L
0144 #define RCFG_SYSPLL_MF  5
0145 #define RCFG_COREPLL_MF 5
0146 /*
0147  * Reset configuration words
0148  */
0149 #define RESET_CONF_WRD_L \
0150   (RCWLR_LBIUCM_1_1                         \
0151    | RCWLR_DDRCM_2_1                            \
0152    | RCWLR_SPMF(RCFG_SYSPLL_MF)                     \
0153    | RCWLR_COREPLL(RCFG_COREPLL_MF)                 \
0154    | RCWLR_CEVCOD_1_2                           \
0155    | RCWLR_CEPMF(8)                         \
0156    )
0157 
0158 #define RESET_CONF_WRD_H (RCWHR_PCI_HOST     |  \
0159               RCWHR_PCI_32       |  \
0160               RCWHR_PCI1ARB_DIS  |  \
0161               RCWHR_CORE_EN      |  \
0162               RCWHR_BMS_LOW      |  \
0163               RCWHR_BOOTSEQ_NONE |  \
0164               RCWHR_SW_DIS       |  \
0165               MPC83XX_RCWHR_BOOT_DEVICE |   \
0166               RCWHR_ENDIAN_BIG)
0167 
0168 #elif defined( HAS_UBOOT)
0169 
0170 /* TODO */
0171 
0172 #else
0173 
0174 #error "board type not defined"
0175 
0176 #endif
0177 
0178 #if defined(MPC83XX_BOARD_MPC8349EAMDS)
0179 /**************************
0180  * for Freescale MPC83XX_BOARD_MPC8349EAMDS
0181  */
0182 
0183 /*
0184  * working values for various registers, used in start/start.S
0185  */
0186 
0187 /*
0188  * Local Access Windows
0189  * FIXME: decode bit settings
0190  */
0191 #define LBLAWBAR0_VAL  0xFE000000
0192 #define LBLAWAR0_VAL   0x80000016
0193 #define LBLAWBAR1_VAL  0xF8000000
0194 #define LBLAWAR1_VAL   0x8000000E
0195 #define LBLAWBAR2_VAL  0xF0000000
0196 #define LBLAWAR2_VAL   0x80000019
0197 #define DDRLAWBAR0_VAL 0x00000000
0198 #define DDRLAWAR0_VAL  0x8000001B
0199 /*
0200  * Local Bus (Memory) Controller
0201  * FIXME: decode bit settings
0202  */
0203 #define BR0_VAL 0xFE001001
0204 #define OR0_VAL 0xFF806FF7
0205 #define BR1_VAL 0xF8000801
0206 #define OR1_VAL 0xFFFFE8F0
0207 #define BR2_VAL 0xF0001861
0208 #define OR2_VAL 0xFC006901
0209 /*
0210  * SDRAM registers
0211  * FIXME: decode bit settings
0212  */
0213 #define MRPTR_VAL 0x20000000
0214 #define LSRT_VAL  0x32000000
0215 #define LSDMR_VAL 0x4062D733
0216 #define LCRR_VAL  0x80000004
0217 
0218 /*
0219  * DDR-SDRAM registers
0220  * FIXME: decode bit settings
0221  */
0222 #define CS2_BNDS_VAL                 0x00000007
0223 #define CS3_BNDS_VAL                 0x0008000F
0224 #define CS2_CONFIG_VAL               0x80000101
0225 #define CS3_CONFIG_VAL               0x80000101
0226 #define TIMING_CFG_1_VAL             0x36333321
0227 #define TIMING_CFG_2_VAL             0x00000800
0228 #define DDR_SDRAM_CFG_VAL            0xC2000000
0229 #define DDR_SDRAM_MODE_VAL           0x00000022
0230 #define DDR_SDRAM_INTTVL_VAL         0x045B0100
0231 #define DDR_SDRAM_CLK_CNTL_VAL       0x00000000
0232 
0233 #elif defined(MPC83XX_BOARD_HSC_CM01)
0234 /**************************
0235  * for JPK HSC_CM01
0236  */
0237 
0238 /*
0239  * working values for various registers, used in start/start.S
0240  */
0241 
0242 /* fpga config 16 MB size */
0243 #define FPGA_CONFIG_START       0xF8000000
0244 #define FPGA_CONFIG_SIZE        0x01000000
0245 /* fpga register 8 MB size */
0246 #define FPGA_REGISTER_START     0xF9000000
0247 #define FPGA_REGISTER_SIZE      0x00800000
0248 /* fpga fifo 8 MB size */
0249 #define FPGA_FIFO_START         0xF9800000
0250 #define FPGA_FIFO_SIZE          0x00800000
0251 
0252 #define FPGA_START (FPGA_CONFIG_START)
0253 // fpga window size 32 MByte
0254 #define FPGA_SIZE  (0x02000000)
0255 #define FPGA_END   (FPGA_START+FPGA_SIZE-1)
0256 
0257 /*
0258  * Local Access Windows
0259  * FIXME: decode bit settings
0260  */
0261 
0262 #define LBLAWBAR0_VAL  bsp_rom_start
0263 #define LBLAWAR0_VAL   0x80000018
0264 #define LBLAWBAR1_VAL  (FPGA_CONFIG_START)
0265 #define LBLAWAR1_VAL   0x80000018
0266 #define DDRLAWBAR0_VAL bsp_ram_start
0267 #define DDRLAWAR0_VAL  0x8000001B
0268 /*
0269  * Local Bus (Memory) Controller
0270  * FIXME: decode bit settings
0271  */
0272 #define BR0_VAL (0xFE000000 | 0x01001)
0273 #define OR0_VAL 0xFE000E54
0274 // fpga config access range (UPM_A) (32 kByte)
0275 #define BR2_VAL (FPGA_CONFIG_START | 0x01881)
0276 #define OR2_VAL 0xFFFF9100
0277 
0278 // fpga register access range (UPM_B) (8 MByte)
0279 #define BR3_VAL (FPGA_REGISTER_START | 0x018A1)
0280 #define OR3_VAL 0xFF801100
0281 
0282 // fpga fifo access range (UPM_C) (8 MByte)
0283 #define BR4_VAL (FPGA_FIFO_START | 0x018C1)
0284 #define OR4_VAL 0xFF801100
0285 
0286 /*
0287  * SDRAM registers
0288  */
0289 #define MRPTR_VAL 0x20000000
0290 #define LSRT_VAL  0x32000000
0291 #define LSDMR_VAL 0x4062D733
0292 #define LCRR_VAL  0x80010004
0293 
0294 /*
0295  * DDR-SDRAM registers
0296  * FIXME: decode bit settings
0297  */
0298 #define DDRCDR_VAL                   0x00000001
0299 #define CS0_BNDS_VAL                 0x0000000F
0300 #define CS0_CONFIG_VAL               0x80810102
0301 #define TIMING_CFG_0_VAL             0x00420802
0302 #define TIMING_CFG_1_VAL             0x3735A322
0303 #define TIMING_CFG_2_VAL             0x2F9044C7
0304 #define DDR_SDRAM_CFG_2_VAL          0x00401000
0305 #define DDR_SDRAM_MODE_VAL           0x44521632
0306 #define DDR_SDRAM_CLK_CNTL_VAL       0x01800000
0307 #define DDR_SDRAM_CFG_VAL            0x63000008
0308 
0309 #define DDR_ERR_DISABLE_VAL          0x0000008D
0310 #define DDR_ERR_DISABLE_VAL2         0x00000089
0311 #define DDR_SDRAM_DATA_INIT_VAL      0xC01DCAFE
0312 #define DDR_SDRAM_INIT_ADDR_VAL      0
0313 #define DDR_SDRAM_INTERVAL_VAL       0x05080000
0314 
0315 #elif defined(MPC83XX_BOARD_BR_UID)
0316 /**************************
0317  * for BR UID
0318  */
0319 
0320 /*
0321  * working values for various registers, used in start/start.S
0322  */
0323 
0324 /*
0325  * Local Access Windows
0326  * FIXME: decode bit settings
0327  */
0328 
0329 #define LBLAWBAR0_VAL  bsp_rom_start
0330 #define LBLAWAR0_VAL   0x80000018
0331 #define DDRLAWBAR0_VAL bsp_ram_start
0332 #define DDRLAWAR0_VAL  0x8000001B
0333 
0334 
0335 /*
0336  * clocking for local bus:
0337  * ALE active for 1 clock
0338  * local bus clock = 1/2 csb clock
0339  */
0340 #define LCRR_VAL  0x80010002
0341 
0342 /*
0343  * DDR-SDRAM registers
0344  * FIXME: decode bit settings
0345  */
0346 #define DDRCDR_VAL                   0x00000001
0347 #define CS0_BNDS_VAL                 0x0000000F
0348 #define CS0_CONFIG_VAL               0x80014202
0349 #define TIMING_CFG_0_VAL             0x00220802
0350 #define TIMING_CFG_1_VAL             0x26259222
0351 #define TIMING_CFG_2_VAL             0x111048C7
0352 #define DDR_SDRAM_CFG_2_VAL          0x00401000
0353 #define DDR_SDRAM_MODE_VAL           0x200F1632
0354 #define DDR_SDRAM_MODE_2_VAL         0x40006000
0355 #define DDR_SDRAM_CLK_CNTL_VAL       0x01800000
0356 #define DDR_SDRAM_CFG_VAL            0x43100008
0357 
0358 #define DDR_ERR_DISABLE_VAL          0x0000008D
0359 #define DDR_ERR_DISABLE_VAL2         0x00000089
0360 #define DDR_SDRAM_DATA_INIT_VAL      0xC01DCAFE
0361 #define DDR_SDRAM_INIT_ADDR_VAL      0
0362 #define DDR_SDRAM_INTERVAL_VAL       0x01E8222E
0363 
0364 #elif defined( HAS_UBOOT)
0365 
0366 /* TODO */
0367 
0368 #else
0369 
0370 #error "board type not defined"
0371 
0372 #endif
0373 
0374 /**************************
0375  * derived values for all boards
0376  */
0377 /* value of input clock divider (derived from pll mode reg) */
0378 #if MPC83XX_CHIP_TYPE != 8309
0379   #define BSP_SYSPLL_CKID (((mpc83xx.clk.spmr>>(31-8))&0x01)+1)
0380 #else
0381   /* On the MPC8309 this bit is reserved */
0382   #define BSP_SYSPLL_CKID 1
0383 #endif
0384 /* value of system pll (derived from pll mode reg) */
0385 #define BSP_SYSPLL_MF    ((mpc83xx.clk.spmr>>(31-7))&0x0f)
0386 /* value of system pll (derived from pll mode reg) */
0387 #define BSP_COREPLL_MF   ((mpc83xx.clk.spmr>>(31-15))&0x7f)
0388 
0389 #endif /* __GEN83xx_HWREG_VALS_h */