From: Meng Li <meng...@windriver.com> When FEC network card works as the prime one in u-boot, and is in active status, kernel might crash during booting up stage, especially working with grub. Because the DMA of FEC is still in active status, and copy data into memory if there is network data received. In this case, if kernel allocated a part of memory that has overlay with the memory used by DMA, kernel memory may be destroyed and cause kernel crashes. Because before kernel boots up really, u-boot dm_remove_devices_flags() can call the remove callback of FEC driver with DM_FLAG_ACTIVE_DMA flag. In fecmxc_remove(), phy power is disabled, so there is no data received. In this way, it makes sure that there is no DMA action, so that avoid kernel crashing occurs.
Signed-off-by: Meng Li <meng...@windriver.com> --- v2: Fix a typo --- drivers/net/fec_mxc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c index d6d5cb52fd..3ac6bd3f3c 100644 --- a/drivers/net/fec_mxc.c +++ b/drivers/net/fec_mxc.c @@ -1491,4 +1491,5 @@ U_BOOT_DRIVER(fecmxc_gem) = { .ops = &fecmxc_ops, .priv_auto = sizeof(struct fec_priv), .plat_auto = sizeof(struct eth_pdata), + .flags = DM_FLAG_ACTIVE_DMA, }; -- 2.34.1