aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen/netxen_nic_init.c
diff options
context:
space:
mode:
authorDhananjay Phadke <dhananjay@netxen.com>2009-07-26 16:07:39 -0400
committerDavid S. Miller <davem@davemloft.net>2009-07-27 13:57:31 -0400
commit83ac51fa747c3a74372417629fcad4b110857b77 (patch)
tree02b85bda7727c4cb7b45c1f4e6a32e4aca8f91e7 /drivers/net/netxen/netxen_nic_init.c
parentca2ef330b5eb30e3bc7047f99fd4be9f1bad22be (diff)
netxen: annotate dma watchdog setup
o remove superfluous code to setup PCI dma watchdog for NX2031. o disable dma watchdog completely for NX3031 (not required). Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netxen/netxen_nic_init.c')
-rw-r--r--drivers/net/netxen/netxen_nic_init.c59
1 files changed, 35 insertions, 24 deletions
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index 5d7a2c453363..91358459adb4 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -954,19 +954,20 @@ netxen_release_firmware(struct netxen_adapter *adapter)
954 release_firmware(adapter->fw); 954 release_firmware(adapter->fw);
955} 955}
956 956
957int netxen_initialize_adapter_offload(struct netxen_adapter *adapter) 957int netxen_init_dummy_dma(struct netxen_adapter *adapter)
958{ 958{
959 uint64_t addr; 959 u64 addr;
960 uint32_t hi; 960 u32 hi, lo;
961 uint32_t lo;
962 961
963 adapter->dummy_dma.addr = 962 if (!NX_IS_REVISION_P2(adapter->ahw.revision_id))
964 pci_alloc_consistent(adapter->pdev, 963 return 0;
964
965 adapter->dummy_dma.addr = pci_alloc_consistent(adapter->pdev,
965 NETXEN_HOST_DUMMY_DMA_SIZE, 966 NETXEN_HOST_DUMMY_DMA_SIZE,
966 &adapter->dummy_dma.phys_addr); 967 &adapter->dummy_dma.phys_addr);
967 if (adapter->dummy_dma.addr == NULL) { 968 if (adapter->dummy_dma.addr == NULL) {
968 printk("%s: ERROR: Could not allocate dummy DMA memory\n", 969 dev_err(&adapter->pdev->dev,
969 __func__); 970 "ERROR: Could not allocate dummy DMA memory\n");
970 return -ENOMEM; 971 return -ENOMEM;
971 } 972 }
972 973
@@ -977,29 +978,41 @@ int netxen_initialize_adapter_offload(struct netxen_adapter *adapter)
977 NXWR32(adapter, CRB_HOST_DUMMY_BUF_ADDR_HI, hi); 978 NXWR32(adapter, CRB_HOST_DUMMY_BUF_ADDR_HI, hi);
978 NXWR32(adapter, CRB_HOST_DUMMY_BUF_ADDR_LO, lo); 979 NXWR32(adapter, CRB_HOST_DUMMY_BUF_ADDR_LO, lo);
979 980
980 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) {
981 uint32_t temp = 0;
982 NXWR32(adapter, CRB_HOST_DUMMY_BUF, temp);
983 }
984
985 return 0; 981 return 0;
986} 982}
987 983
988void netxen_free_adapter_offload(struct netxen_adapter *adapter) 984/*
985 * NetXen DMA watchdog control:
986 *
987 * Bit 0 : enabled => R/O: 1 watchdog active, 0 inactive
988 * Bit 1 : disable_request => 1 req disable dma watchdog
989 * Bit 2 : enable_request => 1 req enable dma watchdog
990 * Bit 3-31 : unused
991 */
992void netxen_free_dummy_dma(struct netxen_adapter *adapter)
989{ 993{
990 int i = 100; 994 int i = 100;
995 u32 ctrl;
996
997 if (!NX_IS_REVISION_P2(adapter->ahw.revision_id))
998 return;
991 999
992 if (!adapter->dummy_dma.addr) 1000 if (!adapter->dummy_dma.addr)
993 return; 1001 return;
994 1002
995 if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { 1003 ctrl = NXRD32(adapter, NETXEN_DMA_WATCHDOG_CTRL);
996 do { 1004 if ((ctrl & 0x1) != 0) {
997 if (dma_watchdog_shutdown_request(adapter) == 1) 1005 NXWR32(adapter, NETXEN_DMA_WATCHDOG_CTRL, (ctrl | 0x2));
998 break; 1006
1007 while ((ctrl & 0x1) != 0) {
1008
999 msleep(50); 1009 msleep(50);
1000 if (dma_watchdog_shutdown_poll_result(adapter) == 1) 1010
1011 ctrl = NXRD32(adapter, NETXEN_DMA_WATCHDOG_CTRL);
1012
1013 if (--i == 0)
1001 break; 1014 break;
1002 } while (--i); 1015 };
1003 } 1016 }
1004 1017
1005 if (i) { 1018 if (i) {
@@ -1008,10 +1021,8 @@ void netxen_free_adapter_offload(struct netxen_adapter *adapter)
1008 adapter->dummy_dma.addr, 1021 adapter->dummy_dma.addr,
1009 adapter->dummy_dma.phys_addr); 1022 adapter->dummy_dma.phys_addr);
1010 adapter->dummy_dma.addr = NULL; 1023 adapter->dummy_dma.addr = NULL;
1011 } else { 1024 } else
1012 printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n", 1025 dev_err(&adapter->pdev->dev, "dma_watchdog_shutdown failed\n");
1013 adapter->netdev->name);
1014 }
1015} 1026}
1016 1027
1017int netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val) 1028int netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val)