aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSathya Perla <sathya.perla@emulex.com>2012-11-06 12:48:59 -0500
committerDavid S. Miller <davem@davemloft.net>2012-11-07 16:59:52 -0500
commit1bc8e7e4f36c0c19dd7dea29e7c248b7c6ef3a15 (patch)
tree510d8b113fa050d595480054aea7759dbecfe43c /drivers
parentce66f781cff6b3522b1234096db77e8bacdbf3c3 (diff)
be2net: fix access to SEMAPHORE reg
The SEMAPHORE register was being accessed from the csr BAR space. This BAR may not be available in some Skyhawk-R configurations. Instead, access this register via the PCI config space (it's available there too). Signed-off-by: Sathya Perla <sathya.perla@emulex.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/emulex/benet/be.h1
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.c11
-rw-r--r--drivers/net/ethernet/emulex/benet/be_hw.h12
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c9
4 files changed, 11 insertions, 22 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index 26b9b8be2bc5..e391d5aa6eaa 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -348,7 +348,6 @@ struct be_adapter {
348 struct pci_dev *pdev; 348 struct pci_dev *pdev;
349 struct net_device *netdev; 349 struct net_device *netdev;
350 350
351 u8 __iomem *csr;
352 u8 __iomem *db; /* Door Bell */ 351 u8 __iomem *db; /* Door Bell */
353 352
354 struct mutex mbox_lock; /* For serializing mbox cmds to BE card */ 353 struct mutex mbox_lock; /* For serializing mbox cmds to BE card */
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index 1768cfa53208..f2875aa47661 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -468,14 +468,13 @@ static int be_mbox_notify_wait(struct be_adapter *adapter)
468static int be_POST_stage_get(struct be_adapter *adapter, u16 *stage) 468static int be_POST_stage_get(struct be_adapter *adapter, u16 *stage)
469{ 469{
470 u32 sem; 470 u32 sem;
471 u32 reg = skyhawk_chip(adapter) ? SLIPORT_SEMAPHORE_OFFSET_SH :
472 SLIPORT_SEMAPHORE_OFFSET_BE;
471 473
472 if (lancer_chip(adapter)) 474 pci_read_config_dword(adapter->pdev, reg, &sem);
473 sem = ioread32(adapter->db + MPU_EP_SEMAPHORE_IF_TYPE2_OFFSET); 475 *stage = sem & POST_STAGE_MASK;
474 else
475 sem = ioread32(adapter->csr + MPU_EP_SEMAPHORE_OFFSET);
476 476
477 *stage = sem & EP_SEMAPHORE_POST_STAGE_MASK; 477 if ((sem >> POST_ERR_SHIFT) & POST_ERR_MASK)
478 if ((sem >> EP_SEMAPHORE_POST_ERR_SHIFT) & EP_SEMAPHORE_POST_ERR_MASK)
479 return -1; 478 return -1;
480 else 479 else
481 return 0; 480 return 0;
diff --git a/drivers/net/ethernet/emulex/benet/be_hw.h b/drivers/net/ethernet/emulex/benet/be_hw.h
index c25720760173..541d4530d5bf 100644
--- a/drivers/net/ethernet/emulex/benet/be_hw.h
+++ b/drivers/net/ethernet/emulex/benet/be_hw.h
@@ -31,12 +31,12 @@
31 31
32#define MPU_EP_CONTROL 0 32#define MPU_EP_CONTROL 0
33 33
34/********** MPU semphore ******************/ 34/********** MPU semphore: used for SH & BE *************/
35#define MPU_EP_SEMAPHORE_OFFSET 0xac 35#define SLIPORT_SEMAPHORE_OFFSET_BE 0x7c
36#define MPU_EP_SEMAPHORE_IF_TYPE2_OFFSET 0x400 36#define SLIPORT_SEMAPHORE_OFFSET_SH 0x94
37#define EP_SEMAPHORE_POST_STAGE_MASK 0x0000FFFF 37#define POST_STAGE_MASK 0x0000FFFF
38#define EP_SEMAPHORE_POST_ERR_MASK 0x1 38#define POST_ERR_MASK 0x1
39#define EP_SEMAPHORE_POST_ERR_SHIFT 31 39#define POST_ERR_SHIFT 31
40 40
41/* MPU semphore POST stage values */ 41/* MPU semphore POST stage values */
42#define POST_STAGE_AWAITING_HOST_RDY 0x1 /* FW awaiting goahead from host */ 42#define POST_STAGE_AWAITING_HOST_RDY 0x1 /* FW awaiting goahead from host */
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 95e279fb2afb..5c475cc333a4 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -3619,8 +3619,6 @@ static void be_netdev_init(struct net_device *netdev)
3619 3619
3620static void be_unmap_pci_bars(struct be_adapter *adapter) 3620static void be_unmap_pci_bars(struct be_adapter *adapter)
3621{ 3621{
3622 if (adapter->csr)
3623 pci_iounmap(adapter->pdev, adapter->csr);
3624 if (adapter->db) 3622 if (adapter->db)
3625 pci_iounmap(adapter->pdev, adapter->db); 3623 pci_iounmap(adapter->pdev, adapter->db);
3626 if (adapter->roce_db.base) 3624 if (adapter->roce_db.base)
@@ -3668,13 +3666,6 @@ static int be_map_pci_bars(struct be_adapter *adapter)
3668 adapter->if_type = (sli_intf & SLI_INTF_IF_TYPE_MASK) >> 3666 adapter->if_type = (sli_intf & SLI_INTF_IF_TYPE_MASK) >>
3669 SLI_INTF_IF_TYPE_SHIFT; 3667 SLI_INTF_IF_TYPE_SHIFT;
3670 3668
3671 if (be_physfn(adapter) && !lancer_chip(adapter)) {
3672 addr = pci_iomap(adapter->pdev, 2, 0);
3673 if (addr == NULL)
3674 return -ENOMEM;
3675 adapter->csr = addr;
3676 }
3677
3678 addr = pci_iomap(adapter->pdev, db_bar(adapter), 0); 3669 addr = pci_iomap(adapter->pdev, db_bar(adapter), 0);
3679 if (addr == NULL) 3670 if (addr == NULL)
3680 goto pci_map_err; 3671 goto pci_map_err;