|
@@ -19,10 +19,7 @@
|
|
#include "workarounds.h"
|
|
#include "workarounds.h"
|
|
#include "selftest.h"
|
|
#include "selftest.h"
|
|
|
|
|
|
-/* We expect these MMDs to be in the package. SFT9001 also has a
|
|
|
|
- * clause 22 extension MMD, but since it doesn't have all the generic
|
|
|
|
- * MMD registers it is pointless to include it here.
|
|
|
|
- */
|
|
|
|
|
|
+/* We expect these MMDs to be in the package. */
|
|
#define TENXPRESS_REQUIRED_DEVS (MDIO_DEVS_PMAPMD | \
|
|
#define TENXPRESS_REQUIRED_DEVS (MDIO_DEVS_PMAPMD | \
|
|
MDIO_DEVS_PCS | \
|
|
MDIO_DEVS_PCS | \
|
|
MDIO_DEVS_PHYXS | \
|
|
MDIO_DEVS_PHYXS | \
|
|
@@ -33,12 +30,6 @@
|
|
(1 << LOOPBACK_PMAPMD) | \
|
|
(1 << LOOPBACK_PMAPMD) | \
|
|
(1 << LOOPBACK_PHYXS_WS))
|
|
(1 << LOOPBACK_PHYXS_WS))
|
|
|
|
|
|
-#define SFT9001_LOOPBACKS ((1 << LOOPBACK_GPHY) | \
|
|
|
|
- (1 << LOOPBACK_PHYXS) | \
|
|
|
|
- (1 << LOOPBACK_PCS) | \
|
|
|
|
- (1 << LOOPBACK_PMAPMD) | \
|
|
|
|
- (1 << LOOPBACK_PHYXS_WS))
|
|
|
|
-
|
|
|
|
/* We complain if we fail to see the link partner as 10G capable this many
|
|
/* We complain if we fail to see the link partner as 10G capable this many
|
|
* times in a row (must be > 1 as sampling the autoneg. registers is racy)
|
|
* times in a row (must be > 1 as sampling the autoneg. registers is racy)
|
|
*/
|
|
*/
|
|
@@ -50,9 +41,8 @@
|
|
#define PMA_PMD_EXT_GMII_EN_WIDTH 1
|
|
#define PMA_PMD_EXT_GMII_EN_WIDTH 1
|
|
#define PMA_PMD_EXT_CLK_OUT_LBN 2
|
|
#define PMA_PMD_EXT_CLK_OUT_LBN 2
|
|
#define PMA_PMD_EXT_CLK_OUT_WIDTH 1
|
|
#define PMA_PMD_EXT_CLK_OUT_WIDTH 1
|
|
-#define PMA_PMD_LNPGA_POWERDOWN_LBN 8 /* SFX7101 only */
|
|
|
|
|
|
+#define PMA_PMD_LNPGA_POWERDOWN_LBN 8
|
|
#define PMA_PMD_LNPGA_POWERDOWN_WIDTH 1
|
|
#define PMA_PMD_LNPGA_POWERDOWN_WIDTH 1
|
|
-#define PMA_PMD_EXT_CLK312_LBN 8 /* SFT9001 only */
|
|
|
|
#define PMA_PMD_EXT_CLK312_WIDTH 1
|
|
#define PMA_PMD_EXT_CLK312_WIDTH 1
|
|
#define PMA_PMD_EXT_LPOWER_LBN 12
|
|
#define PMA_PMD_EXT_LPOWER_LBN 12
|
|
#define PMA_PMD_EXT_LPOWER_WIDTH 1
|
|
#define PMA_PMD_EXT_LPOWER_WIDTH 1
|
|
@@ -84,7 +74,6 @@
|
|
#define PMA_PMD_LED_FLASH (3)
|
|
#define PMA_PMD_LED_FLASH (3)
|
|
#define PMA_PMD_LED_MASK 3
|
|
#define PMA_PMD_LED_MASK 3
|
|
/* All LEDs under hardware control */
|
|
/* All LEDs under hardware control */
|
|
-#define SFT9001_PMA_PMD_LED_DEFAULT 0
|
|
|
|
/* Green and Amber under hardware control, Red off */
|
|
/* Green and Amber under hardware control, Red off */
|
|
#define SFX7101_PMA_PMD_LED_DEFAULT (PMA_PMD_LED_OFF << PMA_PMD_LED_RX_LBN)
|
|
#define SFX7101_PMA_PMD_LED_DEFAULT (PMA_PMD_LED_OFF << PMA_PMD_LED_RX_LBN)
|
|
|
|
|
|
@@ -98,31 +87,7 @@
|
|
#define PMA_PMD_SPEED_LBN 4
|
|
#define PMA_PMD_SPEED_LBN 4
|
|
#define PMA_PMD_SPEED_WIDTH 4
|
|
#define PMA_PMD_SPEED_WIDTH 4
|
|
|
|
|
|
-/* Cable diagnostics - SFT9001 only */
|
|
|
|
-#define PMA_PMD_CDIAG_CTRL_REG 49213
|
|
|
|
-#define CDIAG_CTRL_IMMED_LBN 15
|
|
|
|
-#define CDIAG_CTRL_BRK_LINK_LBN 12
|
|
|
|
-#define CDIAG_CTRL_IN_PROG_LBN 11
|
|
|
|
-#define CDIAG_CTRL_LEN_UNIT_LBN 10
|
|
|
|
-#define CDIAG_CTRL_LEN_METRES 1
|
|
|
|
-#define PMA_PMD_CDIAG_RES_REG 49174
|
|
|
|
-#define CDIAG_RES_A_LBN 12
|
|
|
|
-#define CDIAG_RES_B_LBN 8
|
|
|
|
-#define CDIAG_RES_C_LBN 4
|
|
|
|
-#define CDIAG_RES_D_LBN 0
|
|
|
|
-#define CDIAG_RES_WIDTH 4
|
|
|
|
-#define CDIAG_RES_OPEN 2
|
|
|
|
-#define CDIAG_RES_OK 1
|
|
|
|
-#define CDIAG_RES_INVALID 0
|
|
|
|
-/* Set of 4 registers for pairs A-D */
|
|
|
|
-#define PMA_PMD_CDIAG_LEN_REG 49175
|
|
|
|
-
|
|
|
|
-/* Serdes control registers - SFT9001 only */
|
|
|
|
-#define PMA_PMD_CSERDES_CTRL_REG 64258
|
|
|
|
-/* Set the 156.25 MHz output to 312.5 MHz to drive Falcon's XMAC */
|
|
|
|
-#define PMA_PMD_CSERDES_DEFAULT 0x000f
|
|
|
|
-
|
|
|
|
-/* Misc register defines - SFX7101 only */
|
|
|
|
|
|
+/* Misc register defines */
|
|
#define PCS_CLOCK_CTRL_REG 55297
|
|
#define PCS_CLOCK_CTRL_REG 55297
|
|
#define PLL312_RST_N_LBN 2
|
|
#define PLL312_RST_N_LBN 2
|
|
|
|
|
|
@@ -185,121 +150,17 @@ struct tenxpress_phy_data {
|
|
int bad_lp_tries;
|
|
int bad_lp_tries;
|
|
};
|
|
};
|
|
|
|
|
|
-static ssize_t show_phy_short_reach(struct device *dev,
|
|
|
|
- struct device_attribute *attr, char *buf)
|
|
|
|
-{
|
|
|
|
- struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev));
|
|
|
|
- int reg;
|
|
|
|
-
|
|
|
|
- reg = efx_mdio_read(efx, MDIO_MMD_PMAPMD, MDIO_PMA_10GBT_TXPWR);
|
|
|
|
- return sprintf(buf, "%d\n", !!(reg & MDIO_PMA_10GBT_TXPWR_SHORT));
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static ssize_t set_phy_short_reach(struct device *dev,
|
|
|
|
- struct device_attribute *attr,
|
|
|
|
- const char *buf, size_t count)
|
|
|
|
-{
|
|
|
|
- struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev));
|
|
|
|
- int rc;
|
|
|
|
-
|
|
|
|
- rtnl_lock();
|
|
|
|
- if (efx->state != STATE_RUNNING) {
|
|
|
|
- rc = -EBUSY;
|
|
|
|
- } else {
|
|
|
|
- efx_mdio_set_flag(efx, MDIO_MMD_PMAPMD, MDIO_PMA_10GBT_TXPWR,
|
|
|
|
- MDIO_PMA_10GBT_TXPWR_SHORT,
|
|
|
|
- count != 0 && *buf != '0');
|
|
|
|
- rc = efx_reconfigure_port(efx);
|
|
|
|
- }
|
|
|
|
- rtnl_unlock();
|
|
|
|
-
|
|
|
|
- return rc < 0 ? rc : (ssize_t)count;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static DEVICE_ATTR(phy_short_reach, 0644, show_phy_short_reach,
|
|
|
|
- set_phy_short_reach);
|
|
|
|
-
|
|
|
|
-int sft9001_wait_boot(struct efx_nic *efx)
|
|
|
|
-{
|
|
|
|
- unsigned long timeout = jiffies + HZ + 1;
|
|
|
|
- int boot_stat;
|
|
|
|
-
|
|
|
|
- for (;;) {
|
|
|
|
- boot_stat = efx_mdio_read(efx, MDIO_MMD_PCS,
|
|
|
|
- PCS_BOOT_STATUS_REG);
|
|
|
|
- if (boot_stat >= 0) {
|
|
|
|
- netif_dbg(efx, hw, efx->net_dev,
|
|
|
|
- "PHY boot status = %#x\n", boot_stat);
|
|
|
|
- switch (boot_stat &
|
|
|
|
- ((1 << PCS_BOOT_FATAL_ERROR_LBN) |
|
|
|
|
- (3 << PCS_BOOT_PROGRESS_LBN) |
|
|
|
|
- (1 << PCS_BOOT_DOWNLOAD_WAIT_LBN) |
|
|
|
|
- (1 << PCS_BOOT_CODE_STARTED_LBN))) {
|
|
|
|
- case ((1 << PCS_BOOT_FATAL_ERROR_LBN) |
|
|
|
|
- (PCS_BOOT_PROGRESS_CHECKSUM <<
|
|
|
|
- PCS_BOOT_PROGRESS_LBN)):
|
|
|
|
- case ((1 << PCS_BOOT_FATAL_ERROR_LBN) |
|
|
|
|
- (PCS_BOOT_PROGRESS_INIT <<
|
|
|
|
- PCS_BOOT_PROGRESS_LBN) |
|
|
|
|
- (1 << PCS_BOOT_DOWNLOAD_WAIT_LBN)):
|
|
|
|
- return -EINVAL;
|
|
|
|
- case ((PCS_BOOT_PROGRESS_WAIT_MDIO <<
|
|
|
|
- PCS_BOOT_PROGRESS_LBN) |
|
|
|
|
- (1 << PCS_BOOT_DOWNLOAD_WAIT_LBN)):
|
|
|
|
- return (efx->phy_mode & PHY_MODE_SPECIAL) ?
|
|
|
|
- 0 : -EIO;
|
|
|
|
- case ((PCS_BOOT_PROGRESS_JUMP <<
|
|
|
|
- PCS_BOOT_PROGRESS_LBN) |
|
|
|
|
- (1 << PCS_BOOT_CODE_STARTED_LBN)):
|
|
|
|
- case ((PCS_BOOT_PROGRESS_JUMP <<
|
|
|
|
- PCS_BOOT_PROGRESS_LBN) |
|
|
|
|
- (1 << PCS_BOOT_DOWNLOAD_WAIT_LBN) |
|
|
|
|
- (1 << PCS_BOOT_CODE_STARTED_LBN)):
|
|
|
|
- return (efx->phy_mode & PHY_MODE_SPECIAL) ?
|
|
|
|
- -EIO : 0;
|
|
|
|
- default:
|
|
|
|
- if (boot_stat & (1 << PCS_BOOT_FATAL_ERROR_LBN))
|
|
|
|
- return -EIO;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (time_after_eq(jiffies, timeout))
|
|
|
|
- return -ETIMEDOUT;
|
|
|
|
-
|
|
|
|
- msleep(50);
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
static int tenxpress_init(struct efx_nic *efx)
|
|
static int tenxpress_init(struct efx_nic *efx)
|
|
{
|
|
{
|
|
- int reg;
|
|
|
|
-
|
|
|
|
- if (efx->phy_type == PHY_TYPE_SFX7101) {
|
|
|
|
- /* Enable 312.5 MHz clock */
|
|
|
|
- efx_mdio_write(efx, MDIO_MMD_PCS, PCS_TEST_SELECT_REG,
|
|
|
|
- 1 << CLK312_EN_LBN);
|
|
|
|
- } else {
|
|
|
|
- /* Enable 312.5 MHz clock and GMII */
|
|
|
|
- reg = efx_mdio_read(efx, MDIO_MMD_PMAPMD, PMA_PMD_XCONTROL_REG);
|
|
|
|
- reg |= ((1 << PMA_PMD_EXT_GMII_EN_LBN) |
|
|
|
|
- (1 << PMA_PMD_EXT_CLK_OUT_LBN) |
|
|
|
|
- (1 << PMA_PMD_EXT_CLK312_LBN) |
|
|
|
|
- (1 << PMA_PMD_EXT_ROBUST_LBN));
|
|
|
|
-
|
|
|
|
- efx_mdio_write(efx, MDIO_MMD_PMAPMD, PMA_PMD_XCONTROL_REG, reg);
|
|
|
|
- efx_mdio_set_flag(efx, MDIO_MMD_C22EXT,
|
|
|
|
- GPHY_XCONTROL_REG, 1 << GPHY_ISOLATE_LBN,
|
|
|
|
- false);
|
|
|
|
- }
|
|
|
|
|
|
+ /* Enable 312.5 MHz clock */
|
|
|
|
+ efx_mdio_write(efx, MDIO_MMD_PCS, PCS_TEST_SELECT_REG,
|
|
|
|
+ 1 << CLK312_EN_LBN);
|
|
|
|
|
|
/* Set the LEDs up as: Green = Link, Amber = Link/Act, Red = Off */
|
|
/* Set the LEDs up as: Green = Link, Amber = Link/Act, Red = Off */
|
|
- if (efx->phy_type == PHY_TYPE_SFX7101) {
|
|
|
|
- efx_mdio_set_flag(efx, MDIO_MMD_PMAPMD, PMA_PMD_LED_CTRL_REG,
|
|
|
|
- 1 << PMA_PMA_LED_ACTIVITY_LBN, true);
|
|
|
|
- efx_mdio_write(efx, MDIO_MMD_PMAPMD, PMA_PMD_LED_OVERR_REG,
|
|
|
|
- SFX7101_PMA_PMD_LED_DEFAULT);
|
|
|
|
- }
|
|
|
|
|
|
+ efx_mdio_set_flag(efx, MDIO_MMD_PMAPMD, PMA_PMD_LED_CTRL_REG,
|
|
|
|
+ 1 << PMA_PMA_LED_ACTIVITY_LBN, true);
|
|
|
|
+ efx_mdio_write(efx, MDIO_MMD_PMAPMD, PMA_PMD_LED_OVERR_REG,
|
|
|
|
+ SFX7101_PMA_PMD_LED_DEFAULT);
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
@@ -307,7 +168,6 @@ static int tenxpress_init(struct efx_nic *efx)
|
|
static int tenxpress_phy_probe(struct efx_nic *efx)
|
|
static int tenxpress_phy_probe(struct efx_nic *efx)
|
|
{
|
|
{
|
|
struct tenxpress_phy_data *phy_data;
|
|
struct tenxpress_phy_data *phy_data;
|
|
- int rc;
|
|
|
|
|
|
|
|
/* Allocate phy private storage */
|
|
/* Allocate phy private storage */
|
|
phy_data = kzalloc(sizeof(*phy_data), GFP_KERNEL);
|
|
phy_data = kzalloc(sizeof(*phy_data), GFP_KERNEL);
|
|
@@ -316,42 +176,15 @@ static int tenxpress_phy_probe(struct efx_nic *efx)
|
|
efx->phy_data = phy_data;
|
|
efx->phy_data = phy_data;
|
|
phy_data->phy_mode = efx->phy_mode;
|
|
phy_data->phy_mode = efx->phy_mode;
|
|
|
|
|
|
- /* Create any special files */
|
|
|
|
- if (efx->phy_type == PHY_TYPE_SFT9001B) {
|
|
|
|
- rc = device_create_file(&efx->pci_dev->dev,
|
|
|
|
- &dev_attr_phy_short_reach);
|
|
|
|
- if (rc)
|
|
|
|
- goto fail;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (efx->phy_type == PHY_TYPE_SFX7101) {
|
|
|
|
- efx->mdio.mmds = TENXPRESS_REQUIRED_DEVS;
|
|
|
|
- efx->mdio.mode_support = MDIO_SUPPORTS_C45;
|
|
|
|
-
|
|
|
|
- efx->loopback_modes = SFX7101_LOOPBACKS | FALCON_XMAC_LOOPBACKS;
|
|
|
|
|
|
+ efx->mdio.mmds = TENXPRESS_REQUIRED_DEVS;
|
|
|
|
+ efx->mdio.mode_support = MDIO_SUPPORTS_C45;
|
|
|
|
|
|
- efx->link_advertising = (ADVERTISED_TP | ADVERTISED_Autoneg |
|
|
|
|
- ADVERTISED_10000baseT_Full);
|
|
|
|
- } else {
|
|
|
|
- efx->mdio.mmds = TENXPRESS_REQUIRED_DEVS;
|
|
|
|
- efx->mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22;
|
|
|
|
|
|
+ efx->loopback_modes = SFX7101_LOOPBACKS | FALCON_XMAC_LOOPBACKS;
|
|
|
|
|
|
- efx->loopback_modes = (SFT9001_LOOPBACKS |
|
|
|
|
- FALCON_XMAC_LOOPBACKS |
|
|
|
|
- FALCON_GMAC_LOOPBACKS);
|
|
|
|
-
|
|
|
|
- efx->link_advertising = (ADVERTISED_TP | ADVERTISED_Autoneg |
|
|
|
|
- ADVERTISED_10000baseT_Full |
|
|
|
|
- ADVERTISED_1000baseT_Full |
|
|
|
|
- ADVERTISED_100baseT_Full);
|
|
|
|
- }
|
|
|
|
|
|
+ efx->link_advertising = (ADVERTISED_TP | ADVERTISED_Autoneg |
|
|
|
|
+ ADVERTISED_10000baseT_Full);
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
-
|
|
|
|
-fail:
|
|
|
|
- kfree(efx->phy_data);
|
|
|
|
- efx->phy_data = NULL;
|
|
|
|
- return rc;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
static int tenxpress_phy_init(struct efx_nic *efx)
|
|
static int tenxpress_phy_init(struct efx_nic *efx)
|
|
@@ -361,16 +194,6 @@ static int tenxpress_phy_init(struct efx_nic *efx)
|
|
falcon_board(efx)->type->init_phy(efx);
|
|
falcon_board(efx)->type->init_phy(efx);
|
|
|
|
|
|
if (!(efx->phy_mode & PHY_MODE_SPECIAL)) {
|
|
if (!(efx->phy_mode & PHY_MODE_SPECIAL)) {
|
|
- if (efx->phy_type == PHY_TYPE_SFT9001A) {
|
|
|
|
- int reg;
|
|
|
|
- reg = efx_mdio_read(efx, MDIO_MMD_PMAPMD,
|
|
|
|
- PMA_PMD_XCONTROL_REG);
|
|
|
|
- reg |= (1 << PMA_PMD_EXT_SSR_LBN);
|
|
|
|
- efx_mdio_write(efx, MDIO_MMD_PMAPMD,
|
|
|
|
- PMA_PMD_XCONTROL_REG, reg);
|
|
|
|
- mdelay(200);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
rc = efx_mdio_wait_reset_mmds(efx, TENXPRESS_REQUIRED_DEVS);
|
|
rc = efx_mdio_wait_reset_mmds(efx, TENXPRESS_REQUIRED_DEVS);
|
|
if (rc < 0)
|
|
if (rc < 0)
|
|
return rc;
|
|
return rc;
|
|
@@ -403,7 +226,7 @@ static int tenxpress_special_reset(struct efx_nic *efx)
|
|
{
|
|
{
|
|
int rc, reg;
|
|
int rc, reg;
|
|
|
|
|
|
- /* The XGMAC clock is driven from the SFC7101/SFT9001 312MHz clock, so
|
|
|
|
|
|
+ /* The XGMAC clock is driven from the SFX7101 312MHz clock, so
|
|
* a special software reset can glitch the XGMAC sufficiently for stats
|
|
* a special software reset can glitch the XGMAC sufficiently for stats
|
|
* requests to fail. */
|
|
* requests to fail. */
|
|
falcon_stop_nic_stats(efx);
|
|
falcon_stop_nic_stats(efx);
|
|
@@ -484,53 +307,18 @@ static bool sfx7101_link_ok(struct efx_nic *efx)
|
|
MDIO_DEVS_PHYXS);
|
|
MDIO_DEVS_PHYXS);
|
|
}
|
|
}
|
|
|
|
|
|
-static bool sft9001_link_ok(struct efx_nic *efx, struct ethtool_cmd *ecmd)
|
|
|
|
-{
|
|
|
|
- u32 reg;
|
|
|
|
-
|
|
|
|
- if (efx_phy_mode_disabled(efx->phy_mode))
|
|
|
|
- return false;
|
|
|
|
- else if (efx->loopback_mode == LOOPBACK_GPHY)
|
|
|
|
- return true;
|
|
|
|
- else if (efx->loopback_mode)
|
|
|
|
- return efx_mdio_links_ok(efx,
|
|
|
|
- MDIO_DEVS_PMAPMD |
|
|
|
|
- MDIO_DEVS_PHYXS);
|
|
|
|
-
|
|
|
|
- /* We must use the same definition of link state as LASI,
|
|
|
|
- * otherwise we can miss a link state transition
|
|
|
|
- */
|
|
|
|
- if (ecmd->speed == 10000) {
|
|
|
|
- reg = efx_mdio_read(efx, MDIO_MMD_PCS, MDIO_PCS_10GBRT_STAT1);
|
|
|
|
- return reg & MDIO_PCS_10GBRT_STAT1_BLKLK;
|
|
|
|
- } else {
|
|
|
|
- reg = efx_mdio_read(efx, MDIO_MMD_C22EXT, C22EXT_STATUS_REG);
|
|
|
|
- return reg & (1 << C22EXT_STATUS_LINK_LBN);
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
static void tenxpress_ext_loopback(struct efx_nic *efx)
|
|
static void tenxpress_ext_loopback(struct efx_nic *efx)
|
|
{
|
|
{
|
|
efx_mdio_set_flag(efx, MDIO_MMD_PHYXS, PHYXS_TEST1,
|
|
efx_mdio_set_flag(efx, MDIO_MMD_PHYXS, PHYXS_TEST1,
|
|
1 << LOOPBACK_NEAR_LBN,
|
|
1 << LOOPBACK_NEAR_LBN,
|
|
efx->loopback_mode == LOOPBACK_PHYXS);
|
|
efx->loopback_mode == LOOPBACK_PHYXS);
|
|
- if (efx->phy_type != PHY_TYPE_SFX7101)
|
|
|
|
- efx_mdio_set_flag(efx, MDIO_MMD_C22EXT, GPHY_XCONTROL_REG,
|
|
|
|
- 1 << GPHY_LOOPBACK_NEAR_LBN,
|
|
|
|
- efx->loopback_mode == LOOPBACK_GPHY);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
static void tenxpress_low_power(struct efx_nic *efx)
|
|
static void tenxpress_low_power(struct efx_nic *efx)
|
|
{
|
|
{
|
|
- if (efx->phy_type == PHY_TYPE_SFX7101)
|
|
|
|
- efx_mdio_set_mmds_lpower(
|
|
|
|
- efx, !!(efx->phy_mode & PHY_MODE_LOW_POWER),
|
|
|
|
- TENXPRESS_REQUIRED_DEVS);
|
|
|
|
- else
|
|
|
|
- efx_mdio_set_flag(
|
|
|
|
- efx, MDIO_MMD_PMAPMD, PMA_PMD_XCONTROL_REG,
|
|
|
|
- 1 << PMA_PMD_EXT_LPOWER_LBN,
|
|
|
|
- !!(efx->phy_mode & PHY_MODE_LOW_POWER));
|
|
|
|
|
|
+ efx_mdio_set_mmds_lpower(
|
|
|
|
+ efx, !!(efx->phy_mode & PHY_MODE_LOW_POWER),
|
|
|
|
+ TENXPRESS_REQUIRED_DEVS);
|
|
}
|
|
}
|
|
|
|
|
|
static int tenxpress_phy_reconfigure(struct efx_nic *efx)
|
|
static int tenxpress_phy_reconfigure(struct efx_nic *efx)
|
|
@@ -550,12 +338,7 @@ static int tenxpress_phy_reconfigure(struct efx_nic *efx)
|
|
|
|
|
|
if (loop_reset || phy_mode_change) {
|
|
if (loop_reset || phy_mode_change) {
|
|
tenxpress_special_reset(efx);
|
|
tenxpress_special_reset(efx);
|
|
-
|
|
|
|
- /* Reset XAUI if we were in 10G, and are staying
|
|
|
|
- * in 10G. If we're moving into and out of 10G
|
|
|
|
- * then xaui will be reset anyway */
|
|
|
|
- if (EFX_IS10G(efx))
|
|
|
|
- falcon_reset_xaui(efx);
|
|
|
|
|
|
+ falcon_reset_xaui(efx);
|
|
}
|
|
}
|
|
|
|
|
|
tenxpress_low_power(efx);
|
|
tenxpress_low_power(efx);
|
|
@@ -578,29 +361,12 @@ static bool tenxpress_phy_poll(struct efx_nic *efx)
|
|
{
|
|
{
|
|
struct efx_link_state old_state = efx->link_state;
|
|
struct efx_link_state old_state = efx->link_state;
|
|
|
|
|
|
- if (efx->phy_type == PHY_TYPE_SFX7101) {
|
|
|
|
- efx->link_state.up = sfx7101_link_ok(efx);
|
|
|
|
- efx->link_state.speed = 10000;
|
|
|
|
- efx->link_state.fd = true;
|
|
|
|
- efx->link_state.fc = efx_mdio_get_pause(efx);
|
|
|
|
-
|
|
|
|
- sfx7101_check_bad_lp(efx, efx->link_state.up);
|
|
|
|
- } else {
|
|
|
|
- struct ethtool_cmd ecmd;
|
|
|
|
-
|
|
|
|
- /* Check the LASI alarm first */
|
|
|
|
- if (efx->loopback_mode == LOOPBACK_NONE &&
|
|
|
|
- !(efx_mdio_read(efx, MDIO_MMD_PMAPMD, MDIO_PMA_LASI_STAT) &
|
|
|
|
- MDIO_PMA_LASI_LSALARM))
|
|
|
|
- return false;
|
|
|
|
|
|
+ efx->link_state.up = sfx7101_link_ok(efx);
|
|
|
|
+ efx->link_state.speed = 10000;
|
|
|
|
+ efx->link_state.fd = true;
|
|
|
|
+ efx->link_state.fc = efx_mdio_get_pause(efx);
|
|
|
|
|
|
- tenxpress_get_settings(efx, &ecmd);
|
|
|
|
-
|
|
|
|
- efx->link_state.up = sft9001_link_ok(efx, &ecmd);
|
|
|
|
- efx->link_state.speed = ecmd.speed;
|
|
|
|
- efx->link_state.fd = (ecmd.duplex == DUPLEX_FULL);
|
|
|
|
- efx->link_state.fc = efx_mdio_get_pause(efx);
|
|
|
|
- }
|
|
|
|
|
|
+ sfx7101_check_bad_lp(efx, efx->link_state.up);
|
|
|
|
|
|
return !efx_link_state_equal(&efx->link_state, &old_state);
|
|
return !efx_link_state_equal(&efx->link_state, &old_state);
|
|
}
|
|
}
|
|
@@ -621,10 +387,6 @@ static void sfx7101_phy_fini(struct efx_nic *efx)
|
|
|
|
|
|
static void tenxpress_phy_remove(struct efx_nic *efx)
|
|
static void tenxpress_phy_remove(struct efx_nic *efx)
|
|
{
|
|
{
|
|
- if (efx->phy_type == PHY_TYPE_SFT9001B)
|
|
|
|
- device_remove_file(&efx->pci_dev->dev,
|
|
|
|
- &dev_attr_phy_short_reach);
|
|
|
|
-
|
|
|
|
kfree(efx->phy_data);
|
|
kfree(efx->phy_data);
|
|
efx->phy_data = NULL;
|
|
efx->phy_data = NULL;
|
|
}
|
|
}
|
|
@@ -647,10 +409,7 @@ void tenxpress_set_id_led(struct efx_nic *efx, enum efx_led_mode mode)
|
|
(PMA_PMD_LED_ON << PMA_PMD_LED_LINK_LBN);
|
|
(PMA_PMD_LED_ON << PMA_PMD_LED_LINK_LBN);
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
- if (efx->phy_type == PHY_TYPE_SFX7101)
|
|
|
|
- reg = SFX7101_PMA_PMD_LED_DEFAULT;
|
|
|
|
- else
|
|
|
|
- reg = SFT9001_PMA_PMD_LED_DEFAULT;
|
|
|
|
|
|
+ reg = SFX7101_PMA_PMD_LED_DEFAULT;
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -685,102 +444,12 @@ sfx7101_run_tests(struct efx_nic *efx, int *results, unsigned flags)
|
|
return rc;
|
|
return rc;
|
|
}
|
|
}
|
|
|
|
|
|
-static const char *const sft9001_test_names[] = {
|
|
|
|
- "bist",
|
|
|
|
- "cable.pairA.status",
|
|
|
|
- "cable.pairB.status",
|
|
|
|
- "cable.pairC.status",
|
|
|
|
- "cable.pairD.status",
|
|
|
|
- "cable.pairA.length",
|
|
|
|
- "cable.pairB.length",
|
|
|
|
- "cable.pairC.length",
|
|
|
|
- "cable.pairD.length",
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-static const char *sft9001_test_name(struct efx_nic *efx, unsigned int index)
|
|
|
|
-{
|
|
|
|
- if (index < ARRAY_SIZE(sft9001_test_names))
|
|
|
|
- return sft9001_test_names[index];
|
|
|
|
- return NULL;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static int sft9001_run_tests(struct efx_nic *efx, int *results, unsigned flags)
|
|
|
|
-{
|
|
|
|
- int rc = 0, rc2, i, ctrl_reg, res_reg;
|
|
|
|
-
|
|
|
|
- /* Initialise cable diagnostic results to unknown failure */
|
|
|
|
- for (i = 1; i < 9; ++i)
|
|
|
|
- results[i] = -1;
|
|
|
|
-
|
|
|
|
- /* Run cable diagnostics; wait up to 5 seconds for them to complete.
|
|
|
|
- * A cable fault is not a self-test failure, but a timeout is. */
|
|
|
|
- ctrl_reg = ((1 << CDIAG_CTRL_IMMED_LBN) |
|
|
|
|
- (CDIAG_CTRL_LEN_METRES << CDIAG_CTRL_LEN_UNIT_LBN));
|
|
|
|
- if (flags & ETH_TEST_FL_OFFLINE) {
|
|
|
|
- /* Break the link in order to run full diagnostics. We
|
|
|
|
- * must reset the PHY to resume normal service. */
|
|
|
|
- ctrl_reg |= (1 << CDIAG_CTRL_BRK_LINK_LBN);
|
|
|
|
- }
|
|
|
|
- efx_mdio_write(efx, MDIO_MMD_PMAPMD, PMA_PMD_CDIAG_CTRL_REG,
|
|
|
|
- ctrl_reg);
|
|
|
|
- i = 0;
|
|
|
|
- while (efx_mdio_read(efx, MDIO_MMD_PMAPMD, PMA_PMD_CDIAG_CTRL_REG) &
|
|
|
|
- (1 << CDIAG_CTRL_IN_PROG_LBN)) {
|
|
|
|
- if (++i == 50) {
|
|
|
|
- rc = -ETIMEDOUT;
|
|
|
|
- goto out;
|
|
|
|
- }
|
|
|
|
- msleep(100);
|
|
|
|
- }
|
|
|
|
- res_reg = efx_mdio_read(efx, MDIO_MMD_PMAPMD, PMA_PMD_CDIAG_RES_REG);
|
|
|
|
- for (i = 0; i < 4; i++) {
|
|
|
|
- int pair_res =
|
|
|
|
- (res_reg >> (CDIAG_RES_A_LBN - i * CDIAG_RES_WIDTH))
|
|
|
|
- & ((1 << CDIAG_RES_WIDTH) - 1);
|
|
|
|
- int len_reg = efx_mdio_read(efx, MDIO_MMD_PMAPMD,
|
|
|
|
- PMA_PMD_CDIAG_LEN_REG + i);
|
|
|
|
- if (pair_res == CDIAG_RES_OK)
|
|
|
|
- results[1 + i] = 1;
|
|
|
|
- else if (pair_res == CDIAG_RES_INVALID)
|
|
|
|
- results[1 + i] = -1;
|
|
|
|
- else
|
|
|
|
- results[1 + i] = -pair_res;
|
|
|
|
- if (pair_res != CDIAG_RES_INVALID &&
|
|
|
|
- pair_res != CDIAG_RES_OPEN &&
|
|
|
|
- len_reg != 0xffff)
|
|
|
|
- results[5 + i] = len_reg;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-out:
|
|
|
|
- if (flags & ETH_TEST_FL_OFFLINE) {
|
|
|
|
- /* Reset, running the BIST and then resuming normal service. */
|
|
|
|
- rc2 = tenxpress_special_reset(efx);
|
|
|
|
- results[0] = rc2 ? -1 : 1;
|
|
|
|
- if (!rc)
|
|
|
|
- rc = rc2;
|
|
|
|
-
|
|
|
|
- efx_mdio_an_reconfigure(efx);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return rc;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
static void
|
|
static void
|
|
tenxpress_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
|
|
tenxpress_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
|
|
{
|
|
{
|
|
u32 adv = 0, lpa = 0;
|
|
u32 adv = 0, lpa = 0;
|
|
int reg;
|
|
int reg;
|
|
|
|
|
|
- if (efx->phy_type != PHY_TYPE_SFX7101) {
|
|
|
|
- reg = efx_mdio_read(efx, MDIO_MMD_C22EXT, C22EXT_MSTSLV_CTRL);
|
|
|
|
- if (reg & (1 << C22EXT_MSTSLV_CTRL_ADV_1000_FD_LBN))
|
|
|
|
- adv |= ADVERTISED_1000baseT_Full;
|
|
|
|
- reg = efx_mdio_read(efx, MDIO_MMD_C22EXT, C22EXT_MSTSLV_STATUS);
|
|
|
|
- if (reg & (1 << C22EXT_MSTSLV_STATUS_LP_1000_HD_LBN))
|
|
|
|
- lpa |= ADVERTISED_1000baseT_Half;
|
|
|
|
- if (reg & (1 << C22EXT_MSTSLV_STATUS_LP_1000_FD_LBN))
|
|
|
|
- lpa |= ADVERTISED_1000baseT_Full;
|
|
|
|
- }
|
|
|
|
reg = efx_mdio_read(efx, MDIO_MMD_AN, MDIO_AN_10GBT_CTRL);
|
|
reg = efx_mdio_read(efx, MDIO_MMD_AN, MDIO_AN_10GBT_CTRL);
|
|
if (reg & MDIO_AN_10GBT_CTRL_ADV10G)
|
|
if (reg & MDIO_AN_10GBT_CTRL_ADV10G)
|
|
adv |= ADVERTISED_10000baseT_Full;
|
|
adv |= ADVERTISED_10000baseT_Full;
|
|
@@ -790,23 +459,9 @@ tenxpress_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
|
|
|
|
|
|
mdio45_ethtool_gset_npage(&efx->mdio, ecmd, adv, lpa);
|
|
mdio45_ethtool_gset_npage(&efx->mdio, ecmd, adv, lpa);
|
|
|
|
|
|
- if (efx->phy_type != PHY_TYPE_SFX7101) {
|
|
|
|
- ecmd->supported |= (SUPPORTED_100baseT_Full |
|
|
|
|
- SUPPORTED_1000baseT_Full);
|
|
|
|
- if (ecmd->speed != SPEED_10000) {
|
|
|
|
- ecmd->eth_tp_mdix =
|
|
|
|
- (efx_mdio_read(efx, MDIO_MMD_PMAPMD,
|
|
|
|
- PMA_PMD_XSTATUS_REG) &
|
|
|
|
- (1 << PMA_PMD_XSTAT_MDIX_LBN))
|
|
|
|
- ? ETH_TP_MDI_X : ETH_TP_MDI;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/* In loopback, the PHY automatically brings up the correct interface,
|
|
/* In loopback, the PHY automatically brings up the correct interface,
|
|
* but doesn't advertise the correct speed. So override it */
|
|
* but doesn't advertise the correct speed. So override it */
|
|
- if (efx->loopback_mode == LOOPBACK_GPHY)
|
|
|
|
- ecmd->speed = SPEED_1000;
|
|
|
|
- else if (LOOPBACK_EXTERNAL(efx))
|
|
|
|
|
|
+ if (LOOPBACK_EXTERNAL(efx))
|
|
ecmd->speed = SPEED_10000;
|
|
ecmd->speed = SPEED_10000;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -825,16 +480,6 @@ static void sfx7101_set_npage_adv(struct efx_nic *efx, u32 advertising)
|
|
advertising & ADVERTISED_10000baseT_Full);
|
|
advertising & ADVERTISED_10000baseT_Full);
|
|
}
|
|
}
|
|
|
|
|
|
-static void sft9001_set_npage_adv(struct efx_nic *efx, u32 advertising)
|
|
|
|
-{
|
|
|
|
- efx_mdio_set_flag(efx, MDIO_MMD_C22EXT, C22EXT_MSTSLV_CTRL,
|
|
|
|
- 1 << C22EXT_MSTSLV_CTRL_ADV_1000_FD_LBN,
|
|
|
|
- advertising & ADVERTISED_1000baseT_Full);
|
|
|
|
- efx_mdio_set_flag(efx, MDIO_MMD_AN, MDIO_AN_10GBT_CTRL,
|
|
|
|
- MDIO_AN_10GBT_CTRL_ADV10G,
|
|
|
|
- advertising & ADVERTISED_10000baseT_Full);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
struct efx_phy_operations falcon_sfx7101_phy_ops = {
|
|
struct efx_phy_operations falcon_sfx7101_phy_ops = {
|
|
.probe = tenxpress_phy_probe,
|
|
.probe = tenxpress_phy_probe,
|
|
.init = tenxpress_phy_init,
|
|
.init = tenxpress_phy_init,
|
|
@@ -849,18 +494,3 @@ struct efx_phy_operations falcon_sfx7101_phy_ops = {
|
|
.test_name = sfx7101_test_name,
|
|
.test_name = sfx7101_test_name,
|
|
.run_tests = sfx7101_run_tests,
|
|
.run_tests = sfx7101_run_tests,
|
|
};
|
|
};
|
|
-
|
|
|
|
-struct efx_phy_operations falcon_sft9001_phy_ops = {
|
|
|
|
- .probe = tenxpress_phy_probe,
|
|
|
|
- .init = tenxpress_phy_init,
|
|
|
|
- .reconfigure = tenxpress_phy_reconfigure,
|
|
|
|
- .poll = tenxpress_phy_poll,
|
|
|
|
- .fini = efx_port_dummy_op_void,
|
|
|
|
- .remove = tenxpress_phy_remove,
|
|
|
|
- .get_settings = tenxpress_get_settings,
|
|
|
|
- .set_settings = tenxpress_set_settings,
|
|
|
|
- .set_npage_adv = sft9001_set_npage_adv,
|
|
|
|
- .test_alive = efx_mdio_test_alive,
|
|
|
|
- .test_name = sft9001_test_name,
|
|
|
|
- .run_tests = sft9001_run_tests,
|
|
|
|
-};
|
|
|