X-Git-Url: https://repo.jachan.dev/J-u-boot.git/blobdiff_plain/612f2dc026548466adf55268b9faaea108b15ec8..552a848e4f75e224515269a84a1155c84b762bc7:/board/boundary/nitrogen6x/nitrogen6x.c diff --git a/board/boundary/nitrogen6x/nitrogen6x.c b/board/boundary/nitrogen6x/nitrogen6x.c index e8ea256be0c..17fd6f56eaf 100644 --- a/board/boundary/nitrogen6x/nitrogen6x.c +++ b/board/boundary/nitrogen6x/nitrogen6x.c @@ -13,14 +13,14 @@ #include #include #include -#include +#include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -31,7 +31,7 @@ #include #include #include -#include +#include DECLARE_GLOBAL_DATA_PTR; #define GP_USB_OTG_PWR IMX_GPIO_NR(3, 22) @@ -387,20 +387,17 @@ int board_eth_init(bd_t *bis) #ifdef CONFIG_FEC_MXC bus = fec_get_miibus(base, -1); if (!bus) - return 0; + return -EINVAL; /* scan phy 4,5,6,7 */ phydev = phy_find_by_mask(bus, (0xf << 4), PHY_INTERFACE_MODE_RGMII); if (!phydev) { - free(bus); - return 0; + ret = -EINVAL; + goto free_bus; } printf("using phy at %d\n", phydev->addr); ret = fec_probe(bis, -1, base, bus, phydev); - if (ret) { - printf("FEC MXC: %s:failed\n", __func__); - free(phydev); - free(bus); - } + if (ret) + goto free_phydev; #endif #ifdef CONFIG_CI_UDC @@ -408,6 +405,12 @@ int board_eth_init(bd_t *bis) usb_eth_initialize(bis); #endif return 0; + +free_phydev: + free(phydev); +free_bus: + free(bus); + return ret; } static void setup_buttons(void) @@ -900,7 +903,7 @@ int board_init(void) setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1); setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info2); -#ifdef CONFIG_CMD_SATA +#ifdef CONFIG_SATA setup_sata(); #endif @@ -1018,5 +1021,6 @@ int misc_init_r(void) #ifdef CONFIG_CMD_BMODE add_board_boot_modes(board_boot_modes); #endif + setenv_hex("reset_cause", get_imx_reset_cause()); return 0; }