20 #include <linux/module.h>
21 #include <linux/kernel.h>
22 #include <linux/types.h>
23 #include <linux/netdevice.h>
24 #include <linux/mii.h>
25 #include <linux/ethtool.h>
31 #define phy_read _phy_read
32 #define phy_write _phy_write
44 static inline int gpcs_phy_read(
struct mii_phy *phy,
int reg)
49 static inline void gpcs_phy_write(
struct mii_phy *phy,
int reg,
int val)
97 gpcs_phy_write(phy,
MII_BMCR, val & ~BMCR_ISOLATE);
101 gpcs_phy_write(phy, 0x04, 0x8120);
102 gpcs_phy_write(phy, 0x07, 0x2801);
103 gpcs_phy_write(phy, 0x00, 0x0140);
109 static int genmii_setup_aneg(
struct mii_phy *phy,
u32 advertise)
168 static int genmii_setup_forced(
struct mii_phy *phy,
int speed,
int fd)
205 static int genmii_poll_link(
struct mii_phy *phy)
219 static int genmii_read_link(
struct mii_phy *phy)
232 if (glpa < 0 || adv < 0)
280 .setup_aneg = genmii_setup_aneg,
281 .setup_forced = genmii_setup_forced,
282 .poll_link = genmii_poll_link,
283 .read_link = genmii_read_link
287 .phy_id = 0x00000000,
288 .phy_id_mask = 0x00000000,
289 .name =
"Generic MII",
290 .ops = &generic_phy_ops
294 #define MII_CIS8201_10BTCSR 0x16
295 #define TENBTCSR_ECHO_DISABLE 0x2000
296 #define MII_CIS8201_EPCR 0x17
297 #define EPCR_MODE_MASK 0x3000
298 #define EPCR_GMII_MODE 0x0000
299 #define EPCR_RGMII_MODE 0x1000
300 #define EPCR_TBI_MODE 0x2000
301 #define EPCR_RTBI_MODE 0x3000
302 #define MII_CIS8201_ACSR 0x1c
303 #define ACSR_PIN_PRIO_SELECT 0x0004
305 static int cis8201_init(
struct mii_phy *phy)
344 .init = cis8201_init,
345 .setup_aneg = genmii_setup_aneg,
346 .setup_forced = genmii_setup_forced,
347 .poll_link = genmii_poll_link,
348 .read_link = genmii_read_link
352 .phy_id = 0x000fc410,
353 .phy_id_mask = 0x000ffff0,
354 .name =
"CIS8201 Gigabit Ethernet",
355 .ops = &cis8201_phy_ops
360 .phy_id = 0x0143bc00,
361 .phy_id_mask = 0x0ffffff0,
362 .name =
"BCM5248 10/100 SMII Ethernet",
363 .ops = &generic_phy_ops
366 static int m88e1111_init(
struct mii_phy *phy)
368 pr_debug(
"%s: Marvell 88E1111 Ethernet\n", __func__);
379 static int m88e1112_init(
struct mii_phy *phy)
389 pr_debug(
"%s: Marvell 88E1112 Ethernet\n", __func__);
406 static int et1011c_init(
struct mii_phy *phy)
416 reg_short &= ~(0x40);
424 .init = et1011c_init,
425 .setup_aneg = genmii_setup_aneg,
426 .setup_forced = genmii_setup_forced,
427 .poll_link = genmii_poll_link,
428 .read_link = genmii_read_link
432 .phy_id = 0x0282f000,
433 .phy_id_mask = 0x0fffff00,
434 .name =
"ET1011C Gigabit Ethernet",
435 .ops = &et1011c_phy_ops
443 .init = m88e1111_init,
444 .setup_aneg = genmii_setup_aneg,
445 .setup_forced = genmii_setup_forced,
446 .poll_link = genmii_poll_link,
447 .read_link = genmii_read_link
452 .phy_id = 0x01410CC0,
453 .phy_id_mask = 0x0ffffff0,
454 .name =
"Marvell 88E1111 Ethernet",
455 .ops = &m88e1111_phy_ops,
459 .init = m88e1112_init,
460 .setup_aneg = genmii_setup_aneg,
461 .setup_forced = genmii_setup_forced,
462 .poll_link = genmii_poll_link,
463 .read_link = genmii_read_link
467 .phy_id = 0x01410C90,
468 .phy_id_mask = 0x0ffffff0,
469 .name =
"Marvell 88E1112 Ethernet",
470 .ops = &m88e1112_phy_ops,
502 for (i = 0; (def = mii_phy_table[
i]) !=
NULL; i++)