Commit b58ecad8 authored by Linsys Contractor Mithlesh Thukral's avatar Linsys Contractor Mithlesh Thukral Committed by Jeff Garzik

NetXen: Fix softlockup seen during hardware access

NetXen: This will fix a softlock seen on some machines.
The reason was too much time was spent waiting for hardware access
to go through.

Signed-off by: Mithlesh Thukral <mithlesh@netxen.com>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent 8b902aea
...@@ -232,6 +232,7 @@ enum { ...@@ -232,6 +232,7 @@ enum {
#define MPORT_SINGLE_FUNCTION_MODE 0x1111 #define MPORT_SINGLE_FUNCTION_MODE 0x1111
extern unsigned long long netxen_dma_mask; extern unsigned long long netxen_dma_mask;
extern unsigned long last_schedule_time;
/* /*
* NetXen host-peg signal message structure * NetXen host-peg signal message structure
......
...@@ -462,6 +462,7 @@ netxen_nic_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, ...@@ -462,6 +462,7 @@ netxen_nic_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
} }
printk(KERN_INFO "%s: flash unlocked. \n", printk(KERN_INFO "%s: flash unlocked. \n",
netxen_nic_driver_name); netxen_nic_driver_name);
last_schedule_time = jiffies;
ret = netxen_flash_erase_secondary(adapter); ret = netxen_flash_erase_secondary(adapter);
if (ret != FLASH_SUCCESS) { if (ret != FLASH_SUCCESS) {
printk(KERN_ERR "%s: Flash erase failed.\n", printk(KERN_ERR "%s: Flash erase failed.\n",
......
...@@ -42,6 +42,8 @@ struct crb_addr_pair { ...@@ -42,6 +42,8 @@ struct crb_addr_pair {
u32 data; u32 data;
}; };
unsigned long last_schedule_time;
#define NETXEN_MAX_CRB_XFORM 60 #define NETXEN_MAX_CRB_XFORM 60
static unsigned int crb_addr_xform[NETXEN_MAX_CRB_XFORM]; static unsigned int crb_addr_xform[NETXEN_MAX_CRB_XFORM];
#define NETXEN_ADDR_ERROR (0xffffffff) #define NETXEN_ADDR_ERROR (0xffffffff)
...@@ -404,9 +406,14 @@ static inline int do_rom_fast_write(struct netxen_adapter *adapter, int addr, ...@@ -404,9 +406,14 @@ static inline int do_rom_fast_write(struct netxen_adapter *adapter, int addr,
static inline int static inline int
do_rom_fast_read(struct netxen_adapter *adapter, int addr, int *valp) do_rom_fast_read(struct netxen_adapter *adapter, int addr, int *valp)
{ {
if (jiffies > (last_schedule_time + (8 * HZ))) {
last_schedule_time = jiffies;
schedule();
}
netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ADDRESS, addr); netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ADDRESS, addr);
netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 3); netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 3);
udelay(70); /* prevent bursting on CRB */ udelay(100); /* prevent bursting on CRB */
netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0);
netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_INSTR_OPCODE, 0xb); netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_INSTR_OPCODE, 0xb);
if (netxen_wait_rom_done(adapter)) { if (netxen_wait_rom_done(adapter)) {
...@@ -415,7 +422,7 @@ do_rom_fast_read(struct netxen_adapter *adapter, int addr, int *valp) ...@@ -415,7 +422,7 @@ do_rom_fast_read(struct netxen_adapter *adapter, int addr, int *valp)
} }
/* reset abyte_cnt and dummy_byte_cnt */ /* reset abyte_cnt and dummy_byte_cnt */
netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 0); netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 0);
udelay(70); /* prevent bursting on CRB */ udelay(100); /* prevent bursting on CRB */
netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0);
*valp = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_ROM_RDATA); *valp = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_ROM_RDATA);
......
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