This is the code that i am using for MCG initialization. I am using K20 controller. I have only attached OSC1 still my code is working properly
MCG->C2 = (uint8_t)0x1Cu;
MCG->C10 = (uint8_t)0x1Cu;
MCG->C1 = (uint8_t)0xA0u;
MCG->C5 = (uint8_t)0x80u;
MCG->C6 = (uint8_t)0x00u;
MCG->C6 = (uint8_t)0x40u;
while((MCG->S & MCG_S_PLLST_MASK) == 0u);
while((MCG->S & MCG_S_LOCK0_MASK) == 0u);
MCG->C1 = (uint8_t)0x20u;
while((MCG->S & 0x0Cu) != 0x0Cu);
while((MCG->S & MCG_S_LOCK0_MASK) == 0u);