Back to home page

LXR

 
 

    


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

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /**
0004  * @file
0005  *
0006  * @ingroup RTEMSBSPsPowerPCMPC55XX
0007  *
0008  * @brief Low-level configuration.
0009  */
0010 
0011 /*
0012  * Copyright (C) 2008, 2012 embedded brains GmbH & Co. KG
0013  *
0014  * Redistribution and use in source and binary forms, with or without
0015  * modification, are permitted provided that the following conditions
0016  * are met:
0017  * 1. Redistributions of source code must retain the above copyright
0018  *    notice, this list of conditions and the following disclaimer.
0019  * 2. Redistributions in binary form must reproduce the above copyright
0020  *    notice, this list of conditions and the following disclaimer in the
0021  *    documentation and/or other materials provided with the distribution.
0022  *
0023  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0024  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0025  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0026  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0027  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0028  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0029  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0030  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0031  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0032  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0033  * POSSIBILITY OF SUCH DAMAGE.
0034  */
0035 
0036 #ifndef LIBBSP_POWERPC_MPC55XXEVB_MPC55XX_CONFIG_H
0037 #define LIBBSP_POWERPC_MPC55XXEVB_MPC55XX_CONFIG_H
0038 
0039 #include <stddef.h>
0040 
0041 #include <libcpu/powerpc-utility.h>
0042 
0043 #include <bsp/start.h>
0044 
0045 #include <mpc55xx/regs.h>
0046 #include <mpc55xx/regs-mmu.h>
0047 #include <mpc55xx/siu.h>
0048 
0049 #ifdef __cplusplus
0050 extern "C" {
0051 #endif /* __cplusplus */
0052 
0053 typedef struct {
0054   uint32_t index : 10;
0055   uint32_t count : 10;
0056   uint32_t output : 1;
0057   union SIU_PCR_tag pcr;
0058 } mpc55xx_siu_pcr_config;
0059 
0060 extern BSP_START_DATA_SECTION const mpc55xx_siu_pcr_config
0061   mpc55xx_start_config_siu_pcr [];
0062 
0063 extern BSP_START_DATA_SECTION const size_t
0064   mpc55xx_start_config_siu_pcr_count [];
0065 
0066 extern BSP_START_DATA_SECTION const struct
0067   MMU_tag mpc55xx_start_config_mmu_early [];
0068 
0069 extern BSP_START_DATA_SECTION const size_t
0070   mpc55xx_start_config_mmu_early_count [];
0071 
0072 extern BSP_START_DATA_SECTION const struct
0073   MMU_tag mpc55xx_start_config_mmu [];
0074 
0075 extern BSP_START_DATA_SECTION const size_t
0076   mpc55xx_start_config_mmu_count [];
0077 
0078 #ifdef MPC55XX_HAS_FMPLL
0079   typedef struct {
0080     union FMPLL_SYNCR_tag syncr_tmp;
0081     union FMPLL_SYNCR_tag syncr_final;
0082   } mpc55xx_clock_config;
0083 #endif
0084 
0085 #ifdef MPC55XX_HAS_FMPLL_ENHANCED
0086   typedef struct {
0087     union FMPLL_ESYNCR2_tag esyncr2_tmp;
0088     union FMPLL_ESYNCR2_tag esyncr2_final;
0089     union FMPLL_ESYNCR1_tag esyncr1_final;
0090   } mpc55xx_clock_config;
0091 #endif
0092 
0093 #ifdef MPC55XX_HAS_MODE_CONTROL
0094   typedef struct {
0095     struct {
0096       PLLD_CR_32B_tag cr;
0097       PLLD_MR_32B_tag mr;
0098     } fmpll [2];
0099     CGM_OC_EN_32B_tag oc_en;
0100     CGM_OCDS_SC_32B_tag ocds_sc;
0101     CGM_SC_DC0_3_32B_tag sc_dc0_3;
0102     CGM_AUXCLK_tag auxclk [5];
0103   } mpc55xx_clock_config;
0104 #endif
0105 
0106 extern BSP_START_DATA_SECTION const mpc55xx_clock_config
0107   mpc55xx_start_config_clock [];
0108 
0109 #ifdef MPC55XX_HAS_EBI
0110   typedef struct {
0111     union EBI_MCR_tag ebi_mcr;
0112     uint32_t siu_eccr_ebdf;
0113   } mpc55xx_ebi_config;
0114 
0115   extern BSP_START_DATA_SECTION const mpc55xx_ebi_config
0116     mpc55xx_start_config_ebi [];
0117 
0118   extern BSP_START_DATA_SECTION const size_t
0119     mpc55xx_start_config_ebi_count [];
0120 
0121   extern BSP_START_DATA_SECTION const struct EBI_CS_tag
0122     mpc55xx_start_config_ebi_cs [];
0123 
0124   extern BSP_START_DATA_SECTION const size_t
0125     mpc55xx_start_config_ebi_cs_count [];
0126 
0127   extern BSP_START_DATA_SECTION const struct EBI_CAL_CS_tag
0128     mpc55xx_start_config_ebi_cal_cs [];
0129 
0130   extern BSP_START_DATA_SECTION const size_t
0131     mpc55xx_start_config_ebi_cal_cs_count [];
0132 #endif
0133 
0134 /**
0135  * @brief Start prologue.
0136  *
0137  * In case the BSP enabled the MPC55XX_ENABLE_START_PROLOGUE option, then this
0138  * function will be called directly after the Boot Assist Module (BAM) jumped
0139  * to the start entry defined by the reset configuration.
0140  *
0141  * This function executes in the context initialized by the BAM.  There exists
0142  * no valid stack pointer and the internal RAM has an invalid ECC state.
0143  *
0144  * The default implementation does nothing.  The application may provide its
0145  * own implementation.
0146  */
0147 void mpc55xx_start_prologue(void);
0148 
0149 void mpc55xx_start_early(void);
0150 
0151 void mpc55xx_start_flash(void);
0152 
0153 void mpc55xx_start_cache(void);
0154 
0155 void mpc55xx_start_clock(void);
0156 
0157 void mpc55xx_start_watchdog(void);
0158 
0159 void mpc55xx_start_mmu_apply_config(const struct MMU_tag *config, size_t count);
0160 
0161 uint32_t mpc55xx_get_system_clock(void);
0162 
0163 LINKER_SYMBOL(bsp_ram_start)
0164 LINKER_SYMBOL(bsp_ram_end)
0165 LINKER_SYMBOL(bsp_ram_size)
0166 
0167 LINKER_SYMBOL(bsp_ram_1_start)
0168 LINKER_SYMBOL(bsp_ram_1_end)
0169 LINKER_SYMBOL(bsp_ram_1_size)
0170 
0171 LINKER_SYMBOL(bsp_rom_start)
0172 LINKER_SYMBOL(bsp_rom_end)
0173 LINKER_SYMBOL(bsp_rom_size)
0174 
0175 #ifdef MPC55XX_BOOTFLAGS
0176   extern uint32_t mpc55xx_bootflag_0 [];
0177 #endif
0178 
0179 #ifdef __cplusplus
0180 }
0181 #endif /* __cplusplus */
0182 
0183 #endif /* LIBBSP_POWERPC_MPC55XXEVB_MPC55XX_CONFIG_H */