/* Wait for state machine to be at in INIT_FS state.  */
static int fs26_poll_for_init_fs_state(const struct device *dev)
/* Wait for state machine to be at in INIT_FS state.  */
static int fs26_poll_for_init_fs_state(const struct device *dev)
{
	const struct wdt_nxp_fs26_config *config = dev->config;
	struct fs26_spi_rx_frame rx_frame;
	uint32_t regval = 0;
	int64_t timeout;
	int64_t now;
	timeout = k_uptime_get() + FS26_INIT_FS_TIMEOUT_MS;
	do {
		if (!fs26_getreg(&config->spi, FS26_FS_STATES, &rx_frame)) {
			regval = rx_frame.data;
		}
		k_sleep(K_MSEC(1));
		now = k_uptime_get();
	} while ((now < timeout) && (regval & FS_STATES_MASK) != FS_STATES_INIT_FS);
	if (now >= timeout) {
		LOG_ERR("Timedout waiting for INIT_FS state");
		return -ETIMEDOUT;
	}
	return 0;
}