1 /*
2 * Copyright 2017-2018 NXP
3 * All rights reserved.
4 *
5 *
6 * SPDX-License-Identifier: BSD-3-Clause
7 */
8
9 #include "fsl_common.h"
10 #include "clock_config.h"
11
12 /*******************************************************************************
13 * Definitions
14 ******************************************************************************/
15 // /*! @brief Clock configuration structure. */
16 // typedef struct _clock_config
17 // {
18 // mcg_config_t mcgConfig; /*!< MCG configuration. */
19 // sim_clock_config_t simConfig; /*!< SIM configuration. */
20 // osc_config_t oscConfig; /*!< OSC configuration. */
21 // uint32_t coreClock; /*!< core clock frequency. */
22 // } clock_config_t;
23
24 /*******************************************************************************
25 * Variables
26 ******************************************************************************/
27 /* System clock frequency. */
28 extern uint32_t SystemCoreClock;
29
30 /*******************************************************************************
31 * Code
32 ******************************************************************************/
33 /*
34 * How to setup clock using clock driver functions:
35 *
36 * 1. CLOCK_SetSimSafeDivs, to make sure core clock, bus clock, flexbus clock
37 * and flash clock are in allowed range during clock mode switch.
38 *
39 * 2. Call CLOCK_Osc0Init to setup OSC clock, if it is used in target mode.
40 *
41 * 3. Set MCG configuration, MCG includes three parts: FLL clock, PLL clock and
42 * internal reference clock(MCGIRCLK). Follow the steps to setup:
43 *
44 * 1). Call CLOCK_BootToXxxMode to set MCG to target mode.
45 *
46 * 2). If target mode is FBI/BLPI/PBI mode, the MCGIRCLK has been configured
47 * correctly. For other modes, need to call CLOCK_SetInternalRefClkConfig
48 * explicitly to setup MCGIRCLK.
49 *
50 * 3). Don't need to configure FLL explicitly, because if target mode is FLL
51 * mode, then FLL has been configured by the function CLOCK_BootToXxxMode,
52 * if the target mode is not FLL mode, the FLL is disabled.
53 *
54 * 4). If target mode is PEE/PBE/PEI/PBI mode, then the related PLL has been
55 * setup by CLOCK_BootToXxxMode. In FBE/FBI/FEE/FBE mode, the PLL could
56 * be enabled independently, call CLOCK_EnablePll0 explicitly in this case.
57 *
58 * 4. Call CLOCK_SetSimConfig to set the clock configuration in SIM.
59 */
60
BOARD_BootClockVLPR(void)61 void BOARD_BootClockVLPR(void)
62 {
63 SystemCoreClockUpdate();
64 }
65
BOARD_BootClockRUN(void)66 void BOARD_BootClockRUN(void)
67 {
68 SystemCoreClockUpdate();
69 }
70
BOARD_BootClockHSRUN(void)71 void BOARD_BootClockHSRUN(void)
72 {
73 SystemCoreClockUpdate();
74 }
75