1 | /* SPDX-License-Identifier: BSD-2-Clause */ |
---|
2 | |
---|
3 | /** |
---|
4 | * @file |
---|
5 | * |
---|
6 | * @ingroup RTEMSBSPsPowerPCMPC55XX |
---|
7 | * |
---|
8 | * @brief Low-level configuration. |
---|
9 | */ |
---|
10 | |
---|
11 | /* |
---|
12 | * Copyright (C) 2008, 2012 embedded brains GmbH & Co. KG |
---|
13 | * |
---|
14 | * Redistribution and use in source and binary forms, with or without |
---|
15 | * modification, are permitted provided that the following conditions |
---|
16 | * are met: |
---|
17 | * 1. Redistributions of source code must retain the above copyright |
---|
18 | * notice, this list of conditions and the following disclaimer. |
---|
19 | * 2. Redistributions in binary form must reproduce the above copyright |
---|
20 | * notice, this list of conditions and the following disclaimer in the |
---|
21 | * documentation and/or other materials provided with the distribution. |
---|
22 | * |
---|
23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
24 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
25 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
26 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
---|
27 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
28 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
29 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
30 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
31 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
32 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
33 | * POSSIBILITY OF SUCH DAMAGE. |
---|
34 | */ |
---|
35 | |
---|
36 | #ifndef LIBBSP_POWERPC_MPC55XXEVB_MPC55XX_CONFIG_H |
---|
37 | #define LIBBSP_POWERPC_MPC55XXEVB_MPC55XX_CONFIG_H |
---|
38 | |
---|
39 | #include <stddef.h> |
---|
40 | |
---|
41 | #include <libcpu/powerpc-utility.h> |
---|
42 | |
---|
43 | #include <bsp/start.h> |
---|
44 | |
---|
45 | #include <mpc55xx/regs.h> |
---|
46 | #include <mpc55xx/regs-mmu.h> |
---|
47 | #include <mpc55xx/siu.h> |
---|
48 | |
---|
49 | #ifdef __cplusplus |
---|
50 | extern "C" { |
---|
51 | #endif /* __cplusplus */ |
---|
52 | |
---|
53 | typedef struct { |
---|
54 | uint32_t index : 10; |
---|
55 | uint32_t count : 10; |
---|
56 | uint32_t output : 1; |
---|
57 | union SIU_PCR_tag pcr; |
---|
58 | } mpc55xx_siu_pcr_config; |
---|
59 | |
---|
60 | extern BSP_START_DATA_SECTION const mpc55xx_siu_pcr_config |
---|
61 | mpc55xx_start_config_siu_pcr []; |
---|
62 | |
---|
63 | extern BSP_START_DATA_SECTION const size_t |
---|
64 | mpc55xx_start_config_siu_pcr_count []; |
---|
65 | |
---|
66 | extern BSP_START_DATA_SECTION const struct |
---|
67 | MMU_tag mpc55xx_start_config_mmu_early []; |
---|
68 | |
---|
69 | extern BSP_START_DATA_SECTION const size_t |
---|
70 | mpc55xx_start_config_mmu_early_count []; |
---|
71 | |
---|
72 | extern BSP_START_DATA_SECTION const struct |
---|
73 | MMU_tag mpc55xx_start_config_mmu []; |
---|
74 | |
---|
75 | extern BSP_START_DATA_SECTION const size_t |
---|
76 | mpc55xx_start_config_mmu_count []; |
---|
77 | |
---|
78 | #ifdef MPC55XX_HAS_FMPLL |
---|
79 | typedef struct { |
---|
80 | union FMPLL_SYNCR_tag syncr_tmp; |
---|
81 | union FMPLL_SYNCR_tag syncr_final; |
---|
82 | } mpc55xx_clock_config; |
---|
83 | #endif |
---|
84 | |
---|
85 | #ifdef MPC55XX_HAS_FMPLL_ENHANCED |
---|
86 | typedef struct { |
---|
87 | union FMPLL_ESYNCR2_tag esyncr2_tmp; |
---|
88 | union FMPLL_ESYNCR2_tag esyncr2_final; |
---|
89 | union FMPLL_ESYNCR1_tag esyncr1_final; |
---|
90 | } mpc55xx_clock_config; |
---|
91 | #endif |
---|
92 | |
---|
93 | #ifdef MPC55XX_HAS_MODE_CONTROL |
---|
94 | typedef struct { |
---|
95 | struct { |
---|
96 | PLLD_CR_32B_tag cr; |
---|
97 | PLLD_MR_32B_tag mr; |
---|
98 | } fmpll [2]; |
---|
99 | CGM_OC_EN_32B_tag oc_en; |
---|
100 | CGM_OCDS_SC_32B_tag ocds_sc; |
---|
101 | CGM_SC_DC0_3_32B_tag sc_dc0_3; |
---|
102 | CGM_AUXCLK_tag auxclk [5]; |
---|
103 | } mpc55xx_clock_config; |
---|
104 | #endif |
---|
105 | |
---|
106 | extern BSP_START_DATA_SECTION const mpc55xx_clock_config |
---|
107 | mpc55xx_start_config_clock []; |
---|
108 | |
---|
109 | #ifdef MPC55XX_HAS_EBI |
---|
110 | typedef struct { |
---|
111 | union EBI_MCR_tag ebi_mcr; |
---|
112 | uint32_t siu_eccr_ebdf; |
---|
113 | } mpc55xx_ebi_config; |
---|
114 | |
---|
115 | extern BSP_START_DATA_SECTION const mpc55xx_ebi_config |
---|
116 | mpc55xx_start_config_ebi []; |
---|
117 | |
---|
118 | extern BSP_START_DATA_SECTION const size_t |
---|
119 | mpc55xx_start_config_ebi_count []; |
---|
120 | |
---|
121 | extern BSP_START_DATA_SECTION const struct EBI_CS_tag |
---|
122 | mpc55xx_start_config_ebi_cs []; |
---|
123 | |
---|
124 | extern BSP_START_DATA_SECTION const size_t |
---|
125 | mpc55xx_start_config_ebi_cs_count []; |
---|
126 | |
---|
127 | extern BSP_START_DATA_SECTION const struct EBI_CAL_CS_tag |
---|
128 | mpc55xx_start_config_ebi_cal_cs []; |
---|
129 | |
---|
130 | extern BSP_START_DATA_SECTION const size_t |
---|
131 | mpc55xx_start_config_ebi_cal_cs_count []; |
---|
132 | #endif |
---|
133 | |
---|
134 | /** |
---|
135 | * @brief Start prologue. |
---|
136 | * |
---|
137 | * In case the BSP enabled the MPC55XX_ENABLE_START_PROLOGUE option, then this |
---|
138 | * function will be called directly after the Boot Assist Module (BAM) jumped |
---|
139 | * to the start entry defined by the reset configuration. |
---|
140 | * |
---|
141 | * This function executes in the context initialized by the BAM. There exists |
---|
142 | * no valid stack pointer and the internal RAM has an invalid ECC state. |
---|
143 | * |
---|
144 | * The default implementation does nothing. The application may provide its |
---|
145 | * own implementation. |
---|
146 | */ |
---|
147 | void mpc55xx_start_prologue(void); |
---|
148 | |
---|
149 | void mpc55xx_start_early(void); |
---|
150 | |
---|
151 | void mpc55xx_start_flash(void); |
---|
152 | |
---|
153 | void mpc55xx_start_cache(void); |
---|
154 | |
---|
155 | void mpc55xx_start_clock(void); |
---|
156 | |
---|
157 | void mpc55xx_start_watchdog(void); |
---|
158 | |
---|
159 | void mpc55xx_start_mmu_apply_config(const struct MMU_tag *config, size_t count); |
---|
160 | |
---|
161 | uint32_t mpc55xx_get_system_clock(void); |
---|
162 | |
---|
163 | LINKER_SYMBOL(bsp_ram_start) |
---|
164 | LINKER_SYMBOL(bsp_ram_end) |
---|
165 | LINKER_SYMBOL(bsp_ram_size) |
---|
166 | |
---|
167 | LINKER_SYMBOL(bsp_ram_1_start) |
---|
168 | LINKER_SYMBOL(bsp_ram_1_end) |
---|
169 | LINKER_SYMBOL(bsp_ram_1_size) |
---|
170 | |
---|
171 | LINKER_SYMBOL(bsp_rom_start) |
---|
172 | LINKER_SYMBOL(bsp_rom_end) |
---|
173 | LINKER_SYMBOL(bsp_rom_size) |
---|
174 | |
---|
175 | #ifdef MPC55XX_BOOTFLAGS |
---|
176 | extern uint32_t mpc55xx_bootflag_0 []; |
---|
177 | #endif |
---|
178 | |
---|
179 | #ifdef __cplusplus |
---|
180 | } |
---|
181 | #endif /* __cplusplus */ |
---|
182 | |
---|
183 | #endif /* LIBBSP_POWERPC_MPC55XXEVB_MPC55XX_CONFIG_H */ |
---|