lib/sw_apps/zynqmp_pmufw/src/pm_pll.c
s32 PmPllSetModeInt(PmPll* const pll, const u32 mode)
{
	s32 status = XST_SUCCESS;
	u32 val;

	/* Check whether all config parameters are known for frac/int mode */
	if (PM_PLL_MODE_FRACTIONAL == mode) {
		PmPllParam* p = &pllParams[PM_PLL_PARAM_DATA];

		val = XPfw_Read32(pll->addr + p->regOffset);
		val = (val >> p->shift) & MASK_OF_BITS(p->bits);
		/* Check if fractional divider has been set (data parameter) */
		if (0U == val) {
			status = XST_NO_DATA;
			goto done;
		}
	}

	PmPllBypassAndReset(pll);
	if (PM_PLL_MODE_RESET == mode) {
		goto done;
	}

	if (PM_PLL_MODE_FRACTIONAL == mode) {
		val = PLL_FRAC_CFG_ENABLED_MASK;
	} else {
		val = ~PLL_FRAC_CFG_ENABLED_MASK;
	}
	/* Enable/disable fractional mode */
	XPfw_RMW32(pll->addr + PM_PLL_FRAC_OFFSET, PLL_FRAC_CFG_ENABLED_MASK,
		   val);

	status = PmPllLock(pll);
	if (XST_SUCCESS != status) {
		goto done;
	}

	/* Deassert bypass if the PLL has locked */
	XPfw_RMW32(pll->addr + PM_PLL_CTRL_OFFSET,
		   PM_PLL_CTRL_BYPASS_MASK, ~PM_PLL_CTRL_BYPASS_MASK);

done:
	return status;
}
/**
 * PmPllSetModeInt() - Set the mode for PLL
 * @pll		Target PLL
 * @mode	Identifier of the mode to be set
 *
 * @return	XST_SUCCESS if the mode is set
 *		XST_NO_DATA if the fractional mode is requested and configured
 *		fractional divider is zero
 */
Set the mode for PLL
@pll         Target PLL
@mode        Identifier of the mode to be set

@return      XST_SUCCESS if the mode is set
XST_NO_DATA if the fractional mode is requested and configured
fractional divider is zero
Set the mode for PLL @pll Target PLL @mode Identifier of the mode to be set @return XST_SUCCESS if the mode is set XST_NO_DATA if the fractional mode is requested and configured fractional divider is zero
s32 PmPllSetModeInt(PmPll* const pll, const u32 mode)
{
	s32 status = XST_SUCCESS;
	u32 val;
	if (PM_PLL_MODE_FRACTIONAL == mode) {
		PmPllParam* p = &pllParams[PM_PLL_PARAM_DATA];
		val = XPfw_Read32(pll->addr + p->regOffset);
		val = (val >> p->shift) & MASK_OF_BITS(p->bits);
		if (0U == val) {
			status = XST_NO_DATA;
			goto done;
		}
	}
	PmPllBypassAndReset(pll);
	if (PM_PLL_MODE_RESET == mode) {
		goto done;
	}
	if (PM_PLL_MODE_FRACTIONAL == mode) {
		val = PLL_FRAC_CFG_ENABLED_MASK;
	} else {
		val = ~PLL_FRAC_CFG_ENABLED_MASK;
	}
	XPfw_RMW32(pll->addr + PM_PLL_FRAC_OFFSET, PLL_FRAC_CFG_ENABLED_MASK,
		   val);
	status = PmPllLock(pll);
	if (XST_SUCCESS != status) {
		goto done;
	}
	XPfw_RMW32(pll->addr + PM_PLL_CTRL_OFFSET,
		   PM_PLL_CTRL_BYPASS_MASK, ~PM_PLL_CTRL_BYPASS_MASK);
done:
	return status;
}
s32 PmPllSetModeInt ( PmPll * const pll , const u32 mode ) { s32 status = XST_SUCCESS ; u32 val ; if ( PM_PLL_MODE_FRACTIONAL == mode ) { PmPllParam * p = & pllParams [ PM_PLL_PARAM_DATA ] ; val = XPfw_Read32 ( pll -> addr + p -> regOffset ) ; val = ( val >> p -> shift ) & MASK_OF_BITS ( p -> bits ) ; if ( 0U == val ) { status = XST_NO_DATA ; goto done ; } } PmPllBypassAndReset ( pll ) ; if ( PM_PLL_MODE_RESET == mode ) { goto done ; } if ( PM_PLL_MODE_FRACTIONAL == mode ) { val = PLL_FRAC_CFG_ENABLED_MASK ; } else { val = ~ PLL_FRAC_CFG_ENABLED_MASK ; } XPfw_RMW32 ( pll -> addr + PM_PLL_FRAC_OFFSET , PLL_FRAC_CFG_ENABLED_MASK , val ) ; status = PmPllLock ( pll ) ; if ( XST_SUCCESS != status ) { goto done ; } XPfw_RMW32 ( pll -> addr + PM_PLL_CTRL_OFFSET , PM_PLL_CTRL_BYPASS_MASK , ~ PM_PLL_CTRL_BYPASS_MASK ) ; done : return status ; }
PmPllSetModeInt() - Set the mode for PLL
 @pll         Target PLL
 @mode        Identifier of the mode to be set
PmPllSetModeInt () - Set the mode for PLL @pll Target PLL @mode Identifier of the mode to be set
/* Check whether all config parameters are known for frac/int mode */ /* Check if fractional divider has been set (data parameter) */ /* Enable/disable fractional mode */ /* Deassert bypass if the PLL has locked */