Commit 21d5fc57 authored by Jeff Garzik's avatar Jeff Garzik

e100 net driver cleanups from Arjan van de Ven:

* fix PCI posting bugs
* remove ia64-specific code, requires an arch workaround/fix instead
* other misc cleanups and small bug fixes
parent f9c57480
...@@ -128,12 +128,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -128,12 +128,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define E100_DEFAULT_TCB MAX_TCB #define E100_DEFAULT_TCB MAX_TCB
#define E100_MIN_TCB 2*TX_FRAME_CNT + 3 /* make room for at least 2 interrupts */ #define E100_MIN_TCB 2*TX_FRAME_CNT + 3 /* make room for at least 2 interrupts */
#ifdef __ia64__
/* We can't use too many DMAble buffers on IA64 machines with >4 GB mem */
#define E100_MAX_TCB 64
#else
#define E100_MAX_TCB 1024 #define E100_MAX_TCB 1024
#endif /* __ia64__ */
#define E100_DEFAULT_RFD MAX_RFD #define E100_DEFAULT_RFD MAX_RFD
#define E100_MIN_RFD 8 #define E100_MIN_RFD 8
......
...@@ -69,6 +69,10 @@ ANY LOSS OF USE; DATA, OR PROFITS; OR BUSINESS INTERUPTION) HOWEVER CAUSED ...@@ -69,6 +69,10 @@ ANY LOSS OF USE; DATA, OR PROFITS; OR BUSINESS INTERUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************
Portions (C) 2002 Red Hat, Inc. under the terms of the GNU GPL v2.
*******************************************************************************/ *******************************************************************************/
/********************************************************************** /**********************************************************************
...@@ -152,7 +156,7 @@ eeprom_set_semaphore(struct e100_private *adapter) ...@@ -152,7 +156,7 @@ eeprom_set_semaphore(struct e100_private *adapter)
} }
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(1); schedule_timeout(1+(HZ-1)/100);
} }
return false; return false;
} }
...@@ -252,19 +256,12 @@ e100_eeprom_size(struct e100_private *adapter) ...@@ -252,19 +256,12 @@ e100_eeprom_size(struct e100_private *adapter)
// Returns: bits in an address for that size eeprom // Returns: bits in an address for that size eeprom
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
static u16 static inline int
eeprom_address_size(u16 size) eeprom_address_size(u16 size)
{ {
switch (size) { int isize = size;
case 64:
return 6; return ffs(isize);
case 128:
return 7;
case 256:
return 8;
}
return 0; //fix compiler warning or error!
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
...@@ -348,6 +345,7 @@ shift_out_bits(struct e100_private *adapter, u16 data, u16 count) ...@@ -348,6 +345,7 @@ shift_out_bits(struct e100_private *adapter, u16 data, u16 count)
x |= EEDI; x |= EEDI;
writew(x, &CSR_EEPROM_CONTROL_FIELD(adapter)); writew(x, &CSR_EEPROM_CONTROL_FIELD(adapter));
readw(&(adapter->scb->scb_status)); /* flush command to card */
udelay(EEPROM_STALL_TIME); udelay(EEPROM_STALL_TIME);
raise_clock(adapter, &x); raise_clock(adapter, &x);
lower_clock(adapter, &x); lower_clock(adapter, &x);
...@@ -374,6 +372,7 @@ raise_clock(struct e100_private *adapter, u16 *x) ...@@ -374,6 +372,7 @@ raise_clock(struct e100_private *adapter, u16 *x)
{ {
*x = *x | EESK; *x = *x | EESK;
writew(*x, &CSR_EEPROM_CONTROL_FIELD(adapter)); writew(*x, &CSR_EEPROM_CONTROL_FIELD(adapter));
readw(&(adapter->scb->scb_status)); /* flush command to card */
udelay(EEPROM_STALL_TIME); udelay(EEPROM_STALL_TIME);
} }
...@@ -393,6 +392,7 @@ lower_clock(struct e100_private *adapter, u16 *x) ...@@ -393,6 +392,7 @@ lower_clock(struct e100_private *adapter, u16 *x)
{ {
*x = *x & ~EESK; *x = *x & ~EESK;
writew(*x, &CSR_EEPROM_CONTROL_FIELD(adapter)); writew(*x, &CSR_EEPROM_CONTROL_FIELD(adapter));
readw(&(adapter->scb->scb_status)); /* flush command to card */
udelay(EEPROM_STALL_TIME); udelay(EEPROM_STALL_TIME);
} }
...@@ -498,7 +498,7 @@ e100_eeprom_write_word(struct e100_private *adapter, u16 reg, u16 data) ...@@ -498,7 +498,7 @@ e100_eeprom_write_word(struct e100_private *adapter, u16 reg, u16 data)
x = readw(&CSR_EEPROM_CONTROL_FIELD(adapter)); x = readw(&CSR_EEPROM_CONTROL_FIELD(adapter));
x &= ~(EEDI | EEDO | EESK); x &= ~(EEDI | EEDO | EESK);
writew(x, &CSR_EEPROM_CONTROL_FIELD(adapter)); writew(x, &CSR_EEPROM_CONTROL_FIELD(adapter));
wmb(); readw(&(adapter->scb->scb_status)); /* flush command to card */
udelay(EEPROM_STALL_TIME); udelay(EEPROM_STALL_TIME);
x |= EECS; x |= EECS;
writew(x, &CSR_EEPROM_CONTROL_FIELD(adapter)); writew(x, &CSR_EEPROM_CONTROL_FIELD(adapter));
...@@ -587,7 +587,7 @@ eeprom_wait_cmd_done(struct e100_private *adapter) ...@@ -587,7 +587,7 @@ eeprom_wait_cmd_done(struct e100_private *adapter)
return true; return true;
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(1); schedule_timeout(1+(HZ-1)/100);
} }
return false; return false;
...@@ -606,9 +606,10 @@ eeprom_stand_by(struct e100_private *adapter) ...@@ -606,9 +606,10 @@ eeprom_stand_by(struct e100_private *adapter)
x = readw(&CSR_EEPROM_CONTROL_FIELD(adapter)); x = readw(&CSR_EEPROM_CONTROL_FIELD(adapter));
x &= ~(EECS | EESK); x &= ~(EECS | EESK);
writew(x, &CSR_EEPROM_CONTROL_FIELD(adapter)); writew(x, &CSR_EEPROM_CONTROL_FIELD(adapter));
wmb(); readw(&(adapter->scb->scb_status)); /* flush command to card */
udelay(EEPROM_STALL_TIME); udelay(EEPROM_STALL_TIME);
x |= EECS; x |= EECS;
writew(x, &CSR_EEPROM_CONTROL_FIELD(adapter)); writew(x, &CSR_EEPROM_CONTROL_FIELD(adapter));
readw(&(adapter->scb->scb_status)); /* flush command to card */
udelay(EEPROM_STALL_TIME); udelay(EEPROM_STALL_TIME);
} }
...@@ -69,6 +69,10 @@ ANY LOSS OF USE; DATA, OR PROFITS; OR BUSINESS INTERUPTION) HOWEVER CAUSED ...@@ -69,6 +69,10 @@ ANY LOSS OF USE; DATA, OR PROFITS; OR BUSINESS INTERUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************
Portions (C) 2002 Red Hat, Inc. under the terms of the GNU GPL v2.
*******************************************************************************/ *******************************************************************************/
/********************************************************************** /**********************************************************************
...@@ -162,7 +166,7 @@ static void e100_non_tx_background(unsigned long); ...@@ -162,7 +166,7 @@ static void e100_non_tx_background(unsigned long);
/* Global Data structures and variables */ /* Global Data structures and variables */
char e100_copyright[] __devinitdata = "Copyright (c) 2002 Intel Corporation"; char e100_copyright[] __devinitdata = "Copyright (c) 2002 Intel Corporation";
#define E100_VERSION "2.0.21" #define E100_VERSION "2.0.22-pre1"
#define E100_FULL_DRIVER_NAME "Intel(R) PRO/100 Fast Ethernet Adapter - Loadable driver, ver " #define E100_FULL_DRIVER_NAME "Intel(R) PRO/100 Fast Ethernet Adapter - Loadable driver, ver "
...@@ -525,6 +529,7 @@ e100_dis_intr(struct e100_private *bdp) ...@@ -525,6 +529,7 @@ e100_dis_intr(struct e100_private *bdp)
{ {
/* Disable interrupts on our PCI board by setting the mask bit */ /* Disable interrupts on our PCI board by setting the mask bit */
writeb(SCB_INT_MASK, &bdp->scb->scb_cmd_hi); writeb(SCB_INT_MASK, &bdp->scb->scb_cmd_hi);
readw(&(bdp->scb->scb_status)); /* flushes last write, read-safe */
} }
/** /**
...@@ -545,6 +550,7 @@ e100_trigger_SWI(struct e100_private *bdp) ...@@ -545,6 +550,7 @@ e100_trigger_SWI(struct e100_private *bdp)
{ {
/* Trigger interrupt on our PCI board by asserting SWI bit */ /* Trigger interrupt on our PCI board by asserting SWI bit */
writeb(SCB_SOFT_INT, &bdp->scb->scb_cmd_hi); writeb(SCB_SOFT_INT, &bdp->scb->scb_cmd_hi);
readw(&(bdp->scb->scb_status)); /* flushes last write, read-safe */
} }
static int __devinit static int __devinit
...@@ -2053,10 +2059,8 @@ e100_rx_srv(struct e100_private *bdp, u32 max_number_of_rfds, ...@@ -2053,10 +2059,8 @@ e100_rx_srv(struct e100_private *bdp, u32 max_number_of_rfds,
(data_sz + bdp->rfd_size), (data_sz + bdp->rfd_size),
PCI_DMA_FROMDEVICE); PCI_DMA_FROMDEVICE);
// we unmap using DMA_TODEVICE to avoid another memcpy from the
// bounce buffer
pci_unmap_single(bdp->pdev, rx_struct->dma_addr, pci_unmap_single(bdp->pdev, rx_struct->dma_addr,
sizeof (rfd_t), PCI_DMA_TODEVICE); sizeof (rfd_t), PCI_DMA_FROMDEVICE);
list_add(&(rx_struct->list_elem), &(bdp->rx_struct_pool)); list_add(&(rx_struct->list_elem), &(bdp->rx_struct_pool));
...@@ -2427,6 +2431,7 @@ e100_selftest(struct e100_private *bdp, u32 *st_timeout, u32 *st_result) ...@@ -2427,6 +2431,7 @@ e100_selftest(struct e100_private *bdp, u32 *st_timeout, u32 *st_result)
/* Do the port command */ /* Do the port command */
writel(selftest_cmd, &bdp->scb->scb_port); writel(selftest_cmd, &bdp->scb->scb_port);
readw(&(bdp->scb->scb_status)); /* flushes last write, read-safe */
/* Wait at least 10 milliseconds for the self-test to complete */ /* Wait at least 10 milliseconds for the self-test to complete */
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
...@@ -2435,8 +2440,6 @@ e100_selftest(struct e100_private *bdp, u32 *st_timeout, u32 *st_result) ...@@ -2435,8 +2440,6 @@ e100_selftest(struct e100_private *bdp, u32 *st_timeout, u32 *st_result)
/* disable interrupts since the're now enabled */ /* disable interrupts since the're now enabled */
e100_dis_intr(bdp); e100_dis_intr(bdp);
rmb();
/* if The First Self Test DWORD Still Zero, We've timed out. If the /* if The First Self Test DWORD Still Zero, We've timed out. If the
* second DWORD is not zero then we have an error. */ * second DWORD is not zero then we have an error. */
if ((bdp->selftest->st_sign == 0) || (bdp->selftest->st_result != 0)) { if ((bdp->selftest->st_sign == 0) || (bdp->selftest->st_result != 0)) {
...@@ -2803,6 +2806,7 @@ e100_sw_reset(struct e100_private *bdp, u32 reset_cmd) ...@@ -2803,6 +2806,7 @@ e100_sw_reset(struct e100_private *bdp, u32 reset_cmd)
{ {
/* Do a selective reset first to avoid a potential PCI hang */ /* Do a selective reset first to avoid a potential PCI hang */
writel(PORT_SELECTIVE_RESET, &bdp->scb->scb_port); writel(PORT_SELECTIVE_RESET, &bdp->scb->scb_port);
readw(&(bdp->scb->scb_status)); /* flushes last write, read-safe */
/* wait for the reset to take effect */ /* wait for the reset to take effect */
udelay(20); udelay(20);
......
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