xref: /openbmc/u-boot/include/net/mdio.h (revision 3ba98ed8)
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2018 Marvell International Ltd.
4  * Author: Ken Ma<make@marvell.com>
5  */
6 
7 #ifndef _MDIO_H_
8 #define _MDIO_H_
9 
10 #include <dm.h>
11 #include <phy.h>
12 
13 /**
14  * mdio_mii_bus_get() - Get mii bus from mdio udevice
15  *
16  * @mdio_dev:  mdio udevice
17  * @busp:      returns mii bus
18  * @returns 0 on success, error code otherwise.
19  */
20 int mdio_mii_bus_get(struct udevice *mdio_dev, struct mii_dev **busp);
21 
22 /**
23  * mdio_device_get_from_phy() - Get the mdio udevice which the phy belongs to
24  *
25  * @phy_node:  phy node offset
26  * @devp:      returns mdio udevice
27  * @returns 0 on success, error code otherwise.
28  */
29 int mdio_device_get_from_phy(ofnode phy_node, struct udevice **devp);
30 
31 /**
32  * mdio_mii_bus_get_from_phy() - Get the mii bus which the phy belongs to
33  *
34  * @phy_node:  phy node offset
35  * @busp:      returns mii bus
36  * @returns 0 on success, error code otherwise.
37  */
38 int mdio_mii_bus_get_from_phy(ofnode phy_node, struct mii_dev **busp);
39 
40 /**
41  * mdio_device_get_from_eth() - When there is a phy reference of "phy = <&...>"
42  *                      under an ethernet udevice fdt node, this function can
43  *                      get the mdio udevice which the phy belongs to
44  *
45  * @dev:       the ethernet udevice which contains the phy reference
46  * @devp:      returns mdio udevice
47  * @returns 0 on success, error code otherwise.
48  */
49 int mdio_device_get_from_eth(struct udevice *eth, struct udevice **devp);
50 
51 /**
52  * mdio_mii_bus_get_from_eth() - When there is a phy reference of
53  *                      "phy = <&...>" under an ethernet udevice fdt node, this
54  *                      function can get the mii bus which the phy belongs to
55  *
56  * @eth:       the ethernet udevice which contains the phy reference
57  * @busp:      returns mii bus
58  * @returns 0 on success, error code otherwise.
59  */
60 int mdio_mii_bus_get_from_eth(struct udevice *eth, struct mii_dev **busp);
61 
62 #endif /* _MDIO_H_ */
63 
64 
65