aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/nes/nes_nic.c
diff options
context:
space:
mode:
authorEric Schneider <eric.schneider@neteffect.com>2008-04-29 16:46:54 -0400
committerRoland Dreier <rolandd@cisco.com>2008-04-29 16:46:54 -0400
commit0e1de5d62e751ca9c589d8dfabfc1e5074e62724 (patch)
tree164536558179b7741fe2659f11c19b26a3f185a7 /drivers/infiniband/hw/nes/nes_nic.c
parent37dab4112d7b53c3574426ef7bdd92a78d32ac3e (diff)
RDMA/nes: Add support for SFP+ PHY
This patch enables the iw_nes module for NetEffect RNICs to support additional PHYs including SFP+ (referred to as ARGUS in the code). Signed-off-by: Eric Schneider <eric.schneider@neteffect.com> Signed-off-by: Glenn Streiff <gstreiff@neteffect.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/nes/nes_nic.c')
-rw-r--r--drivers/infiniband/hw/nes/nes_nic.c72
1 files changed, 48 insertions, 24 deletions
diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c
index 6998af0172ab..d65a846f04be 100644
--- a/drivers/infiniband/hw/nes/nes_nic.c
+++ b/drivers/infiniband/hw/nes/nes_nic.c
@@ -1377,21 +1377,29 @@ static int nes_netdev_get_settings(struct net_device *netdev, struct ethtool_cmd
1377 1377
1378 et_cmd->duplex = DUPLEX_FULL; 1378 et_cmd->duplex = DUPLEX_FULL;
1379 et_cmd->port = PORT_MII; 1379 et_cmd->port = PORT_MII;
1380
1380 if (nesadapter->OneG_Mode) { 1381 if (nesadapter->OneG_Mode) {
1381 et_cmd->supported = SUPPORTED_1000baseT_Full|SUPPORTED_Autoneg;
1382 et_cmd->advertising = ADVERTISED_1000baseT_Full|ADVERTISED_Autoneg;
1383 et_cmd->speed = SPEED_1000; 1382 et_cmd->speed = SPEED_1000;
1384 nes_read_1G_phy_reg(nesdev, 0, nesadapter->phy_index[nesdev->mac_index], 1383 if (nesadapter->phy_type[nesdev->mac_index] == NES_PHY_TYPE_PUMA_1G) {
1385 &phy_data); 1384 et_cmd->supported = SUPPORTED_1000baseT_Full;
1386 if (phy_data&0x1000) { 1385 et_cmd->advertising = ADVERTISED_1000baseT_Full;
1387 et_cmd->autoneg = AUTONEG_ENABLE; 1386 et_cmd->autoneg = AUTONEG_DISABLE;
1387 et_cmd->transceiver = XCVR_INTERNAL;
1388 et_cmd->phy_address = nesdev->mac_index;
1388 } else { 1389 } else {
1389 et_cmd->autoneg = AUTONEG_DISABLE; 1390 et_cmd->supported = SUPPORTED_1000baseT_Full | SUPPORTED_Autoneg;
1391 et_cmd->advertising = ADVERTISED_1000baseT_Full | ADVERTISED_Autoneg;
1392 nes_read_1G_phy_reg(nesdev, 0, nesadapter->phy_index[nesdev->mac_index], &phy_data);
1393 if (phy_data & 0x1000)
1394 et_cmd->autoneg = AUTONEG_ENABLE;
1395 else
1396 et_cmd->autoneg = AUTONEG_DISABLE;
1397 et_cmd->transceiver = XCVR_EXTERNAL;
1398 et_cmd->phy_address = nesadapter->phy_index[nesdev->mac_index];
1390 } 1399 }
1391 et_cmd->transceiver = XCVR_EXTERNAL;
1392 et_cmd->phy_address = nesadapter->phy_index[nesdev->mac_index];
1393 } else { 1400 } else {
1394 if (nesadapter->phy_type[nesvnic->logical_port] == NES_PHY_TYPE_IRIS) { 1401 if ((nesadapter->phy_type[nesdev->mac_index] == NES_PHY_TYPE_IRIS) ||
1402 (nesadapter->phy_type[nesdev->mac_index] == NES_PHY_TYPE_ARGUS)) {
1395 et_cmd->transceiver = XCVR_EXTERNAL; 1403 et_cmd->transceiver = XCVR_EXTERNAL;
1396 et_cmd->port = PORT_FIBRE; 1404 et_cmd->port = PORT_FIBRE;
1397 et_cmd->supported = SUPPORTED_FIBRE; 1405 et_cmd->supported = SUPPORTED_FIBRE;
@@ -1422,7 +1430,8 @@ static int nes_netdev_set_settings(struct net_device *netdev, struct ethtool_cmd
1422 struct nes_adapter *nesadapter = nesdev->nesadapter; 1430 struct nes_adapter *nesadapter = nesdev->nesadapter;
1423 u16 phy_data; 1431 u16 phy_data;
1424 1432
1425 if (nesadapter->OneG_Mode) { 1433 if ((nesadapter->OneG_Mode) &&
1434 (nesadapter->phy_type[nesdev->mac_index] != NES_PHY_TYPE_PUMA_1G)) {
1426 nes_read_1G_phy_reg(nesdev, 0, nesadapter->phy_index[nesdev->mac_index], 1435 nes_read_1G_phy_reg(nesdev, 0, nesadapter->phy_index[nesdev->mac_index],
1427 &phy_data); 1436 &phy_data);
1428 if (et_cmd->autoneg) { 1437 if (et_cmd->autoneg) {
@@ -1615,27 +1624,34 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
1615 list_add_tail(&nesvnic->list, &nesdev->nesadapter->nesvnic_list[nesdev->mac_index]); 1624 list_add_tail(&nesvnic->list, &nesdev->nesadapter->nesvnic_list[nesdev->mac_index]);
1616 1625
1617 if ((nesdev->netdev_count == 0) && 1626 if ((nesdev->netdev_count == 0) &&
1618 (PCI_FUNC(nesdev->pcidev->devfn) == nesdev->mac_index)) { 1627 ((PCI_FUNC(nesdev->pcidev->devfn) == nesdev->mac_index) ||
1619 nes_debug(NES_DBG_INIT, "Setting up PHY interrupt mask. Using register index 0x%04X\n", 1628 ((nesdev->nesadapter->phy_type[nesdev->mac_index] == NES_PHY_TYPE_PUMA_1G) &&
1620 NES_IDX_PHY_PCS_CONTROL_STATUS0+(0x200*(nesvnic->logical_port&1))); 1629 (((PCI_FUNC(nesdev->pcidev->devfn) == 1) && (nesdev->mac_index == 2)) ||
1630 ((PCI_FUNC(nesdev->pcidev->devfn) == 2) && (nesdev->mac_index == 1)))))) {
1631 /*
1632 * nes_debug(NES_DBG_INIT, "Setting up PHY interrupt mask. Using register index 0x%04X\n",
1633 * NES_IDX_PHY_PCS_CONTROL_STATUS0 + (0x200 * (nesvnic->logical_port & 1)));
1634 */
1621 u32temp = nes_read_indexed(nesdev, NES_IDX_PHY_PCS_CONTROL_STATUS0 + 1635 u32temp = nes_read_indexed(nesdev, NES_IDX_PHY_PCS_CONTROL_STATUS0 +
1622 (0x200*(nesvnic->logical_port&1))); 1636 (0x200 * (nesdev->mac_index & 1)));
1623 u32temp |= 0x00200000; 1637 if (nesdev->nesadapter->phy_type[nesdev->mac_index] != NES_PHY_TYPE_PUMA_1G) {
1624 nes_write_indexed(nesdev, NES_IDX_PHY_PCS_CONTROL_STATUS0 + 1638 u32temp |= 0x00200000;
1625 (0x200*(nesvnic->logical_port&1)), u32temp); 1639 nes_write_indexed(nesdev, NES_IDX_PHY_PCS_CONTROL_STATUS0 +
1640 (0x200 * (nesdev->mac_index & 1)), u32temp);
1641 }
1642
1626 u32temp = nes_read_indexed(nesdev, NES_IDX_PHY_PCS_CONTROL_STATUS0 + 1643 u32temp = nes_read_indexed(nesdev, NES_IDX_PHY_PCS_CONTROL_STATUS0 +
1627 (0x200*(nesvnic->logical_port&1)) ); 1644 (0x200 * (nesdev->mac_index & 1)));
1645
1628 if ((u32temp&0x0f1f0000) == 0x0f0f0000) { 1646 if ((u32temp&0x0f1f0000) == 0x0f0f0000) {
1629 if (nesdev->nesadapter->phy_type[nesvnic->logical_port] == NES_PHY_TYPE_IRIS) { 1647 if (nesdev->nesadapter->phy_type[nesdev->mac_index] == NES_PHY_TYPE_IRIS) {
1630 nes_init_phy(nesdev); 1648 nes_init_phy(nesdev);
1631 nes_read_10G_phy_reg(nesdev, 1, 1649 nes_read_10G_phy_reg(nesdev, nesdev->nesadapter->phy_index[nesdev->mac_index], 1, 1);
1632 nesdev->nesadapter->phy_index[nesvnic->logical_port]);
1633 temp_phy_data = (u16)nes_read_indexed(nesdev, 1650 temp_phy_data = (u16)nes_read_indexed(nesdev,
1634 NES_IDX_MAC_MDIO_CONTROL); 1651 NES_IDX_MAC_MDIO_CONTROL);
1635 u32temp = 20; 1652 u32temp = 20;
1636 do { 1653 do {
1637 nes_read_10G_phy_reg(nesdev, 1, 1654 nes_read_10G_phy_reg(nesdev, nesdev->nesadapter->phy_index[nesdev->mac_index], 1, 1);
1638 nesdev->nesadapter->phy_index[nesvnic->logical_port]);
1639 phy_data = (u16)nes_read_indexed(nesdev, 1655 phy_data = (u16)nes_read_indexed(nesdev,
1640 NES_IDX_MAC_MDIO_CONTROL); 1656 NES_IDX_MAC_MDIO_CONTROL);
1641 if ((phy_data == temp_phy_data) || (!(--u32temp))) 1657 if ((phy_data == temp_phy_data) || (!(--u32temp)))
@@ -1652,6 +1668,14 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
1652 nes_debug(NES_DBG_INIT, "The Link is UP!!.\n"); 1668 nes_debug(NES_DBG_INIT, "The Link is UP!!.\n");
1653 nesvnic->linkup = 1; 1669 nesvnic->linkup = 1;
1654 } 1670 }
1671 } else if (nesdev->nesadapter->phy_type[nesdev->mac_index] == NES_PHY_TYPE_PUMA_1G) {
1672 nes_debug(NES_DBG_INIT, "mac_index=%d, logical_port=%d, u32temp=0x%04X, PCI_FUNC=%d\n",
1673 nesdev->mac_index, nesvnic->logical_port, u32temp, PCI_FUNC(nesdev->pcidev->devfn));
1674 if (((nesdev->mac_index < 2) && ((u32temp&0x01010000) == 0x01010000)) ||
1675 ((nesdev->mac_index > 1) && ((u32temp&0x02020000) == 0x02020000))) {
1676 nes_debug(NES_DBG_INIT, "The Link is UP!!.\n");
1677 nesvnic->linkup = 1;
1678 }
1655 } 1679 }
1656 /* clear the MAC interrupt status, assumes direct logical to physical mapping */ 1680 /* clear the MAC interrupt status, assumes direct logical to physical mapping */
1657 u32temp = nes_read_indexed(nesdev, NES_IDX_MAC_INT_STATUS + (0x200 * nesdev->mac_index)); 1681 u32temp = nes_read_indexed(nesdev, NES_IDX_MAC_INT_STATUS + (0x200 * nesdev->mac_index));