• Home
  • Raw
  • Download

Lines Matching refs:mii_info

113 static void config_genmii_advert (struct uec_mii_info *mii_info);
114 static void genmii_setup_forced (struct uec_mii_info *mii_info);
115 static void genmii_restart_aneg (struct uec_mii_info *mii_info);
116 static int gbit_config_aneg (struct uec_mii_info *mii_info);
117 static int genmii_config_aneg (struct uec_mii_info *mii_info);
118 static int genmii_update_link (struct uec_mii_info *mii_info);
119 static int genmii_read_status (struct uec_mii_info *mii_info);
120 u16 uec_phy_read(struct uec_mii_info *mii_info, u16 regnum);
121 void uec_phy_write(struct uec_mii_info *mii_info, u16 regnum, u16 val);
213 void mii_clear_phy_interrupt (struct uec_mii_info *mii_info) in mii_clear_phy_interrupt() argument
215 if (mii_info->phyinfo->ack_interrupt) in mii_clear_phy_interrupt()
216 mii_info->phyinfo->ack_interrupt (mii_info); in mii_clear_phy_interrupt()
219 void mii_configure_phy_interrupt (struct uec_mii_info *mii_info, in mii_configure_phy_interrupt() argument
222 mii_info->interrupts = interrupts; in mii_configure_phy_interrupt()
223 if (mii_info->phyinfo->config_intr) in mii_configure_phy_interrupt()
224 mii_info->phyinfo->config_intr (mii_info); in mii_configure_phy_interrupt()
231 static void config_genmii_advert (struct uec_mii_info *mii_info) in config_genmii_advert() argument
237 mii_info->advertising &= mii_info->phyinfo->features; in config_genmii_advert()
238 advertise = mii_info->advertising; in config_genmii_advert()
241 adv = uec_phy_read(mii_info, MII_ADVERTISE); in config_genmii_advert()
251 uec_phy_write(mii_info, MII_ADVERTISE, adv); in config_genmii_advert()
254 static void genmii_setup_forced (struct uec_mii_info *mii_info) in genmii_setup_forced() argument
257 u32 features = mii_info->phyinfo->features; in genmii_setup_forced()
259 ctrl = uec_phy_read(mii_info, MII_BMCR); in genmii_setup_forced()
265 switch (mii_info->speed) { in genmii_setup_forced()
272 mii_info->speed = SPEED_100; in genmii_setup_forced()
279 mii_info->speed = SPEED_10; in genmii_setup_forced()
285 ugphy_err ("%s: Bad speed!", mii_info->dev->name); in genmii_setup_forced()
289 uec_phy_write(mii_info, MII_BMCR, ctrl); in genmii_setup_forced()
293 static void genmii_restart_aneg (struct uec_mii_info *mii_info) in genmii_restart_aneg() argument
297 ctl = uec_phy_read(mii_info, MII_BMCR); in genmii_restart_aneg()
299 uec_phy_write(mii_info, MII_BMCR, ctl); in genmii_restart_aneg()
302 static int gbit_config_aneg (struct uec_mii_info *mii_info) in gbit_config_aneg() argument
307 if (mii_info->autoneg) { in gbit_config_aneg()
309 config_genmii_advert (mii_info); in gbit_config_aneg()
310 advertise = mii_info->advertising; in gbit_config_aneg()
312 adv = uec_phy_read(mii_info, MII_CTRL1000); in gbit_config_aneg()
319 uec_phy_write(mii_info, MII_CTRL1000, adv); in gbit_config_aneg()
322 genmii_restart_aneg (mii_info); in gbit_config_aneg()
324 genmii_setup_forced (mii_info); in gbit_config_aneg()
329 static int marvell_config_aneg (struct uec_mii_info *mii_info) in marvell_config_aneg() argument
334 uec_phy_write(mii_info, MII_BMCR, BMCR_RESET); in marvell_config_aneg()
336 uec_phy_write(mii_info, 0x1d, 0x1f); in marvell_config_aneg()
337 uec_phy_write(mii_info, 0x1e, 0x200c); in marvell_config_aneg()
338 uec_phy_write(mii_info, 0x1d, 0x5); in marvell_config_aneg()
339 uec_phy_write(mii_info, 0x1e, 0); in marvell_config_aneg()
340 uec_phy_write(mii_info, 0x1e, 0x100); in marvell_config_aneg()
342 gbit_config_aneg (mii_info); in marvell_config_aneg()
347 static int genmii_config_aneg (struct uec_mii_info *mii_info) in genmii_config_aneg() argument
349 if (mii_info->autoneg) { in genmii_config_aneg()
352 if (!genmii_read_status(mii_info) && mii_info->link) in genmii_config_aneg()
353 if (mii_info->duplex == DUPLEX_FULL && in genmii_config_aneg()
354 mii_info->speed == SPEED_100) in genmii_config_aneg()
355 if (mii_info->advertising & in genmii_config_aneg()
359 config_genmii_advert (mii_info); in genmii_config_aneg()
360 genmii_restart_aneg (mii_info); in genmii_config_aneg()
362 genmii_setup_forced (mii_info); in genmii_config_aneg()
367 static int genmii_update_link (struct uec_mii_info *mii_info) in genmii_update_link() argument
372 uec_phy_read(mii_info, MII_BMSR); in genmii_update_link()
378 status = uec_phy_read(mii_info, MII_BMSR); in genmii_update_link()
388 mii_info->link = 0; in genmii_update_link()
394 status = uec_phy_read(mii_info, MII_BMSR); in genmii_update_link()
396 mii_info->link = 1; in genmii_update_link()
399 mii_info->link = 1; in genmii_update_link()
401 mii_info->link = 0; in genmii_update_link()
407 static int genmii_read_status (struct uec_mii_info *mii_info) in genmii_read_status() argument
414 err = genmii_update_link (mii_info); in genmii_read_status()
418 if (mii_info->autoneg) { in genmii_read_status()
419 status = uec_phy_read(mii_info, MII_STAT1000); in genmii_read_status()
422 mii_info->speed = SPEED_1000; in genmii_read_status()
424 mii_info->duplex = DUPLEX_FULL; in genmii_read_status()
426 mii_info->duplex = DUPLEX_HALF; in genmii_read_status()
428 status = uec_phy_read(mii_info, MII_LPA); in genmii_read_status()
431 mii_info->duplex = DUPLEX_FULL; in genmii_read_status()
433 mii_info->duplex = DUPLEX_HALF; in genmii_read_status()
435 mii_info->speed = SPEED_100; in genmii_read_status()
437 mii_info->speed = SPEED_10; in genmii_read_status()
439 mii_info->pause = 0; in genmii_read_status()
448 static int bcm_init(struct uec_mii_info *mii_info) in bcm_init() argument
450 struct eth_device *edev = mii_info->dev; in bcm_init()
453 gbit_config_aneg(mii_info); in bcm_init()
463 val = uec_phy_read(mii_info, MII_BMSR); in bcm_init()
467 uec_phy_write(mii_info, 0x18, 0x7 | (7 << 12)); in bcm_init()
469 val = uec_phy_read(mii_info, 0x18); in bcm_init()
475 uec_phy_write(mii_info, 0x18, val); in bcm_init()
481 static int uec_marvell_init(struct uec_mii_info *mii_info) in uec_marvell_init() argument
483 struct eth_device *edev = mii_info->dev; in uec_marvell_init()
494 temp = uec_phy_read(mii_info, MII_M1111_PHY_EXT_CR); in uec_marvell_init()
504 uec_phy_write(mii_info, MII_M1111_PHY_EXT_CR, temp); in uec_marvell_init()
506 temp = uec_phy_read(mii_info, MII_M1111_PHY_EXT_SR); in uec_marvell_init()
509 uec_phy_write(mii_info, MII_M1111_PHY_EXT_SR, temp); in uec_marvell_init()
511 uec_phy_write(mii_info, MII_BMCR, BMCR_RESET); in uec_marvell_init()
517 static int marvell_read_status (struct uec_mii_info *mii_info) in marvell_read_status() argument
524 err = genmii_update_link (mii_info); in marvell_read_status()
531 if (mii_info->autoneg && mii_info->link) { in marvell_read_status()
534 status = uec_phy_read(mii_info, MII_M1011_PHY_SPEC_STATUS); in marvell_read_status()
538 mii_info->duplex = DUPLEX_FULL; in marvell_read_status()
540 mii_info->duplex = DUPLEX_HALF; in marvell_read_status()
546 mii_info->speed = SPEED_1000; in marvell_read_status()
549 mii_info->speed = SPEED_100; in marvell_read_status()
552 mii_info->speed = SPEED_10; in marvell_read_status()
555 mii_info->pause = 0; in marvell_read_status()
561 static int marvell_ack_interrupt (struct uec_mii_info *mii_info) in marvell_ack_interrupt() argument
564 uec_phy_read(mii_info, MII_M1011_IEVENT); in marvell_ack_interrupt()
569 static int marvell_config_intr (struct uec_mii_info *mii_info) in marvell_config_intr() argument
571 if (mii_info->interrupts == MII_INTERRUPT_ENABLED) in marvell_config_intr()
572 uec_phy_write(mii_info, MII_M1011_IMASK, MII_M1011_IMASK_INIT); in marvell_config_intr()
574 uec_phy_write(mii_info, MII_M1011_IMASK, in marvell_config_intr()
580 static int dm9161_init (struct uec_mii_info *mii_info) in dm9161_init() argument
583 uec_phy_write(mii_info, MII_BMCR, uec_phy_read(mii_info, MII_BMCR) | in dm9161_init()
586 uec_phy_write(mii_info, MII_BMCR, uec_phy_read(mii_info, MII_BMCR) & in dm9161_init()
589 uec_phy_write(mii_info, MII_DM9161_SCR, MII_DM9161_SCR_INIT); in dm9161_init()
591 config_genmii_advert (mii_info); in dm9161_init()
593 genmii_config_aneg (mii_info); in dm9161_init()
598 static int dm9161_config_aneg (struct uec_mii_info *mii_info) in dm9161_config_aneg() argument
603 static int dm9161_read_status (struct uec_mii_info *mii_info) in dm9161_read_status() argument
609 err = genmii_update_link (mii_info); in dm9161_read_status()
614 if (mii_info->autoneg && mii_info->link) { in dm9161_read_status()
615 status = uec_phy_read(mii_info, MII_DM9161_SCSR); in dm9161_read_status()
617 mii_info->speed = SPEED_100; in dm9161_read_status()
619 mii_info->speed = SPEED_10; in dm9161_read_status()
622 mii_info->duplex = DUPLEX_FULL; in dm9161_read_status()
624 mii_info->duplex = DUPLEX_HALF; in dm9161_read_status()
630 static int dm9161_ack_interrupt (struct uec_mii_info *mii_info) in dm9161_ack_interrupt() argument
633 uec_phy_read(mii_info, MII_DM9161_INTR); in dm9161_ack_interrupt()
638 static int dm9161_config_intr (struct uec_mii_info *mii_info) in dm9161_config_intr() argument
640 if (mii_info->interrupts == MII_INTERRUPT_ENABLED) in dm9161_config_intr()
641 uec_phy_write(mii_info, MII_DM9161_INTR, MII_DM9161_INTR_INIT); in dm9161_config_intr()
643 uec_phy_write(mii_info, MII_DM9161_INTR, MII_DM9161_INTR_STOP); in dm9161_config_intr()
648 static void dm9161_close (struct uec_mii_info *mii_info) in dm9161_close() argument
652 static int fixed_phy_aneg (struct uec_mii_info *mii_info) in fixed_phy_aneg() argument
654 mii_info->autoneg = 0; /* Turn off auto negotiation for fixed phy */ in fixed_phy_aneg()
658 static int fixed_phy_read_status (struct uec_mii_info *mii_info) in fixed_phy_read_status() argument
663 if (strncmp(mii_info->dev->name, fixed_phy_port[i].name, in fixed_phy_read_status()
664 strlen(mii_info->dev->name)) == 0) { in fixed_phy_read_status()
665 mii_info->speed = fixed_phy_port[i].speed; in fixed_phy_read_status()
666 mii_info->duplex = fixed_phy_port[i].duplex; in fixed_phy_read_status()
667 mii_info->link = 1; /* Link is always UP */ in fixed_phy_read_status()
668 mii_info->pause = 0; in fixed_phy_read_status()
675 static int smsc_config_aneg (struct uec_mii_info *mii_info) in smsc_config_aneg() argument
680 static int smsc_read_status (struct uec_mii_info *mii_info) in smsc_read_status() argument
687 err = genmii_update_link (mii_info); in smsc_read_status()
694 if (mii_info->autoneg && mii_info->link) { in smsc_read_status()
697 status = uec_phy_read(mii_info, 0x1f); in smsc_read_status()
702 mii_info->duplex = DUPLEX_HALF; in smsc_read_status()
703 mii_info->speed = SPEED_10; in smsc_read_status()
706 mii_info->duplex = DUPLEX_FULL; in smsc_read_status()
707 mii_info->speed = SPEED_10; in smsc_read_status()
710 mii_info->duplex = DUPLEX_HALF; in smsc_read_status()
711 mii_info->speed = SPEED_100; in smsc_read_status()
714 mii_info->duplex = DUPLEX_FULL; in smsc_read_status()
715 mii_info->speed = SPEED_100; in smsc_read_status()
718 mii_info->pause = 0; in smsc_read_status()
805 u16 uec_phy_read(struct uec_mii_info *mii_info, u16 regnum) in uec_phy_read() argument
807 return mii_info->mdio_read (mii_info->dev, mii_info->mii_id, regnum); in uec_phy_read()
810 void uec_phy_write(struct uec_mii_info *mii_info, u16 regnum, u16 val) in uec_phy_write() argument
812 mii_info->mdio_write (mii_info->dev, mii_info->mii_id, regnum, val); in uec_phy_write()
818 struct phy_info *uec_get_phy_info (struct uec_mii_info *mii_info) in uec_get_phy_info() argument
826 phy_reg = uec_phy_read(mii_info, MII_PHYSID1); in uec_get_phy_info()
830 phy_reg = uec_phy_read(mii_info, MII_PHYSID2); in uec_get_phy_info()
857 struct uec_mii_info *mii_info; in marvell_phy_interface_mode() local
860 if (!uec->mii_info) { in marvell_phy_interface_mode()
864 mii_info = uec->mii_info; in marvell_phy_interface_mode()
868 uec_phy_write(mii_info, 0x00, 0x9140); in marvell_phy_interface_mode()
869 uec_phy_write(mii_info, 0x1d, 0x001f); in marvell_phy_interface_mode()
870 uec_phy_write(mii_info, 0x1e, 0x200c); in marvell_phy_interface_mode()
871 uec_phy_write(mii_info, 0x1d, 0x0005); in marvell_phy_interface_mode()
872 uec_phy_write(mii_info, 0x1e, 0x0000); in marvell_phy_interface_mode()
873 uec_phy_write(mii_info, 0x1e, 0x0100); in marvell_phy_interface_mode()
874 uec_phy_write(mii_info, 0x09, 0x0e00); in marvell_phy_interface_mode()
875 uec_phy_write(mii_info, 0x04, 0x01e1); in marvell_phy_interface_mode()
876 uec_phy_write(mii_info, 0x00, 0x9140); in marvell_phy_interface_mode()
877 uec_phy_write(mii_info, 0x00, 0x1000); in marvell_phy_interface_mode()
879 uec_phy_write(mii_info, 0x00, 0x2900); in marvell_phy_interface_mode()
880 uec_phy_write(mii_info, 0x14, 0x0cd2); in marvell_phy_interface_mode()
881 uec_phy_write(mii_info, 0x00, 0xa100); in marvell_phy_interface_mode()
882 uec_phy_write(mii_info, 0x09, 0x0000); in marvell_phy_interface_mode()
883 uec_phy_write(mii_info, 0x1b, 0x800b); in marvell_phy_interface_mode()
884 uec_phy_write(mii_info, 0x04, 0x05e1); in marvell_phy_interface_mode()
885 uec_phy_write(mii_info, 0x00, 0xa100); in marvell_phy_interface_mode()
886 uec_phy_write(mii_info, 0x00, 0x2100); in marvell_phy_interface_mode()
889 uec_phy_write(mii_info, 0x14, 0x8e40); in marvell_phy_interface_mode()
890 uec_phy_write(mii_info, 0x1b, 0x800b); in marvell_phy_interface_mode()
891 uec_phy_write(mii_info, 0x14, 0x0c82); in marvell_phy_interface_mode()
892 uec_phy_write(mii_info, 0x00, 0x8100); in marvell_phy_interface_mode()
898 if (mii_info->autoneg) { in marvell_phy_interface_mode()
899 status = uec_phy_read(mii_info, MII_BMCR); in marvell_phy_interface_mode()
900 uec_phy_write(mii_info, MII_BMCR, status | BMCR_ANENABLE); in marvell_phy_interface_mode()