ixgbe_phy.c revision 9da57d7b0ddd8d73b676ce12c040362132cdd538
/*
* CDDL HEADER START
*
* Copyright(c) 2007-2008 Intel Corporation. All rights reserved.
* 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:
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When using or redistributing this file, you may do so under the
* License only. No other modification of this header is permitted.
*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms of the CDDL.
*/
/* IntelVersion: 1.37 v2008-03-04 */
#pragma ident "%Z%%M% %I% %E% SMI"
#include "ixgbe_api.h"
#include "ixgbe_common.h"
#include "ixgbe_phy.h"
/*
* ixgbe_init_phy_ops_generic - Inits PHY function ptrs
* @hw: pointer to the hardware structure
*
* Initialize the function pointers.
*/
{
/* PHY */
return (IXGBE_SUCCESS);
}
/*
* ixgbe_identify_phy_generic - Get physical layer module
* @hw: pointer to hardware structure
*
* Determines the physical layer module found on the current adapter.
*/
{
(void) ixgbe_get_phy_id(hw);
break;
}
}
} else {
}
return (status);
}
/*
* ixgbe_validate_phy_addr - Determines phy address is valid
* @hw: pointer to hardware structure
*
*/
bool
{
return (valid);
}
/*
* ixgbe_get_phy_id - Get the phy type
* @hw: pointer to hardware structure
*
*/
{
u16 phy_id_high = 0;
u16 phy_id_low = 0;
&phy_id_high);
if (status == IXGBE_SUCCESS) {
&phy_id_low);
}
return (status);
}
/*
* ixgbe_get_phy_type_from_id - Get the phy type
* @hw: pointer to hardware structure
*
*/
enum ixgbe_phy_type
{
enum ixgbe_phy_type phy_type;
switch (phy_id) {
case QT2022_PHY_ID:
break;
default:
break;
}
return (phy_type);
}
/*
* ixgbe_reset_phy_generic - Performs a PHY reset
* @hw: pointer to hardware structure
*/
{
/*
* Perform soft PHY reset to the PHY_XS.
* This will cause a soft reset to the PHY
*/
}
/*
* ixgbe_read_phy_reg_generic - Reads a value from a specified PHY register
* @hw: pointer to hardware structure
* @reg_addr: 32 bit address of PHY register to read
* @phy_data: Pointer to read data from PHY register
*/
{
u32 i;
else
if (status == IXGBE_SUCCESS) {
/* Setup and write the address cycle command */
/*
* Check every 10 usec to see if the address cycle completed.
* The MDI Command bit will clear when the operation is
* complete
*/
for (i = 0; i < IXGBE_MDIO_COMMAND_TIMEOUT; i++) {
usec_delay(10);
if ((command & IXGBE_MSCA_MDI_COMMAND) == 0) {
break;
}
}
if ((command & IXGBE_MSCA_MDI_COMMAND) != 0) {
DEBUGOUT("PHY address command did not complete.\n");
}
if (status == IXGBE_SUCCESS) {
/*
* Address cycle complete, setup and write the read
* command
*/
/*
* Check every 10 usec to see if the address cycle
* completed. The MDI Command bit will clear when the
* operation is complete
*/
for (i = 0; i < IXGBE_MDIO_COMMAND_TIMEOUT; i++) {
usec_delay(10);
if ((command & IXGBE_MSCA_MDI_COMMAND) == 0)
break;
}
if ((command & IXGBE_MSCA_MDI_COMMAND) != 0) {
DEBUGOUT("PHY read command didn't complete\n");
} else {
/*
* Read operation is complete. Get the data
* from MSRWD
*/
}
}
}
return (status);
}
/*
* ixgbe_write_phy_reg_generic - Writes a value to specified PHY register
* @hw: pointer to hardware structure
* @reg_addr: 32 bit PHY register to write
* @device_type: 5 bit device type
* @phy_data: Data to write to the PHY register
*/
{
u32 i;
else
if (status == IXGBE_SUCCESS) {
/*
* Put the data in the MDI single read and write data register
*/
/* Setup and write the address cycle command */
/*
* Check every 10 usec to see if the address cycle completed.
* The MDI Command bit will clear when the operation is
* complete
*/
for (i = 0; i < IXGBE_MDIO_COMMAND_TIMEOUT; i++) {
usec_delay(10);
if ((command & IXGBE_MSCA_MDI_COMMAND) == 0)
break;
}
if ((command & IXGBE_MSCA_MDI_COMMAND) != 0) {
DEBUGOUT("PHY address cmd didn't complete\n");
}
if (status == IXGBE_SUCCESS) {
/*
* Address cycle complete, setup and write the write
* command
*/
/*
* Check every 10 usec to see if the address cycle
* completed. The MDI Command bit will clear when the
* operation is complete
*/
for (i = 0; i < IXGBE_MDIO_COMMAND_TIMEOUT; i++) {
usec_delay(10);
if ((command & IXGBE_MSCA_MDI_COMMAND) == 0)
break;
}
if ((command & IXGBE_MSCA_MDI_COMMAND) != 0) {
DEBUGOUT("PHY address cmd didn't complete\n");
}
}
}
return (status);
}
/*
* ixgbe_setup_phy_link_generic - Set and restart autoneg
* @hw: pointer to hardware structure
*
* Restart autonegotiation and PHY and waits for completion.
*/
{
/*
* Set advertisement settings in PHY based on autoneg_advertised
* settings. If autoneg_advertised = 0, then advertise default values
* tnx devices cannot be "forced" to a autoneg 10G and fail. But can
* for a 1G.
*/
else
/* Restart PHY autonegotiation and wait for completion */
/* Wait for autonegotiation to finish */
usec_delay(10);
/* Restart PHY autonegotiation and wait for completion */
&autoneg_reg);
if (autoneg_reg == IXGBE_MII_AUTONEG_COMPLETE) {
break;
}
}
if (time_out == max_time_out)
return (status);
}
/*
* ixgbe_setup_phy_link_speed_generic - Sets the auto advertised capabilities
* @hw: pointer to hardware structure
* @speed: new link speed
* @autoneg: TRUE if autonegotiation enabled
*/
bool autoneg,
bool autoneg_wait_to_complete)
{
/*
* Clear autoneg_advertised and set new values based on input link
* speed.
*/
if (speed & IXGBE_LINK_SPEED_10GB_FULL) {
}
if (speed & IXGBE_LINK_SPEED_1GB_FULL) {
}
/* Setup link based on the new speed settings */
return (IXGBE_SUCCESS);
}