FIX: [uboot] Change netbird mmc block device from mmcblk0 to mmcblk1

Fix patch file

BugzId: 56050
This commit is contained in:
Moritz Rosenthal 2019-03-07 18:33:44 +01:00
parent 2ec05303ef
commit 2d30a14cb2
2 changed files with 30 additions and 110 deletions

View File

@ -651,50 +651,53 @@ static struct cpsw_platform_data cpsw_data = {
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("<ethaddr> 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;
}
/* 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()) {
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;

View File

@ -1,83 +0,0 @@
--- 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("<ethaddr> 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;