1 /*
2  * Copyright (c) 2019 Interay Solutions B.V.
3  * Copyright (c) 2019 Oane Kingma
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 
8 #ifndef ZEPHYR_DRIVERS_ETHERNET_PHY_GECKO_H_
9 #define ZEPHYR_DRIVERS_ETHERNET_PHY_GECKO_H_
10 
11 #include <zephyr/types.h>
12 #include <soc.h>
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 struct phy_gecko_dev {
19 	ETH_TypeDef *regs;
20 	uint8_t address;
21 };
22 
23 /**
24  * @brief Initialize Ethernet PHY device.
25  *
26  * @param phy PHY instance
27  * @return 0 on success or a negative error value on failure
28  */
29 int phy_gecko_init(const struct phy_gecko_dev *phy);
30 
31 /**
32  * @brief Auto-negotiate and configure link parameters.
33  *
34  * @param phy PHY instance
35  * @param status link parameters common to remote and local PHY
36  * @return 0 on success or a negative error value on failure
37  */
38 int phy_gecko_auto_negotiate(const struct phy_gecko_dev *phy,
39 				uint32_t *status);
40 /**
41  * @brief Get PHY ID value.
42  *
43  * @param phy PHY instance
44  * @return PHY ID value or 0xFFFFFFFF on failure
45  */
46 uint32_t phy_gecko_id_get(const struct phy_gecko_dev *phy);
47 
48 /**
49  * @brief Get PHY linked status.
50  *
51  * @param phy PHY instance
52  * @return PHY linked status
53  */
54 bool phy_gecko_is_linked(const struct phy_gecko_dev *phy);
55 
56 #ifdef __cplusplus
57 }
58 #endif
59 
60 #endif /* ZEPHYR_DRIVERS_ETHERNET_PHY_GECKO_H_ */
61