sfc: Move mdio_lock to struct falcon_nic_data
We only have direct access to MDIO on Falcon, so move this out of struct efx_nic. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
4de9218025
commit
4833f02a29
@@ -2198,7 +2198,6 @@ static int efx_init_struct(struct efx_nic *efx, struct efx_nic_type *type,
|
|||||||
/* Initialise common structures */
|
/* Initialise common structures */
|
||||||
memset(efx, 0, sizeof(*efx));
|
memset(efx, 0, sizeof(*efx));
|
||||||
spin_lock_init(&efx->biu_lock);
|
spin_lock_init(&efx->biu_lock);
|
||||||
mutex_init(&efx->mdio_lock);
|
|
||||||
#ifdef CONFIG_SFC_MTD
|
#ifdef CONFIG_SFC_MTD
|
||||||
INIT_LIST_HEAD(&efx->mtd_list);
|
INIT_LIST_HEAD(&efx->mtd_list);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -717,6 +717,7 @@ static int falcon_mdio_write(struct net_device *net_dev,
|
|||||||
int prtad, int devad, u16 addr, u16 value)
|
int prtad, int devad, u16 addr, u16 value)
|
||||||
{
|
{
|
||||||
struct efx_nic *efx = netdev_priv(net_dev);
|
struct efx_nic *efx = netdev_priv(net_dev);
|
||||||
|
struct falcon_nic_data *nic_data = efx->nic_data;
|
||||||
efx_oword_t reg;
|
efx_oword_t reg;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
@@ -724,7 +725,7 @@ static int falcon_mdio_write(struct net_device *net_dev,
|
|||||||
"writing MDIO %d register %d.%d with 0x%04x\n",
|
"writing MDIO %d register %d.%d with 0x%04x\n",
|
||||||
prtad, devad, addr, value);
|
prtad, devad, addr, value);
|
||||||
|
|
||||||
mutex_lock(&efx->mdio_lock);
|
mutex_lock(&nic_data->mdio_lock);
|
||||||
|
|
||||||
/* Check MDIO not currently being accessed */
|
/* Check MDIO not currently being accessed */
|
||||||
rc = falcon_gmii_wait(efx);
|
rc = falcon_gmii_wait(efx);
|
||||||
@@ -760,7 +761,7 @@ static int falcon_mdio_write(struct net_device *net_dev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
mutex_unlock(&efx->mdio_lock);
|
mutex_unlock(&nic_data->mdio_lock);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -769,10 +770,11 @@ static int falcon_mdio_read(struct net_device *net_dev,
|
|||||||
int prtad, int devad, u16 addr)
|
int prtad, int devad, u16 addr)
|
||||||
{
|
{
|
||||||
struct efx_nic *efx = netdev_priv(net_dev);
|
struct efx_nic *efx = netdev_priv(net_dev);
|
||||||
|
struct falcon_nic_data *nic_data = efx->nic_data;
|
||||||
efx_oword_t reg;
|
efx_oword_t reg;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
mutex_lock(&efx->mdio_lock);
|
mutex_lock(&nic_data->mdio_lock);
|
||||||
|
|
||||||
/* Check MDIO not currently being accessed */
|
/* Check MDIO not currently being accessed */
|
||||||
rc = falcon_gmii_wait(efx);
|
rc = falcon_gmii_wait(efx);
|
||||||
@@ -811,7 +813,7 @@ static int falcon_mdio_read(struct net_device *net_dev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
mutex_unlock(&efx->mdio_lock);
|
mutex_unlock(&nic_data->mdio_lock);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -839,6 +841,7 @@ static int falcon_probe_port(struct efx_nic *efx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Fill out MDIO structure and loopback modes */
|
/* Fill out MDIO structure and loopback modes */
|
||||||
|
mutex_init(&nic_data->mdio_lock);
|
||||||
efx->mdio.mdio_read = falcon_mdio_read;
|
efx->mdio.mdio_read = falcon_mdio_read;
|
||||||
efx->mdio.mdio_write = falcon_mdio_write;
|
efx->mdio.mdio_write = falcon_mdio_write;
|
||||||
rc = efx->phy_op->probe(efx);
|
rc = efx->phy_op->probe(efx);
|
||||||
|
@@ -679,7 +679,6 @@ struct efx_filter_state;
|
|||||||
* @mac_op: MAC interface
|
* @mac_op: MAC interface
|
||||||
* @mac_address: Permanent MAC address
|
* @mac_address: Permanent MAC address
|
||||||
* @phy_type: PHY type
|
* @phy_type: PHY type
|
||||||
* @mdio_lock: MDIO lock
|
|
||||||
* @phy_op: PHY interface
|
* @phy_op: PHY interface
|
||||||
* @phy_data: PHY private data (including PHY-specific stats)
|
* @phy_data: PHY private data (including PHY-specific stats)
|
||||||
* @mdio: PHY MDIO interface
|
* @mdio: PHY MDIO interface
|
||||||
@@ -766,7 +765,6 @@ struct efx_nic {
|
|||||||
unsigned char mac_address[ETH_ALEN];
|
unsigned char mac_address[ETH_ALEN];
|
||||||
|
|
||||||
unsigned int phy_type;
|
unsigned int phy_type;
|
||||||
struct mutex mdio_lock;
|
|
||||||
struct efx_phy_operations *phy_op;
|
struct efx_phy_operations *phy_op;
|
||||||
void *phy_data;
|
void *phy_data;
|
||||||
struct mdio_if_info mdio;
|
struct mdio_if_info mdio;
|
||||||
|
@@ -117,6 +117,7 @@ struct falcon_board {
|
|||||||
* @spi_flash: SPI flash device
|
* @spi_flash: SPI flash device
|
||||||
* @spi_eeprom: SPI EEPROM device
|
* @spi_eeprom: SPI EEPROM device
|
||||||
* @spi_lock: SPI bus lock
|
* @spi_lock: SPI bus lock
|
||||||
|
* @mdio_lock: MDIO bus lock
|
||||||
*/
|
*/
|
||||||
struct falcon_nic_data {
|
struct falcon_nic_data {
|
||||||
struct pci_dev *pci_dev2;
|
struct pci_dev *pci_dev2;
|
||||||
@@ -128,6 +129,7 @@ struct falcon_nic_data {
|
|||||||
struct efx_spi_device spi_flash;
|
struct efx_spi_device spi_flash;
|
||||||
struct efx_spi_device spi_eeprom;
|
struct efx_spi_device spi_eeprom;
|
||||||
struct mutex spi_lock;
|
struct mutex spi_lock;
|
||||||
|
struct mutex mdio_lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline struct falcon_board *falcon_board(struct efx_nic *efx)
|
static inline struct falcon_board *falcon_board(struct efx_nic *efx)
|
||||||
|
Reference in New Issue
Block a user