Kinetis:Add the configuring SIM_CLKDIV2[USBFRAC, USBDIV] in kinetis_clockconfig

If a board.h provides BOARD_SIM_CLKDIV2_FREQ it will configure the
  SIM_CLKDIV2 based on the additional provided
  BOARD_SIM_CLKDIV2_USBFRAC and BOARD_SIM_CLKDIV2_USBDIV

  The reason for doing this globaly is that the output the
  SIM_CLKDIV2 divisor may be also used for other IP blocks in
  future configurations (as is done for SIM_CLKDIV3)
This commit is contained in:
David Sidrane 2017-02-27 13:06:01 -10:00
parent 8ff7e5106d
commit 1c518b223d

View File

@ -360,6 +360,16 @@ void kinetis_pllconfig(void)
putreg32(regval32, KINETIS_SIM_SOPT2);
#endif
#if defined(BOARD_SIM_CLKDIV2_FREQ)
/* Set up the SIM_CLKDIV2[USBFRAC, USBDIV] */
regval32 = getreg32(KINETIS_SIM_CLKDIV2);
regval32 &= ~(SIM_CLKDIV2_USBFRAC_MASK | SIM_CLKDIV2_USBDIV_MASK);
regval32 |= (SIM_CLKDIV2_USBFRAC(BOARD_SIM_CLKDIV2_USBFRAC) |
SIM_CLKDIV2_USBDIV(BOARD_SIM_CLKDIV2_USBDIV));
putreg32(regval32, KINETIS_SIM_CLKDIV2);
#endif
#if defined(BOARD_SIM_CLKDIV3_FREQ)
/* Set up the SIM_CLKDIV3 [PLLFLLFRAC, PLLFLLDIV] */