aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Fainelli <ffainelli@freebox.fr>2012-01-04 15:23:35 -0500
committerDavid S. Miller <davem@davemloft.net>2012-01-05 13:12:03 -0500
commit13acde8fffc0afbe8341fe08d2c594243f905c1f (patch)
tree8a44b5817f90678997110723ff041dd89d7eb028
parent1c26750c485de20a3bd68ec5d396887650b53976 (diff)
e1000: cleanup CE4100 MDIO registers access
A global variable is currently used to hold the virtual address of the CE4100 MDIO base register address. Store the address in the e1000_hw structure and update macros accordingly. Signed-off-by: Florian Fainelli <ffainelli@freebox.fr> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/intel/e1000/e1000_hw.h4
-rw-r--r--drivers/net/ethernet/intel/e1000/e1000_main.c15
2 files changed, 7 insertions, 12 deletions
diff --git a/drivers/net/ethernet/intel/e1000/e1000_hw.h b/drivers/net/ethernet/intel/e1000/e1000_hw.h
index cf7e3c094477..f6c4d7e2560c 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_hw.h
+++ b/drivers/net/ethernet/intel/e1000/e1000_hw.h
@@ -812,8 +812,7 @@ struct e1000_ffvt_entry {
812#define E1000_FLA 0x0001C /* Flash Access - RW */ 812#define E1000_FLA 0x0001C /* Flash Access - RW */
813#define E1000_MDIC 0x00020 /* MDI Control - RW */ 813#define E1000_MDIC 0x00020 /* MDI Control - RW */
814 814
815extern void __iomem *ce4100_gbe_mdio_base_virt; 815#define INTEL_CE_GBE_MDIO_RCOMP_BASE (hw->ce4100_gbe_mdio_base_virt)
816#define INTEL_CE_GBE_MDIO_RCOMP_BASE (ce4100_gbe_mdio_base_virt)
817#define E1000_MDIO_STS (INTEL_CE_GBE_MDIO_RCOMP_BASE + 0) 816#define E1000_MDIO_STS (INTEL_CE_GBE_MDIO_RCOMP_BASE + 0)
818#define E1000_MDIO_CMD (INTEL_CE_GBE_MDIO_RCOMP_BASE + 4) 817#define E1000_MDIO_CMD (INTEL_CE_GBE_MDIO_RCOMP_BASE + 4)
819#define E1000_MDIO_DRV (INTEL_CE_GBE_MDIO_RCOMP_BASE + 8) 818#define E1000_MDIO_DRV (INTEL_CE_GBE_MDIO_RCOMP_BASE + 8)
@@ -1343,6 +1342,7 @@ struct e1000_hw_stats {
1343struct e1000_hw { 1342struct e1000_hw {
1344 u8 __iomem *hw_addr; 1343 u8 __iomem *hw_addr;
1345 u8 __iomem *flash_address; 1344 u8 __iomem *flash_address;
1345 void __iomem *ce4100_gbe_mdio_base_virt;
1346 e1000_mac_type mac_type; 1346 e1000_mac_type mac_type;
1347 e1000_phy_type phy_type; 1347 e1000_phy_type phy_type;
1348 u32 phy_init_script; 1348 u32 phy_init_script;
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
index 9cf07f6322f8..669ca3800c01 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_main.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
@@ -33,11 +33,6 @@
33#include <linux/bitops.h> 33#include <linux/bitops.h>
34#include <linux/if_vlan.h> 34#include <linux/if_vlan.h>
35 35
36/* Intel Media SOC GbE MDIO physical base address */
37static unsigned long ce4100_gbe_mdio_base_phy;
38/* Intel Media SOC GbE MDIO virtual base address */
39void __iomem *ce4100_gbe_mdio_base_virt;
40
41char e1000_driver_name[] = "e1000"; 36char e1000_driver_name[] = "e1000";
42static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; 37static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver";
43#define DRV_VERSION "7.3.21-k8-NAPI" 38#define DRV_VERSION "7.3.21-k8-NAPI"
@@ -1054,11 +1049,11 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
1054 1049
1055 err = -EIO; 1050 err = -EIO;
1056 if (hw->mac_type == e1000_ce4100) { 1051 if (hw->mac_type == e1000_ce4100) {
1057 ce4100_gbe_mdio_base_phy = pci_resource_start(pdev, BAR_1); 1052 hw->ce4100_gbe_mdio_base_virt =
1058 ce4100_gbe_mdio_base_virt = ioremap(ce4100_gbe_mdio_base_phy, 1053 ioremap(pci_resource_start(pdev, BAR_1),
1059 pci_resource_len(pdev, BAR_1)); 1054 pci_resource_len(pdev, BAR_1));
1060 1055
1061 if (!ce4100_gbe_mdio_base_virt) 1056 if (!hw->ce4100_gbe_mdio_base_virt)
1062 goto err_mdio_ioremap; 1057 goto err_mdio_ioremap;
1063 } 1058 }
1064 1059
@@ -1249,7 +1244,7 @@ err_eeprom:
1249err_dma: 1244err_dma:
1250err_sw_init: 1245err_sw_init:
1251err_mdio_ioremap: 1246err_mdio_ioremap:
1252 iounmap(ce4100_gbe_mdio_base_virt); 1247 iounmap(hw->ce4100_gbe_mdio_base_virt);
1253 iounmap(hw->hw_addr); 1248 iounmap(hw->hw_addr);
1254err_ioremap: 1249err_ioremap:
1255 free_netdev(netdev); 1250 free_netdev(netdev);
@@ -1287,7 +1282,7 @@ static void __devexit e1000_remove(struct pci_dev *pdev)
1287 kfree(adapter->rx_ring); 1282 kfree(adapter->rx_ring);
1288 1283
1289 if (hw->mac_type == e1000_ce4100) 1284 if (hw->mac_type == e1000_ce4100)
1290 iounmap(ce4100_gbe_mdio_base_virt); 1285 iounmap(hw->ce4100_gbe_mdio_base_virt);
1291 iounmap(hw->hw_addr); 1286 iounmap(hw->hw_addr);
1292 if (hw->flash_address) 1287 if (hw->flash_address)
1293 iounmap(hw->flash_address); 1288 iounmap(hw->flash_address);