/*
* 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" /* mv88x201x.c */
#include "cphy.h"
#include "elmer0.h"
/*
* The 88x2010 Rev C. requires some link status registers * to be read
* twice in order to get the right values. Future * revisions will fix
* this problem and then this macro * can disappear.
*/
{
* Writing these bits maps control to another
* register. mmd(0x1) addr(0x7)
*/
return 0;
}
{
if (do_enable & LINK_ENABLE_BIT) {
led |= LINK_ENABLE_BIT;
} else {
led &= ~LINK_ENABLE_BIT;
}
return 0;
}
/* Port Reset */
/* ARGSUSED */
{
/* This can be done through registers. It is not required since
* a full chip reset is used.
*/
return 0;
}
{
/* Enable PHY LASI interrupts. */
/* Enable Marvell interrupts through Elmer0. */
elmer |= ELMER0_GP_BIT6;
}
return 0;
}
{
/* Disable PHY LASI interrupts. */
/* Disable Marvell interrupts through Elmer0. */
elmer &= ~ELMER0_GP_BIT6;
}
return 0;
}
{
#ifdef MV88x2010_LINK_STATUS_BUGS
/* Required to read twice before clear takes affect. */
/* Read this register after the others above it else
* the register doesn't clear correctly.
*/
#endif
/* Clear link status. */
/* Clear PHY LASI interrupts. */
#ifdef MV88x2010_LINK_STATUS_BUGS
/* Do it again. */
#endif
/* Clear Marvell interrupts through Elmer0. */
elmer |= ELMER0_GP_BIT6;
}
return 0;
}
{
/* Clear interrupts */
(void) mv88x201x_interrupt_clear(cphy);
/* We have only enabled link change interrupts and so
* cphy_cause must be a link change interrupt.
*/
return cphy_cause_link_change;
}
/* ARGSUSED */
{
return 0;
}
{
if (link_ok) {
/* Read link status. */
val &= LINK_STATUS_BIT;
}
if (speed)
*speed = SPEED_10000;
if (duplex)
*duplex = DUPLEX_FULL;
if (fc)
return 0;
}
{
}
#ifdef C99_NOT_SUPPORTED
NULL,
NULL,
NULL,
NULL,
NULL,
};
#else
.reset = mv88x201x_reset,
};
#endif
{
if (!cphy)
return NULL;
/* Commands the PHY to enable XFP's clock. */
/* Clear link status. Required because of a bug in the PHY. */
return cphy;
}
/* Chip Reset */
{
val &= ~4;
DELAY_MS(100);
DELAY_MS(1000);
/* Now lets enable the Laser. Delay 100us */
val |= 0x8000;
DELAY_US(100);
return 0;
}
};