drivers: nxp_enet: Fix build error with PTP on
Fix build errors in nxp enet driver during case where PTP on, and add coverage to CI. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
This commit is contained in:
parent
3ff78288a6
commit
dcedb649ca
|
@ -39,6 +39,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
|
|||
#include <zephyr/dt-bindings/ethernet/nxp_enet.h>
|
||||
#include <zephyr/net/phy.h>
|
||||
#include <zephyr/net/mii.h>
|
||||
#include <zephyr/drivers/ptp_clock.h>
|
||||
#if defined(CONFIG_NET_DSA)
|
||||
#include <zephyr/net/dsa.h>
|
||||
#endif
|
||||
|
@ -351,7 +352,7 @@ static int eth_nxp_enet_rx(const struct device *dev)
|
|||
uint16_t vlan_tag = NET_VLAN_TAG_UNSPEC;
|
||||
uint32_t frame_length = 0U;
|
||||
struct net_if *iface;
|
||||
struct net_pkt *pkt;
|
||||
struct net_pkt *pkt = NULL;
|
||||
status_t status;
|
||||
uint32_t ts;
|
||||
|
||||
|
@ -420,7 +421,7 @@ static int eth_nxp_enet_rx(const struct device *dev)
|
|||
if (eth_get_ptp_data(get_iface(data, vlan_tag), pkt)) {
|
||||
struct net_ptp_time ptp_time;
|
||||
|
||||
ptp_clock_nxp_enet_get(config->ptp_clock, &ptp_time);
|
||||
ptp_clock_get(config->ptp_clock, &ptp_time);
|
||||
|
||||
/* If latest timestamp reloads after getting from Rx BD,
|
||||
* then second - 1 to make sure the actual Rx timestamp is accurate
|
||||
|
@ -453,7 +454,9 @@ flush:
|
|||
0, RING_ID, NULL);
|
||||
__ASSERT_NO_MSG(status == kStatus_Success);
|
||||
error:
|
||||
net_pkt_unref(pkt);
|
||||
if (pkt) {
|
||||
net_pkt_unref(pkt);
|
||||
}
|
||||
eth_stats_update_errors_rx(get_iface(data, vlan_tag));
|
||||
return -EIO;
|
||||
}
|
||||
|
|
|
@ -153,7 +153,7 @@ static int ptp_clock_nxp_enet_rate_adjust(const struct device *dev,
|
|||
|
||||
void nxp_enet_ptp_clock_callback(const struct device *dev,
|
||||
enum nxp_enet_callback_reason event,
|
||||
void *data)
|
||||
void *cb_data)
|
||||
{
|
||||
const struct ptp_clock_nxp_enet_config *config = dev->config;
|
||||
struct ptp_clock_nxp_enet_data *data = dev->data;
|
||||
|
@ -181,9 +181,9 @@ void nxp_enet_ptp_clock_callback(const struct device *dev,
|
|||
&ptp_config);
|
||||
}
|
||||
|
||||
if (data != NULL) {
|
||||
if (cb_data != NULL) {
|
||||
/* Share the mutex with mac driver */
|
||||
*(struct k_mutex *)data = &data->ptp_mutex;
|
||||
*(uintptr_t *)cb_data = (uintptr_t)&data->ptp_mutex;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,3 +21,10 @@ tests:
|
|||
depends_on: netif
|
||||
integration_platforms:
|
||||
- frdm_k64f
|
||||
sample.net.gpt.nxp_enet_experimental:
|
||||
extra_args: EXTRA_DTC_OVERLAY_FILE="nxp,enet-experimental.overlay"
|
||||
platform_allow:
|
||||
- mimxrt1050_evk
|
||||
- mimxrt1060_evk
|
||||
- mimxrt1064_evk
|
||||
- mimxrt1024_evk
|
||||
|
|
Loading…
Reference in a new issue