diff --git a/board/nm/netbird/board.c b/board/nm/netbird/board.c index a6efd08f07..390542137b 100644 --- a/board/nm/netbird/board.c +++ b/board/nm/netbird/board.c @@ -425,7 +425,7 @@ int board_late_init(void) boot_partition = 0; } - /* mmcblk0p1 => root0, mmcblk0p2 => root1 so +1 */ + /* mmcblk1p1 => root0, mmcblk1p2 => root1 so +1 */ setenv_ulong("root_part", boot_partition + 1); check_reset_button(); diff --git a/board/nm/netbird_v2/board.c b/board/nm/netbird_v2/board.c index b533512996..98c03d6a10 100644 --- a/board/nm/netbird_v2/board.c +++ b/board/nm/netbird_v2/board.c @@ -683,7 +683,7 @@ int board_late_init(void) boot_partition = 0; } - /* mmcblk0p1 => root0, mmcblk0p2 => root1 so +1 */ + /* mmcblk1p1 => root0, mmcblk1p2 => root1 so +1 */ setenv_ulong("root_part", boot_partition + 1); check_reset_button(); diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c index 56f4984f47..0f7ba804cb 100644 --- a/board/ti/am335x/board.c +++ b/board/ti/am335x/board.c @@ -651,53 +651,50 @@ static struct cpsw_platform_data cpsw_data = { int board_eth_init(bd_t *bis) { int rv, n = 0; - uint8_t mac_addr[6]; - uint32_t mac_hi, mac_lo; + uint8_t mac_addr0[6]; + uint8_t mac_addr1[6]; __maybe_unused struct ti_am_eeprom *header; + int boot_partition; - /* try reading mac address from efuse */ - mac_lo = readl(&cdev->macid0l); - mac_hi = readl(&cdev->macid0h); - mac_addr[0] = mac_hi & 0xFF; - mac_addr[1] = (mac_hi & 0xFF00) >> 8; - mac_addr[2] = (mac_hi & 0xFF0000) >> 16; - mac_addr[3] = (mac_hi & 0xFF000000) >> 24; - mac_addr[4] = mac_lo & 0xFF; - mac_addr[5] = (mac_lo & 0xFF00) >> 8; #if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \ (defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD)) - if (!getenv("ethaddr")) { - printf(" not set. Validating first E-fuse MAC\n"); - - if (is_valid_ethaddr(mac_addr)) - eth_setenv_enetaddr("ethaddr", mac_addr); - } #ifdef CONFIG_DRIVER_TI_CPSW - mac_lo = readl(&cdev->macid1l); - mac_hi = readl(&cdev->macid1h); - mac_addr[0] = mac_hi & 0xFF; - mac_addr[1] = (mac_hi & 0xFF00) >> 8; - mac_addr[2] = (mac_hi & 0xFF0000) >> 16; - mac_addr[3] = (mac_hi & 0xFF000000) >> 24; - mac_addr[4] = mac_lo & 0xFF; - mac_addr[5] = (mac_lo & 0xFF00) >> 8; - - if (!getenv("eth1addr")) { - if (is_valid_ethaddr(mac_addr)) - eth_setenv_enetaddr("eth1addr", mac_addr); + if (board_is_nbhw16()) { + /* Clock should be 2MHz */ + cpsw_data.mdio_div = 0x3E; } if (read_eeprom() < 0) puts("Could not get board ID.\n"); + board_ti_get_eth_mac_addr(0, mac_addr0); + board_ti_get_eth_mac_addr(1, mac_addr1); + + set_mac_address(0, mac_addr0); + set_mac_address(1, mac_addr1); + + boot_partition = get_boot_partition(); + if (boot_partition > 1) { + boot_partition = 0; + } + + /* mmcblk1p1 => u-boot, mmcblk1p2 => root0 so +2 */ + setenv_ulong("root_part", boot_partition + 2); + if (board_is_bone() || board_is_bone_lt() || - board_is_idk()) { + board_is_idk()) { writel(MII_MODE_ENABLE, &cdev->miisel); cpsw_slaves[0].phy_if = cpsw_slaves[1].phy_if = PHY_INTERFACE_MODE_MII; + } else if (board_is_nbhw16()) { + writel(RMII_MODE_ENABLE | RMII_CHIPCKL_ENABLE, &cdev->miisel); + cpsw_slaves[0].phy_if = PHY_INTERFACE_MODE_RMII; + cpsw_slaves[1].phy_if = PHY_INTERFACE_MODE_RMII; + cpsw_slaves[0].phy_addr = 0; + cpsw_slaves[1].phy_addr = 1; } else if (board_is_icev2()) { writel(RMII_MODE_ENABLE | RMII_CHIPCKL_ENABLE, &cdev->miisel); cpsw_slaves[0].phy_if = PHY_INTERFACE_MODE_RMII; diff --git a/board/ti/am335x/board.c.rej b/board/ti/am335x/board.c.rej new file mode 100644 index 0000000000..e385684cb4 --- /dev/null +++ b/board/ti/am335x/board.c.rej @@ -0,0 +1,83 @@ +--- board/ti/am335x/board.c ++++ board/ti/am335x/board.c +@@ -651,50 +557,53 @@ static void set_mac_address(int index, uchar mac[6]) + int board_eth_init(bd_t *bis) + { + int rv, n = 0; +- uint8_t mac_addr0[6]; +- uint8_t mac_addr1[6]; ++ uint8_t mac_addr[6]; ++ uint32_t mac_hi, mac_lo; + __maybe_unused struct ti_am_eeprom *header; +- int boot_partition; + ++ /* try reading mac address from efuse */ ++ mac_lo = readl(&cdev->macid0l); ++ mac_hi = readl(&cdev->macid0h); ++ mac_addr[0] = mac_hi & 0xFF; ++ mac_addr[1] = (mac_hi & 0xFF00) >> 8; ++ mac_addr[2] = (mac_hi & 0xFF0000) >> 16; ++ mac_addr[3] = (mac_hi & 0xFF000000) >> 24; ++ mac_addr[4] = mac_lo & 0xFF; ++ mac_addr[5] = (mac_lo & 0xFF00) >> 8; + + #if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \ + (defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD)) ++ if (!getenv("ethaddr")) { ++ printf(" not set. Validating first E-fuse MAC\n"); ++ ++ if (is_valid_ethaddr(mac_addr)) ++ eth_setenv_enetaddr("ethaddr", mac_addr); ++ } + + #ifdef CONFIG_DRIVER_TI_CPSW + +- if (board_is_nbhw16()) { +- /* Clock should be 2MHz */ +- cpsw_data.mdio_div = 0x3E; ++ mac_lo = readl(&cdev->macid1l); ++ mac_hi = readl(&cdev->macid1h); ++ mac_addr[0] = mac_hi & 0xFF; ++ mac_addr[1] = (mac_hi & 0xFF00) >> 8; ++ mac_addr[2] = (mac_hi & 0xFF0000) >> 16; ++ mac_addr[3] = (mac_hi & 0xFF000000) >> 24; ++ mac_addr[4] = mac_lo & 0xFF; ++ mac_addr[5] = (mac_lo & 0xFF00) >> 8; ++ ++ if (!getenv("eth1addr")) { ++ if (is_valid_ethaddr(mac_addr)) ++ eth_setenv_enetaddr("eth1addr", mac_addr); + } + + if (read_eeprom() < 0) + puts("Could not get board ID.\n"); + +- board_ti_get_eth_mac_addr(0, mac_addr0); +- board_ti_get_eth_mac_addr(1, mac_addr1); +- +- set_mac_address(0, mac_addr0); +- set_mac_address(1, mac_addr1); +- +- boot_partition = get_boot_partition(); +- if (boot_partition > 1) { +- boot_partition = 0; +- } +- +- /* mmcblk0p1 => u-boot, mmcblk0p2 => root0 so +2 */ +- setenv_ulong("root_part", boot_partition + 2); +- + if (board_is_bone() || board_is_bone_lt() || +- board_is_idk()) { ++ board_is_idk()) { + writel(MII_MODE_ENABLE, &cdev->miisel); + cpsw_slaves[0].phy_if = cpsw_slaves[1].phy_if = + PHY_INTERFACE_MODE_MII; +- } else if (board_is_nbhw16()) { +- writel(RMII_MODE_ENABLE | RMII_CHIPCKL_ENABLE, &cdev->miisel); +- cpsw_slaves[0].phy_if = PHY_INTERFACE_MODE_RMII; +- cpsw_slaves[1].phy_if = PHY_INTERFACE_MODE_RMII; +- cpsw_slaves[0].phy_addr = 0; +- cpsw_slaves[1].phy_addr = 1; + } else if (board_is_icev2()) { + writel(RMII_MODE_ENABLE | RMII_CHIPCKL_ENABLE, &cdev->miisel); + cpsw_slaves[0].phy_if = PHY_INTERFACE_MODE_RMII; diff --git a/include/configs/am335x_netbird.h b/include/configs/am335x_netbird.h index 5a20efb611..b9c49997ff 100644 --- a/include/configs/am335x_netbird.h +++ b/include/configs/am335x_netbird.h @@ -53,7 +53,7 @@ "kernel_addr=0x80000000\0" \ "load_addr=0x83000000\0" \ "root_part=1\0" /* Default root partition, overwritte in board/mv_ebu/a38x/nbhw14_env.c */ \ - "add_sd_bootargs=setenv bootargs $bootargs root=/dev/mmcblk0p$root_part rootfstype=ext4 console=ttyO0,115200 rootwait earlyprintk\0" \ + "add_sd_bootargs=setenv bootargs $bootargs root=/dev/mmcblk1p$root_part rootfstype=ext4 console=ttyO0,115200 rootwait earlyprintk\0" \ "add_version_bootargs=setenv bootargs $bootargs\0" \ "fdt_skip_update=yes\0" \ "ethprime=cpsw\0" \ diff --git a/include/configs/am335x_netbird_v2.h b/include/configs/am335x_netbird_v2.h index 5806092425..de16bed159 100644 --- a/include/configs/am335x_netbird_v2.h +++ b/include/configs/am335x_netbird_v2.h @@ -59,7 +59,7 @@ "load_addr=" LOAD_ADDR "\0" \ "root_part=1\0" /* Default root partition, overwritte in board file */ \ "defaultconsole=ttyS1\0" /* Default output console */ \ - "add_sd_bootargs=setenv bootargs $bootargs root=/dev/mmcblk0p$root_part rootfstype=ext4 console=$defaultconsole,115200 rootwait loglevel=4\0" \ + "add_sd_bootargs=setenv bootargs $bootargs root=/dev/mmcblk1p$root_part rootfstype=ext4 console=$defaultconsole,115200 rootwait loglevel=4\0" \ "add_version_bootargs=setenv bootargs $bootargs\0" \ "fdt_skip_update=yes\0" \ "ethprime=cpsw\0" \