/* RELOAD mode must be selected if total number of data bytes to be sent is greater than MAX_LEN  */
static void stm32_i2c_handle_reload(struct stm32_i2c_priv *i2c_priv, struct i2c_msg *msg, bool stop)
/* RELOAD mode must be selected if total number of data bytes to be sent is greater than MAX_LEN  */
static void stm32_i2c_handle_reload(struct stm32_i2c_priv *i2c_priv, struct i2c_msg *msg, bool stop)
{
	struct stm32_i2c_regs *regs = i2c_priv->regs;
	u32 cr2 = readl(&regs->cr2);
	cr2 &= ~STM32_I2C_CR2_NBYTES_MASK;
	if (msg->len > STM32_I2C_MAX_LEN) {
		cr2 |= STM32_I2C_CR2_NBYTES(STM32_I2C_MAX_LEN);
	} else {
		cr2 &= ~STM32_I2C_CR2_RELOAD;
		cr2 |= STM32_I2C_CR2_NBYTES(msg->len);
	}
	writel(cr2, &regs->cr2);
}