Commit 0be367bd authored by Amit Kumar Salecha's avatar Amit Kumar Salecha Committed by David S. Miller

netxen: reset sequence changes

Future revisions need different chip reset sequence
and firmware initialization.

Also clean up some never used debug code.
Signed-off-by: default avatarAmit Kumar Salecha <amit@netxen.com>
Signed-off-by: default avatarDhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fb1f6a43
...@@ -1270,7 +1270,7 @@ int netxen_load_firmware(struct netxen_adapter *adapter); ...@@ -1270,7 +1270,7 @@ int netxen_load_firmware(struct netxen_adapter *adapter);
int netxen_need_fw_reset(struct netxen_adapter *adapter); int netxen_need_fw_reset(struct netxen_adapter *adapter);
void netxen_request_firmware(struct netxen_adapter *adapter); void netxen_request_firmware(struct netxen_adapter *adapter);
void netxen_release_firmware(struct netxen_adapter *adapter); void netxen_release_firmware(struct netxen_adapter *adapter);
int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose); int netxen_pinit_from_rom(struct netxen_adapter *adapter);
int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr, int *valp); int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr, int *valp);
int netxen_rom_fast_read_words(struct netxen_adapter *adapter, int addr, int netxen_rom_fast_read_words(struct netxen_adapter *adapter, int addr,
......
...@@ -437,7 +437,7 @@ int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr, int *valp) ...@@ -437,7 +437,7 @@ int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr, int *valp)
#define NETXEN_BOARDNUM 0x400c #define NETXEN_BOARDNUM 0x400c
#define NETXEN_CHIPNUM 0x4010 #define NETXEN_CHIPNUM 0x4010
int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) int netxen_pinit_from_rom(struct netxen_adapter *adapter)
{ {
int addr, val; int addr, val;
int i, n, init_delay = 0; int i, n, init_delay = 0;
...@@ -450,21 +450,6 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) ...@@ -450,21 +450,6 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
NXWR32(adapter, NETXEN_ROMUSB_GLB_SW_RESET, 0xffffffff); NXWR32(adapter, NETXEN_ROMUSB_GLB_SW_RESET, 0xffffffff);
netxen_rom_unlock(adapter); netxen_rom_unlock(adapter);
if (verbose) {
if (netxen_rom_fast_read(adapter, NETXEN_BOARDTYPE, &val) == 0)
printk("P2 ROM board type: 0x%08x\n", val);
else
printk("Could not read board type\n");
if (netxen_rom_fast_read(adapter, NETXEN_BOARDNUM, &val) == 0)
printk("P2 ROM board num: 0x%08x\n", val);
else
printk("Could not read board number\n");
if (netxen_rom_fast_read(adapter, NETXEN_CHIPNUM, &val) == 0)
printk("P2 ROM chip num: 0x%08x\n", val);
else
printk("Could not read chip number\n");
}
if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) {
if (netxen_rom_fast_read(adapter, 0, &n) != 0 || if (netxen_rom_fast_read(adapter, 0, &n) != 0 ||
(n != 0xcafecafe) || (n != 0xcafecafe) ||
...@@ -486,11 +471,7 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) ...@@ -486,11 +471,7 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
n &= ~0x80000000; n &= ~0x80000000;
} }
if (n < 1024) { if (n >= 1024) {
if (verbose)
printk(KERN_DEBUG "%s: %d CRB init values found"
" in ROM.\n", netxen_nic_driver_name, n);
} else {
printk(KERN_ERR "%s:n=0x%x Error! NetXen card flash not" printk(KERN_ERR "%s:n=0x%x Error! NetXen card flash not"
" initialized.\n", __func__, n); " initialized.\n", __func__, n);
return -EIO; return -EIO;
...@@ -502,6 +483,7 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) ...@@ -502,6 +483,7 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
netxen_nic_driver_name); netxen_nic_driver_name);
return -ENOMEM; return -ENOMEM;
} }
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
if (netxen_rom_fast_read(adapter, 8*i + 4*offset, &val) != 0 || if (netxen_rom_fast_read(adapter, 8*i + 4*offset, &val) != 0 ||
netxen_rom_fast_read(adapter, 8*i + 4*offset + 4, &addr) != 0) { netxen_rom_fast_read(adapter, 8*i + 4*offset + 4, &addr) != 0) {
...@@ -512,11 +494,8 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) ...@@ -512,11 +494,8 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
buf[i].addr = addr; buf[i].addr = addr;
buf[i].data = val; buf[i].data = val;
if (verbose)
printk(KERN_DEBUG "%s: PCI: 0x%08x == 0x%08x\n",
netxen_nic_driver_name,
(u32)netxen_decode_crb_addr(addr), val);
} }
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
off = netxen_decode_crb_addr(buf[i].addr); off = netxen_decode_crb_addr(buf[i].addr);
...@@ -526,6 +505,10 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) ...@@ -526,6 +505,10 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
continue; continue;
} }
off += NETXEN_PCI_CRBSPACE; off += NETXEN_PCI_CRBSPACE;
if (off & 1)
continue;
/* skipping cold reboot MAGIC */ /* skipping cold reboot MAGIC */
if (off == NETXEN_CAM_RAM(0x1fc)) if (off == NETXEN_CAM_RAM(0x1fc))
continue; continue;
...@@ -542,7 +525,8 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) ...@@ -542,7 +525,8 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
continue; continue;
if (off == (ROMUSB_GLB + 0x1c)) /* MS clock */ if (off == (ROMUSB_GLB + 0x1c)) /* MS clock */
continue; continue;
if (off == (NETXEN_CRB_PEG_NET_1 + 0x18)) if (off == (NETXEN_CRB_PEG_NET_1 + 0x18) &&
!NX_IS_REVISION_P3P(adapter->ahw.revision_id))
buf[i].data = 0x1020; buf[i].data = 0x1020;
/* skip the function enable register */ /* skip the function enable register */
if (off == NETXEN_PCIE_REG(PCIE_SETUP_FUNCTION)) if (off == NETXEN_PCIE_REG(PCIE_SETUP_FUNCTION))
...@@ -751,7 +735,10 @@ netxen_load_firmware(struct netxen_adapter *adapter) ...@@ -751,7 +735,10 @@ netxen_load_firmware(struct netxen_adapter *adapter)
} }
msleep(1); msleep(1);
if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) if (NX_IS_REVISION_P3P(adapter->ahw.revision_id)) {
NXWR32(adapter, NETXEN_CRB_PEG_NET_0 + 0x18, 0x1020);
NXWR32(adapter, NETXEN_ROMUSB_GLB_SW_RESET, 0x80001e);
} else if (NX_IS_REVISION_P3(adapter->ahw.revision_id))
NXWR32(adapter, NETXEN_ROMUSB_GLB_SW_RESET, 0x80001d); NXWR32(adapter, NETXEN_ROMUSB_GLB_SW_RESET, 0x80001d);
else { else {
NXWR32(adapter, NETXEN_ROMUSB_GLB_CHIP_CLK_CTRL, 0x3fff); NXWR32(adapter, NETXEN_ROMUSB_GLB_CHIP_CLK_CTRL, 0x3fff);
......
...@@ -810,7 +810,7 @@ netxen_start_firmware(struct netxen_adapter *adapter) ...@@ -810,7 +810,7 @@ netxen_start_firmware(struct netxen_adapter *adapter)
if (first_boot != 0x55555555) { if (first_boot != 0x55555555) {
NXWR32(adapter, CRB_CMDPEG_STATE, 0); NXWR32(adapter, CRB_CMDPEG_STATE, 0);
netxen_pinit_from_rom(adapter, 0); netxen_pinit_from_rom(adapter);
msleep(1); msleep(1);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment