xref: /linux-6.15/include/linux/smscphy.h (revision 8b305ee2)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
243c6759eSJavier Martinez Canillas #ifndef __LINUX_SMSCPHY_H__
343c6759eSJavier Martinez Canillas #define __LINUX_SMSCPHY_H__
443c6759eSJavier Martinez Canillas 
543c6759eSJavier Martinez Canillas #define MII_LAN83C185_ISF 29 /* Interrupt Source Flags */
643c6759eSJavier Martinez Canillas #define MII_LAN83C185_IM  30 /* Interrupt Mask */
743c6759eSJavier Martinez Canillas #define MII_LAN83C185_CTRL_STATUS 17 /* Mode/Status Register */
86ded7cd6Strem #define MII_LAN83C185_SPECIAL_MODES 18 /* Special Modes Register */
943c6759eSJavier Martinez Canillas 
1043c6759eSJavier Martinez Canillas #define MII_LAN83C185_ISF_INT1 (1<<1) /* Auto-Negotiation Page Received */
1143c6759eSJavier Martinez Canillas #define MII_LAN83C185_ISF_INT2 (1<<2) /* Parallel Detection Fault */
1243c6759eSJavier Martinez Canillas #define MII_LAN83C185_ISF_INT3 (1<<3) /* Auto-Negotiation LP Ack */
1343c6759eSJavier Martinez Canillas #define MII_LAN83C185_ISF_INT4 (1<<4) /* Link Down */
1443c6759eSJavier Martinez Canillas #define MII_LAN83C185_ISF_INT5 (1<<5) /* Remote Fault Detected */
1543c6759eSJavier Martinez Canillas #define MII_LAN83C185_ISF_INT6 (1<<6) /* Auto-Negotiation complete */
1643c6759eSJavier Martinez Canillas #define MII_LAN83C185_ISF_INT7 (1<<7) /* ENERGYON */
1743c6759eSJavier Martinez Canillas 
1843c6759eSJavier Martinez Canillas #define MII_LAN83C185_ISF_INT_ALL (0x0e)
1943c6759eSJavier Martinez Canillas 
2043c6759eSJavier Martinez Canillas #define MII_LAN83C185_ISF_INT_PHYLIB_EVENTS \
2143c6759eSJavier Martinez Canillas 	(MII_LAN83C185_ISF_INT6 | MII_LAN83C185_ISF_INT4 | \
2243c6759eSJavier Martinez Canillas 	 MII_LAN83C185_ISF_INT7)
2343c6759eSJavier Martinez Canillas 
2443c6759eSJavier Martinez Canillas #define MII_LAN83C185_EDPWRDOWN (1 << 13) /* EDPWRDOWN */
2543c6759eSJavier Martinez Canillas #define MII_LAN83C185_ENERGYON  (1 << 1)  /* ENERGYON */
2643c6759eSJavier Martinez Canillas 
276ded7cd6Strem #define MII_LAN83C185_MODE_MASK      0xE0
286ded7cd6Strem #define MII_LAN83C185_MODE_POWERDOWN 0xC0 /* Power Down mode */
296ded7cd6Strem #define MII_LAN83C185_MODE_ALL       0xE0 /* All capable mode */
306ded7cd6Strem 
31a69e332bSHeiner Kallweit int smsc_phy_config_intr(struct phy_device *phydev);
32a69e332bSHeiner Kallweit irqreturn_t smsc_phy_handle_interrupt(struct phy_device *phydev);
33a69e332bSHeiner Kallweit int smsc_phy_config_init(struct phy_device *phydev);
34a69e332bSHeiner Kallweit int lan87xx_read_status(struct phy_device *phydev);
35657de1cfSHeiner Kallweit int smsc_phy_get_tunable(struct phy_device *phydev,
36657de1cfSHeiner Kallweit 			 struct ethtool_tunable *tuna, void *data);
37657de1cfSHeiner Kallweit int smsc_phy_set_tunable(struct phy_device *phydev,
38657de1cfSHeiner Kallweit 			 struct ethtool_tunable *tuna, const void *data);
39a69e332bSHeiner Kallweit int smsc_phy_probe(struct phy_device *phydev);
40a69e332bSHeiner Kallweit 
41*8b305ee2STristram Ha #define MII_LAN874X_PHY_MMD_WOL_WUCSR		0x8010
42*8b305ee2STristram Ha #define MII_LAN874X_PHY_MMD_WOL_WUF_CFGA	0x8011
43*8b305ee2STristram Ha #define MII_LAN874X_PHY_MMD_WOL_WUF_CFGB	0x8012
44*8b305ee2STristram Ha #define MII_LAN874X_PHY_MMD_WOL_WUF_MASK0	0x8021
45*8b305ee2STristram Ha #define MII_LAN874X_PHY_MMD_WOL_WUF_MASK1	0x8022
46*8b305ee2STristram Ha #define MII_LAN874X_PHY_MMD_WOL_WUF_MASK2	0x8023
47*8b305ee2STristram Ha #define MII_LAN874X_PHY_MMD_WOL_WUF_MASK3	0x8024
48*8b305ee2STristram Ha #define MII_LAN874X_PHY_MMD_WOL_WUF_MASK4	0x8025
49*8b305ee2STristram Ha #define MII_LAN874X_PHY_MMD_WOL_WUF_MASK5	0x8026
50*8b305ee2STristram Ha #define MII_LAN874X_PHY_MMD_WOL_WUF_MASK6	0x8027
51*8b305ee2STristram Ha #define MII_LAN874X_PHY_MMD_WOL_WUF_MASK7	0x8028
52*8b305ee2STristram Ha #define MII_LAN874X_PHY_MMD_WOL_RX_ADDRA	0x8061
53*8b305ee2STristram Ha #define MII_LAN874X_PHY_MMD_WOL_RX_ADDRB	0x8062
54*8b305ee2STristram Ha #define MII_LAN874X_PHY_MMD_WOL_RX_ADDRC	0x8063
55*8b305ee2STristram Ha #define MII_LAN874X_PHY_MMD_MCFGR		0x8064
56*8b305ee2STristram Ha 
57*8b305ee2STristram Ha #define MII_LAN874X_PHY_PME1_SET		(2 << 13)
58*8b305ee2STristram Ha #define MII_LAN874X_PHY_PME2_SET		(2 << 11)
59*8b305ee2STristram Ha #define MII_LAN874X_PHY_PME_SELF_CLEAR		BIT(9)
60*8b305ee2STristram Ha #define MII_LAN874X_PHY_WOL_PFDA_FR		BIT(7)
61*8b305ee2STristram Ha #define MII_LAN874X_PHY_WOL_WUFR		BIT(6)
62*8b305ee2STristram Ha #define MII_LAN874X_PHY_WOL_MPR			BIT(5)
63*8b305ee2STristram Ha #define MII_LAN874X_PHY_WOL_BCAST_FR		BIT(4)
64*8b305ee2STristram Ha #define MII_LAN874X_PHY_WOL_PFDAEN		BIT(3)
65*8b305ee2STristram Ha #define MII_LAN874X_PHY_WOL_WUEN		BIT(2)
66*8b305ee2STristram Ha #define MII_LAN874X_PHY_WOL_MPEN		BIT(1)
67*8b305ee2STristram Ha #define MII_LAN874X_PHY_WOL_BCSTEN		BIT(0)
68*8b305ee2STristram Ha 
69*8b305ee2STristram Ha #define MII_LAN874X_PHY_WOL_FILTER_EN		BIT(15)
70*8b305ee2STristram Ha #define MII_LAN874X_PHY_WOL_FILTER_MCASTTEN	BIT(9)
71*8b305ee2STristram Ha #define MII_LAN874X_PHY_WOL_FILTER_BCSTEN	BIT(8)
72*8b305ee2STristram Ha 
73*8b305ee2STristram Ha #define MII_LAN874X_PHY_PME_SELF_CLEAR_DELAY	0x1000 /* 81 milliseconds */
74*8b305ee2STristram Ha 
7543c6759eSJavier Martinez Canillas #endif /* __LINUX_SMSCPHY_H__ */
76