xref: /linux/drivers/net/phy/phylib.h (revision c36461825469a9ceee2346a2e89286c522525da7)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * phylib header
4  */
5 
6 #ifndef __PHYLIB_H
7 #define __PHYLIB_H
8 
9 struct device_node;
10 struct phy_device;
11 struct mii_bus;
12 
13 struct device_node *phy_package_get_node(struct phy_device *phydev);
14 void *phy_package_get_priv(struct phy_device *phydev);
15 void phy_package_lock(struct phy_device *phydev);
16 void phy_package_unlock(struct phy_device *phydev);
17 int __phy_package_read(struct phy_device *phydev, unsigned int addr_offset,
18 		       u32 regnum);
19 int __phy_package_write(struct phy_device *phydev, unsigned int addr_offset,
20 			u32 regnum, u16 val);
21 int __phy_package_read_mmd(struct phy_device *phydev,
22 			   unsigned int addr_offset, int devad,
23 			   u32 regnum);
24 int __phy_package_write_mmd(struct phy_device *phydev,
25 			    unsigned int addr_offset, int devad,
26 			    u32 regnum, u16 val);
27 bool phy_package_init_once(struct phy_device *phydev);
28 bool phy_package_probe_once(struct phy_device *phydev);
29 int phy_package_join(struct phy_device *phydev, int base_addr, size_t priv_size);
30 int of_phy_package_join(struct phy_device *phydev, size_t priv_size);
31 void phy_package_leave(struct phy_device *phydev);
32 int devm_phy_package_join(struct device *dev, struct phy_device *phydev,
33 			  int base_addr, size_t priv_size);
34 int devm_of_phy_package_join(struct device *dev, struct phy_device *phydev,
35 			     size_t priv_size);
36 int mmd_phy_read(struct mii_bus *bus, int phy_addr, bool is_c45,
37 		 int devad, u32 regnum);
38 int mmd_phy_write(struct mii_bus *bus, int phy_addr, bool is_c45,
39 		  int devad, u32 regnum, u16 val);
40 
41 #endif /* __PHYLIB_H */
42