Lines Matching refs:pdata
421 static enum xgbe_an_mode xgbe_phy_an_mode(struct xgbe_prv_data *pdata);
422 static int xgbe_phy_reset(struct xgbe_prv_data *pdata);
427 xgbe_phy_i2c_xfer(struct xgbe_prv_data *pdata, struct xgbe_i2c_op *i2c_op) in xgbe_phy_i2c_xfer() argument
429 return (pdata->i2c_if.i2c_xfer(pdata, i2c_op)); in xgbe_phy_i2c_xfer()
433 xgbe_phy_redrv_write(struct xgbe_prv_data *pdata, unsigned int reg, in xgbe_phy_redrv_write() argument
436 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_redrv_write()
464 ret = xgbe_phy_i2c_xfer(pdata, &i2c_op); in xgbe_phy_redrv_write()
478 ret = xgbe_phy_i2c_xfer(pdata, &i2c_op); in xgbe_phy_redrv_write()
495 xgbe_phy_i2c_write(struct xgbe_prv_data *pdata, unsigned int target, void *val, in xgbe_phy_i2c_write() argument
508 ret = xgbe_phy_i2c_xfer(pdata, &i2c_op); in xgbe_phy_i2c_write()
516 xgbe_phy_i2c_read(struct xgbe_prv_data *pdata, unsigned int target, void *reg, in xgbe_phy_i2c_read() argument
531 ret = xgbe_phy_i2c_xfer(pdata, &i2c_op); in xgbe_phy_i2c_read()
547 ret = xgbe_phy_i2c_xfer(pdata, &i2c_op); in xgbe_phy_i2c_read()
556 xgbe_phy_sfp_put_mux(struct xgbe_prv_data *pdata) in xgbe_phy_sfp_put_mux() argument
558 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_sfp_put_mux()
572 return (xgbe_phy_i2c_xfer(pdata, &i2c_op)); in xgbe_phy_sfp_put_mux()
576 xgbe_phy_sfp_get_mux(struct xgbe_prv_data *pdata) in xgbe_phy_sfp_get_mux() argument
578 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_sfp_get_mux()
592 return (xgbe_phy_i2c_xfer(pdata, &i2c_op)); in xgbe_phy_sfp_get_mux()
596 xgbe_phy_put_comm_ownership(struct xgbe_prv_data *pdata) in xgbe_phy_put_comm_ownership() argument
602 xgbe_phy_get_comm_ownership(struct xgbe_prv_data *pdata) in xgbe_phy_get_comm_ownership() argument
604 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_get_comm_ownership()
615 XP_IOWRITE(pdata, XP_I2C_MUTEX, XGBE_MUTEX_RELEASE); in xgbe_phy_get_comm_ownership()
616 XP_IOWRITE(pdata, XP_MDIO_MUTEX, XGBE_MUTEX_RELEASE); in xgbe_phy_get_comm_ownership()
626 if (XP_IOREAD(pdata, XP_I2C_MUTEX) || in xgbe_phy_get_comm_ownership()
627 XP_IOREAD(pdata, XP_MDIO_MUTEX)) { in xgbe_phy_get_comm_ownership()
633 XP_IOWRITE(pdata, XP_I2C_MUTEX, mutex_id); in xgbe_phy_get_comm_ownership()
634 XP_IOWRITE(pdata, XP_MDIO_MUTEX, mutex_id); in xgbe_phy_get_comm_ownership()
647 xgbe_phy_mdio_mii_write(struct xgbe_prv_data *pdata, int addr, int reg, in xgbe_phy_mdio_mii_write() argument
650 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_mdio_mii_write()
660 return (pdata->hw_if.write_ext_mii_regs(pdata, addr, reg, val)); in xgbe_phy_mdio_mii_write()
664 xgbe_phy_i2c_mii_write(struct xgbe_prv_data *pdata, int reg, uint16_t val) in xgbe_phy_i2c_mii_write() argument
670 ret = xgbe_phy_sfp_get_mux(pdata); in xgbe_phy_i2c_mii_write()
678 ret = xgbe_phy_i2c_write(pdata, XGBE_SFP_PHY_ADDRESS, in xgbe_phy_i2c_mii_write()
681 xgbe_phy_sfp_put_mux(pdata); in xgbe_phy_i2c_mii_write()
687 xgbe_phy_mii_write(struct xgbe_prv_data *pdata, int addr, int reg, uint16_t val) in xgbe_phy_mii_write() argument
689 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_mii_write()
693 ret = xgbe_phy_get_comm_ownership(pdata); in xgbe_phy_mii_write()
698 ret = xgbe_phy_i2c_mii_write(pdata, reg, val); in xgbe_phy_mii_write()
700 ret = xgbe_phy_mdio_mii_write(pdata, addr, reg, val); in xgbe_phy_mii_write()
704 xgbe_phy_put_comm_ownership(pdata); in xgbe_phy_mii_write()
710 xgbe_phy_mdio_mii_read(struct xgbe_prv_data *pdata, int addr, int reg) in xgbe_phy_mdio_mii_read() argument
712 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_mdio_mii_read()
722 return (pdata->hw_if.read_ext_mii_regs(pdata, addr, reg)); in xgbe_phy_mdio_mii_read()
726 xgbe_phy_i2c_mii_read(struct xgbe_prv_data *pdata, int reg) in xgbe_phy_i2c_mii_read() argument
732 ret = xgbe_phy_sfp_get_mux(pdata); in xgbe_phy_i2c_mii_read()
737 ret = xgbe_phy_i2c_read(pdata, XGBE_SFP_PHY_ADDRESS, in xgbe_phy_i2c_mii_read()
743 xgbe_phy_sfp_put_mux(pdata); in xgbe_phy_i2c_mii_read()
749 xgbe_phy_mii_read(struct xgbe_prv_data *pdata, int addr, int reg) in xgbe_phy_mii_read() argument
751 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_mii_read()
755 ret = xgbe_phy_get_comm_ownership(pdata); in xgbe_phy_mii_read()
760 ret = xgbe_phy_i2c_mii_read(pdata, reg); in xgbe_phy_mii_read()
762 ret = xgbe_phy_mdio_mii_read(pdata, addr, reg); in xgbe_phy_mii_read()
766 xgbe_phy_put_comm_ownership(pdata); in xgbe_phy_mii_read()
772 xgbe_phy_sfp_phy_settings(struct xgbe_prv_data *pdata) in xgbe_phy_sfp_phy_settings() argument
774 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_sfp_phy_settings()
779 XGBE_ZERO_SUP(&pdata->phy); in xgbe_phy_sfp_phy_settings()
782 pdata->phy.speed = SPEED_UNKNOWN; in xgbe_phy_sfp_phy_settings()
783 pdata->phy.duplex = DUPLEX_UNKNOWN; in xgbe_phy_sfp_phy_settings()
784 pdata->phy.autoneg = AUTONEG_ENABLE; in xgbe_phy_sfp_phy_settings()
785 pdata->phy.pause_autoneg = AUTONEG_ENABLE; in xgbe_phy_sfp_phy_settings()
787 XGBE_SET_SUP(&pdata->phy, Autoneg); in xgbe_phy_sfp_phy_settings()
788 XGBE_SET_SUP(&pdata->phy, Pause); in xgbe_phy_sfp_phy_settings()
789 XGBE_SET_SUP(&pdata->phy, Asym_Pause); in xgbe_phy_sfp_phy_settings()
790 XGBE_SET_SUP(&pdata->phy, TP); in xgbe_phy_sfp_phy_settings()
791 XGBE_SET_SUP(&pdata->phy, FIBRE); in xgbe_phy_sfp_phy_settings()
793 XGBE_LM_COPY(&pdata->phy, advertising, &pdata->phy, supported); in xgbe_phy_sfp_phy_settings()
802 pdata->phy.speed = SPEED_100; in xgbe_phy_sfp_phy_settings()
803 pdata->phy.duplex = DUPLEX_FULL; in xgbe_phy_sfp_phy_settings()
804 pdata->phy.autoneg = AUTONEG_DISABLE; in xgbe_phy_sfp_phy_settings()
805 pdata->phy.pause_autoneg = AUTONEG_DISABLE; in xgbe_phy_sfp_phy_settings()
811 pdata->phy.speed = SPEED_UNKNOWN; in xgbe_phy_sfp_phy_settings()
812 pdata->phy.duplex = DUPLEX_UNKNOWN; in xgbe_phy_sfp_phy_settings()
813 pdata->phy.autoneg = AUTONEG_ENABLE; in xgbe_phy_sfp_phy_settings()
814 pdata->phy.pause_autoneg = AUTONEG_ENABLE; in xgbe_phy_sfp_phy_settings()
815 XGBE_SET_SUP(&pdata->phy, Autoneg); in xgbe_phy_sfp_phy_settings()
816 XGBE_SET_SUP(&pdata->phy, Pause); in xgbe_phy_sfp_phy_settings()
817 XGBE_SET_SUP(&pdata->phy, Asym_Pause); in xgbe_phy_sfp_phy_settings()
820 XGBE_SET_SUP(&pdata->phy, 100baseT_Full); in xgbe_phy_sfp_phy_settings()
822 XGBE_SET_SUP(&pdata->phy, 1000baseT_Full); in xgbe_phy_sfp_phy_settings()
825 XGBE_SET_SUP(&pdata->phy, 1000baseX_Full); in xgbe_phy_sfp_phy_settings()
830 pdata->phy.speed = SPEED_1000; in xgbe_phy_sfp_phy_settings()
831 pdata->phy.duplex = DUPLEX_FULL; in xgbe_phy_sfp_phy_settings()
832 pdata->phy.autoneg = AUTONEG_DISABLE; in xgbe_phy_sfp_phy_settings()
833 pdata->phy.pause_autoneg = AUTONEG_DISABLE; in xgbe_phy_sfp_phy_settings()
840 pdata->phy.speed = SPEED_10000; in xgbe_phy_sfp_phy_settings()
841 pdata->phy.duplex = DUPLEX_FULL; in xgbe_phy_sfp_phy_settings()
842 pdata->phy.autoneg = AUTONEG_DISABLE; in xgbe_phy_sfp_phy_settings()
843 pdata->phy.pause_autoneg = AUTONEG_DISABLE; in xgbe_phy_sfp_phy_settings()
847 XGBE_SET_SUP(&pdata->phy, 10000baseSR_Full); in xgbe_phy_sfp_phy_settings()
850 XGBE_SET_SUP(&pdata->phy, 10000baseLR_Full); in xgbe_phy_sfp_phy_settings()
853 XGBE_SET_SUP(&pdata->phy, 10000baseLRM_Full); in xgbe_phy_sfp_phy_settings()
856 XGBE_SET_SUP(&pdata->phy, 10000baseER_Full); in xgbe_phy_sfp_phy_settings()
859 XGBE_SET_SUP(&pdata->phy, 10000baseCR_Full); in xgbe_phy_sfp_phy_settings()
867 pdata->phy.speed = SPEED_UNKNOWN; in xgbe_phy_sfp_phy_settings()
868 pdata->phy.duplex = DUPLEX_UNKNOWN; in xgbe_phy_sfp_phy_settings()
869 pdata->phy.autoneg = AUTONEG_DISABLE; in xgbe_phy_sfp_phy_settings()
870 pdata->phy.pause_autoneg = AUTONEG_DISABLE; in xgbe_phy_sfp_phy_settings()
878 XGBE_SET_SUP(&pdata->phy, TP); in xgbe_phy_sfp_phy_settings()
881 XGBE_SET_SUP(&pdata->phy, FIBRE); in xgbe_phy_sfp_phy_settings()
885 XGBE_LM_COPY(&pdata->phy, advertising, &pdata->phy, supported); in xgbe_phy_sfp_phy_settings()
888 "advert 0x%x support 0x%x\n", __func__, pdata->phy.speed, in xgbe_phy_sfp_phy_settings()
889 phy_data->sfp_base, pdata->phy.pause_autoneg, in xgbe_phy_sfp_phy_settings()
890 pdata->phy.advertising, pdata->phy.supported); in xgbe_phy_sfp_phy_settings()
927 xgbe_phy_free_phy_device(struct xgbe_prv_data *pdata) in xgbe_phy_free_phy_device() argument
929 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_free_phy_device()
934 if (pdata->axgbe_miibus != NULL) { in xgbe_phy_free_phy_device()
935 device_delete_child(pdata->dev, pdata->axgbe_miibus); in xgbe_phy_free_phy_device()
936 pdata->axgbe_miibus = NULL; in xgbe_phy_free_phy_device()
941 xgbe_phy_finisar_phy_quirks(struct xgbe_prv_data *pdata) in xgbe_phy_finisar_phy_quirks() argument
943 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_finisar_phy_quirks()
953 xgbe_phy_mii_write(pdata, phy_data->mdio_addr, 0x16, 0x0001); in xgbe_phy_finisar_phy_quirks()
954 xgbe_phy_mii_write(pdata, phy_data->mdio_addr, 0x00, 0x9140); in xgbe_phy_finisar_phy_quirks()
955 xgbe_phy_mii_write(pdata, phy_data->mdio_addr, 0x16, 0x0000); in xgbe_phy_finisar_phy_quirks()
958 xgbe_phy_mii_write(pdata, phy_data->mdio_addr, 0x1b, 0x9084); in xgbe_phy_finisar_phy_quirks()
959 xgbe_phy_mii_write(pdata, phy_data->mdio_addr, 0x09, 0x0e00); in xgbe_phy_finisar_phy_quirks()
960 xgbe_phy_mii_write(pdata, phy_data->mdio_addr, 0x00, 0x8140); in xgbe_phy_finisar_phy_quirks()
961 xgbe_phy_mii_write(pdata, phy_data->mdio_addr, 0x04, 0x0d01); in xgbe_phy_finisar_phy_quirks()
962 xgbe_phy_mii_write(pdata, phy_data->mdio_addr, 0x00, 0x9140); in xgbe_phy_finisar_phy_quirks()
970 xgbe_phy_belfuse_phy_quirks(struct xgbe_prv_data *pdata) in xgbe_phy_belfuse_phy_quirks() argument
972 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_belfuse_phy_quirks()
985 pdata->an_again = 1; in xgbe_phy_belfuse_phy_quirks()
995 xgbe_phy_mii_write(pdata, phy_data->mdio_addr, 0x18, 0x7007); in xgbe_phy_belfuse_phy_quirks()
996 reg = xgbe_phy_mii_read(pdata, phy_data->mdio_addr, 0x18); in xgbe_phy_belfuse_phy_quirks()
997 xgbe_phy_mii_write(pdata, phy_data->mdio_addr, 0x18, reg & ~0x0080); in xgbe_phy_belfuse_phy_quirks()
1000 xgbe_phy_mii_write(pdata, phy_data->mdio_addr, 0x1c, 0x7c00); in xgbe_phy_belfuse_phy_quirks()
1001 reg = xgbe_phy_mii_read(pdata, phy_data->mdio_addr, 0x1c); in xgbe_phy_belfuse_phy_quirks()
1004 xgbe_phy_mii_write(pdata, phy_data->mdio_addr, 0x1c, 0x8000 | 0x7c00 | in xgbe_phy_belfuse_phy_quirks()
1008 reg = xgbe_phy_mii_read(pdata, phy_data->mdio_addr, 0x00); in xgbe_phy_belfuse_phy_quirks()
1009 xgbe_phy_mii_write(pdata, phy_data->mdio_addr, 0x00, reg | 0x00800); in xgbe_phy_belfuse_phy_quirks()
1012 xgbe_phy_mii_write(pdata, phy_data->mdio_addr, 0x1c, 0x7c00); in xgbe_phy_belfuse_phy_quirks()
1013 reg = xgbe_phy_mii_read(pdata, phy_data->mdio_addr, 0x1c); in xgbe_phy_belfuse_phy_quirks()
1016 xgbe_phy_mii_write(pdata, phy_data->mdio_addr, 0x1c, 0x8000 | 0x7c00 | in xgbe_phy_belfuse_phy_quirks()
1020 reg = xgbe_phy_mii_read(pdata, phy_data->mdio_addr, 0x00); in xgbe_phy_belfuse_phy_quirks()
1021 xgbe_phy_mii_write(pdata, phy_data->mdio_addr, 0x00, reg & ~0x00800); in xgbe_phy_belfuse_phy_quirks()
1024 xgbe_phy_mii_write(pdata, phy_data->mdio_addr, 0x1c, 0x7c00); in xgbe_phy_belfuse_phy_quirks()
1025 reg = xgbe_phy_mii_read(pdata, phy_data->mdio_addr, 0x1c); in xgbe_phy_belfuse_phy_quirks()
1028 xgbe_phy_mii_write(pdata, phy_data->mdio_addr, 0x1c, 0x8000 | 0x7c00 | in xgbe_phy_belfuse_phy_quirks()
1032 reg = xgbe_phy_mii_read(pdata, phy_data->mdio_addr, 0x00); in xgbe_phy_belfuse_phy_quirks()
1033 xgbe_phy_mii_write(pdata, phy_data->mdio_addr, 0x00, reg & ~0x00800); in xgbe_phy_belfuse_phy_quirks()
1041 xgbe_phy_external_phy_quirks(struct xgbe_prv_data *pdata) in xgbe_phy_external_phy_quirks() argument
1043 if (xgbe_phy_belfuse_phy_quirks(pdata)) in xgbe_phy_external_phy_quirks()
1046 if (xgbe_phy_finisar_phy_quirks(pdata)) in xgbe_phy_external_phy_quirks()
1051 xgbe_get_phy_id(struct xgbe_prv_data *pdata) in xgbe_get_phy_id() argument
1053 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_get_phy_id()
1057 phy_reg = xgbe_phy_mii_read(pdata, phy_data->mdio_addr, 0x02); in xgbe_get_phy_id()
1064 phy_reg = xgbe_phy_mii_read(pdata, phy_data->mdio_addr, 0x03); in xgbe_get_phy_id()
1081 xgbe_phy_find_phy_device(struct xgbe_prv_data *pdata) in xgbe_phy_find_phy_device() argument
1083 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_find_phy_device()
1097 pdata->an_again = 0; in xgbe_phy_find_phy_device()
1115 ret = pdata->hw_if.set_ext_mii_mode(pdata, phy_data->mdio_addr, in xgbe_phy_find_phy_device()
1123 ret = xgbe_get_phy_id(pdata); in xgbe_phy_find_phy_device()
1129 xgbe_phy_external_phy_quirks(pdata); in xgbe_phy_find_phy_device()
1135 xgbe_phy_sfp_external_phy(struct xgbe_prv_data *pdata) in xgbe_phy_sfp_external_phy() argument
1137 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_sfp_external_phy()
1151 ret = xgbe_phy_i2c_mii_read(pdata, MII_BMCR); in xgbe_phy_sfp_external_phy()
1165 ret = mii_attach(pdata->dev, &pdata->axgbe_miibus, pdata->netdev, in xgbe_phy_sfp_external_phy()
1168 pdata->mdio_addr, MII_OFFSET_ANY, MIIF_FORCEANEG); in xgbe_phy_sfp_external_phy()
1222 xgbe_phy_sfp_parse_eeprom(struct xgbe_prv_data *pdata) in xgbe_phy_sfp_parse_eeprom() argument
1224 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_sfp_parse_eeprom()
1339 xgbe_phy_sfp_eeprom_info(struct xgbe_prv_data *pdata, in xgbe_phy_sfp_eeprom_info() argument
1383 dump_sfp_eeprom(struct xgbe_prv_data *pdata, uint8_t *sfp_base) in dump_sfp_eeprom() argument
1394 xgbe_phy_sfp_read_eeprom(struct xgbe_prv_data *pdata) in xgbe_phy_sfp_read_eeprom() argument
1396 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_sfp_read_eeprom()
1401 ret = xgbe_phy_sfp_get_mux(pdata); in xgbe_phy_sfp_read_eeprom()
1409 ret = xgbe_phy_i2c_read(pdata, XGBE_SFP_SERIAL_ID_ADDRESS, in xgbe_phy_sfp_read_eeprom()
1420 dump_sfp_eeprom(pdata, base); in xgbe_phy_sfp_read_eeprom()
1441 xgbe_phy_sfp_eeprom_info(pdata, &sfp_eeprom); in xgbe_phy_sfp_read_eeprom()
1445 xgbe_phy_free_phy_device(pdata); in xgbe_phy_sfp_read_eeprom()
1450 xgbe_phy_sfp_put_mux(pdata); in xgbe_phy_sfp_read_eeprom()
1456 xgbe_phy_sfp_signals(struct xgbe_prv_data *pdata) in xgbe_phy_sfp_signals() argument
1458 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_sfp_signals()
1467 ret = xgbe_phy_sfp_get_mux(pdata); in xgbe_phy_sfp_signals()
1474 ret = xgbe_phy_i2c_read(pdata, phy_data->sfp_gpio_address, &gpio_reg, in xgbe_phy_sfp_signals()
1495 xgbe_phy_sfp_put_mux(pdata); in xgbe_phy_sfp_signals()
1499 xgbe_read_gpio_expander(struct xgbe_prv_data *pdata) in xgbe_read_gpio_expander() argument
1501 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_read_gpio_expander()
1505 ret = xgbe_phy_sfp_get_mux(pdata); in xgbe_read_gpio_expander()
1513 ret = xgbe_phy_i2c_read(pdata, phy_data->sfp_gpio_address, in xgbe_read_gpio_expander()
1534 xgbe_phy_sfp_put_mux(pdata); in xgbe_read_gpio_expander()
1540 xgbe_log_gpio_expander(struct xgbe_prv_data *pdata) in xgbe_log_gpio_expander() argument
1542 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_log_gpio_expander()
1551 xgbe_phy_validate_gpio_expander(struct xgbe_prv_data *pdata) in xgbe_phy_validate_gpio_expander() argument
1553 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_validate_gpio_expander()
1563 ret = xgbe_phy_get_comm_ownership(pdata); in xgbe_phy_validate_gpio_expander()
1567 ret = xgbe_read_gpio_expander(pdata); in xgbe_phy_validate_gpio_expander()
1571 ret = xgbe_phy_sfp_get_mux(pdata); in xgbe_phy_validate_gpio_expander()
1580 xgbe_log_gpio_expander(pdata); in xgbe_phy_validate_gpio_expander()
1583 ret = xgbe_phy_i2c_write(pdata, phy_data->sfp_gpio_address, in xgbe_phy_validate_gpio_expander()
1595 xgbe_log_gpio_expander(pdata); in xgbe_phy_validate_gpio_expander()
1605 ret = xgbe_phy_i2c_write(pdata, phy_data->sfp_gpio_address, in xgbe_phy_validate_gpio_expander()
1617 xgbe_phy_sfp_put_mux(pdata); in xgbe_phy_validate_gpio_expander()
1620 xgbe_phy_put_comm_ownership(pdata); in xgbe_phy_validate_gpio_expander()
1626 xgbe_phy_sfp_mod_absent(struct xgbe_prv_data *pdata) in xgbe_phy_sfp_mod_absent() argument
1628 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_sfp_mod_absent()
1630 xgbe_phy_free_phy_device(pdata); in xgbe_phy_sfp_mod_absent()
1649 xgbe_phy_sfp_detect(struct xgbe_prv_data *pdata) in xgbe_phy_sfp_detect() argument
1651 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_sfp_detect()
1654 ret = xgbe_phy_get_comm_ownership(pdata); in xgbe_phy_sfp_detect()
1659 xgbe_phy_sfp_signals(pdata); in xgbe_phy_sfp_detect()
1663 xgbe_phy_sfp_mod_absent(pdata); in xgbe_phy_sfp_detect()
1667 ret = xgbe_phy_sfp_read_eeprom(pdata); in xgbe_phy_sfp_detect()
1671 ret = xgbe_read_gpio_expander(pdata); in xgbe_phy_sfp_detect()
1674 xgbe_log_gpio_expander(pdata); in xgbe_phy_sfp_detect()
1677 xgbe_phy_sfp_mod_absent(pdata); in xgbe_phy_sfp_detect()
1681 xgbe_phy_sfp_parse_eeprom(pdata); in xgbe_phy_sfp_detect()
1683 xgbe_phy_sfp_external_phy(pdata); in xgbe_phy_sfp_detect()
1686 xgbe_phy_sfp_phy_settings(pdata); in xgbe_phy_sfp_detect()
1689 "pause_autoneg: 0x%x\n", __func__, pdata->phy.speed, in xgbe_phy_sfp_detect()
1690 pdata->phy.duplex, pdata->phy.autoneg, pdata->phy.pause_autoneg); in xgbe_phy_sfp_detect()
1692 xgbe_phy_put_comm_ownership(pdata); in xgbe_phy_sfp_detect()
1696 xgbe_phy_module_eeprom(struct xgbe_prv_data *pdata) in xgbe_phy_module_eeprom() argument
1698 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_module_eeprom()
1713 ret = xgbe_phy_get_comm_ownership(pdata); in xgbe_phy_module_eeprom()
1719 ret = xgbe_phy_sfp_get_mux(pdata); in xgbe_phy_module_eeprom()
1728 ret = xgbe_phy_i2c_read(pdata, XGBE_SFP_SERIAL_ID_ADDRESS, in xgbe_phy_module_eeprom()
1742 ret = xgbe_phy_i2c_read(pdata, XGBE_SFP_DIAG_INFO_ADDRESS, in xgbe_phy_module_eeprom()
1754 xgbe_phy_sfp_put_mux(pdata); in xgbe_phy_module_eeprom()
1757 xgbe_phy_put_comm_ownership(pdata); in xgbe_phy_module_eeprom()
1764 xgbe_phy_module_info(struct xgbe_prv_data *pdata) in xgbe_phy_module_info() argument
1766 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_module_info()
1778 xgbe_phy_phydev_flowctrl(struct xgbe_prv_data *pdata) in xgbe_phy_phydev_flowctrl() argument
1780 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_phydev_flowctrl()
1782 pdata->phy.tx_pause = 0; in xgbe_phy_phydev_flowctrl()
1783 pdata->phy.rx_pause = 0; in xgbe_phy_phydev_flowctrl()
1788 if (pdata->phy.pause) in xgbe_phy_phydev_flowctrl()
1789 XGBE_SET_LP_ADV(&pdata->phy, Pause); in xgbe_phy_phydev_flowctrl()
1791 if (pdata->phy.asym_pause) in xgbe_phy_phydev_flowctrl()
1792 XGBE_SET_LP_ADV(&pdata->phy, Asym_Pause); in xgbe_phy_phydev_flowctrl()
1795 pdata->phy.tx_pause, pdata->phy.rx_pause); in xgbe_phy_phydev_flowctrl()
1799 xgbe_phy_an37_sgmii_outcome(struct xgbe_prv_data *pdata) in xgbe_phy_an37_sgmii_outcome() argument
1803 XGBE_SET_LP_ADV(&pdata->phy, Autoneg); in xgbe_phy_an37_sgmii_outcome()
1804 XGBE_SET_LP_ADV(&pdata->phy, TP); in xgbe_phy_an37_sgmii_outcome()
1807 pdata->phy.pause_autoneg); in xgbe_phy_an37_sgmii_outcome()
1810 if (pdata->phy.pause_autoneg) in xgbe_phy_an37_sgmii_outcome()
1811 xgbe_phy_phydev_flowctrl(pdata); in xgbe_phy_an37_sgmii_outcome()
1813 switch (pdata->an_status & XGBE_SGMII_AN_LINK_SPEED) { in xgbe_phy_an37_sgmii_outcome()
1815 if (pdata->an_status & XGBE_SGMII_AN_LINK_DUPLEX) { in xgbe_phy_an37_sgmii_outcome()
1816 XGBE_SET_LP_ADV(&pdata->phy, 100baseT_Full); in xgbe_phy_an37_sgmii_outcome()
1820 XGBE_SET_LP_ADV(&pdata->phy, 100baseT_Half); in xgbe_phy_an37_sgmii_outcome()
1827 if (pdata->an_status & XGBE_SGMII_AN_LINK_DUPLEX) { in xgbe_phy_an37_sgmii_outcome()
1828 XGBE_SET_LP_ADV(&pdata->phy, 1000baseT_Full); in xgbe_phy_an37_sgmii_outcome()
1832 XGBE_SET_LP_ADV(&pdata->phy, 1000baseT_Half); in xgbe_phy_an37_sgmii_outcome()
1842 xgbe_phy_an37_outcome(struct xgbe_prv_data *pdata) in xgbe_phy_an37_outcome() argument
1847 XGBE_SET_LP_ADV(&pdata->phy, Autoneg); in xgbe_phy_an37_outcome()
1848 XGBE_SET_LP_ADV(&pdata->phy, FIBRE); in xgbe_phy_an37_outcome()
1851 ad_reg = XMDIO_READ(pdata, MDIO_MMD_VEND2, MDIO_VEND2_AN_ADVERTISE); in xgbe_phy_an37_outcome()
1852 lp_reg = XMDIO_READ(pdata, MDIO_MMD_VEND2, MDIO_VEND2_AN_LP_ABILITY); in xgbe_phy_an37_outcome()
1854 XGBE_SET_LP_ADV(&pdata->phy, Pause); in xgbe_phy_an37_outcome()
1856 XGBE_SET_LP_ADV(&pdata->phy, Asym_Pause); in xgbe_phy_an37_outcome()
1859 __func__, pdata->phy.pause_autoneg, ad_reg, lp_reg); in xgbe_phy_an37_outcome()
1861 if (pdata->phy.pause_autoneg) { in xgbe_phy_an37_outcome()
1863 pdata->phy.tx_pause = 0; in xgbe_phy_an37_outcome()
1864 pdata->phy.rx_pause = 0; in xgbe_phy_an37_outcome()
1867 pdata->phy.tx_pause = 1; in xgbe_phy_an37_outcome()
1868 pdata->phy.rx_pause = 1; in xgbe_phy_an37_outcome()
1871 pdata->phy.rx_pause = 1; in xgbe_phy_an37_outcome()
1873 pdata->phy.tx_pause = 1; in xgbe_phy_an37_outcome()
1877 axgbe_printf(1, "%s: pause tx/rx %d/%d\n", __func__, pdata->phy.tx_pause, in xgbe_phy_an37_outcome()
1878 pdata->phy.rx_pause); in xgbe_phy_an37_outcome()
1881 XGBE_SET_LP_ADV(&pdata->phy, 1000baseX_Full); in xgbe_phy_an37_outcome()
1891 xgbe_phy_an73_redrv_outcome(struct xgbe_prv_data *pdata) in xgbe_phy_an73_redrv_outcome() argument
1893 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_an73_redrv_outcome()
1897 XGBE_SET_LP_ADV(&pdata->phy, Autoneg); in xgbe_phy_an73_redrv_outcome()
1898 XGBE_SET_LP_ADV(&pdata->phy, Backplane); in xgbe_phy_an73_redrv_outcome()
1901 pdata->phy.pause_autoneg); in xgbe_phy_an73_redrv_outcome()
1904 if (pdata->phy.pause_autoneg) in xgbe_phy_an73_redrv_outcome()
1905 xgbe_phy_phydev_flowctrl(pdata); in xgbe_phy_an73_redrv_outcome()
1908 ad_reg = XMDIO_READ(pdata, MDIO_MMD_AN, MDIO_AN_ADVERTISE + 1); in xgbe_phy_an73_redrv_outcome()
1909 lp_reg = XMDIO_READ(pdata, MDIO_MMD_AN, MDIO_AN_LPA + 1); in xgbe_phy_an73_redrv_outcome()
1911 XGBE_SET_LP_ADV(&pdata->phy, 10000baseKR_Full); in xgbe_phy_an73_redrv_outcome()
1913 XGBE_SET_LP_ADV(&pdata->phy, 1000baseKX_Full); in xgbe_phy_an73_redrv_outcome()
1937 (pdata->phy.speed == SPEED_100)) in xgbe_phy_an73_redrv_outcome()
1952 (pdata->phy.speed == SPEED_100)) in xgbe_phy_an73_redrv_outcome()
1963 ad_reg = XMDIO_READ(pdata, MDIO_MMD_AN, MDIO_AN_ADVERTISE + 2); in xgbe_phy_an73_redrv_outcome()
1964 lp_reg = XMDIO_READ(pdata, MDIO_MMD_AN, MDIO_AN_LPA + 2); in xgbe_phy_an73_redrv_outcome()
1966 XGBE_SET_LP_ADV(&pdata->phy, 10000baseR_FEC); in xgbe_phy_an73_redrv_outcome()
1972 xgbe_phy_an73_outcome(struct xgbe_prv_data *pdata) in xgbe_phy_an73_outcome() argument
1977 XGBE_SET_LP_ADV(&pdata->phy, Autoneg); in xgbe_phy_an73_outcome()
1978 XGBE_SET_LP_ADV(&pdata->phy, Backplane); in xgbe_phy_an73_outcome()
1981 ad_reg = XMDIO_READ(pdata, MDIO_MMD_AN, MDIO_AN_ADVERTISE); in xgbe_phy_an73_outcome()
1982 lp_reg = XMDIO_READ(pdata, MDIO_MMD_AN, MDIO_AN_LPA); in xgbe_phy_an73_outcome()
1984 XGBE_SET_LP_ADV(&pdata->phy, Pause); in xgbe_phy_an73_outcome()
1986 XGBE_SET_LP_ADV(&pdata->phy, Asym_Pause); in xgbe_phy_an73_outcome()
1989 __func__, pdata->phy.pause_autoneg, ad_reg, lp_reg); in xgbe_phy_an73_outcome()
1991 if (pdata->phy.pause_autoneg) { in xgbe_phy_an73_outcome()
1993 pdata->phy.tx_pause = 0; in xgbe_phy_an73_outcome()
1994 pdata->phy.rx_pause = 0; in xgbe_phy_an73_outcome()
1997 pdata->phy.tx_pause = 1; in xgbe_phy_an73_outcome()
1998 pdata->phy.rx_pause = 1; in xgbe_phy_an73_outcome()
2001 pdata->phy.rx_pause = 1; in xgbe_phy_an73_outcome()
2003 pdata->phy.tx_pause = 1; in xgbe_phy_an73_outcome()
2007 axgbe_printf(1, "%s: pause tx/rx %d/%d\n", __func__, pdata->phy.tx_pause, in xgbe_phy_an73_outcome()
2008 pdata->phy.rx_pause); in xgbe_phy_an73_outcome()
2011 ad_reg = XMDIO_READ(pdata, MDIO_MMD_AN, MDIO_AN_ADVERTISE + 1); in xgbe_phy_an73_outcome()
2012 lp_reg = XMDIO_READ(pdata, MDIO_MMD_AN, MDIO_AN_LPA + 1); in xgbe_phy_an73_outcome()
2014 XGBE_SET_LP_ADV(&pdata->phy, 10000baseKR_Full); in xgbe_phy_an73_outcome()
2016 XGBE_SET_LP_ADV(&pdata->phy, 1000baseKX_Full); in xgbe_phy_an73_outcome()
2027 ad_reg = XMDIO_READ(pdata, MDIO_MMD_AN, MDIO_AN_ADVERTISE + 2); in xgbe_phy_an73_outcome()
2028 lp_reg = XMDIO_READ(pdata, MDIO_MMD_AN, MDIO_AN_LPA + 2); in xgbe_phy_an73_outcome()
2030 XGBE_SET_LP_ADV(&pdata->phy, 10000baseR_FEC); in xgbe_phy_an73_outcome()
2036 xgbe_phy_an_outcome(struct xgbe_prv_data *pdata) in xgbe_phy_an_outcome() argument
2038 switch (pdata->an_mode) { in xgbe_phy_an_outcome()
2040 return (xgbe_phy_an73_outcome(pdata)); in xgbe_phy_an_outcome()
2042 return (xgbe_phy_an73_redrv_outcome(pdata)); in xgbe_phy_an_outcome()
2044 return (xgbe_phy_an37_outcome(pdata)); in xgbe_phy_an_outcome()
2046 return (xgbe_phy_an37_sgmii_outcome(pdata)); in xgbe_phy_an_outcome()
2053 xgbe_phy_an_advertising(struct xgbe_prv_data *pdata, struct xgbe_phy *dphy) in xgbe_phy_an_advertising() argument
2055 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_an_advertising()
2057 XGBE_LM_COPY(dphy, advertising, &pdata->phy, advertising); in xgbe_phy_an_advertising()
2068 if (pdata->fec_ability & MDIO_PMA_10GBR_FECABLE_ABLE) in xgbe_phy_an_advertising()
2085 (pdata->phy.speed == SPEED_10000)) in xgbe_phy_an_advertising()
2113 xgbe_phy_an_config(struct xgbe_prv_data *pdata) in xgbe_phy_an_config() argument
2115 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_an_config()
2118 ret = xgbe_phy_find_phy_device(pdata); in xgbe_phy_an_config()
2147 xgbe_phy_an_mode(struct xgbe_prv_data *pdata) in xgbe_phy_an_mode() argument
2149 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_an_mode()
2178 xgbe_phy_set_redrv_mode_mdio(struct xgbe_prv_data *pdata, in xgbe_phy_set_redrv_mode_mdio() argument
2181 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_set_redrv_mode_mdio()
2187 return (pdata->hw_if.write_ext_mii_regs(pdata, phy_data->redrv_addr, in xgbe_phy_set_redrv_mode_mdio()
2192 xgbe_phy_set_redrv_mode_i2c(struct xgbe_prv_data *pdata, in xgbe_phy_set_redrv_mode_i2c() argument
2195 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_set_redrv_mode_i2c()
2202 ret = xgbe_phy_redrv_write(pdata, redrv_reg, mode); in xgbe_phy_set_redrv_mode_i2c()
2208 xgbe_phy_set_redrv_mode(struct xgbe_prv_data *pdata) in xgbe_phy_set_redrv_mode() argument
2210 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_set_redrv_mode()
2223 ret = xgbe_phy_get_comm_ownership(pdata); in xgbe_phy_set_redrv_mode()
2229 xgbe_phy_set_redrv_mode_i2c(pdata, mode); in xgbe_phy_set_redrv_mode()
2231 xgbe_phy_set_redrv_mode_mdio(pdata, mode); in xgbe_phy_set_redrv_mode()
2233 xgbe_phy_put_comm_ownership(pdata); in xgbe_phy_set_redrv_mode()
2237 xgbe_phy_pll_ctrl(struct xgbe_prv_data *pdata, bool enable) in xgbe_phy_pll_ctrl() argument
2239 XMDIO_WRITE_BITS(pdata, MDIO_MMD_PMAPMD, MDIO_VEND2_PMA_MISC_CTRL0, in xgbe_phy_pll_ctrl()
2247 xgbe_phy_rx_reset(struct xgbe_prv_data *pdata) in xgbe_phy_rx_reset() argument
2251 reg = XMDIO_READ_BITS(pdata, MDIO_MMD_PCS, MDIO_PCS_DIGITAL_STAT, in xgbe_phy_rx_reset()
2260 XMDIO_WRITE_BITS(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_RX_CTRL1, in xgbe_phy_rx_reset()
2263 XMDIO_WRITE_BITS(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_RX_CTRL1, in xgbe_phy_rx_reset()
2271 xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata, unsigned int cmd, in xgbe_phy_perform_ratechange() argument
2277 xgbe_phy_pll_ctrl(pdata, false); in xgbe_phy_perform_ratechange()
2280 if (XP_IOREAD_BITS(pdata, XP_DRIVER_INT_RO, STATUS)) { in xgbe_phy_perform_ratechange()
2282 xgbe_phy_rx_reset(pdata); in xgbe_phy_perform_ratechange()
2290 XP_IOWRITE(pdata, XP_DRIVER_SCRATCH_0, s0); in xgbe_phy_perform_ratechange()
2291 XP_IOWRITE(pdata, XP_DRIVER_SCRATCH_1, 0); in xgbe_phy_perform_ratechange()
2292 XP_IOWRITE_BITS(pdata, XP_DRIVER_INT_REQ, REQUEST, 1); in xgbe_phy_perform_ratechange()
2297 if (!XP_IOREAD_BITS(pdata, XP_DRIVER_INT_RO, STATUS)) { in xgbe_phy_perform_ratechange()
2308 xgbe_phy_pll_ctrl(pdata, true); in xgbe_phy_perform_ratechange()
2312 xgbe_phy_rrc(struct xgbe_prv_data *pdata) in xgbe_phy_rrc() argument
2315 xgbe_phy_perform_ratechange(pdata, 5, 0); in xgbe_phy_rrc()
2321 xgbe_phy_power_off(struct xgbe_prv_data *pdata) in xgbe_phy_power_off() argument
2323 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_power_off()
2326 xgbe_phy_perform_ratechange(pdata, 0, 0); in xgbe_phy_power_off()
2334 xgbe_phy_sfi_mode(struct xgbe_prv_data *pdata) in xgbe_phy_sfi_mode() argument
2336 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_sfi_mode()
2338 xgbe_phy_set_redrv_mode(pdata); in xgbe_phy_sfi_mode()
2345 xgbe_phy_perform_ratechange(pdata, 3, 0); in xgbe_phy_sfi_mode()
2348 xgbe_phy_perform_ratechange(pdata, 3, 1); in xgbe_phy_sfi_mode()
2350 xgbe_phy_perform_ratechange(pdata, 3, 2); in xgbe_phy_sfi_mode()
2352 xgbe_phy_perform_ratechange(pdata, 3, 3); in xgbe_phy_sfi_mode()
2361 xgbe_phy_x_mode(struct xgbe_prv_data *pdata) in xgbe_phy_x_mode() argument
2363 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_x_mode()
2365 xgbe_phy_set_redrv_mode(pdata); in xgbe_phy_x_mode()
2368 xgbe_phy_perform_ratechange(pdata, 1, 3); in xgbe_phy_x_mode()
2376 xgbe_phy_sgmii_1000_mode(struct xgbe_prv_data *pdata) in xgbe_phy_sgmii_1000_mode() argument
2378 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_sgmii_1000_mode()
2380 xgbe_phy_set_redrv_mode(pdata); in xgbe_phy_sgmii_1000_mode()
2383 xgbe_phy_perform_ratechange(pdata, 1, 2); in xgbe_phy_sgmii_1000_mode()
2391 xgbe_phy_sgmii_100_mode(struct xgbe_prv_data *pdata) in xgbe_phy_sgmii_100_mode() argument
2393 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_sgmii_100_mode()
2395 xgbe_phy_set_redrv_mode(pdata); in xgbe_phy_sgmii_100_mode()
2398 xgbe_phy_perform_ratechange(pdata, 1, 1); in xgbe_phy_sgmii_100_mode()
2406 xgbe_phy_kr_mode(struct xgbe_prv_data *pdata) in xgbe_phy_kr_mode() argument
2408 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_kr_mode()
2410 xgbe_phy_set_redrv_mode(pdata); in xgbe_phy_kr_mode()
2413 xgbe_phy_perform_ratechange(pdata, 4, 0); in xgbe_phy_kr_mode()
2421 xgbe_phy_kx_2500_mode(struct xgbe_prv_data *pdata) in xgbe_phy_kx_2500_mode() argument
2423 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_kx_2500_mode()
2425 xgbe_phy_set_redrv_mode(pdata); in xgbe_phy_kx_2500_mode()
2428 xgbe_phy_perform_ratechange(pdata, 2, 0); in xgbe_phy_kx_2500_mode()
2436 xgbe_phy_kx_1000_mode(struct xgbe_prv_data *pdata) in xgbe_phy_kx_1000_mode() argument
2438 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_kx_1000_mode()
2440 xgbe_phy_set_redrv_mode(pdata); in xgbe_phy_kx_1000_mode()
2443 xgbe_phy_perform_ratechange(pdata, 1, 3); in xgbe_phy_kx_1000_mode()
2451 xgbe_phy_cur_mode(struct xgbe_prv_data *pdata) in xgbe_phy_cur_mode() argument
2453 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_cur_mode()
2459 xgbe_phy_switch_baset_mode(struct xgbe_prv_data *pdata) in xgbe_phy_switch_baset_mode() argument
2461 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_switch_baset_mode()
2465 return (xgbe_phy_cur_mode(pdata)); in xgbe_phy_switch_baset_mode()
2467 switch (xgbe_phy_cur_mode(pdata)) { in xgbe_phy_switch_baset_mode()
2478 xgbe_phy_switch_bp_2500_mode(struct xgbe_prv_data *pdata) in xgbe_phy_switch_bp_2500_mode() argument
2484 xgbe_phy_switch_bp_mode(struct xgbe_prv_data *pdata) in xgbe_phy_switch_bp_mode() argument
2487 switch (xgbe_phy_cur_mode(pdata)) { in xgbe_phy_switch_bp_mode()
2497 xgbe_phy_switch_mode(struct xgbe_prv_data *pdata) in xgbe_phy_switch_mode() argument
2499 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_switch_mode()
2503 return (xgbe_phy_switch_bp_mode(pdata)); in xgbe_phy_switch_mode()
2505 return (xgbe_phy_switch_bp_2500_mode(pdata)); in xgbe_phy_switch_mode()
2509 return (xgbe_phy_switch_baset_mode(pdata)); in xgbe_phy_switch_mode()
2514 return (xgbe_phy_cur_mode(pdata)); in xgbe_phy_switch_mode()
2594 xgbe_phy_get_mode(struct xgbe_prv_data *pdata, int speed) in xgbe_phy_get_mode() argument
2596 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_get_mode()
2618 xgbe_phy_set_mode(struct xgbe_prv_data *pdata, enum xgbe_mode mode) in xgbe_phy_set_mode() argument
2622 xgbe_phy_kx_1000_mode(pdata); in xgbe_phy_set_mode()
2625 xgbe_phy_kx_2500_mode(pdata); in xgbe_phy_set_mode()
2628 xgbe_phy_kr_mode(pdata); in xgbe_phy_set_mode()
2631 xgbe_phy_sgmii_100_mode(pdata); in xgbe_phy_set_mode()
2634 xgbe_phy_sgmii_1000_mode(pdata); in xgbe_phy_set_mode()
2637 xgbe_phy_x_mode(pdata); in xgbe_phy_set_mode()
2640 xgbe_phy_sfi_mode(pdata); in xgbe_phy_set_mode()
2648 xgbe_phy_get_type(struct xgbe_prv_data *pdata, struct ifmediareq * ifmr) in xgbe_phy_get_type() argument
2650 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_get_type()
2652 switch (pdata->phy.speed) { in xgbe_phy_get_type()
2703 xgbe_phy_check_mode(struct xgbe_prv_data *pdata, enum xgbe_mode mode, in xgbe_phy_check_mode() argument
2707 if (pdata->phy.autoneg == AUTONEG_ENABLE) in xgbe_phy_check_mode()
2712 cur_mode = xgbe_phy_get_mode(pdata, pdata->phy.speed); in xgbe_phy_check_mode()
2721 xgbe_phy_use_basex_mode(struct xgbe_prv_data *pdata, enum xgbe_mode mode) in xgbe_phy_use_basex_mode() argument
2726 return (xgbe_phy_check_mode(pdata, mode, XGBE_ADV(&pdata->phy, in xgbe_phy_use_basex_mode()
2729 return (xgbe_phy_check_mode(pdata, mode, XGBE_ADV(&pdata->phy, in xgbe_phy_use_basex_mode()
2737 xgbe_phy_use_baset_mode(struct xgbe_prv_data *pdata, enum xgbe_mode mode) in xgbe_phy_use_baset_mode() argument
2743 return (xgbe_phy_check_mode(pdata, mode, XGBE_ADV(&pdata->phy, in xgbe_phy_use_baset_mode()
2746 return (xgbe_phy_check_mode(pdata, mode, XGBE_ADV(&pdata->phy, in xgbe_phy_use_baset_mode()
2749 return (xgbe_phy_check_mode(pdata, mode, XGBE_ADV(&pdata->phy, in xgbe_phy_use_baset_mode()
2752 return (xgbe_phy_check_mode(pdata, mode, XGBE_ADV(&pdata->phy, in xgbe_phy_use_baset_mode()
2760 xgbe_phy_use_sfp_mode(struct xgbe_prv_data *pdata, enum xgbe_mode mode) in xgbe_phy_use_sfp_mode() argument
2762 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_use_sfp_mode()
2768 return (xgbe_phy_check_mode(pdata, mode, in xgbe_phy_use_sfp_mode()
2769 XGBE_ADV(&pdata->phy, 1000baseX_Full))); in xgbe_phy_use_sfp_mode()
2773 return (xgbe_phy_check_mode(pdata, mode, in xgbe_phy_use_sfp_mode()
2774 XGBE_ADV(&pdata->phy, 100baseT_Full))); in xgbe_phy_use_sfp_mode()
2778 return (xgbe_phy_check_mode(pdata, mode, in xgbe_phy_use_sfp_mode()
2779 XGBE_ADV(&pdata->phy, 1000baseT_Full))); in xgbe_phy_use_sfp_mode()
2783 return (xgbe_phy_check_mode(pdata, mode, in xgbe_phy_use_sfp_mode()
2784 XGBE_ADV(&pdata->phy, 10000baseSR_Full) || in xgbe_phy_use_sfp_mode()
2785 XGBE_ADV(&pdata->phy, 10000baseLR_Full) || in xgbe_phy_use_sfp_mode()
2786 XGBE_ADV(&pdata->phy, 10000baseLRM_Full) || in xgbe_phy_use_sfp_mode()
2787 XGBE_ADV(&pdata->phy, 10000baseER_Full) || in xgbe_phy_use_sfp_mode()
2788 XGBE_ADV(&pdata->phy, 10000baseCR_Full))); in xgbe_phy_use_sfp_mode()
2795 xgbe_phy_use_bp_2500_mode(struct xgbe_prv_data *pdata, enum xgbe_mode mode) in xgbe_phy_use_bp_2500_mode() argument
2800 return (xgbe_phy_check_mode(pdata, mode, in xgbe_phy_use_bp_2500_mode()
2801 XGBE_ADV(&pdata->phy, 2500baseX_Full))); in xgbe_phy_use_bp_2500_mode()
2808 xgbe_phy_use_bp_mode(struct xgbe_prv_data *pdata, enum xgbe_mode mode) in xgbe_phy_use_bp_mode() argument
2813 return (xgbe_phy_check_mode(pdata, mode, in xgbe_phy_use_bp_mode()
2814 XGBE_ADV(&pdata->phy, 1000baseKX_Full))); in xgbe_phy_use_bp_mode()
2816 return (xgbe_phy_check_mode(pdata, mode, in xgbe_phy_use_bp_mode()
2817 XGBE_ADV(&pdata->phy, 10000baseKR_Full))); in xgbe_phy_use_bp_mode()
2824 xgbe_phy_use_mode(struct xgbe_prv_data *pdata, enum xgbe_mode mode) in xgbe_phy_use_mode() argument
2826 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_use_mode()
2830 return (xgbe_phy_use_bp_mode(pdata, mode)); in xgbe_phy_use_mode()
2832 return (xgbe_phy_use_bp_2500_mode(pdata, mode)); in xgbe_phy_use_mode()
2835 xgbe_phy_use_baset_mode(pdata, mode) ? "found" : "Not found"); in xgbe_phy_use_mode()
2838 return (xgbe_phy_use_baset_mode(pdata, mode)); in xgbe_phy_use_mode()
2841 return (xgbe_phy_use_basex_mode(pdata, mode)); in xgbe_phy_use_mode()
2843 return (xgbe_phy_use_sfp_mode(pdata, mode)); in xgbe_phy_use_mode()
2924 xgbe_phy_valid_speed(struct xgbe_prv_data *pdata, int speed) in xgbe_phy_valid_speed() argument
2926 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_valid_speed()
2948 xgbe_upd_link(struct xgbe_prv_data *pdata) in xgbe_upd_link() argument
2952 axgbe_printf(2, "%s: Link %d\n", __func__, pdata->phy.link); in xgbe_upd_link()
2953 reg = xgbe_phy_mii_read(pdata, pdata->mdio_addr, MII_BMSR); in xgbe_upd_link()
2954 reg = xgbe_phy_mii_read(pdata, pdata->mdio_addr, MII_BMSR); in xgbe_upd_link()
2959 pdata->phy.link = 0; in xgbe_upd_link()
2961 pdata->phy.link = 1; in xgbe_upd_link()
2963 axgbe_printf(2, "Link: %d updated reg %#x\n", pdata->phy.link, reg); in xgbe_upd_link()
2968 xgbe_phy_read_status(struct xgbe_prv_data *pdata) in xgbe_phy_read_status() argument
2976 ret = xgbe_upd_link(pdata); in xgbe_phy_read_status()
2982 if (AUTONEG_ENABLE == pdata->phy.autoneg) { in xgbe_phy_read_status()
2983 if (pdata->phy.supported == SUPPORTED_1000baseT_Half || in xgbe_phy_read_status()
2984 pdata->phy.supported == SUPPORTED_1000baseT_Full) { in xgbe_phy_read_status()
2985 lpagb = xgbe_phy_mii_read(pdata, pdata->mdio_addr, in xgbe_phy_read_status()
2990 adv = xgbe_phy_mii_read(pdata, pdata->mdio_addr, in xgbe_phy_read_status()
3004 if (pdata->phy.supported == SUPPORTED_1000baseT_Half) in xgbe_phy_read_status()
3005 XGBE_SET_ADV(&pdata->phy, 1000baseT_Half); in xgbe_phy_read_status()
3006 else if (pdata->phy.supported == SUPPORTED_1000baseT_Full) in xgbe_phy_read_status()
3007 XGBE_SET_ADV(&pdata->phy, 1000baseT_Full); in xgbe_phy_read_status()
3012 lpa = xgbe_phy_mii_read(pdata, pdata->mdio_addr, MII_ANLPAR); in xgbe_phy_read_status()
3016 if (pdata->phy.supported == SUPPORTED_Autoneg) in xgbe_phy_read_status()
3017 XGBE_SET_ADV(&pdata->phy, Autoneg); in xgbe_phy_read_status()
3019 adv = xgbe_phy_mii_read(pdata, pdata->mdio_addr, MII_ANAR); in xgbe_phy_read_status()
3025 pdata->phy.speed = SPEED_10; in xgbe_phy_read_status()
3026 pdata->phy.duplex = DUPLEX_HALF; in xgbe_phy_read_status()
3027 pdata->phy.pause = 0; in xgbe_phy_read_status()
3028 pdata->phy.asym_pause = 0; in xgbe_phy_read_status()
3035 pdata->phy.speed = SPEED_1000; in xgbe_phy_read_status()
3038 pdata->phy.duplex = DUPLEX_FULL; in xgbe_phy_read_status()
3041 pdata->phy.speed = SPEED_100; in xgbe_phy_read_status()
3044 pdata->phy.duplex = DUPLEX_FULL; in xgbe_phy_read_status()
3047 pdata->phy.duplex = DUPLEX_FULL; in xgbe_phy_read_status()
3049 if (pdata->phy.duplex == DUPLEX_FULL) { in xgbe_phy_read_status()
3050 pdata->phy.pause = lpa & ANLPAR_FC ? 1 : 0; in xgbe_phy_read_status()
3051 pdata->phy.asym_pause = lpa & LPA_PAUSE_ASYM ? 1 : 0; in xgbe_phy_read_status()
3054 int bmcr = xgbe_phy_mii_read(pdata, pdata->mdio_addr, MII_BMCR); in xgbe_phy_read_status()
3059 pdata->phy.duplex = DUPLEX_FULL; in xgbe_phy_read_status()
3061 pdata->phy.duplex = DUPLEX_HALF; in xgbe_phy_read_status()
3064 pdata->phy.speed = SPEED_1000; in xgbe_phy_read_status()
3066 pdata->phy.speed = SPEED_100; in xgbe_phy_read_status()
3068 pdata->phy.speed = SPEED_10; in xgbe_phy_read_status()
3070 pdata->phy.pause = 0; in xgbe_phy_read_status()
3071 pdata->phy.asym_pause = 0; in xgbe_phy_read_status()
3073 "autoneg %#x\n", __func__, pdata->phy.speed, in xgbe_phy_read_status()
3074 pdata->phy.duplex, pdata->phy.link, pdata->phy.autoneg); in xgbe_phy_read_status()
3081 xgbe_rrc(struct xgbe_prv_data *pdata) in xgbe_rrc() argument
3083 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_rrc()
3090 if (pdata->link_workaround) { in xgbe_rrc()
3091 ret = xgbe_phy_reset(pdata); in xgbe_rrc()
3095 xgbe_phy_rrc(pdata); in xgbe_rrc()
3100 xgbe_phy_link_status(struct xgbe_prv_data *pdata, int *an_restart) in xgbe_phy_link_status() argument
3102 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_link_status()
3112 xgbe_phy_sfp_detect(pdata); in xgbe_phy_link_status()
3126 xgbe_rrc(pdata); in xgbe_phy_link_status()
3134 if (pdata->axgbe_miibus == NULL) { in xgbe_phy_link_status()
3139 mii = device_get_softc(pdata->axgbe_miibus); in xgbe_phy_link_status()
3142 ret = xgbe_phy_read_status(pdata); in xgbe_phy_link_status()
3149 "autoneg %#x\n", __func__, pdata->phy.speed, in xgbe_phy_link_status()
3150 pdata->phy.duplex, pdata->phy.link, pdata->phy.autoneg); in xgbe_phy_link_status()
3151 ret = xgbe_phy_mii_read(pdata, pdata->mdio_addr, MII_BMSR); in xgbe_phy_link_status()
3154 if ((pdata->phy.autoneg == AUTONEG_ENABLE) && !ret) in xgbe_phy_link_status()
3157 if (pdata->phy.link) in xgbe_phy_link_status()
3160 xgbe_rrc(pdata); in xgbe_phy_link_status()
3168 reg = XMDIO_READ(pdata, MDIO_MMD_PCS, MDIO_STAT1); in xgbe_phy_link_status()
3169 reg = XMDIO_READ(pdata, MDIO_MMD_PCS, MDIO_STAT1); in xgbe_phy_link_status()
3175 xgbe_rrc(pdata); in xgbe_phy_link_status()
3181 xgbe_phy_sfp_gpio_setup(struct xgbe_prv_data *pdata) in xgbe_phy_sfp_gpio_setup() argument
3183 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_sfp_gpio_setup()
3186 XP_GET_BITS(pdata->pp3, XP_PROP_3, GPIO_ADDR); in xgbe_phy_sfp_gpio_setup()
3187 phy_data->sfp_gpio_mask = XP_GET_BITS(pdata->pp3, XP_PROP_3, in xgbe_phy_sfp_gpio_setup()
3189 phy_data->sfp_gpio_rx_los = XP_GET_BITS(pdata->pp3, XP_PROP_3, in xgbe_phy_sfp_gpio_setup()
3191 phy_data->sfp_gpio_tx_fault = XP_GET_BITS(pdata->pp3, XP_PROP_3, in xgbe_phy_sfp_gpio_setup()
3193 phy_data->sfp_gpio_mod_absent = XP_GET_BITS(pdata->pp3, XP_PROP_3, in xgbe_phy_sfp_gpio_setup()
3195 phy_data->sfp_gpio_rate_select = XP_GET_BITS(pdata->pp3, XP_PROP_3, in xgbe_phy_sfp_gpio_setup()
3209 xgbe_phy_sfp_comm_setup(struct xgbe_prv_data *pdata) in xgbe_phy_sfp_comm_setup() argument
3211 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_sfp_comm_setup()
3214 mux_addr_hi = XP_GET_BITS(pdata->pp4, XP_PROP_4, MUX_ADDR_HI); in xgbe_phy_sfp_comm_setup()
3215 mux_addr_lo = XP_GET_BITS(pdata->pp4, XP_PROP_4, MUX_ADDR_LO); in xgbe_phy_sfp_comm_setup()
3221 phy_data->sfp_mux_channel = XP_GET_BITS(pdata->pp4, XP_PROP_4, in xgbe_phy_sfp_comm_setup()
3229 xgbe_phy_sfp_setup(struct xgbe_prv_data *pdata) in xgbe_phy_sfp_setup() argument
3231 xgbe_phy_sfp_comm_setup(pdata); in xgbe_phy_sfp_setup()
3232 xgbe_phy_sfp_gpio_setup(pdata); in xgbe_phy_sfp_setup()
3236 xgbe_phy_int_mdio_reset(struct xgbe_prv_data *pdata) in xgbe_phy_int_mdio_reset() argument
3238 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_int_mdio_reset()
3241 ret = pdata->hw_if.set_gpio(pdata, phy_data->mdio_reset_gpio); in xgbe_phy_int_mdio_reset()
3245 ret = pdata->hw_if.clr_gpio(pdata, phy_data->mdio_reset_gpio); in xgbe_phy_int_mdio_reset()
3251 xgbe_phy_i2c_mdio_reset(struct xgbe_prv_data *pdata) in xgbe_phy_i2c_mdio_reset() argument
3253 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_i2c_mdio_reset()
3259 ret = xgbe_phy_i2c_read(pdata, phy_data->mdio_reset_addr, in xgbe_phy_i2c_mdio_reset()
3277 ret = xgbe_phy_i2c_write(pdata, phy_data->mdio_reset_addr, in xgbe_phy_i2c_mdio_reset()
3289 ret = xgbe_phy_i2c_write(pdata, phy_data->mdio_reset_addr, in xgbe_phy_i2c_mdio_reset()
3296 xgbe_phy_mdio_reset(struct xgbe_prv_data *pdata) in xgbe_phy_mdio_reset() argument
3298 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_mdio_reset()
3304 ret = xgbe_phy_get_comm_ownership(pdata); in xgbe_phy_mdio_reset()
3309 ret = xgbe_phy_i2c_mdio_reset(pdata); in xgbe_phy_mdio_reset()
3311 ret = xgbe_phy_int_mdio_reset(pdata); in xgbe_phy_mdio_reset()
3313 xgbe_phy_put_comm_ownership(pdata); in xgbe_phy_mdio_reset()
3344 xgbe_phy_mdio_reset_setup(struct xgbe_prv_data *pdata) in xgbe_phy_mdio_reset_setup() argument
3346 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_mdio_reset_setup()
3351 phy_data->mdio_reset = XP_GET_BITS(pdata->pp3, XP_PROP_3, MDIO_RESET); in xgbe_phy_mdio_reset_setup()
3365 XP_GET_BITS(pdata->pp3, XP_PROP_3, MDIO_RESET_I2C_ADDR); in xgbe_phy_mdio_reset_setup()
3366 phy_data->mdio_reset_gpio = XP_GET_BITS(pdata->pp3, XP_PROP_3, in xgbe_phy_mdio_reset_setup()
3369 phy_data->mdio_reset_gpio = XP_GET_BITS(pdata->pp3, XP_PROP_3, in xgbe_phy_mdio_reset_setup()
3376 xgbe_phy_port_mode_mismatch(struct xgbe_prv_data *pdata) in xgbe_phy_port_mode_mismatch() argument
3378 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_port_mode_mismatch()
3429 xgbe_phy_conn_type_mismatch(struct xgbe_prv_data *pdata) in xgbe_phy_conn_type_mismatch() argument
3431 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_conn_type_mismatch()
3459 xgbe_phy_port_enabled(struct xgbe_prv_data *pdata) in xgbe_phy_port_enabled() argument
3462 if (!XP_GET_BITS(pdata->pp0, XP_PROP_0, PORT_SPEEDS)) in xgbe_phy_port_enabled()
3464 if (!XP_GET_BITS(pdata->pp0, XP_PROP_0, CONN_TYPE)) in xgbe_phy_port_enabled()
3471 xgbe_phy_cdr_track(struct xgbe_prv_data *pdata) in xgbe_phy_cdr_track() argument
3473 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_cdr_track()
3476 __func__, pdata->sysctl_an_cdr_workaround, phy_data->phy_cdr_notrack); in xgbe_phy_cdr_track()
3478 if (!pdata->sysctl_an_cdr_workaround) in xgbe_phy_cdr_track()
3486 XMDIO_WRITE_BITS(pdata, MDIO_MMD_PMAPMD, MDIO_VEND2_PMA_CDR_CONTROL, in xgbe_phy_cdr_track()
3495 xgbe_phy_cdr_notrack(struct xgbe_prv_data *pdata) in xgbe_phy_cdr_notrack() argument
3497 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_cdr_notrack()
3500 __func__, pdata->sysctl_an_cdr_workaround, phy_data->phy_cdr_notrack); in xgbe_phy_cdr_notrack()
3502 if (!pdata->sysctl_an_cdr_workaround) in xgbe_phy_cdr_notrack()
3508 XMDIO_WRITE_BITS(pdata, MDIO_MMD_PMAPMD, MDIO_VEND2_PMA_CDR_CONTROL, in xgbe_phy_cdr_notrack()
3511 xgbe_phy_rrc(pdata); in xgbe_phy_cdr_notrack()
3517 xgbe_phy_kr_training_post(struct xgbe_prv_data *pdata) in xgbe_phy_kr_training_post() argument
3519 if (!pdata->sysctl_an_cdr_track_early) in xgbe_phy_kr_training_post()
3520 xgbe_phy_cdr_track(pdata); in xgbe_phy_kr_training_post()
3524 xgbe_phy_kr_training_pre(struct xgbe_prv_data *pdata) in xgbe_phy_kr_training_pre() argument
3526 if (pdata->sysctl_an_cdr_track_early) in xgbe_phy_kr_training_pre()
3527 xgbe_phy_cdr_track(pdata); in xgbe_phy_kr_training_pre()
3531 xgbe_phy_an_post(struct xgbe_prv_data *pdata) in xgbe_phy_an_post() argument
3533 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_an_post()
3535 switch (pdata->an_mode) { in xgbe_phy_an_post()
3541 xgbe_phy_cdr_track(pdata); in xgbe_phy_an_post()
3543 switch (pdata->an_result) { in xgbe_phy_an_post()
3561 xgbe_phy_an_pre(struct xgbe_prv_data *pdata) in xgbe_phy_an_pre() argument
3563 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_an_pre()
3565 switch (pdata->an_mode) { in xgbe_phy_an_pre()
3571 xgbe_phy_cdr_notrack(pdata); in xgbe_phy_an_pre()
3579 xgbe_phy_stop(struct xgbe_prv_data *pdata) in xgbe_phy_stop() argument
3581 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_stop()
3584 xgbe_phy_free_phy_device(pdata); in xgbe_phy_stop()
3588 xgbe_phy_sfp_mod_absent(pdata); in xgbe_phy_stop()
3591 xgbe_phy_cdr_track(pdata); in xgbe_phy_stop()
3594 xgbe_phy_power_off(pdata); in xgbe_phy_stop()
3597 pdata->i2c_if.i2c_stop(pdata); in xgbe_phy_stop()
3601 xgbe_phy_start(struct xgbe_prv_data *pdata) in xgbe_phy_start() argument
3603 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_start()
3610 ret = pdata->i2c_if.i2c_start(pdata); in xgbe_phy_start()
3618 ret = pdata->hw_if.set_ext_mii_mode(pdata, phy_data->redrv_addr, in xgbe_phy_start()
3628 xgbe_phy_set_mode(pdata, phy_data->start_mode); in xgbe_phy_start()
3631 xgbe_phy_cdr_track(pdata); in xgbe_phy_start()
3643 xgbe_phy_validate_gpio_expander(pdata); in xgbe_phy_start()
3646 xgbe_phy_sfp_detect(pdata); in xgbe_phy_start()
3653 ret = xgbe_phy_find_phy_device(pdata); in xgbe_phy_start()
3663 pdata->i2c_if.i2c_stop(pdata); in xgbe_phy_start()
3669 xgbe_phy_reset(struct xgbe_prv_data *pdata) in xgbe_phy_reset() argument
3671 struct xgbe_phy_data *phy_data = pdata->phy_data; in xgbe_phy_reset()
3677 xgbe_phy_power_off(pdata); in xgbe_phy_reset()
3678 xgbe_phy_set_mode(pdata, cur_mode); in xgbe_phy_reset()
3687 ret = xgbe_phy_mdio_reset(pdata); in xgbe_phy_reset()
3702 struct xgbe_prv_data *pdata; in axgbe_ifmedia_sts() local
3706 pdata = &sc->pdata; in axgbe_ifmedia_sts()
3709 mtx_lock_spin(&pdata->mdio_mutex); in axgbe_ifmedia_sts()
3710 mii = device_get_softc(pdata->axgbe_miibus); in axgbe_ifmedia_sts()
3716 mtx_unlock_spin(&pdata->mdio_mutex); in axgbe_ifmedia_sts()
3722 struct xgbe_prv_data *pdata; in axgbe_ifmedia_upd() local
3729 pdata = &sc->pdata; in axgbe_ifmedia_upd()
3732 mtx_lock_spin(&pdata->mdio_mutex); in axgbe_ifmedia_upd()
3733 mii = device_get_softc(pdata->axgbe_miibus); in axgbe_ifmedia_upd()
3737 mtx_unlock_spin(&pdata->mdio_mutex); in axgbe_ifmedia_upd()
3743 xgbe_phy_exit(struct xgbe_prv_data *pdata) in xgbe_phy_exit() argument
3745 if (pdata->axgbe_miibus != NULL) in xgbe_phy_exit()
3746 device_delete_child(pdata->dev, pdata->axgbe_miibus); in xgbe_phy_exit()
3749 free(pdata->phy_data, M_AXGBE); in xgbe_phy_exit()
3753 xgbe_phy_init(struct xgbe_prv_data *pdata) in xgbe_phy_init() argument
3763 if (!xgbe_phy_port_enabled(pdata)) { in xgbe_phy_init()
3769 ret = pdata->i2c_if.i2c_init(pdata); in xgbe_phy_init()
3774 pdata->phy_data = phy_data; in xgbe_phy_init()
3776 phy_data->port_mode = XP_GET_BITS(pdata->pp0, XP_PROP_0, PORT_MODE); in xgbe_phy_init()
3777 phy_data->port_id = XP_GET_BITS(pdata->pp0, XP_PROP_0, PORT_ID); in xgbe_phy_init()
3778 phy_data->port_speeds = XP_GET_BITS(pdata->pp0, XP_PROP_0, PORT_SPEEDS); in xgbe_phy_init()
3779 phy_data->conn_type = XP_GET_BITS(pdata->pp0, XP_PROP_0, CONN_TYPE); in xgbe_phy_init()
3780 phy_data->mdio_addr = XP_GET_BITS(pdata->pp0, XP_PROP_0, MDIO_ADDR); in xgbe_phy_init()
3782 pdata->mdio_addr = phy_data->mdio_addr; in xgbe_phy_init()
3789 phy_data->redrv = XP_GET_BITS(pdata->pp4, XP_PROP_4, REDRV_PRESENT); in xgbe_phy_init()
3790 phy_data->redrv_if = XP_GET_BITS(pdata->pp4, XP_PROP_4, REDRV_IF); in xgbe_phy_init()
3791 phy_data->redrv_addr = XP_GET_BITS(pdata->pp4, XP_PROP_4, REDRV_ADDR); in xgbe_phy_init()
3792 phy_data->redrv_lane = XP_GET_BITS(pdata->pp4, XP_PROP_4, REDRV_LANE); in xgbe_phy_init()
3793 phy_data->redrv_model = XP_GET_BITS(pdata->pp4, XP_PROP_4, REDRV_MODEL); in xgbe_phy_init()
3806 if (xgbe_phy_conn_type_mismatch(pdata)) { in xgbe_phy_init()
3813 if (xgbe_phy_port_mode_mismatch(pdata)) { in xgbe_phy_init()
3820 ret = xgbe_phy_mdio_reset_setup(pdata); in xgbe_phy_init()
3831 pdata->kr_redrv = phy_data->redrv; in xgbe_phy_init()
3837 XGBE_ZERO_SUP(&pdata->phy); in xgbe_phy_init()
3843 XGBE_SET_SUP(&pdata->phy, Autoneg); in xgbe_phy_init()
3844 XGBE_SET_SUP(&pdata->phy, Pause); in xgbe_phy_init()
3845 XGBE_SET_SUP(&pdata->phy, Asym_Pause); in xgbe_phy_init()
3846 XGBE_SET_SUP(&pdata->phy, Backplane); in xgbe_phy_init()
3848 XGBE_SET_SUP(&pdata->phy, 1000baseKX_Full); in xgbe_phy_init()
3852 XGBE_SET_SUP(&pdata->phy, 10000baseKR_Full); in xgbe_phy_init()
3853 if (pdata->fec_ability & MDIO_PMA_10GBR_FECABLE_ABLE) in xgbe_phy_init()
3854 XGBE_SET_SUP(&pdata->phy, 10000baseR_FEC); in xgbe_phy_init()
3861 XGBE_SET_SUP(&pdata->phy, Pause); in xgbe_phy_init()
3862 XGBE_SET_SUP(&pdata->phy, Asym_Pause); in xgbe_phy_init()
3863 XGBE_SET_SUP(&pdata->phy, Backplane); in xgbe_phy_init()
3864 XGBE_SET_SUP(&pdata->phy, 2500baseX_Full); in xgbe_phy_init()
3872 XGBE_SET_SUP(&pdata->phy, Autoneg); in xgbe_phy_init()
3873 XGBE_SET_SUP(&pdata->phy, Pause); in xgbe_phy_init()
3874 XGBE_SET_SUP(&pdata->phy, Asym_Pause); in xgbe_phy_init()
3875 XGBE_SET_SUP(&pdata->phy, TP); in xgbe_phy_init()
3877 XGBE_SET_SUP(&pdata->phy, 100baseT_Full); in xgbe_phy_init()
3881 XGBE_SET_SUP(&pdata->phy, 1000baseT_Full); in xgbe_phy_init()
3890 XGBE_SET_SUP(&pdata->phy, Autoneg); in xgbe_phy_init()
3891 XGBE_SET_SUP(&pdata->phy, Pause); in xgbe_phy_init()
3892 XGBE_SET_SUP(&pdata->phy, Asym_Pause); in xgbe_phy_init()
3893 XGBE_SET_SUP(&pdata->phy, FIBRE); in xgbe_phy_init()
3894 XGBE_SET_SUP(&pdata->phy, 1000baseX_Full); in xgbe_phy_init()
3902 XGBE_SET_SUP(&pdata->phy, Autoneg); in xgbe_phy_init()
3903 XGBE_SET_SUP(&pdata->phy, Pause); in xgbe_phy_init()
3904 XGBE_SET_SUP(&pdata->phy, Asym_Pause); in xgbe_phy_init()
3905 XGBE_SET_SUP(&pdata->phy, TP); in xgbe_phy_init()
3907 XGBE_SET_SUP(&pdata->phy, 100baseT_Full); in xgbe_phy_init()
3911 XGBE_SET_SUP(&pdata->phy, 1000baseT_Full); in xgbe_phy_init()
3915 XGBE_SET_SUP(&pdata->phy, 2500baseT_Full); in xgbe_phy_init()
3924 XGBE_SET_SUP(&pdata->phy, Autoneg); in xgbe_phy_init()
3925 XGBE_SET_SUP(&pdata->phy, Pause); in xgbe_phy_init()
3926 XGBE_SET_SUP(&pdata->phy, Asym_Pause); in xgbe_phy_init()
3927 XGBE_SET_SUP(&pdata->phy, TP); in xgbe_phy_init()
3929 XGBE_SET_SUP(&pdata->phy, 100baseT_Full); in xgbe_phy_init()
3933 XGBE_SET_SUP(&pdata->phy, 1000baseT_Full); in xgbe_phy_init()
3937 XGBE_SET_SUP(&pdata->phy, 10000baseT_Full); in xgbe_phy_init()
3946 XGBE_SET_SUP(&pdata->phy, Autoneg); in xgbe_phy_init()
3947 XGBE_SET_SUP(&pdata->phy, Pause); in xgbe_phy_init()
3948 XGBE_SET_SUP(&pdata->phy, Asym_Pause); in xgbe_phy_init()
3949 XGBE_SET_SUP(&pdata->phy, FIBRE); in xgbe_phy_init()
3950 XGBE_SET_SUP(&pdata->phy, 10000baseSR_Full); in xgbe_phy_init()
3951 XGBE_SET_SUP(&pdata->phy, 10000baseLR_Full); in xgbe_phy_init()
3952 XGBE_SET_SUP(&pdata->phy, 10000baseLRM_Full); in xgbe_phy_init()
3953 XGBE_SET_SUP(&pdata->phy, 10000baseER_Full); in xgbe_phy_init()
3954 if (pdata->fec_ability & MDIO_PMA_10GBR_FECABLE_ABLE) in xgbe_phy_init()
3955 XGBE_SET_SUP(&pdata->phy, 10000baseR_FEC); in xgbe_phy_init()
3963 XGBE_SET_SUP(&pdata->phy, Autoneg); in xgbe_phy_init()
3964 XGBE_SET_SUP(&pdata->phy, Pause); in xgbe_phy_init()
3965 XGBE_SET_SUP(&pdata->phy, Asym_Pause); in xgbe_phy_init()
3966 XGBE_SET_SUP(&pdata->phy, TP); in xgbe_phy_init()
3967 XGBE_SET_SUP(&pdata->phy, FIBRE); in xgbe_phy_init()
3977 xgbe_phy_sfp_setup(pdata); in xgbe_phy_init()
3980 pdata->phy.advertising); in xgbe_phy_init()
3987 phy_data->start_mode, phy_data->phydev_mode, pdata->phy.advertising); in xgbe_phy_init()
3993 ret = pdata->hw_if.set_ext_mii_mode(pdata, phy_data->mdio_addr, in xgbe_phy_init()
4003 ret = pdata->hw_if.set_ext_mii_mode(pdata, phy_data->redrv_addr, in xgbe_phy_init()
4015 ret = mii_attach(pdata->dev, &pdata->axgbe_miibus, pdata->netdev, in xgbe_phy_init()
4018 pdata->mdio_addr, MII_OFFSET_ANY, MIIF_FORCEANEG); in xgbe_phy_init()