diff options
Diffstat (limited to 'drivers/net/phy/micrel.c')
-rw-r--r-- | drivers/net/phy/micrel.c | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index cf287e0eb408..2165d5fdb8c0 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c | |||
@@ -21,6 +21,12 @@ | |||
21 | #include <linux/phy.h> | 21 | #include <linux/phy.h> |
22 | #include <linux/micrel_phy.h> | 22 | #include <linux/micrel_phy.h> |
23 | 23 | ||
24 | /* Operation Mode Strap Override */ | ||
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) | ||
29 | |||
24 | /* general Interrupt control/status reg in vendor specific block. */ | 30 | /* general Interrupt control/status reg in vendor specific block. */ |
25 | #define MII_KSZPHY_INTCS 0x1B | 31 | #define MII_KSZPHY_INTCS 0x1B |
26 | #define KSZPHY_INTCS_JABBER (1 << 15) | 32 | #define KSZPHY_INTCS_JABBER (1 << 15) |
@@ -101,6 +107,13 @@ static int kszphy_config_init(struct phy_device *phydev) | |||
101 | return 0; | 107 | return 0; |
102 | } | 108 | } |
103 | 109 | ||
110 | static int ksz8021_config_init(struct phy_device *phydev) | ||
111 | { | ||
112 | const u16 val = KSZPHY_OMSO_B_CAST_OFF | KSZPHY_OMSO_RMII_OVERRIDE; | ||
113 | phy_write(phydev, MII_KSZPHY_OMSO, val); | ||
114 | return 0; | ||
115 | } | ||
116 | |||
104 | static int ks8051_config_init(struct phy_device *phydev) | 117 | static int ks8051_config_init(struct phy_device *phydev) |
105 | { | 118 | { |
106 | int regval; | 119 | int regval; |
@@ -128,9 +141,22 @@ static struct phy_driver ksphy_driver[] = { | |||
128 | .config_intr = ks8737_config_intr, | 141 | .config_intr = ks8737_config_intr, |
129 | .driver = { .owner = THIS_MODULE,}, | 142 | .driver = { .owner = THIS_MODULE,}, |
130 | }, { | 143 | }, { |
131 | .phy_id = PHY_ID_KS8041, | 144 | .phy_id = PHY_ID_KSZ8021, |
145 | .phy_id_mask = 0x00ffffff, | ||
146 | .name = "Micrel KSZ8021", | ||
147 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause | | ||
148 | SUPPORTED_Asym_Pause), | ||
149 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, | ||
150 | .config_init = ksz8021_config_init, | ||
151 | .config_aneg = genphy_config_aneg, | ||
152 | .read_status = genphy_read_status, | ||
153 | .ack_interrupt = kszphy_ack_interrupt, | ||
154 | .config_intr = kszphy_config_intr, | ||
155 | .driver = { .owner = THIS_MODULE,}, | ||
156 | }, { | ||
157 | .phy_id = PHY_ID_KSZ8041, | ||
132 | .phy_id_mask = 0x00fffff0, | 158 | .phy_id_mask = 0x00fffff0, |
133 | .name = "Micrel KS8041", | 159 | .name = "Micrel KSZ8041", |
134 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause | 160 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause |
135 | | SUPPORTED_Asym_Pause), | 161 | | SUPPORTED_Asym_Pause), |
136 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, | 162 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
@@ -141,9 +167,9 @@ static struct phy_driver ksphy_driver[] = { | |||
141 | .config_intr = kszphy_config_intr, | 167 | .config_intr = kszphy_config_intr, |
142 | .driver = { .owner = THIS_MODULE,}, | 168 | .driver = { .owner = THIS_MODULE,}, |
143 | }, { | 169 | }, { |
144 | .phy_id = PHY_ID_KS8051, | 170 | .phy_id = PHY_ID_KSZ8051, |
145 | .phy_id_mask = 0x00fffff0, | 171 | .phy_id_mask = 0x00fffff0, |
146 | .name = "Micrel KS8051", | 172 | .name = "Micrel KSZ8051", |
147 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause | 173 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause |
148 | | SUPPORTED_Asym_Pause), | 174 | | SUPPORTED_Asym_Pause), |
149 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, | 175 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
@@ -154,8 +180,8 @@ static struct phy_driver ksphy_driver[] = { | |||
154 | .config_intr = kszphy_config_intr, | 180 | .config_intr = kszphy_config_intr, |
155 | .driver = { .owner = THIS_MODULE,}, | 181 | .driver = { .owner = THIS_MODULE,}, |
156 | }, { | 182 | }, { |
157 | .phy_id = PHY_ID_KS8001, | 183 | .phy_id = PHY_ID_KSZ8001, |
158 | .name = "Micrel KS8001 or KS8721", | 184 | .name = "Micrel KSZ8001 or KS8721", |
159 | .phy_id_mask = 0x00ffffff, | 185 | .phy_id_mask = 0x00ffffff, |
160 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause), | 186 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause), |
161 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, | 187 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
@@ -201,10 +227,11 @@ MODULE_LICENSE("GPL"); | |||
201 | 227 | ||
202 | static struct mdio_device_id __maybe_unused micrel_tbl[] = { | 228 | static struct mdio_device_id __maybe_unused micrel_tbl[] = { |
203 | { PHY_ID_KSZ9021, 0x000ffffe }, | 229 | { PHY_ID_KSZ9021, 0x000ffffe }, |
204 | { PHY_ID_KS8001, 0x00ffffff }, | 230 | { PHY_ID_KSZ8001, 0x00ffffff }, |
205 | { PHY_ID_KS8737, 0x00fffff0 }, | 231 | { PHY_ID_KS8737, 0x00fffff0 }, |
206 | { PHY_ID_KS8041, 0x00fffff0 }, | 232 | { PHY_ID_KSZ8021, 0x00ffffff }, |
207 | { PHY_ID_KS8051, 0x00fffff0 }, | 233 | { PHY_ID_KSZ8041, 0x00fffff0 }, |
234 | { PHY_ID_KSZ8051, 0x00fffff0 }, | ||
208 | { } | 235 | { } |
209 | }; | 236 | }; |
210 | 237 | ||