/* Perform software reset Resets all MAC subsystem registers and logic, wait for the software reset to clear.  */
int eth_cyclonev_software_reset(uint32_t instance, struct eth_cyclonev_priv *p)
/* Perform software reset Resets all MAC subsystem registers and logic, wait for the software reset to clear.  */
int eth_cyclonev_software_reset(uint32_t instance, struct eth_cyclonev_priv *p)
{
	unsigned int i;
	if (instance > 1) {
		return -1;
	}
	sys_set_bits(EMAC_DMAGRP_BUS_MODE_ADDR(p->base_addr), EMAC_DMA_MODE_SWR_SET_MSK);
	for (i = 0; i < 10; i++) {
		k_sleep(K_MSEC(10));
		if (eth_cyclonev_get_software_reset_status(instance, p) == 0) {
			break;
		}
	}
	if (i == 10) {
		return -1;
	}
	return 0;
}