Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@andrewleech
Copy link
Contributor

This PR adds support for the Texas Instruments DP83867 Gigabit Ethernet PHY to the mimxrt port.

Changes

New driver implementation:

  • Add fsl_phydp83867.c and fsl_phydp83867.h implementing the DP83867 PHY driver
  • Supports 10/100/1000 Mbps Ethernet with auto-negotiation
  • Implements standard PHY operations interface (init, read/write, link status detection, speed/duplex configuration, loopback mode)
  • Uses DP83867-specific PHYSTS register (0x11) for link status monitoring
  • PHY ID verification: 0x2000A231

Integration:

  • Add driver to mimxrt Makefile build system
  • Include DP83867 header in eth.c and network_lan.c

Bug fix:

  • Fix incorrect conditional check in eth.c:426 - changed from pin_ENET_1_INT to pin_ENET_1_RESET to properly initialize reset pin
  • Update network_lan.c conditional compilation to check ENET_PHY_ADDRESS || ENET_DUAL_PORT instead of IOMUX_TABLE_ENET

This driver enables Gigabit Ethernet support on boards using the DP83867 PHY, such as the phyCORE-i.MX RT1170's secondary Ethernet port (1G RGMII interface).

@github-actions
Copy link

github-actions bot commented Nov 10, 2025

Code size report:

Reference:  tests/serial_test.py: Allow up to 2 seconds between bytes. [2762fe6]
Comparison: mimxrt/eth: Improve Dual Ethernet configuration. [merge of b1c4c7c]
  mpy-cross:    +0 +0.000% 
   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
     mimxrt:    +0 +0.000% TEENSY40
        rp2:    +0 +0.000% RPI_PICO_W
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:    +0 +0.000% VIRT_RV32


const machine_pin_obj_t *reset_pin = NULL;
#if defined(pin_ENET_1_INT)
#if defined(pin_ENET_1_RESET)
Copy link
Contributor

Choose a reason for hiding this comment

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

OK. It seems to above worked by chance. Looking though the code is seems that there are two obsolete definitions in boards/MIMXRT1170_EVK/mpconfigboard.h. They are not referenced anywhere in the code.

// No INT pin for ENET_1G
#define ENET_1_RESET_PIN       &pin_GPIO_DISP_B2_13
#define ENET_1_INT_PIN         NULL

While you're at it, you could remove them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

#include "extmod/modnetwork.h"

#if defined(IOMUX_TABLE_ENET)
#if defined(ENET_PHY_ADDRESS) || (ENET_DUAL_PORT)
Copy link
Contributor

Choose a reason for hiding this comment

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

Using only ENET_PHY_ADDRESS seems to be sufficient. Only the MIMXRT1170_EVK defines ENET_DUAL_PORT, but it also mandatory defines ENET_PHY_ADDRESS.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made this particular change to support a custom board based on this SOM https://www.phytec.com/product/phycore-rt1170/ that only includes the 1G phy (on som) which results currently in the network init failing because it's only defining Lan(1) but not Lan(0).

I considered a larger refactor that would more cleanly handle either / both Lan ports cleanly but thought it better to start with a simple change like this

Copy link
Contributor

Choose a reason for hiding this comment

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

The same #if defined(IOMUX_TABLE_ENET) is in eth.c, line 34, and can be replaced as well accordingly with
#if defined(ENET_PHY_ADDRESS).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually looking at it again this change really isn't needed (for me or for this PR) - currently IOMUX_TABLE_ENET needs to be defined anyway to satisfy other compilation needs.

I think there's room to do a broader cleanup in the eth driver in a future PR, I've been doing something similar to stm lately, once that's finalised I'd like to roll some of those learnings over here too. Most of them are to do with cleaning up the phy / nic init sequence, default states, dhcp vs static, etc.

If / when I get to this I would probably aim to improve the either / both network configuration to allow either single port or both ports on chips that support them, but again that should be a separate commit / PR as it affects more than just this phy.

@andrewleech
Copy link
Contributor Author

Thanks @robert-hh I raised the PR for this a little early; it's intended to compliment a board profile for https://www.phytec.com/product/phyboard-rt1170-development-kit/ which I just need to do some final testing before pushing up.

@robert-hh
Copy link
Contributor

Tested with a MIMXER_1020_EVK and MIMXRT1170_EVK board and it works. The test included the changes in my comments

@robert-hh
Copy link
Contributor

I considered a larger refactor that would more cleanly handle either / both Lan ports cleanly but thought it better to start with a simple change like this

This part is more grown wild than developed. Refactor was always an option, but it works and so it's not urgent.

Adds new PHY driver for TI DP83867 Gigabit Ethernet PHY.

Signed-off-by: Andrew Leech <[email protected]>
The definitions from pins.csv are used directly in mimxrt/eth.c

Signed-off-by: Andrew Leech <[email protected]>
@robert-hh
Copy link
Contributor

The code seems incomplete. It does not define a constant for PHY_DP83867 and it does not select the driver in network_lan.c, e.g. at around lines 111.

@robert-hh
Copy link
Contributor

The changed logic for using ENET_PHY_ADDRESS and ENET_PHY_1_ADDRESS seems good. I still miss the option allowing phy=PHY_DP83867 at the LAN interface constructor call like it is possible for the other supported PHY devices. ATM, the only way to use a DP83867 is setting it in mpconfigboard.h.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants