aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2010-12-02 08:47:35 -0500
committerDavid S. Miller <davem@davemloft.net>2010-12-03 12:08:08 -0500
commit4833f02a2972b7da4c8a15e1e329db0f984a75d9 (patch)
treed23e8b733fb02507b6894d632270dcb0435e6890 /drivers/net/sfc
parent4de92180258ac661bbce0f0065c9c81633ac862b (diff)
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>
Diffstat (limited to 'drivers/net/sfc')
-rw-r--r--drivers/net/sfc/efx.c1
-rw-r--r--drivers/net/sfc/falcon.c11
-rw-r--r--drivers/net/sfc/net_driver.h2
-rw-r--r--drivers/net/sfc/nic.h2
4 files changed, 9 insertions, 7 deletions
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
index 6aed6acdd2d6..7e820d90e6ba 100644
--- a/drivers/net/sfc/efx.c
+++ b/drivers/net/sfc/efx.c
@@ -2198,7 +2198,6 @@ static int efx_init_struct(struct efx_nic *efx, struct efx_nic_type *type,
2198 /* Initialise common structures */ 2198 /* Initialise common structures */
2199 memset(efx, 0, sizeof(*efx)); 2199 memset(efx, 0, sizeof(*efx));
2200 spin_lock_init(&efx->biu_lock); 2200 spin_lock_init(&efx->biu_lock);
2201 mutex_init(&efx->mdio_lock);
2202#ifdef CONFIG_SFC_MTD 2201#ifdef CONFIG_SFC_MTD
2203 INIT_LIST_HEAD(&efx->mtd_list); 2202 INIT_LIST_HEAD(&efx->mtd_list);
2204#endif 2203#endif
diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c
index ca59f7e02df4..af62899bb981 100644
--- a/drivers/net/sfc/falcon.c
+++ b/drivers/net/sfc/falcon.c
@@ -717,6 +717,7 @@ static int falcon_mdio_write(struct net_device *net_dev,
717 int prtad, int devad, u16 addr, u16 value) 717 int prtad, int devad, u16 addr, u16 value)
718{ 718{
719 struct efx_nic *efx = netdev_priv(net_dev); 719 struct efx_nic *efx = netdev_priv(net_dev);
720 struct falcon_nic_data *nic_data = efx->nic_data;
720 efx_oword_t reg; 721 efx_oword_t reg;
721 int rc; 722 int rc;
722 723
@@ -724,7 +725,7 @@ static int falcon_mdio_write(struct net_device *net_dev,
724 "writing MDIO %d register %d.%d with 0x%04x\n", 725 "writing MDIO %d register %d.%d with 0x%04x\n",
725 prtad, devad, addr, value); 726 prtad, devad, addr, value);
726 727
727 mutex_lock(&efx->mdio_lock); 728 mutex_lock(&nic_data->mdio_lock);
728 729
729 /* Check MDIO not currently being accessed */ 730 /* Check MDIO not currently being accessed */
730 rc = falcon_gmii_wait(efx); 731 rc = falcon_gmii_wait(efx);
@@ -760,7 +761,7 @@ static int falcon_mdio_write(struct net_device *net_dev,
760 } 761 }
761 762
762out: 763out:
763 mutex_unlock(&efx->mdio_lock); 764 mutex_unlock(&nic_data->mdio_lock);
764 return rc; 765 return rc;
765} 766}
766 767
@@ -769,10 +770,11 @@ static int falcon_mdio_read(struct net_device *net_dev,
769 int prtad, int devad, u16 addr) 770 int prtad, int devad, u16 addr)
770{ 771{
771 struct efx_nic *efx = netdev_priv(net_dev); 772 struct efx_nic *efx = netdev_priv(net_dev);
773 struct falcon_nic_data *nic_data = efx->nic_data;
772 efx_oword_t reg; 774 efx_oword_t reg;
773 int rc; 775 int rc;
774 776
775 mutex_lock(&efx->mdio_lock); 777 mutex_lock(&nic_data->mdio_lock);
776 778
777 /* Check MDIO not currently being accessed */ 779 /* Check MDIO not currently being accessed */
778 rc = falcon_gmii_wait(efx); 780 rc = falcon_gmii_wait(efx);
@@ -811,7 +813,7 @@ static int falcon_mdio_read(struct net_device *net_dev,
811 } 813 }
812 814
813out: 815out:
814 mutex_unlock(&efx->mdio_lock); 816 mutex_unlock(&nic_data->mdio_lock);
815 return rc; 817 return rc;
816} 818}
817 819
@@ -839,6 +841,7 @@ static int falcon_probe_port(struct efx_nic *efx)
839 } 841 }
840 842
841 /* Fill out MDIO structure and loopback modes */ 843 /* Fill out MDIO structure and loopback modes */
844 mutex_init(&nic_data->mdio_lock);
842 efx->mdio.mdio_read = falcon_mdio_read; 845 efx->mdio.mdio_read = falcon_mdio_read;
843 efx->mdio.mdio_write = falcon_mdio_write; 846 efx->mdio.mdio_write = falcon_mdio_write;
844 rc = efx->phy_op->probe(efx); 847 rc = efx->phy_op->probe(efx);
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h
index e5ee2d53750e..2ffc920d6ec0 100644
--- a/drivers/net/sfc/net_driver.h
+++ b/drivers/net/sfc/net_driver.h
@@ -679,7 +679,6 @@ struct efx_filter_state;
679 * @mac_op: MAC interface 679 * @mac_op: MAC interface
680 * @mac_address: Permanent MAC address 680 * @mac_address: Permanent MAC address
681 * @phy_type: PHY type 681 * @phy_type: PHY type
682 * @mdio_lock: MDIO lock
683 * @phy_op: PHY interface 682 * @phy_op: PHY interface
684 * @phy_data: PHY private data (including PHY-specific stats) 683 * @phy_data: PHY private data (including PHY-specific stats)
685 * @mdio: PHY MDIO interface 684 * @mdio: PHY MDIO interface
@@ -766,7 +765,6 @@ struct efx_nic {
766 unsigned char mac_address[ETH_ALEN]; 765 unsigned char mac_address[ETH_ALEN];
767 766
768 unsigned int phy_type; 767 unsigned int phy_type;
769 struct mutex mdio_lock;
770 struct efx_phy_operations *phy_op; 768 struct efx_phy_operations *phy_op;
771 void *phy_data; 769 void *phy_data;
772 struct mdio_if_info mdio; 770 struct mdio_if_info mdio;
diff --git a/drivers/net/sfc/nic.h b/drivers/net/sfc/nic.h
index 2a0fff324f1f..980cf4b5a868 100644
--- a/drivers/net/sfc/nic.h
+++ b/drivers/net/sfc/nic.h
@@ -117,6 +117,7 @@ struct falcon_board {
117 * @spi_flash: SPI flash device 117 * @spi_flash: SPI flash device
118 * @spi_eeprom: SPI EEPROM device 118 * @spi_eeprom: SPI EEPROM device
119 * @spi_lock: SPI bus lock 119 * @spi_lock: SPI bus lock
120 * @mdio_lock: MDIO bus lock
120 */ 121 */
121struct falcon_nic_data { 122struct falcon_nic_data {
122 struct pci_dev *pci_dev2; 123 struct pci_dev *pci_dev2;
@@ -128,6 +129,7 @@ struct falcon_nic_data {
128 struct efx_spi_device spi_flash; 129 struct efx_spi_device spi_flash;
129 struct efx_spi_device spi_eeprom; 130 struct efx_spi_device spi_eeprom;
130 struct mutex spi_lock; 131 struct mutex spi_lock;
132 struct mutex mdio_lock;
131}; 133};
132 134
133static inline struct falcon_board *falcon_board(struct efx_nic *efx) 135static inline struct falcon_board *falcon_board(struct efx_nic *efx)