From patchwork Thu Mar 26 22:59:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "tomcwarren3959 at gmail.com" X-Patchwork-Id: 244362 List-Id: U-Boot discussion From: tomcwarren3959 at gmail.com (tomcwarren3959 at gmail.com) Date: Thu, 26 Mar 2020 15:59:13 -0700 Subject: [PATCH 1/2] net: rt8169: WAR for DHCP not getting IP after kernel boot/reboot In-Reply-To: <1585263554-10258-1-git-send-email-tomcwarren3959@gmail.com> References: <1585263554-10258-1-git-send-email-tomcwarren3959@gmail.com> Message-ID: <1585263554-10258-2-git-send-email-tomcwarren3959@gmail.com> From: Tom Warren This is a WAR for DHCP failure after rebooting from the L4T kernel. The r8169.c kernel driver is setting bit 19 of the rt816x HW register 0xF0, which goes by FuncEvent and MISC in various driver source/datasheets. That bit is called RxDv_Gated_En in the r8169.c kernel driver. Clear it here at the end of probe to ensure that U-Boot can get an IP assigned via DHCP. Signed-off-by: Tom Warren --- drivers/net/rtl8169.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c index 5ccdfdd..ff89e28 100644 --- a/drivers/net/rtl8169.c +++ b/drivers/net/rtl8169.c @@ -237,6 +237,9 @@ enum RTL8169_register_content { /*_TBICSRBit*/ TBILinkOK = 0x02000000, + + /* FuncEvent/Misc */ + RxDv_Gated_En = 0x80000, }; static struct { @@ -1207,6 +1210,19 @@ static int rtl8169_eth_probe(struct udevice *dev) return ret; } + /* + * WAR for DHCP failure after rebooting from kernel. + * Clear RxDv_Gated_En bit which was set by kernel driver. + * Without this, U-Boot can't get an IP via DHCP. + * Register (FuncEvent, aka MISC) and RXDV_GATED_EN bit are from + * the r8169.c kernel driver. + */ + + u32 val = RTL_R32(FuncEvent); + debug("%s: FuncEvent/Misc (0xF0) = 0x%08X\n", __func__, val); + val &= ~RxDv_Gated_En; + RTL_W32(FuncEvent, val); + return 0; }