From de974efebb517dfd8f4d8142e29fc5f608820a12 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Tue, 18 May 2021 19:28:16 +0200 Subject: [PATCH] drivers: eth_enc424j600: explicitly disable INTIE after reset After system reset (SETETHRST) interrupt enable register (EIE) has the default value 0x8010 and global interrupt enable flag (INTIE) is set. This is not desired and the INTIE flag should be set only at the end of the initialization. Disable INTIE flag and set desired interrupts sources in a single write command just right after system reset. Resolves: #35091 Reported-by: Jamie McCrae Signed-off-by: Johann Fischer --- drivers/ethernet/eth_enc424j600.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/ethernet/eth_enc424j600.c b/drivers/ethernet/eth_enc424j600.c index dc2b5441af6..0b4177a8820 100644 --- a/drivers/ethernet/eth_enc424j600.c +++ b/drivers/ethernet/eth_enc424j600.c @@ -690,6 +690,15 @@ static int enc424j600_init(const struct device *dev) return -EIO; } + /* Disable INTIE and setup interrupt logic */ + enc424j600_write_sfru(dev, ENC424J600_SFR3_EIEL, + ENC424J600_EIE_PKTIE | ENC424J600_EIE_LINKIE); + + if (CONFIG_ETHERNET_LOG_LEVEL == LOG_LEVEL_DBG) { + enc424j600_read_sfru(dev, ENC424J600_SFR3_EIEL, &tmp); + LOG_DBG("EIE: 0x%04x", tmp); + } + /* Configure TX and RX buffer */ enc424j600_write_sfru(dev, ENC424J600_SFR0_ETXSTL, ENC424J600_TXSTART); @@ -721,15 +730,6 @@ static int enc424j600_init(const struct device *dev) enc424j600_init_filters(dev); enc424j600_init_phy(dev); - /* Setup interrupt logic */ - enc424j600_set_sfru(dev, ENC424J600_SFR3_EIEL, - ENC424J600_EIE_PKTIE | ENC424J600_EIE_LINKIE); - - if (CONFIG_ETHERNET_LOG_LEVEL == LOG_LEVEL_DBG) { - enc424j600_read_sfru(dev, ENC424J600_SFR3_EIEL, &tmp); - LOG_DBG("EIE: 0x%04x", tmp); - } - /* Enable Reception */ enc424j600_set_sfru(dev, ENC424J600_SFRX_ECON1L, ENC424J600_ECON1_RXEN); if (CONFIG_ETHERNET_LOG_LEVEL == LOG_LEVEL_DBG) {