xref: /linux/drivers/net/phy/bcm-phy-lib.h (revision 79fb218d97980d4fee9a64f4c8ff05289364ba25)
1a1cba561SArun Parameswaran /*
2a1cba561SArun Parameswaran  * Copyright (C) 2015 Broadcom Corporation
3a1cba561SArun Parameswaran  *
4a1cba561SArun Parameswaran  * This program is free software; you can redistribute it and/or
5a1cba561SArun Parameswaran  * modify it under the terms of the GNU General Public License as
6a1cba561SArun Parameswaran  * published by the Free Software Foundation version 2.
7a1cba561SArun Parameswaran  *
8a1cba561SArun Parameswaran  * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9a1cba561SArun Parameswaran  * kind, whether express or implied; without even the implied warranty
10a1cba561SArun Parameswaran  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11a1cba561SArun Parameswaran  * GNU General Public License for more details.
12a1cba561SArun Parameswaran  */
13a1cba561SArun Parameswaran 
14a1cba561SArun Parameswaran #ifndef _LINUX_BCM_PHY_LIB_H
15a1cba561SArun Parameswaran #define _LINUX_BCM_PHY_LIB_H
16a1cba561SArun Parameswaran 
17*79fb218dSFlorian Fainelli #include <linux/brcmphy.h>
18a1cba561SArun Parameswaran #include <linux/phy.h>
19a1cba561SArun Parameswaran 
20a1cba561SArun Parameswaran int bcm_phy_write_exp(struct phy_device *phydev, u16 reg, u16 val);
21a1cba561SArun Parameswaran int bcm_phy_read_exp(struct phy_device *phydev, u16 reg);
22a1cba561SArun Parameswaran 
23*79fb218dSFlorian Fainelli static inline int bcm_phy_write_exp_sel(struct phy_device *phydev,
24*79fb218dSFlorian Fainelli 					u16 reg, u16 val)
25*79fb218dSFlorian Fainelli {
26*79fb218dSFlorian Fainelli 	return bcm_phy_write_exp(phydev, reg | MII_BCM54XX_EXP_SEL_ER, val);
27*79fb218dSFlorian Fainelli }
28*79fb218dSFlorian Fainelli 
295519da87SFlorian Fainelli int bcm54xx_auxctl_write(struct phy_device *phydev, u16 regnum, u16 val);
305519da87SFlorian Fainelli int bcm54xx_auxctl_read(struct phy_device *phydev, u16 regnum);
315519da87SFlorian Fainelli 
32a1cba561SArun Parameswaran int bcm_phy_write_misc(struct phy_device *phydev,
33a1cba561SArun Parameswaran 		       u16 reg, u16 chl, u16 value);
34a1cba561SArun Parameswaran int bcm_phy_read_misc(struct phy_device *phydev,
35a1cba561SArun Parameswaran 		      u16 reg, u16 chl);
36a1cba561SArun Parameswaran 
37a1cba561SArun Parameswaran int bcm_phy_write_shadow(struct phy_device *phydev, u16 shadow,
38a1cba561SArun Parameswaran 			 u16 val);
39a1cba561SArun Parameswaran int bcm_phy_read_shadow(struct phy_device *phydev, u16 shadow);
40a1cba561SArun Parameswaran 
41a1cba561SArun Parameswaran int bcm_phy_ack_intr(struct phy_device *phydev);
42a1cba561SArun Parameswaran int bcm_phy_config_intr(struct phy_device *phydev);
43a1cba561SArun Parameswaran 
44a1cba561SArun Parameswaran int bcm_phy_enable_apd(struct phy_device *phydev, bool dll_pwr_down);
45a1cba561SArun Parameswaran 
4699cec8a4SFlorian Fainelli int bcm_phy_set_eee(struct phy_device *phydev, bool enable);
47d06f78c4SFlorian Fainelli 
48d06f78c4SFlorian Fainelli int bcm_phy_downshift_get(struct phy_device *phydev, u8 *count);
49d06f78c4SFlorian Fainelli 
50d06f78c4SFlorian Fainelli int bcm_phy_downshift_set(struct phy_device *phydev, u8 count);
51d06f78c4SFlorian Fainelli 
52820ee17bSFlorian Fainelli int bcm_phy_get_sset_count(struct phy_device *phydev);
53820ee17bSFlorian Fainelli void bcm_phy_get_strings(struct phy_device *phydev, u8 *data);
54820ee17bSFlorian Fainelli void bcm_phy_get_stats(struct phy_device *phydev, u64 *shadow,
55820ee17bSFlorian Fainelli 		       struct ethtool_stats *stats, u64 *data);
56820ee17bSFlorian Fainelli 
57a1cba561SArun Parameswaran #endif /* _LINUX_BCM_PHY_LIB_H */
58