-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
mimxrt/eth: Add DP83867 PHY driver support. #18392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Code size report: |
|
|
||
| const machine_pin_obj_t *reset_pin = NULL; | ||
| #if defined(pin_ENET_1_INT) | ||
| #if defined(pin_ENET_1_RESET) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
ports/mimxrt/network_lan.c
Outdated
| #include "extmod/modnetwork.h" | ||
|
|
||
| #if defined(IOMUX_TABLE_ENET) | ||
| #if defined(ENET_PHY_ADDRESS) || (ENET_DUAL_PORT) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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.
|
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. |
|
Tested with a MIMXER_1020_EVK and MIMXRT1170_EVK board and it works. The test included the changes in my comments |
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]>
4992574 to
d1e47a5
Compare
|
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. |
Signed-off-by: Andrew Leech <[email protected]>
|
The changed logic for using ENET_PHY_ADDRESS and ENET_PHY_1_ADDRESS seems good. I still miss the option allowing |
This PR adds support for the Texas Instruments DP83867 Gigabit Ethernet PHY to the mimxrt port.
Changes
New driver implementation:
fsl_phydp83867.candfsl_phydp83867.himplementing the DP83867 PHY driverIntegration:
eth.candnetwork_lan.cBug fix:
eth.c:426- changed frompin_ENET_1_INTtopin_ENET_1_RESETto properly initialize reset pinnetwork_lan.cconditional compilation to checkENET_PHY_ADDRESS || ENET_DUAL_PORTinstead ofIOMUX_TABLE_ENETThis 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).