Commit f8b87c17 authored by Ben Hutchings's avatar Ben Hutchings Committed by Jeff Garzik
Browse files

sfc: Make PHY flash mode a device attribute, not a module parameter



This allows updating PHY firmware for one interface without removing
all other interfaces handled by the driver.

Replace tx_disabled flags and 10Xpress status enumeration with flags in
enum efx_phy_mode.

Prevent an interface from being brought up while in PHY flash mode.

Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent 3594e131
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -21,7 +21,5 @@ enum efx_board_type {

extern int efx_set_board_info(struct efx_nic *efx, u16 revision_info);
extern int sfe4001_init(struct efx_nic *efx);
/* Are we putting the PHY into flash config mode */
extern unsigned int sfe4001_phy_flash_cfg;

#endif
+3 −0
Original line number Diff line number Diff line
@@ -1296,6 +1296,9 @@ static int efx_net_open(struct net_device *net_dev)
	EFX_LOG(efx, "opening device %s on CPU %d\n", net_dev->name,
		raw_smp_processor_id());

	if (efx->phy_mode & PHY_MODE_SPECIAL)
		return -EBUSY;

	efx_start_all(efx);
	return 0;
}
+8 −7
Original line number Diff line number Diff line
@@ -69,10 +69,6 @@ static int falcon_reset_xmac(struct efx_nic *efx)
		udelay(10);
	}

	/* This often fails when DSP is disabled, ignore it */
	if (sfe4001_phy_flash_cfg)
		return 0;

	EFX_ERR(efx, "timed out waiting for XMAC core reset\n");
	return -ETIMEDOUT;
}
@@ -444,7 +440,8 @@ static bool falcon_check_xaui_link_up(struct efx_nic *efx)
	max_tries = tries;

	if ((efx->loopback_mode == LOOPBACK_NETWORK) ||
	    (efx->phy_type == PHY_TYPE_NONE))
	    (efx->phy_type == PHY_TYPE_NONE) ||
	    efx_phy_mode_disabled(efx->phy_mode))
		return false;

	while (tries) {
@@ -471,7 +468,11 @@ void falcon_reconfigure_xmac(struct efx_nic *efx)

	falcon_deconfigure_mac_wrapper(efx);

	efx->tx_disabled = LOOPBACK_INTERNAL(efx);
	/* Reconfigure the PHY, disabling transmit in mac level loopback. */
	if (LOOPBACK_INTERNAL(efx))
		efx->phy_mode |= PHY_MODE_TX_DISABLED;
	else
		efx->phy_mode &= ~PHY_MODE_TX_DISABLED;
	efx->phy_op->reconfigure(efx);

	falcon_reconfigure_xgxs_core(efx);
@@ -566,7 +567,7 @@ int falcon_check_xmac(struct efx_nic *efx)
	int rc;

	if ((efx->loopback_mode == LOOPBACK_NETWORK) ||
	    (efx->phy_type == PHY_TYPE_NONE))
	    efx_phy_mode_disabled(efx->phy_mode))
		return 0;

	falcon_mask_status_intr(efx, false);
+3 −1
Original line number Diff line number Diff line
@@ -172,6 +172,8 @@ bool mdio_clause45_links_ok(struct efx_nic *efx, unsigned int mmd_mask)
		return true;
	else if (efx->loopback_mode == LOOPBACK_NETWORK)
		return false;
	else if (efx_phy_mode_disabled(efx->phy_mode))
		return false;
	else if (efx->loopback_mode == LOOPBACK_PHYXS)
		mmd_mask &= ~(MDIO_MMDREG_DEVS0_PHYXS |
			      MDIO_MMDREG_DEVS0_PCS |
@@ -206,7 +208,7 @@ void mdio_clause45_transmit_disable(struct efx_nic *efx)

	ctrl1 = ctrl2 = mdio_clause45_read(efx, phy_id, MDIO_MMD_PMAPMD,
					   MDIO_MMDREG_TXDIS);
	if (efx->tx_disabled)
	if (efx->phy_mode & PHY_MODE_TX_DISABLED)
		ctrl2 |= (1 << MDIO_MMDREG_TXDIS_GLOBAL_LBN);
	else
		ctrl1 &= ~(1 << MDIO_MMDREG_TXDIS_GLOBAL_LBN);
+19 −2
Original line number Diff line number Diff line
@@ -519,6 +519,23 @@ struct efx_phy_operations {
	unsigned loopbacks;
};

/**
 * @enum efx_phy_mode - PHY operating mode flags
 * @PHY_MODE_NORMAL: on and should pass traffic
 * @PHY_MODE_TX_DISABLED: on with TX disabled
 * @PHY_MODE_SPECIAL: on but will not pass traffic
 */
enum efx_phy_mode {
	PHY_MODE_NORMAL		= 0,
	PHY_MODE_TX_DISABLED	= 1,
	PHY_MODE_SPECIAL	= 8,
};

static inline bool efx_phy_mode_disabled(enum efx_phy_mode mode)
{
	return (mode & ~PHY_MODE_TX_DISABLED) != 0;
}

/*
 * Efx extended statistics
 *
@@ -661,7 +678,7 @@ union efx_multicast_hash {
 * @phy_op: PHY interface
 * @phy_data: PHY private data (including PHY-specific stats)
 * @mii: PHY interface
 * @tx_disabled: PHY transmitter turned off
 * @phy_mode: PHY operating mode
 * @link_up: Link status
 * @link_options: Link options (MII/GMII format)
 * @n_link_state_changes: Number of times the link has changed state
@@ -735,7 +752,7 @@ struct efx_nic {
	struct efx_phy_operations *phy_op;
	void *phy_data;
	struct mii_if_info mii;
	bool tx_disabled;
	enum efx_phy_mode phy_mode;

	bool link_up;
	unsigned int link_options;
Loading