Line data Source code
1 0 : /*
2 : * Copyright 2023 NXP
3 : *
4 : * SPDX-License-Identifier: Apache-2.0
5 : */
6 :
7 : #ifndef ZEPHYR_INCLUDE_DRIVERS_ETH_NXP_ENET_H__
8 : #define ZEPHYR_INCLUDE_DRIVERS_ETH_NXP_ENET_H__
9 :
10 : /*
11 : * This header is for NXP ENET driver development
12 : * and has definitions for internal implementations
13 : * not to be used by application
14 : */
15 :
16 : #include <zephyr/device.h>
17 : #include <zephyr/kernel.h>
18 :
19 : #ifdef __cplusplus
20 : extern "C" {
21 : #endif
22 :
23 : /*
24 : * Reasons for callback to a driver:
25 : *
26 : * Module reset: The ENET module was reset, perhaps because of power management
27 : * actions, and subdriver should reinitialize part of the module.
28 : * Interrupt: An interrupt of a type relevant to the subdriver occurred.
29 : * Interrupt enable: The driver's relevant interrupt was enabled in NVIC
30 : */
31 0 : enum nxp_enet_callback_reason {
32 : NXP_ENET_MODULE_RESET,
33 : NXP_ENET_INTERRUPT,
34 : NXP_ENET_INTERRUPT_ENABLED,
35 : };
36 :
37 0 : enum nxp_enet_driver {
38 : NXP_ENET_MAC,
39 : NXP_ENET_MDIO,
40 : NXP_ENET_PTP_CLOCK,
41 : };
42 :
43 0 : struct nxp_enet_ptp_data {
44 0 : struct k_sem ptp_ts_sem;
45 0 : struct k_mutex *ptp_mutex; /* created in PTP driver */
46 0 : void *enet; /* enet_handle poiniter used by PTP driver */
47 : };
48 :
49 0 : extern void nxp_enet_mdio_callback(const struct device *mdio_dev,
50 : enum nxp_enet_callback_reason event,
51 : void *data);
52 :
53 : #ifdef CONFIG_PTP_CLOCK_NXP_ENET
54 : extern void nxp_enet_ptp_clock_callback(const struct device *dev,
55 : enum nxp_enet_callback_reason event,
56 : void *data);
57 : #else
58 0 : #define nxp_enet_ptp_clock_callback(...)
59 : #endif
60 :
61 : /*
62 : * Internal implementation, inter-driver communication function
63 : *
64 : * dev: target device to call back
65 : * dev_type: which driver to call back
66 : * event: reason/cause of callback
67 : * data: opaque data, will be interpreted based on reason and target driver
68 : */
69 0 : extern void nxp_enet_driver_cb(const struct device *dev,
70 : enum nxp_enet_driver dev_type,
71 : enum nxp_enet_callback_reason event,
72 : void *data);
73 :
74 : #ifdef __cplusplus
75 : }
76 : #endif
77 :
78 :
79 : #endif /* ZEPHYR_INCLUDE_DRIVERS_ETH_NXP_ENET_H__ */
|