Skip to content

Conversation

@MaureenHelm
Copy link
Member

Moves the Ethernet PHY reset routine on mimxrt1xxx_evk boards to execute
in the POST_KERNEL initialization level rather than the PRE_KERNEL_2
level because it relies on a kernel service, k_busy_wait(). Leverages
the existing CONFIG_PHY_INIT_PRIORITY to allow users to configure when
within the POST_KERNEL level this routine occurs, which by default is
set correctly to the following order:

Init Function			Init Level	Priority
--------------------------------------------------------------------------------------
sys_clock_driver_init		PRE_KERNEL_2	CONFIG_SYSTEM_CLOCK_INIT_PRIORITY=0
mcux_igpio_##n##_init		POST_KERNEL	CONFIG_KERNEL_INIT_PRIORITY_DEFAULT=40
mimxrt1064_evk_phy_reset	POST_KERNEL	CONFIG_PHY_INIT_PRIORITY=70
eth_init			POST_KERNEL	CONFIG_ETH_INIT_PRIORITY=80
net_init			POST_KERNEL	CONFIG_NET_INIT_PRIO=90

This fixes an issue that was introduced in commit
f0b3146, which caused the system timer
to be initialized after the Ethernet PHY reset. As a result, the
k_busy_wait() never returned and the kernel never finished booting. The
serial driver never initialized and there was no output on the console,
not even a boot banner.

Tested on the mimxrt1064_evk board with samples/net/dhcpv4_client.

Signed-off-by: Maureen Helm maureen.helm@nxp.com

Fixes #38186

cc: @ainguraXmarquiegui

Moves the Ethernet PHY reset routine on mimxrt1xxx_evk boards to execute
in the POST_KERNEL initialization level rather than the PRE_KERNEL_2
level because it relies on a kernel service, k_busy_wait(). Leverages
the existing CONFIG_PHY_INIT_PRIORITY to allow users to configure when
within the POST_KERNEL level this routine occurs, which by default is
set correctly to the following order:

Init Function			Init Level	Priority
--------------------------------------------------------------------------------------
sys_clock_driver_init		PRE_KERNEL_2	CONFIG_SYSTEM_CLOCK_INIT_PRIORITY=0
mcux_igpio_##n##_init		POST_KERNEL	CONFIG_KERNEL_INIT_PRIORITY_DEFAULT=40
mimxrt1064_evk_phy_reset	POST_KERNEL	CONFIG_PHY_INIT_PRIORITY=70
eth_init			POST_KERNEL	CONFIG_ETH_INIT_PRIORITY=80
net_init			POST_KERNEL	CONFIG_NET_INIT_PRIO=90

This fixes an issue that was introduced in commit
f0b3146, which caused the system timer
to be initialized after the Ethernet PHY reset. As a result, the
k_busy_wait() never returned and the kernel never finished booting. The
serial driver never initialized and there was no output on the console,
not even a boot banner.

Tested on the mimxrt1064_evk board with samples/net/dhcpv4_client.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
@MaureenHelm
Copy link
Member Author

Compliance failure is due to the table in the commit message

Copy link
Member

@cfriedt cfriedt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cfriedt
Copy link
Member

cfriedt commented Sep 11, 2021

@dleach02, @hakehuang - are you able to ack?

@stephanosio stephanosio added the bug The issue is a bug, or the PR is fixing a bug label Sep 11, 2021
@stephanosio stephanosio added this to the v2.7.0 milestone Sep 11, 2021
Copy link
Contributor

@hakehuang hakehuang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@aunsbjerg aunsbjerg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works on mimxrt1024-evk with samples/net/zperf

@ainguraXmarquiegui
Copy link
Contributor

Tested mimxrt1050_evk and mimxrt1020_evk.

I used c8c3d32 from main and cherry-picked bea067f .

Using test samples/net/zperf both boards boot and can be ping-ed.

@galak galak merged commit 4fc08a7 into zephyrproject-rtos:main Sep 13, 2021
@MaureenHelm MaureenHelm deleted the mimxrt-phy-reset branch September 13, 2021 14:38
bdkrae pushed a commit to bdkrae/zephyr that referenced this pull request Oct 8, 2021
- Update to dts file to use the generic MII PHY driver
- Fix pinmux file according PR zephyrproject-rtos#38473
- Update Kconfig file for networking

Signed-off-by: Bernhard Krämer <bdkrae@gmail.com>
elcritch pushed a commit to elcritch/zephyr that referenced this pull request Dec 8, 2021
- Update to dts file to use the generic MII PHY driver
- Fix pinmux file according PR zephyrproject-rtos#38473
- Update Kconfig file for networking

Signed-off-by: Bernhard Krämer <bdkrae@gmail.com>

soc: arm: nxp_rt: add support for MDIO driver

Update to dts file to add MDIO driver.

Signed-off-by: Bernhard Krämer <bdkrae@gmail.com>

drivers: mdio: add NXP MCUX MDIO driver

MDIO driver for MCUX platform with Ethernet.

Signed-off-by: Bernhard Krämer <bdkrae@gmail.com>

drivers: Extend generic ethernet phy

NXP imx soc´s have the mdio bus integrated within the
ethernet peripheral. Especially a flag within ethernet interrupt is
used to signal successfull mii data transfer. Therefore
the mii communication to phy must not start before
ethernet module is initialized.

To achieve this, 'late_mii_start' property is introduced to
generic ethernet-phy. If set, the startup of phy communication
is postponed until a callback is registered by eth driver.

Also fix missing line (421) to parse 'no-reset' property in
phy_mii.c

Signed-off-by: Bernhard Krämer <bdkrae@gmail.com>

drivers: add option for separate mdio+phy driver

Update driver

Signed-off-by: Bernhard Krämer <bdkrae@gmail.com>
elcritch pushed a commit to EmbeddedNim/zephyr that referenced this pull request Jan 28, 2022
- Update to dts file to use the generic MII PHY driver
- Fix pinmux file according PR zephyrproject-rtos#38473
- Update Kconfig file for networking

Signed-off-by: Bernhard Krämer <bdkrae@gmail.com>

soc: arm: nxp_rt: add support for MDIO driver

Update to dts file to add MDIO driver.

Signed-off-by: Bernhard Krämer <bdkrae@gmail.com>

drivers: mdio: add NXP MCUX MDIO driver

MDIO driver for MCUX platform with Ethernet.

Signed-off-by: Bernhard Krämer <bdkrae@gmail.com>

drivers: Extend generic ethernet phy

NXP imx soc´s have the mdio bus integrated within the
ethernet peripheral. Especially a flag within ethernet interrupt is
used to signal successfull mii data transfer. Therefore
the mii communication to phy must not start before
ethernet module is initialized.

To achieve this, 'late_mii_start' property is introduced to
generic ethernet-phy. If set, the startup of phy communication
is postponed until a callback is registered by eth driver.

Also fix missing line (421) to parse 'no-reset' property in
phy_mii.c

Signed-off-by: Bernhard Krämer <bdkrae@gmail.com>

drivers: add option for separate mdio+phy driver

Update driver

Signed-off-by: Bernhard Krämer <bdkrae@gmail.com>
sdamico pushed a commit to impulse-internal/zephyr that referenced this pull request Mar 2, 2022
- Update to dts file to use the generic MII PHY driver
- Fix pinmux file according PR zephyrproject-rtos#38473
- Update Kconfig file for networking

Signed-off-by: Bernhard Krämer <bdkrae@gmail.com>

soc: arm: nxp_rt: add support for MDIO driver

Update to dts file to add MDIO driver.

Signed-off-by: Bernhard Krämer <bdkrae@gmail.com>

drivers: mdio: add NXP MCUX MDIO driver

MDIO driver for MCUX platform with Ethernet.

Signed-off-by: Bernhard Krämer <bdkrae@gmail.com>

drivers: Extend generic ethernet phy

NXP imx soc´s have the mdio bus integrated within the
ethernet peripheral. Especially a flag within ethernet interrupt is
used to signal successfull mii data transfer. Therefore
the mii communication to phy must not start before
ethernet module is initialized.

To achieve this, 'late_mii_start' property is introduced to
generic ethernet-phy. If set, the startup of phy communication
is postponed until a callback is registered by eth driver.

Also fix missing line (421) to parse 'no-reset' property in
phy_mii.c

Signed-off-by: Bernhard Krämer <bdkrae@gmail.com>

drivers: add option for separate mdio+phy driver

Update driver

Signed-off-by: Bernhard Krämer <bdkrae@gmail.com>
shlomozippel pushed a commit to shlomozippel/zephyr that referenced this pull request Dec 22, 2022
- Update to dts file to use the generic MII PHY driver
- Fix pinmux file according PR zephyrproject-rtos#38473
- Update Kconfig file for networking

Signed-off-by: Bernhard Krämer <bdkrae@gmail.com>

soc: arm: nxp_rt: add support for MDIO driver

Update to dts file to add MDIO driver.

Signed-off-by: Bernhard Krämer <bdkrae@gmail.com>

drivers: mdio: add NXP MCUX MDIO driver

MDIO driver for MCUX platform with Ethernet.

Signed-off-by: Bernhard Krämer <bdkrae@gmail.com>

drivers: Extend generic ethernet phy

NXP imx soc´s have the mdio bus integrated within the
ethernet peripheral. Especially a flag within ethernet interrupt is
used to signal successfull mii data transfer. Therefore
the mii communication to phy must not start before
ethernet module is initialized.

To achieve this, 'late_mii_start' property is introduced to
generic ethernet-phy. If set, the startup of phy communication
is postponed until a callback is registered by eth driver.

Also fix missing line (421) to parse 'no-reset' property in
phy_mii.c

Signed-off-by: Bernhard Krämer <bdkrae@gmail.com>

drivers: add option for separate mdio+phy driver

Update driver

Signed-off-by: Bernhard Krämer <bdkrae@gmail.com>
shlomozippel pushed a commit to impulse-internal/zephyr that referenced this pull request May 10, 2023
- Update to dts file to use the generic MII PHY driver
- Fix pinmux file according PR zephyrproject-rtos#38473
- Update Kconfig file for networking

Signed-off-by: Bernhard Krämer <bdkrae@gmail.com>

soc: arm: nxp_rt: add support for MDIO driver

Update to dts file to add MDIO driver.

Signed-off-by: Bernhard Krämer <bdkrae@gmail.com>

drivers: mdio: add NXP MCUX MDIO driver

MDIO driver for MCUX platform with Ethernet.

Signed-off-by: Bernhard Krämer <bdkrae@gmail.com>

drivers: Extend generic ethernet phy

NXP imx soc´s have the mdio bus integrated within the
ethernet peripheral. Especially a flag within ethernet interrupt is
used to signal successfull mii data transfer. Therefore
the mii communication to phy must not start before
ethernet module is initialized.

To achieve this, 'late_mii_start' property is introduced to
generic ethernet-phy. If set, the startup of phy communication
is postponed until a callback is registered by eth driver.

Also fix missing line (421) to parse 'no-reset' property in
phy_mii.c

Signed-off-by: Bernhard Krämer <bdkrae@gmail.com>

drivers: add option for separate mdio+phy driver

Update driver

Signed-off-by: Bernhard Krämer <bdkrae@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Boards bug The issue is a bug, or the PR is fixing a bug platform: NXP NXP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

i.MX RT10xx boards fail to initialize when Ethernet is enabled

7 participants