File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change 8
8
#include <linux/mii.h>
9
9
#include <linux/phy.h>
10
10
11
+ /**
12
+ * genphy_c45_pma_can_sleep - checks if the PMA have sleep support
13
+ * @phydev: target phy_device struct
14
+ */
15
+ static bool genphy_c45_pma_can_sleep (struct phy_device * phydev )
16
+ {
17
+ int stat1 ;
18
+
19
+ stat1 = phy_read_mmd (phydev , MDIO_MMD_PMAPMD , MDIO_STAT1 );
20
+ if (stat1 < 0 )
21
+ return false;
22
+
23
+ return !!(stat1 & MDIO_STAT1_LPOWERABLE );
24
+ }
25
+
26
+ /**
27
+ * genphy_c45_pma_resume - wakes up the PMA module
28
+ * @phydev: target phy_device struct
29
+ */
30
+ int genphy_c45_pma_resume (struct phy_device * phydev )
31
+ {
32
+ if (!genphy_c45_pma_can_sleep (phydev ))
33
+ return - EOPNOTSUPP ;
34
+
35
+ return phy_clear_bits_mmd (phydev , MDIO_MMD_PMAPMD , MDIO_CTRL1 ,
36
+ MDIO_CTRL1_LPOWER );
37
+ }
38
+ EXPORT_SYMBOL_GPL (genphy_c45_pma_resume );
39
+
40
+ /**
41
+ * genphy_c45_pma_suspend - suspends the PMA module
42
+ * @phydev: target phy_device struct
43
+ */
44
+ int genphy_c45_pma_suspend (struct phy_device * phydev )
45
+ {
46
+ if (!genphy_c45_pma_can_sleep (phydev ))
47
+ return - EOPNOTSUPP ;
48
+
49
+ return phy_set_bits_mmd (phydev , MDIO_MMD_PMAPMD , MDIO_CTRL1 ,
50
+ MDIO_CTRL1_LPOWER );
51
+ }
52
+ EXPORT_SYMBOL_GPL (genphy_c45_pma_suspend );
53
+
11
54
/**
12
55
* genphy_c45_pma_setup_forced - configures a forced speed
13
56
* @phydev: target phy_device struct
Original file line number Diff line number Diff line change @@ -1535,6 +1535,8 @@ int genphy_c45_pma_read_abilities(struct phy_device *phydev);
1535
1535
int genphy_c45_read_status (struct phy_device * phydev );
1536
1536
int genphy_c45_config_aneg (struct phy_device * phydev );
1537
1537
int genphy_c45_loopback (struct phy_device * phydev , bool enable );
1538
+ int genphy_c45_pma_resume (struct phy_device * phydev );
1539
+ int genphy_c45_pma_suspend (struct phy_device * phydev );
1538
1540
1539
1541
/* Generic C45 PHY driver */
1540
1542
extern struct phy_driver genphy_c45_driver ;
You can’t perform that action at this time.
0 commit comments