Lines Matching +full:twisted +full:- +full:pair

11 		Written 1998-2002 by Donald Becker.
40 advert = mii->mdio_read(mii->dev, mii->phy_id, addr); in mii_get_an()
46 * mii_ethtool_gset - get settings that are specified in @ecmd
55 struct net_device *dev = mii->dev; in mii_ethtool_gset()
59 ecmd->supported = in mii_ethtool_gset()
63 if (mii->supports_gmii) in mii_ethtool_gset()
64 ecmd->supported |= SUPPORTED_1000baseT_Half | in mii_ethtool_gset()
67 /* only supports twisted-pair */ in mii_ethtool_gset()
68 ecmd->port = PORT_MII; in mii_ethtool_gset()
71 ecmd->transceiver = XCVR_INTERNAL; in mii_ethtool_gset()
74 ecmd->phy_address = mii->phy_id; in mii_ethtool_gset()
75 ecmd->mdio_support = ETH_MDIO_SUPPORTS_C22; in mii_ethtool_gset()
77 ecmd->advertising = ADVERTISED_TP | ADVERTISED_MII; in mii_ethtool_gset()
79 bmcr = mii->mdio_read(dev, mii->phy_id, MII_BMCR); in mii_ethtool_gset()
80 bmsr = mii->mdio_read(dev, mii->phy_id, MII_BMSR); in mii_ethtool_gset()
81 if (mii->supports_gmii) { in mii_ethtool_gset()
82 ctrl1000 = mii->mdio_read(dev, mii->phy_id, MII_CTRL1000); in mii_ethtool_gset()
83 stat1000 = mii->mdio_read(dev, mii->phy_id, MII_STAT1000); in mii_ethtool_gset()
86 ecmd->advertising |= mii_get_an(mii, MII_ADVERTISE); in mii_ethtool_gset()
87 if (mii->supports_gmii) in mii_ethtool_gset()
88 ecmd->advertising |= in mii_ethtool_gset()
92 ecmd->advertising |= ADVERTISED_Autoneg; in mii_ethtool_gset()
93 ecmd->autoneg = AUTONEG_ENABLE; in mii_ethtool_gset()
96 ecmd->lp_advertising = mii_get_an(mii, MII_LPA); in mii_ethtool_gset()
97 ecmd->lp_advertising |= in mii_ethtool_gset()
100 ecmd->lp_advertising = 0; in mii_ethtool_gset()
103 nego = ecmd->advertising & ecmd->lp_advertising; in mii_ethtool_gset()
108 ecmd->duplex = !!(nego & ADVERTISED_1000baseT_Full); in mii_ethtool_gset()
112 ecmd->duplex = !!(nego & ADVERTISED_100baseT_Full); in mii_ethtool_gset()
115 ecmd->duplex = !!(nego & ADVERTISED_10baseT_Full); in mii_ethtool_gset()
118 ecmd->autoneg = AUTONEG_DISABLE; in mii_ethtool_gset()
126 ecmd->duplex = (bmcr & BMCR_FULLDPLX) ? DUPLEX_FULL : DUPLEX_HALF; in mii_ethtool_gset()
129 mii->full_duplex = ecmd->duplex; in mii_ethtool_gset()
135 * mii_ethtool_get_link_ksettings - get settings that are specified in @cmd
145 struct net_device *dev = mii->dev; in mii_ethtool_get_link_ksettings()
152 if (mii->supports_gmii) in mii_ethtool_get_link_ksettings()
156 /* only supports twisted-pair */ in mii_ethtool_get_link_ksettings()
157 cmd->base.port = PORT_MII; in mii_ethtool_get_link_ksettings()
160 cmd->base.phy_address = mii->phy_id; in mii_ethtool_get_link_ksettings()
161 cmd->base.mdio_support = ETH_MDIO_SUPPORTS_C22; in mii_ethtool_get_link_ksettings()
165 bmcr = mii->mdio_read(dev, mii->phy_id, MII_BMCR); in mii_ethtool_get_link_ksettings()
166 bmsr = mii->mdio_read(dev, mii->phy_id, MII_BMSR); in mii_ethtool_get_link_ksettings()
167 if (mii->supports_gmii) { in mii_ethtool_get_link_ksettings()
168 ctrl1000 = mii->mdio_read(dev, mii->phy_id, MII_CTRL1000); in mii_ethtool_get_link_ksettings()
169 stat1000 = mii->mdio_read(dev, mii->phy_id, MII_STAT1000); in mii_ethtool_get_link_ksettings()
173 if (mii->supports_gmii) in mii_ethtool_get_link_ksettings()
178 cmd->base.autoneg = AUTONEG_ENABLE; in mii_ethtool_get_link_ksettings()
192 cmd->base.speed = SPEED_1000; in mii_ethtool_get_link_ksettings()
193 cmd->base.duplex = !!(nego & ADVERTISED_1000baseT_Full); in mii_ethtool_get_link_ksettings()
196 cmd->base.speed = SPEED_100; in mii_ethtool_get_link_ksettings()
197 cmd->base.duplex = !!(nego & ADVERTISED_100baseT_Full); in mii_ethtool_get_link_ksettings()
199 cmd->base.speed = SPEED_10; in mii_ethtool_get_link_ksettings()
200 cmd->base.duplex = !!(nego & ADVERTISED_10baseT_Full); in mii_ethtool_get_link_ksettings()
203 cmd->base.autoneg = AUTONEG_DISABLE; in mii_ethtool_get_link_ksettings()
205 cmd->base.speed = ((bmcr & BMCR_SPEED1000 && in mii_ethtool_get_link_ksettings()
210 cmd->base.duplex = (bmcr & BMCR_FULLDPLX) ? in mii_ethtool_get_link_ksettings()
216 mii->full_duplex = cmd->base.duplex; in mii_ethtool_get_link_ksettings()
218 ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported, in mii_ethtool_get_link_ksettings()
220 ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising, in mii_ethtool_get_link_ksettings()
222 ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.lp_advertising, in mii_ethtool_get_link_ksettings()
229 * mii_ethtool_sset - set settings that are specified in @ecmd
237 struct net_device *dev = mii->dev; in mii_ethtool_sset()
243 return -EINVAL; in mii_ethtool_sset()
244 if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL) in mii_ethtool_sset()
245 return -EINVAL; in mii_ethtool_sset()
246 if (ecmd->port != PORT_MII) in mii_ethtool_sset()
247 return -EINVAL; in mii_ethtool_sset()
248 if (ecmd->transceiver != XCVR_INTERNAL) in mii_ethtool_sset()
249 return -EINVAL; in mii_ethtool_sset()
250 if (ecmd->phy_address != mii->phy_id) in mii_ethtool_sset()
251 return -EINVAL; in mii_ethtool_sset()
252 if (ecmd->autoneg != AUTONEG_DISABLE && ecmd->autoneg != AUTONEG_ENABLE) in mii_ethtool_sset()
253 return -EINVAL; in mii_ethtool_sset()
254 if ((speed == SPEED_1000) && (!mii->supports_gmii)) in mii_ethtool_sset()
255 return -EINVAL; in mii_ethtool_sset()
259 if (ecmd->autoneg == AUTONEG_ENABLE) { in mii_ethtool_sset()
263 if ((ecmd->advertising & (ADVERTISED_10baseT_Half | in mii_ethtool_sset()
269 return -EINVAL; in mii_ethtool_sset()
272 advert = mii->mdio_read(dev, mii->phy_id, MII_ADVERTISE); in mii_ethtool_sset()
274 if (mii->supports_gmii) { in mii_ethtool_sset()
275 advert2 = mii->mdio_read(dev, mii->phy_id, MII_CTRL1000); in mii_ethtool_sset()
278 tmp |= ethtool_adv_to_mii_adv_t(ecmd->advertising); in mii_ethtool_sset()
280 if (mii->supports_gmii) in mii_ethtool_sset()
282 ethtool_adv_to_mii_ctrl1000_t(ecmd->advertising); in mii_ethtool_sset()
284 mii->mdio_write(dev, mii->phy_id, MII_ADVERTISE, tmp); in mii_ethtool_sset()
285 mii->advertising = tmp; in mii_ethtool_sset()
287 if ((mii->supports_gmii) && (advert2 != tmp2)) in mii_ethtool_sset()
288 mii->mdio_write(dev, mii->phy_id, MII_CTRL1000, tmp2); in mii_ethtool_sset()
291 bmcr = mii->mdio_read(dev, mii->phy_id, MII_BMCR); in mii_ethtool_sset()
293 mii->mdio_write(dev, mii->phy_id, MII_BMCR, bmcr); in mii_ethtool_sset()
295 mii->force_media = 0; in mii_ethtool_sset()
300 bmcr = mii->mdio_read(dev, mii->phy_id, MII_BMCR); in mii_ethtool_sset()
307 if (ecmd->duplex == DUPLEX_FULL) { in mii_ethtool_sset()
309 mii->full_duplex = 1; in mii_ethtool_sset()
311 mii->full_duplex = 0; in mii_ethtool_sset()
313 mii->mdio_write(dev, mii->phy_id, MII_BMCR, tmp); in mii_ethtool_sset()
315 mii->force_media = 1; in mii_ethtool_sset()
321 * mii_ethtool_set_link_ksettings - set settings that are specified in @cmd
330 struct net_device *dev = mii->dev; in mii_ethtool_set_link_ksettings()
331 u32 speed = cmd->base.speed; in mii_ethtool_set_link_ksettings()
336 return -EINVAL; in mii_ethtool_set_link_ksettings()
337 if (cmd->base.duplex != DUPLEX_HALF && cmd->base.duplex != DUPLEX_FULL) in mii_ethtool_set_link_ksettings()
338 return -EINVAL; in mii_ethtool_set_link_ksettings()
339 if (cmd->base.port != PORT_MII) in mii_ethtool_set_link_ksettings()
340 return -EINVAL; in mii_ethtool_set_link_ksettings()
341 if (cmd->base.phy_address != mii->phy_id) in mii_ethtool_set_link_ksettings()
342 return -EINVAL; in mii_ethtool_set_link_ksettings()
343 if (cmd->base.autoneg != AUTONEG_DISABLE && in mii_ethtool_set_link_ksettings()
344 cmd->base.autoneg != AUTONEG_ENABLE) in mii_ethtool_set_link_ksettings()
345 return -EINVAL; in mii_ethtool_set_link_ksettings()
346 if ((speed == SPEED_1000) && (!mii->supports_gmii)) in mii_ethtool_set_link_ksettings()
347 return -EINVAL; in mii_ethtool_set_link_ksettings()
351 if (cmd->base.autoneg == AUTONEG_ENABLE) { in mii_ethtool_set_link_ksettings()
357 &advertising, cmd->link_modes.advertising); in mii_ethtool_set_link_ksettings()
365 return -EINVAL; in mii_ethtool_set_link_ksettings()
368 advert = mii->mdio_read(dev, mii->phy_id, MII_ADVERTISE); in mii_ethtool_set_link_ksettings()
370 if (mii->supports_gmii) { in mii_ethtool_set_link_ksettings()
371 advert2 = mii->mdio_read(dev, mii->phy_id, in mii_ethtool_set_link_ksettings()
378 if (mii->supports_gmii) in mii_ethtool_set_link_ksettings()
381 mii->mdio_write(dev, mii->phy_id, MII_ADVERTISE, tmp); in mii_ethtool_set_link_ksettings()
382 mii->advertising = tmp; in mii_ethtool_set_link_ksettings()
384 if ((mii->supports_gmii) && (advert2 != tmp2)) in mii_ethtool_set_link_ksettings()
385 mii->mdio_write(dev, mii->phy_id, MII_CTRL1000, tmp2); in mii_ethtool_set_link_ksettings()
388 bmcr = mii->mdio_read(dev, mii->phy_id, MII_BMCR); in mii_ethtool_set_link_ksettings()
390 mii->mdio_write(dev, mii->phy_id, MII_BMCR, bmcr); in mii_ethtool_set_link_ksettings()
392 mii->force_media = 0; in mii_ethtool_set_link_ksettings()
397 bmcr = mii->mdio_read(dev, mii->phy_id, MII_BMCR); in mii_ethtool_set_link_ksettings()
404 if (cmd->base.duplex == DUPLEX_FULL) { in mii_ethtool_set_link_ksettings()
406 mii->full_duplex = 1; in mii_ethtool_set_link_ksettings()
408 mii->full_duplex = 0; in mii_ethtool_set_link_ksettings()
411 mii->mdio_write(dev, mii->phy_id, MII_BMCR, tmp); in mii_ethtool_set_link_ksettings()
413 mii->force_media = 1; in mii_ethtool_set_link_ksettings()
419 * mii_check_gmii_support - check if the MII supports Gb interfaces
426 reg = mii->mdio_read(mii->dev, mii->phy_id, MII_BMSR); in mii_check_gmii_support()
428 reg = mii->mdio_read(mii->dev, mii->phy_id, MII_ESTATUS); in mii_check_gmii_support()
437 * mii_link_ok - is link status up/ok
445 mii->mdio_read(mii->dev, mii->phy_id, MII_BMSR); in mii_link_ok()
446 if (mii->mdio_read(mii->dev, mii->phy_id, MII_BMSR) & BMSR_LSTATUS) in mii_link_ok()
452 * mii_nway_restart - restart NWay (autonegotiation) for this interface
460 int r = -EINVAL; in mii_nway_restart()
463 bmcr = mii->mdio_read(mii->dev, mii->phy_id, MII_BMCR); in mii_nway_restart()
467 mii->mdio_write(mii->dev, mii->phy_id, MII_BMCR, bmcr); in mii_nway_restart()
475 * mii_check_link - check MII link status
485 int prev_link = netif_carrier_ok(mii->dev); in mii_check_link()
488 netif_carrier_on(mii->dev); in mii_check_link()
490 netif_carrier_off(mii->dev); in mii_check_link()
494 * mii_check_media - check the MII interface for a carrier/speed/duplex change
511 old_carrier = netif_carrier_ok(mii->dev) ? 1 : 0; in mii_check_media()
522 netif_carrier_off(mii->dev); in mii_check_media()
524 netdev_info(mii->dev, "link down\n"); in mii_check_media()
531 netif_carrier_on(mii->dev); in mii_check_media()
533 if (mii->force_media) { in mii_check_media()
535 netdev_info(mii->dev, "link up\n"); in mii_check_media()
540 if ((!init_media) && (mii->advertising)) in mii_check_media()
541 advertise = mii->advertising; in mii_check_media()
543 advertise = mii->mdio_read(mii->dev, mii->phy_id, MII_ADVERTISE); in mii_check_media()
544 mii->advertising = advertise; in mii_check_media()
546 lpa = mii->mdio_read(mii->dev, mii->phy_id, MII_LPA); in mii_check_media()
547 if (mii->supports_gmii) in mii_check_media()
548 lpa2 = mii->mdio_read(mii->dev, mii->phy_id, MII_STAT1000); in mii_check_media()
557 netdev_info(mii->dev, "link up, %uMbps, %s-duplex, lpa 0x%04X\n", in mii_check_media()
564 if ((init_media) || (mii->full_duplex != duplex)) { in mii_check_media()
565 mii->full_duplex = duplex; in mii_check_media()
573 * generic_mii_ioctl - main MII ioctl interface
592 mii_data->phy_id &= mii_if->phy_id_mask; in generic_mii_ioctl()
593 mii_data->reg_num &= mii_if->reg_num_mask; in generic_mii_ioctl()
597 mii_data->phy_id = mii_if->phy_id; in generic_mii_ioctl()
601 mii_data->val_out = in generic_mii_ioctl()
602 mii_if->mdio_read(mii_if->dev, mii_data->phy_id, in generic_mii_ioctl()
603 mii_data->reg_num); in generic_mii_ioctl()
607 u16 val = mii_data->val_in; in generic_mii_ioctl()
609 if (mii_data->phy_id == mii_if->phy_id) { in generic_mii_ioctl()
610 switch(mii_data->reg_num) { in generic_mii_ioctl()
614 mii_if->force_media = 0; in generic_mii_ioctl()
616 mii_if->force_media = 1; in generic_mii_ioctl()
617 if (mii_if->force_media && in generic_mii_ioctl()
620 if (mii_if->full_duplex != new_duplex) { in generic_mii_ioctl()
622 mii_if->full_duplex = new_duplex; in generic_mii_ioctl()
627 mii_if->advertising = val; in generic_mii_ioctl()
635 mii_if->mdio_write(mii_if->dev, mii_data->phy_id, in generic_mii_ioctl()
636 mii_data->reg_num, val); in generic_mii_ioctl()
641 rc = -EOPNOTSUPP; in generic_mii_ioctl()