-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
New NXP ENET driver #62833
New NXP ENET driver #62833
Conversation
The following west manifest projects have been modified in this Pull Request:
Note: This message is automatically posted and updated by the Manifest GitHub Action. |
937574b
to
c46caf6
Compare
6b89377
to
24bca16
Compare
@manuargue can you check if your block is addressed |
Add ENET clock value to the CCM clock decoder for both RT10XX and RT11XX CCM versions. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Add a property to the ethernet controller binding indicating what type of connection the MAC has with the PHY device. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Add DT Binding for Microchip KSZ8081 PHY Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Add Driver for KSZ8081 Ethernet PHY. The Generic MII Driver is not sufficient to use for this PHY chip which has special vendor implemented behaviors. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Add bindings for compatibles related to NXP ENET IP. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Create an include header to be used by NXP ENET drivers. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Add driver for NXP ENET MDIO functionalities Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Add driver for NXP ENET which is a rework of the old eth_mcux.c driver which had become unmaintainable due to fundamental problems with the lack of PHY abstraction. eth_mcux.c and the corresponding compatible nxp,kinetis-ethernet will be deprecated and this new driver will be supported instead. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
when using either old or new driver for nxp enet, enable the phy clock Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Increase the size of the system workqueue stack if using nxp ethernet driver Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Add subsys value for ENET PLL / ENET Ref clk to CCM Driver Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Add binding for NXP ENET PTP Clock device Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Add ptp clock driver init priority kconfig Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Add Driver for NXP ENET PTP Clock device Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Support PTP functionality in NXP ENET MAC driver Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Add overlay to show how to use new experimental nxp enet driver Also make any eth_mcux related kconfigs dependent on eth_mcux in the boards' defconfigs. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
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.
My comments addressed. Nice job!
24bca16
to
a7a1510
Compare
|
||
|
||
|
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.
Nit: multiple newlines
include: ethernet-phy.yaml | ||
|
||
properties: | ||
mc,reset-gpio: |
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.
No, I mean that other drivers that use reset-gpios
handles, simply name them as such. Without the mc,
prefix.
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.
Couple of nits, but driver looks good to me. Verified it is working on an RT1060 EVK.
* Interrupt enable: The driver's relevant interrupt was enabled in NVIC | ||
*/ | ||
enum nxp_enet_callback_reason { | ||
nxp_enet_module_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.
Nit- the convention is typically to use CAPS for a enum constant in Zephyr, right?
* ethernet driver has not initiaized, just do a busy wait | ||
*/ | ||
k_busy_wait(USEC_PER_MSEC * config->timeout); | ||
if (base->EIR && ENET_EIR_MII_MASK == ENET_EIR_MII_MASK) { |
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.
This and the same below do not seem correct. You probably meant:
(base->EIR & ENET_EIR_MII_MASK) == ENET_EIR_MII_MASK
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.
this was fixed in #65999
|
||
extern void nxp_enet_mdio_callback(const struct device *mdio_dev, | ||
enum nxp_enet_callback_reason event); | ||
|
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 think this is already included in one of header you created.
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 think this was fixed in #65998
k_mutex_lock(&data->tx_frame_buf_mutex, K_FOREVER); | ||
|
||
/* Read network packet from upper layer into frame buffer */ | ||
if (net_pkt_read(pkt, data->tx_frame_buf, total_len)) { |
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.
Btw, eth_sam_gmac.c does this with zero-copy (and for receive too), perhaps the same can be done with this driver in the future.
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.
it would be desirable, this driver is still experimental because I am planning that it will get a lot of changes such as potentially this, and I don't want it to be considered stable yet so that we can make these changes more quickly
return ret; | ||
} | ||
|
||
return ret; |
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.
nit: the if (ret) .. is unnecessary above.
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.
my opinion on this is that it is easy to forget to add if another call is in the future added later in the code that affects ret, which can cause a bug that might not immediately appear, and the compiler will optimize this anyways, so I prefer this. I get this nit a lot
struct net_pkt *pkt; | ||
|
||
pkt = frameinfo->context; | ||
if (pkt && atomic_get(&pkt->atomic_ref) > 0) { |
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.
Should the minimum ref count be actually 2?
If the reference count == 1, then the packet will be freed by net_pkt_unref() on line 235. That means whatever we push into the queue by net_if_add_tx_timestamp() is no longer valid.
ETH MCUX driver is unmaintainable and cannot support a PHY other than the one on some of the NXP EVKs. Redo, planning to deprecate old driver but keep for a release or two.
New driver selects
EXPERIMENTAL
until the community has had a chance to try this new driver.This PR also makes the phy-connection-type property generic to all ethernet controllers