/* This function sets the clock prescaler for an QSPI device. The device must be idle rather than busy transferring data before setting these device options. */
s32 XQspiPs_SetClkPrescaler(XQspiPs *InstancePtr, u8 Prescaler)
/* This function sets the clock prescaler for an QSPI device. The device must be idle rather than busy transferring data before setting these device options. */
s32 XQspiPs_SetClkPrescaler(XQspiPs *InstancePtr, u8 Prescaler)
{
	u32 ConfigReg;
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
	Xil_AssertNonvoid(Prescaler <= XQSPIPS_CR_PRESC_MAXIMUM);
	if (InstancePtr->IsBusy) {
		return XST_DEVICE_BUSY;
	}
	ConfigReg = XQspiPs_ReadReg(InstancePtr->Config.BaseAddress,
				      XQSPIPS_CR_OFFSET);
	ConfigReg &= ~XQSPIPS_CR_PRESC_MASK;
	ConfigReg |= (u32) (Prescaler & XQSPIPS_CR_PRESC_MAXIMUM) <<
			    XQSPIPS_CR_PRESC_SHIFT;
	XQspiPs_WriteReg(InstancePtr->Config.BaseAddress,
			  XQSPIPS_CR_OFFSET,
			  ConfigReg);
	return XST_SUCCESS;
}