/* This routine checks if the PLL is locked to its input source. Minimum lock time is 3.3 ms. Lock time can be larger when the source is an external crystal. Crystal cold start times may vary greatly based on many factors. Crystals do not like being power cycled.  */
static int pll_wait_lock(struct pcr_hw_regs *const pcr, uint32_t wait_cnt)
/* This routine checks if the PLL is locked to its input source. Minimum lock time is 3.3 ms. Lock time can be larger when the source is an external crystal. Crystal cold start times may vary greatly based on many factors. Crystals do not like being power cycled.  */
static int pll_wait_lock(struct pcr_hw_regs *const pcr, uint32_t wait_cnt)
{
	while (!(pcr->OSC_ID & MCHP_PCR_OSC_ID_PLL_LOCK)) {
		if (wait_cnt == 0) {
			return -ETIMEDOUT;
		}
		--wait_cnt;
	}
	return 0;
}