19 #include <linux/kernel.h>
20 #include <linux/module.h>
25 #define MII_KSZPHY_OMSO 0x16
26 #define KSZPHY_OMSO_B_CAST_OFF (1 << 9)
27 #define KSZPHY_OMSO_RMII_OVERRIDE (1 << 1)
28 #define KSZPHY_OMSO_MII_OVERRIDE (1 << 0)
31 #define MII_KSZPHY_INTCS 0x1B
32 #define KSZPHY_INTCS_JABBER (1 << 15)
33 #define KSZPHY_INTCS_RECEIVE_ERR (1 << 14)
34 #define KSZPHY_INTCS_PAGE_RECEIVE (1 << 13)
35 #define KSZPHY_INTCS_PARELLEL (1 << 12)
36 #define KSZPHY_INTCS_LINK_PARTNER_ACK (1 << 11)
37 #define KSZPHY_INTCS_LINK_DOWN (1 << 10)
38 #define KSZPHY_INTCS_REMOTE_FAULT (1 << 9)
39 #define KSZPHY_INTCS_LINK_UP (1 << 8)
40 #define KSZPHY_INTCS_ALL (KSZPHY_INTCS_LINK_UP |\
41 KSZPHY_INTCS_LINK_DOWN)
44 #define MII_KSZPHY_CTRL 0x1F
46 #define KSZPHY_CTRL_INT_ACTIVE_HIGH (1 << 9)
47 #define KSZ9021_CTRL_INT_ACTIVE_HIGH (1 << 14)
48 #define KS8737_CTRL_INT_ACTIVE_HIGH (1 << 14)
49 #define KSZ8051_RMII_50MHZ_CLK (1 << 7)
51 static int kszphy_ack_interrupt(
struct phy_device *phydev)
58 return (rc < 0) ? rc : 0;
61 static int kszphy_set_interrupt(
struct phy_device *phydev)
69 static int kszphy_config_intr(
struct phy_device *phydev)
77 rc = kszphy_set_interrupt(phydev);
78 return rc < 0 ? rc : 0;
81 static int ksz9021_config_intr(
struct phy_device *phydev)
89 rc = kszphy_set_interrupt(phydev);
90 return rc < 0 ? rc : 0;
93 static int ks8737_config_intr(
struct phy_device *phydev)
101 rc = kszphy_set_interrupt(phydev);
102 return rc < 0 ? rc : 0;
105 static int kszphy_config_init(
struct phy_device *phydev)
110 static int ksz8021_config_init(
struct phy_device *phydev)
117 static int ks8051_config_init(
struct phy_device *phydev)
133 .phy_id_mask = 0x00fffff0,
134 .name =
"Micrel KS8737",
145 .phy_id_mask = 0x00ffffff,
146 .name =
"Micrel KSZ8021",
158 .phy_id_mask = 0x00fffff0,
159 .name =
"Micrel KSZ8041",
171 .phy_id_mask = 0x00fffff0,
172 .name =
"Micrel KSZ8051",
184 .name =
"Micrel KSZ8001 or KS8721",
185 .phy_id_mask = 0x00ffffff,
196 .phy_id_mask = 0x000ffffe,
197 .name =
"Micrel KSZ9021 Gigabit PHY",
209 static int __init ksphy_init(
void)
215 static void __exit ksphy_exit(
void)