diff --git a/common/bootm.c b/common/bootm.c index 282a4f3175..60de5a5fc4 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -40,6 +40,7 @@ #ifndef USE_HOSTCC extern void board_usb_deinit(int id); +extern void eth_cleanup(void); DECLARE_GLOBAL_DATA_PTR; @@ -726,6 +727,11 @@ int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[], for (i = 0; i < CONFIG_USB_MAX_CONTROLLER_COUNT; i++) board_usb_deinit(i); #endif + /* + * Edma cleanup + */ + eth_cleanup(); + ret = boot_selected_os(argc, argv, BOOTM_STATE_OS_GO, images, boot_fn); } diff --git a/drivers/net/ipq5332/ipq5332_edma.c b/drivers/net/ipq5332/ipq5332_edma.c index 56f2ef91d4..9e65e803f1 100644 --- a/drivers/net/ipq5332/ipq5332_edma.c +++ b/drivers/net/ipq5332/ipq5332_edma.c @@ -2205,3 +2205,18 @@ init_failed: return -1; } + +void ipq_eth_cleanup(struct eth_device *dev) +{ + struct ipq5332_eth_dev *priv = dev->priv; + struct ipq5332_edma_common_info *c_info = priv->c_info; + struct ipq5332_edma_hw *ehw = &c_info->hw; + + ipq5332_edma_disable_intr(ehw); + + ipq5332_edma_disable_rings(ehw); + + ipq5332_edma_reg_write(IPQ5332_EDMA_REG_PORT_CTRL, 0); + + return; +} diff --git a/drivers/net/ipq6018/ipq6018_edma.c b/drivers/net/ipq6018/ipq6018_edma.c index 42e14951a4..150f58444d 100755 --- a/drivers/net/ipq6018/ipq6018_edma.c +++ b/drivers/net/ipq6018/ipq6018_edma.c @@ -2025,3 +2025,18 @@ init_failed: return -1; } + +void ipq_eth_cleanup(struct eth_device *dev) +{ + struct ipq6018_eth_dev *priv = dev->priv; + struct ipq6018_edma_common_info *c_info = priv->c_info; + struct ipq6018_edma_hw *ehw = &c_info->hw; + + ipq6018_edma_disable_intr(ehw); + + ipq6018_edma_disable_rings(ehw); + + ipq6018_edma_reg_write(IPQ6018_EDMA_REG_PORT_CTRL, 0); + + return; +} diff --git a/drivers/net/ipq9574/ipq9574_edma.c b/drivers/net/ipq9574/ipq9574_edma.c index 581564fae3..7b8450b186 100644 --- a/drivers/net/ipq9574/ipq9574_edma.c +++ b/drivers/net/ipq9574/ipq9574_edma.c @@ -2276,3 +2276,18 @@ init_failed: return -1; } + +void ipq_eth_cleanup(struct eth_device *dev) +{ + struct ipq9574_eth_dev *priv = dev->priv; + struct ipq9574_edma_common_info *c_info = priv->c_info; + struct ipq9574_edma_hw *ehw = &c_info->hw; + + ipq9574_edma_disable_intr(ehw); + + ipq9574_edma_disable_rings(ehw); + + ipq9574_edma_reg_write(IPQ9574_EDMA_REG_PORT_CTRL, 0); + + return; +} diff --git a/net/eth.c b/net/eth.c index 3d9739522d..730c000daa 100644 --- a/net/eth.c +++ b/net/eth.c @@ -668,6 +668,19 @@ static unsigned int eth_rcv_current, eth_rcv_last; static struct eth_device *eth_devices; struct eth_device *eth_current; +__weak void ipq_eth_cleanup(struct eth_device *dev) +{ + return; +} + +void eth_cleanup(void) +{ + if (!eth_current) + return; + + ipq_eth_cleanup(eth_current); +} + static void eth_set_current_to_next(void) { eth_current = eth_current->next;