/* bsec_check_error() - Check status of one otp @base: base address of bsec IP @otp: otp number (0 - BSEC_OTP_MAX_VALUE) Return: 0 if no error, -EAGAIN or -ENOTSUPP  */
static u32 bsec_check_error(u32 base, u32 otp)
/* bsec_check_error() - Check status of one otp @base: base address of bsec IP @otp: otp number (0 - BSEC_OTP_MAX_VALUE) Return: 0 if no error, -EAGAIN or -ENOTSUPP  */
static u32 bsec_check_error(u32 base, u32 otp)
{
	u32 bit;
	u32 bank;
	bit = 1 << (otp & OTP_LOCK_MASK);
	bank = ((otp >> OTP_LOCK_BANK_SHIFT) & OTP_LOCK_MASK) * sizeof(u32);
	if (readl(base + BSEC_DISTURBED_OFF + bank) & bit)
		return -EAGAIN;
	else if (readl(base + BSEC_ERROR_OFF + bank) & bit)
		return -ENOTSUPP;
	return 0;
}