Skip to content

drivers: ethernet: ksz8081: unstable PHY link with MCUboot on mimxrt1160_evk #104607

@blemouzy

Description

@blemouzy

Describe the bug

On mimxrt1160_evk,

  • When an application is run without MCUboot, the PHY link is stable
  • When an application is run with MCUboot, the PHY link is unstable (multiple down and up with wrong auto-neg)

Regression

  • This is a regression.

Steps to reproduce

cd bootloader/mcuboot/boot/zephyr
echo 'CONFIG_BOOT_MAX_IMG_SECTORS=1792' >> prj.conf
echo 'CONFIG_BOOT_SIGNATURE_TYPE_NONE=y' >> prj.conf
echo 'CONFIG_BOOT_VALIDATE_SLOT0=n' >> prj.conf
west build -b mimxrt1160_evk/mimxrt1166/cm7 -p
west flash --runner=jlink

cd zephyr/samples/net/dhcpv4_client
echo 'CONFIG_BOOTLOADER_MCUBOOT=y' >> prj.conf
echo 'CONFIG_MCUBOOT_GENERATE_UNSIGNED_IMAGE=y' >> prj.conf
echo 'CONFIG_MCUBOOT_SIGNATURE_KEY_FILE=""' >> prj.conf
echo "CONFIG_PHY_LOG_LEVEL_DBG=y" >> prj.conf
west build -b mimxrt1160_evk/mimxrt1166/cm7 -p
west flash --runner=jlink

Relevant log output

# With sample from v3.7.1 and without MCUboot (working):

[00:00:00.003,000] <dbg> phy_mc_ksz8081: phy_mc_ksz8081_autonegotiate: PHY (0) is entering autonegotiation sequence
[00:00:02.411,000] <dbg> phy_mc_ksz8081: phy_mc_ksz8081_autonegotiate: PHY (0) autonegotiation completed
[00:00:02.412,000] <dbg> phy_mc_ksz8081: phy_mc_ksz8081_get_link: PHY 0 is up
[00:00:02.412,000] <dbg> phy_mc_ksz8081: phy_mc_ksz8081_get_link: PHY (0) Link speed 100 Mb, full duplex

[00:00:02.412,000] <inf> phy_mc_ksz8081: PHY 0 is up
[00:00:02.412,000] <inf> phy_mc_ksz8081: PHY (0) Link speed 100 Mb, full duplex

*** Booting Zephyr OS build v3.7.1 ***
[00:00:02.414,000] <inf> net_dhcpv4_client_sample: Run dhcpv4 client
[00:00:02.414,000] <inf> net_dhcpv4_client_sample: Start on ethernet: index=1
[00:00:06.417,000] <inf> net_dhcpv4_client_sample: DHCP Option 42: 10.3.100.1
[00:00:06.419,000] <inf> net_dhcpv4_client_sample: DHCP Option 42: 10.3.100.1
[00:00:06.419,000] <inf> net_dhcpv4: Received: 192.10.2.219
[00:00:06.419,000] <inf> net_dhcpv4_client_sample:    Address[1]: 192.10.2.219
[00:00:06.419,000] <inf> net_dhcpv4_client_sample:     Subnet[1]: 255.255.252.0
[00:00:06.419,000] <inf> net_dhcpv4_client_sample:     Router[1]: 192.10.1.21
[00:00:06.419,000] <inf> net_dhcpv4_client_sample: Lease time[1]: 86400 seconds

------------------------------------------------------------------------------------------------

# With MCUboot from v3.7.1 and sample from v3.7.1 (not working):

*** Booting MCUboot v2.1.0-71-gea2410697dd0 ***
*** Using Zephyr OS build v3.7.1 ***
I: Starting bootloader
I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Boot source: none
I: Image index: 0, Swap type: none
I: Bootloader chainload address offset: 0x20000
I: Jumping to the first image slot


[00:00:00.021,000] <dbg> phy_mc_ksz8081: phy_mc_ksz8081_autonegotiate: PHY (0) is entering autonegotiation sequence
[00:00:02.345,000] <dbg> phy_mc_ksz8081: phy_mc_ksz8081_autonegotiate: PHY (0) autonegotiation completed
[00:00:02.347,000] <dbg> phy_mc_ksz8081: phy_mc_ksz8081_get_link: PHY 0 is up
[00:00:02.348,000] <dbg> phy_mc_ksz8081: phy_mc_ksz8081_get_link: PHY (0) Link speed 100 Mb, full duplex

[00:00:02.348,000] <inf> phy_mc_ksz8081: PHY 0 is up
[00:00:02.348,000] <inf> phy_mc_ksz8081: PHY (0) Link speed 100 Mb, full duplex

*** Booting Zephyr OS build v3.7.1 ***
[00:00:02.367,000] <inf> net_dhcpv4_client_sample: Run dhcpv4 client
[00:00:02.369,000] <inf> net_dhcpv4_client_sample: Start on ethernet: index=1
[00:00:06.856,000] <dbg> phy_mc_ksz8081: phy_mc_ksz8081_get_link: PHY 0 is down
[00:00:06.857,000] <inf> eth_nxp_enet_mac: Link is down
[00:00:06.858,000] <dbg> phy_mc_ksz8081: phy_mc_ksz8081_autonegotiate: PHY (0) is entering autonegotiation sequence
[00:00:09.264,000] <dbg> phy_mc_ksz8081: phy_mc_ksz8081_autonegotiate: PHY (0) autonegotiation completed
[00:00:09.264,000] <dbg> phy_mc_ksz8081: phy_mc_ksz8081_get_link: PHY 0 is up
[00:00:09.264,000] <dbg> phy_mc_ksz8081: phy_mc_ksz8081_get_link: PHY (0) Link speed 100 Mb, full duplex

[00:00:09.265,000] <inf> eth_nxp_enet_mac: Link is up
[00:00:09.269,000] <inf> phy_mc_ksz8081: PHY 0 is up
[00:00:09.269,000] <inf> phy_mc_ksz8081: PHY (0) Link speed 100 Mb, full duplex

[00:00:12.399,000] <inf> net_dhcpv4_client_sample: DHCP Option 42: 10.3.100.1
[00:00:12.429,000] <inf> net_dhcpv4_client_sample: DHCP Option 42: 10.3.100.1
[00:00:12.430,000] <inf> net_dhcpv4: Received: 192.10.2.234
[00:00:12.433,000] <inf> net_dhcpv4_client_sample:    Address[1]: 192.10.2.234
[00:00:12.434,000] <inf> net_dhcpv4_client_sample:     Subnet[1]: 255.255.252.0
[00:00:12.434,000] <inf> net_dhcpv4_client_sample:     Router[1]: 192.10.1.21
[00:00:12.435,000] <inf> net_dhcpv4_client_sample: Lease time[1]: 86400 seconds
[00:01:11.906,000] <dbg> phy_mc_ksz8081: phy_mc_ksz8081_get_link: PHY 0 is up
[00:01:11.906,000] <dbg> phy_mc_ksz8081: phy_mc_ksz8081_get_link: PHY (0) Link speed 10 Mb, half duplex

[00:04:19.119,000] <dbg> phy_mc_ksz8081: phy_mc_ksz8081_get_link: PHY 0 is up
[00:04:19.119,000] <dbg> phy_mc_ksz8081: phy_mc_ksz8081_get_link: PHY (0) Link speed 10 Mb, half duplex

[00:04:19.622,000] <dbg> phy_mc_ksz8081: phy_mc_ksz8081_get_link: PHY 0 is down
[00:04:19.623,000] <inf> eth_nxp_enet_mac: Link is down
[00:04:19.625,000] <dbg> phy_mc_ksz8081: phy_mc_ksz8081_autonegotiate: PHY (0) is entering autonegotiation sequence
[00:04:22.030,000] <dbg> phy_mc_ksz8081: phy_mc_ksz8081_autonegotiate: PHY (0) autonegotiation completed
[00:04:22.031,000] <dbg> phy_mc_ksz8081: phy_mc_ksz8081_get_link: PHY 0 is up
[00:04:22.031,000] <dbg> phy_mc_ksz8081: phy_mc_ksz8081_get_link: PHY (0) Link speed 100 Mb, full duplex

[00:04:22.032,000] <inf> eth_nxp_enet_mac: Link is up
[00:04:22.032,000] <inf> phy_mc_ksz8081: PHY 0 is up
[00:04:22.032,000] <inf> phy_mc_ksz8081: PHY (0) Link speed 100 Mb, full duplex

------------------------------------------------------------------------------------------------

# With MCUboot from v4.3.0 and sample from v3.7.1 (working):

*** Booting MCUboot v2.2.0-192-g96576b341ee1 ***
*** Using Zephyr OS build v4.3.0 ***
I: Starting bootloader
I: Image index: 0, Swap type: none
I: Image index: 0, Swap type: none
I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Boot source: none
I: Image index: 0, Swap type: none
I: Image index: 0, Swap type: none
I: Image index: 0, Swap type: none
I: Image index: 0, Swap type: none
I: Bootloader chainload address offset: 0x20000
I: Image version: v0.0.0
I: Jumping to the first image slot


[00:00:00.004,000] <dbg> phy_mc_ksz8081: phy_mc_ksz8081_autonegotiate: PHY (0) is entering autonegotiation sequence
[00:00:02.412,000] <dbg> phy_mc_ksz8081: phy_mc_ksz8081_autonegotiate: PHY (0) autonegotiation completed
[00:00:02.413,000] <dbg> phy_mc_ksz8081: phy_mc_ksz8081_get_link: PHY 0 is up
[00:00:02.413,000] <dbg> phy_mc_ksz8081: phy_mc_ksz8081_get_link: PHY (0) Link speed 100 Mb, full duplex

[00:00:02.413,000] <inf> phy_mc_ksz8081: PHY 0 is up
[00:00:02.413,000] <inf> phy_mc_ksz8081: PHY (0) Link speed 100 Mb, full duplex

*** Booting Zephyr OS build v3.7.1 ***
[00:00:02.416,000] <inf> net_dhcpv4_client_sample: Run dhcpv4 client
[00:00:02.416,000] <inf> net_dhcpv4_client_sample: Start on ethernet: index=1
[00:00:09.420,000] <inf> net_dhcpv4_client_sample: DHCP Option 42: 10.3.100.1
[00:00:09.422,000] <inf> net_dhcpv4_client_sample: DHCP Option 42: 10.3.100.1
[00:00:09.422,000] <inf> net_dhcpv4: Received: 192.10.2.232
[00:00:09.423,000] <inf> net_dhcpv4_client_sample:    Address[1]: 192.10.2.232
[00:00:09.423,000] <inf> net_dhcpv4_client_sample:     Subnet[1]: 255.255.252.0
[00:00:09.423,000] <inf> net_dhcpv4_client_sample:     Router[1]: 192.10.1.21
[00:00:09.423,000] <inf> net_dhcpv4_client_sample: Lease time[1]: 86400 seconds

Impact

Functional Limitation – Some features not working as expected, but system usable.

Environment

  • Zephyr v3.7.1 with the following backports:
  • MCUboot v2.1.0-71
  • mimxrt1160_evk/mimxrt1166/cm7 board

Additional Context

Since the issue only occurs with MCUboot from Zephyr v3.7.1 (and not without it), I guess that the problem comes from MCUboot itself and has since been fixed now.

Does anyone know how to fix it?
(Which patches should be backported to v3.7.1?)

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions