2 * File: mcf52221_sysinit.c
3 * Purpose: Power-on Reset configuration of the MCF52221.
8 #include "support_common.h"
9 #include "exceptions.h"
13 /********************************************************************/
14 static void pll_init(void)
17 MCF_CLOCK_CCHR =0x05; // The PLL pre divider - 48MHz / 6 = 8MHz
19 /* The PLL pre-divider affects this!!!
20 * Multiply 8Mhz reference crystal /CCHR by 10 to acheive system clock of 80Mhz
23 MCF_CLOCK_SYNCR = MCF_CLOCK_SYNCR_MFD(3) | MCF_CLOCK_SYNCR_CLKSRC| MCF_CLOCK_SYNCR_PLLMODE | MCF_CLOCK_SYNCR_PLLEN ;
25 while (!(MCF_CLOCK_SYNSR & MCF_CLOCK_SYNSR_LOCK))
29 /********************************************************************/
30 static void scm_init(void)
33 * Enable on-chip modules to access internal SRAM
36 | MCF_SCM_RAMBAR_BA(RAMBAR_ADDRESS)
37 | MCF_SCM_RAMBAR_BDE);
40 /********************************************************************/
43 * Out of reset, the low-level assembly code calls this routine to
44 * initialize the mcf5206e for this board. A temporary stack has been
45 * setup in the internal SRAM, and the stack pointer will be changed
46 * to point to DRAM once this routine returns.
48 void __initialize_hardware(void)
50 /*******************************************************
51 * Out of reset, the low-level assembly code calls this
52 * routine to initialize the MCF52221 modules for the
54 ********************************************************/
59 /* Initialize IPSBAR */
61 andi.l #0xC0000000,d0 // need to mask
67 /* Initialize FLASHBAR */
69 andi.l #0xFFF80000,d0 // need to mask
76 /* Set real time clock freq */
77 MCF_CLOCK_RTCDR = 48000000;
82 initialize_exceptions();