Kinetis: Fixed wrong MCG VDIV calculation on new NXP K60

This commit is contained in:
Maciej Skrzypek 2017-01-13 08:13:21 -06:00 committed by Gregory Nutt
parent bc1826da63
commit 4becebe59f
2 changed files with 5 additions and 0 deletions

View File

@ -1014,6 +1014,7 @@
# undef KINETIS_K20 /* Not Kinetis K20 family */
# undef KINETIS_K40 /* Not Kinetics K40 family */
# define KINETIS_K60 1 /* Kinetis K60 family */
# define KINETIS_NEW_MCG 1 /* Kinetis New MCG - different VDIV */
# undef KINETIS_K64 /* Not Kinetis K64 family */
# define KINETIS_FLASH_SIZE (1024*1024) /* 1Mb */
# define KINETIS_FLEXNVM_SIZE (512*1024) /* 512Kb FlexNVM */

View File

@ -151,7 +151,11 @@
#define MCG_C6_VDIV_SHIFT (0) /* Bits 0-4: VCO Divider */
#define MCG_C6_VDIV_MASK (31 << MCG_C6_VDIV_SHIFT)
#ifdef KINETIS_NEW_MCG
# define MCG_C6_VDIV(n) ((uint32_t)((n)-16) << MCG_C6_VDIV_SHIFT) /* n=16..47 */
#else
# define MCG_C6_VDIV(n) ((uint32_t)((n)-24) << MCG_C6_VDIV_SHIFT) /* n=24..55 */
#endif
#define MCG_C6_CME (1 << 5) /* Bit 5: Clock Monitor Enable */
#define MCG_C6_PLLS (1 << 6) /* Bit 6: PLL Select */
#define MCG_C6_LOLIE (1 << 7) /* Bit 7: Loss of Lock Interrrupt Enable */