Exemplo n.º 1
0
/*
 * If we negotiate a 10Mbps mode, we need to check for an alternate
 * PHY and make sure it's enabled and set correctly.
 */
void
mlphy_status(struct mii_softc *sc)
{
    struct mlphy_softc *msc = (struct mlphy_softc *)sc;
    struct mii_data *mii = sc->mii_pdata;
    struct mii_softc *other = NULL;

    /* See if there's another PHY on the bus with us. */
    LIST_FOREACH(other, &mii->mii_phys, mii_list)
    if (other != sc)
        break;

    ukphy_status(sc);

    if (IFM_SUBTYPE(mii->mii_media_active) != IFM_10_T) {
        msc->ml_state = ML_STATE_AUTO_SELF;
        if (other != NULL) {
            mii_phy_reset(other);
            PHY_WRITE(other, MII_BMCR, BMCR_ISO);
        }
    }

    if (IFM_SUBTYPE(mii->mii_media_active) == IFM_10_T) {
        msc->ml_state = ML_STATE_AUTO_OTHER;
        mlphy_reset(&msc->ml_mii);
        PHY_WRITE(&msc->ml_mii, MII_BMCR, BMCR_ISO);
        if (other != NULL) {
            mii_phy_reset(other);
            mii_phy_auto(other, 1);
        }
    }
}
Exemplo n.º 2
0
/*
 * If we negotiate a 10Mbps mode, we need to check for an alternate
 * PHY and make sure it's enabled and set correctly.
 */
static void
mlphy_status(struct mii_softc *sc)
{
	struct mlphy_softc	*msc = (struct mlphy_softc *)sc;
	struct mii_data		*mii = msc->ml_mii.mii_pdata;
	struct mii_softc	*other = NULL;
	device_t		*devlist;
	int			devs, i;

	/* See if there's another PHY on the bus with us. */
	device_get_children(msc->ml_mii.mii_dev, &devlist, &devs);
	for (i = 0; i < devs; i++) {
		if (strcmp(device_get_name(devlist[i]), "mlphy")) {
			other = device_get_softc(devlist[i]);
			break;
		}
	}
	kfree(devlist, M_TEMP);

	if (other == NULL)
		return;

	ukphy_status(sc);

	if (IFM_SUBTYPE(mii->mii_media_active) != IFM_10_T) {
		msc->ml_state = ML_STATE_AUTO_SELF;
		mii_phy_reset(other);
		PHY_WRITE(other, MII_BMCR, BMCR_ISO);
	}

	if (IFM_SUBTYPE(mii->mii_media_active) == IFM_10_T) {
		msc->ml_state = ML_STATE_AUTO_OTHER;
		mlphy_reset(&msc->ml_mii);
		PHY_WRITE(&msc->ml_mii, MII_BMCR, BMCR_ISO);
		mii_phy_reset(other);
		mii_phy_auto(other, 1);
	}
}