summaryrefslogtreecommitdiffstats
path: root/bsps/powerpc/mpc55xxevb/include/bsp/mpc55xx-config.h
blob: 97f2dceb1f221c3fc0a219073693b383cf53a2e7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
/* SPDX-License-Identifier: BSD-2-Clause */

/**
 * @file
 *
 * @ingroup RTEMSBSPsPowerPCMPC55XX
 *
 * @brief Low-level configuration.
 */

/*
 * Copyright (C) 2008, 2012 embedded brains GmbH & Co. KG
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef LIBBSP_POWERPC_MPC55XXEVB_MPC55XX_CONFIG_H
#define LIBBSP_POWERPC_MPC55XXEVB_MPC55XX_CONFIG_H

#include <stddef.h>

#include <libcpu/powerpc-utility.h>

#include <bsp/start.h>

#include <mpc55xx/regs.h>
#include <mpc55xx/regs-mmu.h>
#include <mpc55xx/siu.h>

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

typedef struct {
  uint32_t index : 10;
  uint32_t count : 10;
  uint32_t output : 1;
  union SIU_PCR_tag pcr;
} mpc55xx_siu_pcr_config;

extern BSP_START_DATA_SECTION const mpc55xx_siu_pcr_config
  mpc55xx_start_config_siu_pcr [];

extern BSP_START_DATA_SECTION const size_t
  mpc55xx_start_config_siu_pcr_count [];

extern BSP_START_DATA_SECTION const struct
  MMU_tag mpc55xx_start_config_mmu_early [];

extern BSP_START_DATA_SECTION const size_t
  mpc55xx_start_config_mmu_early_count [];

extern BSP_START_DATA_SECTION const struct
  MMU_tag mpc55xx_start_config_mmu [];

extern BSP_START_DATA_SECTION const size_t
  mpc55xx_start_config_mmu_count [];

#ifdef MPC55XX_HAS_FMPLL
  typedef struct {
    union FMPLL_SYNCR_tag syncr_tmp;
    union FMPLL_SYNCR_tag syncr_final;
  } mpc55xx_clock_config;
#endif

#ifdef MPC55XX_HAS_FMPLL_ENHANCED
  typedef struct {
    union FMPLL_ESYNCR2_tag esyncr2_tmp;
    union FMPLL_ESYNCR2_tag esyncr2_final;
    union FMPLL_ESYNCR1_tag esyncr1_final;
  } mpc55xx_clock_config;
#endif

#ifdef MPC55XX_HAS_MODE_CONTROL
  typedef struct {
    struct {
      PLLD_CR_32B_tag cr;
      PLLD_MR_32B_tag mr;
    } fmpll [2];
    CGM_OC_EN_32B_tag oc_en;
    CGM_OCDS_SC_32B_tag ocds_sc;
    CGM_SC_DC0_3_32B_tag sc_dc0_3;
    CGM_AUXCLK_tag auxclk [5];
  } mpc55xx_clock_config;
#endif

extern BSP_START_DATA_SECTION const mpc55xx_clock_config
  mpc55xx_start_config_clock [];

#ifdef MPC55XX_HAS_EBI
  typedef struct {
    union EBI_MCR_tag ebi_mcr;
    uint32_t siu_eccr_ebdf;
  } mpc55xx_ebi_config;

  extern BSP_START_DATA_SECTION const mpc55xx_ebi_config
    mpc55xx_start_config_ebi [];

  extern BSP_START_DATA_SECTION const size_t
    mpc55xx_start_config_ebi_count [];

  extern BSP_START_DATA_SECTION const struct EBI_CS_tag
    mpc55xx_start_config_ebi_cs [];

  extern BSP_START_DATA_SECTION const size_t
    mpc55xx_start_config_ebi_cs_count [];

  extern BSP_START_DATA_SECTION const struct EBI_CAL_CS_tag
    mpc55xx_start_config_ebi_cal_cs [];

  extern BSP_START_DATA_SECTION const size_t
    mpc55xx_start_config_ebi_cal_cs_count [];
#endif

/**
 * @brief Start prologue.
 *
 * In case the BSP enabled the MPC55XX_ENABLE_START_PROLOGUE option, then this
 * function will be called directly after the Boot Assist Module (BAM) jumped
 * to the start entry defined by the reset configuration.
 *
 * This function executes in the context initialized by the BAM.  There exists
 * no valid stack pointer and the internal RAM has an invalid ECC state.
 *
 * The default implementation does nothing.  The application may provide its
 * own implementation.
 */
void mpc55xx_start_prologue(void);

void mpc55xx_start_early(void);

void mpc55xx_start_flash(void);

void mpc55xx_start_cache(void);

void mpc55xx_start_clock(void);

void mpc55xx_start_watchdog(void);

void mpc55xx_start_mmu_apply_config(const struct MMU_tag *config, size_t count);

uint32_t mpc55xx_get_system_clock(void);

LINKER_SYMBOL(bsp_ram_start)
LINKER_SYMBOL(bsp_ram_end)
LINKER_SYMBOL(bsp_ram_size)

LINKER_SYMBOL(bsp_ram_1_start)
LINKER_SYMBOL(bsp_ram_1_end)
LINKER_SYMBOL(bsp_ram_1_size)

LINKER_SYMBOL(bsp_rom_start)
LINKER_SYMBOL(bsp_rom_end)
LINKER_SYMBOL(bsp_rom_size)

#ifdef MPC55XX_BOOTFLAGS
  extern uint32_t mpc55xx_bootflag_0 [];
#endif

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* LIBBSP_POWERPC_MPC55XXEVB_MPC55XX_CONFIG_H */