bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * CDDL HEADER START
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * The contents of this file are subject to the terms of the
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * Common Development and Distribution License (the "License").
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * You may not use this file except in compliance with the License.
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * or http://www.opensolaris.org/os/licensing.
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * See the License for the specific language governing permissions
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * and limitations under the License.
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * When distributing Covered Code, include this CDDL HEADER in each
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * If applicable, add the following below this CDDL HEADER, with the
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * fields enclosed by brackets "[]" replaced with your own identifying
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * information: Portions Copyright [yyyy] [name of copyright owner]
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * CDDL HEADER END
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * Use is subject to license terms.
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * MII overrides for Intel PHYs.
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * The older 82555 code in iprb had a bunch of workarounds to deal
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * with chip errata surrounding (I believe) autonegotiation problems
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * with the 82555 and long cables.
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * I can't find any evidence in current Linux, NetBSD, or FreeBSD
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * sources for the same kinds of workarounds for this PHY, so I'm
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * going to operate on the belief that these workarounds are simply
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * not necessary. Without access to the errata for these parts, as
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * well as parts that exhibit the problems, I can't be certain that
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * such workarounds will work properly. So I'm leaving them out for
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * now. I believe that the errata were mostly problems for 10 Mbps
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * links which are very hard to find anymore, anyway.
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * Apparently some devices have problem with 10 Mbps polarity and
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * short cable lengths. However, these days everyone should be using
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * 100 Mbps, and rather than retain the extra legacy complexity
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * here, I'm going to simply offer the choice to disable auto polarity.
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * If autopolarity doesn't work for you, you have several choices:
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * 1) Find a longer cable.
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * 2) Upgrade to 100Mbps.
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * 3) Disable the polarity check by setting AutoPolarity to 0.
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * We also believe that 10BASE-T autopolarity may be harmful (because
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * when used it can prevent use of a superior 100Mbps mode), so we
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore * disable autopolarity by default.
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore if (phy_get_prop(ph, "AutoPolarity", 0) == 0) {
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore /* disable autopolarity */
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore PHY_SET(ph, MII_82555_SPCL_CONTROL, I82555_AUTOPOL_DIS);
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore /* enable basic autopolarity */
bdb9230ac765cb7af3fc1f4119caf2c5720dceb3Garrett D'Amore PHY_CLR(ph, MII_82555_SPCL_CONTROL, I82555_AUTOPOL_DIS);