/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (C) 2003-2005 Chelsio Communications. All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI" /* mv88e1xxx.c */
#include "common.h"
#include "mv88e1xxx.h"
#include "cphy.h"
#include "elmer0.h"
/* MV88E1XXX MDI crossover register values */
#define CROSSOVER_MDI 0
/*
* Set the bits given by 'bitval' in PHY register 'reg'.
*/
{
}
/*
* Clear the bits given by 'bitval' in PHY register 'reg'.
*/
{
}
/*
* NAME: phy_reset
*
* DESC: Reset the given PHY's port. NOTE: This is not a global
* chip reset.
*
* PARAMS: cphy - Pointer to PHY instance data.
*
* RETURN: 0 - Successfull reset.
* -1 - Timeout.
*/
/* ARGSUSED */
{
do {
ctl &= BMCR_RESET;
if (ctl)
DELAY_US(1);
return ctl ? -1 : 0;
}
{
/* Enable PHY interrupts. */
/* Enable Marvell interrupts through Elmer0. */
elmer |= ELMER0_GP_BIT1;
}
}
return 0;
}
{
/* Disable all phy interrupts. */
/* Disable Marvell interrupts through Elmer0. */
elmer &= ~ELMER0_GP_BIT1;
}
}
return 0;
}
{
/* Clear PHY interrupts by reading the register. */
/* Clear Marvell interrupts through Elmer0. */
elmer |= ELMER0_GP_BIT1;
}
}
return 0;
}
/*
* Set the PHY speed and duplex. This also disables auto-negotiation, except
* for 1Gb/s, where auto-negotiation is mandatory.
*/
{
if (speed >= 0) {
ctl |= BMCR_SPEED100;
else if (speed == SPEED_1000)
ctl |= BMCR_SPEED1000;
}
if (duplex >= 0) {
if (duplex == DUPLEX_FULL)
ctl |= BMCR_FULLDPLX;
}
ctl |= BMCR_ANENABLE;
return 0;
}
{
return 0;
}
{
/* restart autoneg for change to take effect */
return 0;
}
{
/*
* Crossover *must* be set to manual in order to disable auto-neg.
* The Alaska FAQs document highlights this point.
*/
/*
* Must include autoneg reset when disabling auto-neg. This
* is described in the Alaska FAQ document.
*/
ctl &= ~BMCR_ANENABLE;
return 0;
}
{
return 0;
}
{
if (advertise_map &
val |= GBCR_ADV_1000HALF;
val |= GBCR_ADV_1000FULL;
}
val = 1;
val |= ADVERTISE_10HALF;
val |= ADVERTISE_10FULL;
val |= ADVERTISE_100HALF;
val |= ADVERTISE_100FULL;
if (advertise_map & ADVERTISED_PAUSE)
val |= ADVERTISE_PAUSE;
return 0;
}
{
if (on)
else
return 0;
}
{
if ((status & V_PSSR_STATUS_RESOLVED) != 0) {
if (status & V_PSSR_RX_PAUSE)
if (status & V_PSSR_TX_PAUSE)
if (sp == 0)
else if (sp == 1)
else
sp = SPEED_1000;
}
if (link_ok)
if (speed)
if (duplex)
if (fc)
return 0;
}
{
/*
* Set the downshift counter to 2 so we try to establish Gb link
* twice before downshifting.
*/
if (downshift_enable)
return 0;
}
{
int cphy_cause = 0;
/*
* Loop until cause reads zero. Need to handle bouncing interrupts.
*/
/*CONSTCOND*/
while (1) {
&cause);
if (!cause) break;
if (cause & MV88E1XXX_INTR_LINK_CHNG) {
(void) simple_mdio_read(cphy,
if (status & MV88E1XXX_INTR_LINK_CHNG) {
} else {
}
}
if (cause & MV88E1XXX_INTR_AUTONEG_DONE)
}
return cphy_cause;
}
{
}
#ifdef C99_NOT_SUPPORTED
};
#else
.reset = mv88e1xxx_reset,
};
#endif
{
/* Configure particular PHY's to run in a different mode. */
/*
* Configure the PHY transmitter as class A to reduce EMI.
*/
}
/* LED */
(void) simple_mdio_write(cphy,
}
return cphy;
}
/* ARGSUSED */
{
return 0;
}
};