Commit 9fafec3f9de634ab3215811059f02cd15878b8d1
Committed by
Lokesh Vutla
1 parent
82a23416ad
Exists in
v2016.05-smarct4x
and in
3 other branches
am335x_evm: Don't fail SPL USB eth boot
In commit c3839fc5b8e9 ("board: am335x: Always set eth/eth1addr environment variable") we got rid of setting usbnet_devaddr based on efuse. However this causes SPL USB eth boot to fail as usbnet_devaddr is not set. We bring back the code that sets usbnet_devaddr based on efuse. Fixes: c3839fc5b8e9 ("board: am335x: Always set eth/eth1addr environment variable") Signed-off-by: Roger Quadros <rogerq@ti.com>
Showing 1 changed file with 22 additions and 0 deletions Side-by-side Diff
board/ti/am335x/board.c
... | ... | @@ -771,7 +771,26 @@ |
771 | 771 | int board_eth_init(bd_t *bis) |
772 | 772 | { |
773 | 773 | int rv, n = 0; |
774 | +#if defined(CONFIG_USB_ETHER) && \ | |
775 | + (!defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_USBETH_SUPPORT)) | |
776 | + uint8_t mac_addr[6]; | |
777 | + uint32_t mac_hi, mac_lo; | |
774 | 778 | |
779 | + /* | |
780 | + * use efuse mac address for USB ethernet as we know that | |
781 | + * both CPSW and USB ethernet will never be active at the same time | |
782 | + */ | |
783 | + mac_lo = readl(&cdev->macid0l); | |
784 | + mac_hi = readl(&cdev->macid0h); | |
785 | + mac_addr[0] = mac_hi & 0xFF; | |
786 | + mac_addr[1] = (mac_hi & 0xFF00) >> 8; | |
787 | + mac_addr[2] = (mac_hi & 0xFF0000) >> 16; | |
788 | + mac_addr[3] = (mac_hi & 0xFF000000) >> 24; | |
789 | + mac_addr[4] = mac_lo & 0xFF; | |
790 | + mac_addr[5] = (mac_lo & 0xFF00) >> 8; | |
791 | +#endif | |
792 | + | |
793 | + | |
775 | 794 | #if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \ |
776 | 795 | (defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD)) |
777 | 796 | |
... | ... | @@ -827,6 +846,9 @@ |
827 | 846 | #endif |
828 | 847 | #if defined(CONFIG_USB_ETHER) && \ |
829 | 848 | (!defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_USBETH_SUPPORT)) |
849 | + if (is_valid_ethaddr(mac_addr)) | |
850 | + eth_setenv_enetaddr("usbnet_devaddr", mac_addr); | |
851 | + | |
830 | 852 | rv = usb_eth_initialize(bis); |
831 | 853 | if (rv < 0) |
832 | 854 | printf("Error %d registering USB_ETHER\n", rv); |