Commit 7dbdd525 authored by Scott Feldman's avatar Scott Feldman Committed by David Mosberger

Update e100 net driver:

Feedback from review by Arjan @ Redhat:
o Cleanup: Removed unneccesary #ifdef/#endif wrappers for features 
  already part of kernel.
o Bug fix: Added read-behind-write calls to post writes before delays.
o Cleanup: added "e100" prefix to all driver messages.
o Cleanup: removed unnecessary barrier() call because spin_unlock
  already implies a barrier.
o Cleanup: removed __NO_VERSION__
o Cleanup: fixed some spelling mistakes.
o Cleanup: removed some proprietary /proc entries.
parent c0e1c9e4
...@@ -95,10 +95,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -95,10 +95,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <asm/io.h> #include <asm/io.h>
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include <asm/processor.h> #include <asm/processor.h>
#ifdef SIOCETHTOOL
#include <linux/ethtool.h> #include <linux/ethtool.h>
#include <linux/inetdevice.h> #include <linux/inetdevice.h>
#endif
#include <linux/if.h> #include <linux/if.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -782,15 +780,7 @@ typedef struct _tcb_ipcb_t { ...@@ -782,15 +780,7 @@ typedef struct _tcb_ipcb_t {
u16 total_tcp_payload; u16 total_tcp_payload;
} tcb_ipcb_t __attribute__ ((__packed__)); } tcb_ipcb_t __attribute__ ((__packed__));
#ifdef MAX_SKB_FRAGS
#define E100_ZEROCOPY
#endif
#ifdef E100_ZEROCOPY
#define E100_TBD_ARRAY_SIZE (2+MAX_SKB_FRAGS) #define E100_TBD_ARRAY_SIZE (2+MAX_SKB_FRAGS)
#else
#define E100_TBD_ARRAY_SIZE 2
#endif /*E100_ZEROCOPY */
/* Transmit Command Block (TCB)*/ /* Transmit Command Block (TCB)*/
struct _tcb_t { struct _tcb_t {
...@@ -811,19 +801,15 @@ struct _tcb_t { ...@@ -811,19 +801,15 @@ struct _tcb_t {
*/ */
tbd_t *tbd_ptr; tbd_t *tbd_ptr;
#ifdef E100_ZEROCOPY
u32 tcb_tbd_dflt_ptr; /* TBD address for non-segmented packet */ u32 tcb_tbd_dflt_ptr; /* TBD address for non-segmented packet */
u32 tcb_tbd_expand_ptr; /* TBD address for segmented packet */ u32 tcb_tbd_expand_ptr; /* TBD address for segmented packet */
#endif /*E100_ZEROCOPY */
struct sk_buff *tcb_skb; /* the associated socket buffer */ struct sk_buff *tcb_skb; /* the associated socket buffer */
dma_addr_t tcb_phys; /* phys addr of the TCB */ dma_addr_t tcb_phys; /* phys addr of the TCB */
} __attribute__ ((__packed__)); } __attribute__ ((__packed__));
#ifndef _TCB_T_
#define _TCB_T_ #define _TCB_T_
typedef struct _tcb_t tcb_t; typedef struct _tcb_t tcb_t;
#endif
/* Receive Frame Descriptor (RFD) - will be using the simple model*/ /* Receive Frame Descriptor (RFD) - will be using the simple model*/
struct _rfd_t { struct _rfd_t {
...@@ -844,10 +830,8 @@ struct _rfd_t { ...@@ -844,10 +830,8 @@ struct _rfd_t {
} __attribute__ ((__packed__)); } __attribute__ ((__packed__));
#ifndef _RFD_T_
#define _RFD_T_ #define _RFD_T_
typedef struct _rfd_t rfd_t; typedef struct _rfd_t rfd_t;
#endif
/* Receive Buffer Descriptor (RBD)*/ /* Receive Buffer Descriptor (RBD)*/
typedef struct _rbd_t { typedef struct _rbd_t {
...@@ -909,14 +893,12 @@ struct cfg_params { ...@@ -909,14 +893,12 @@ struct cfg_params {
int PollingMaxWork; int PollingMaxWork;
u32 b_params; u32 b_params;
}; };
#ifdef ETHTOOL_TEST
struct ethtool_lpbk_data{ struct ethtool_lpbk_data{
dma_addr_t dma_handle; dma_addr_t dma_handle;
tcb_t *tcb; tcb_t *tcb;
rfd_t *rfd; rfd_t *rfd;
}; };
#endif
struct e100_private { struct e100_private {
u32 flags; /* board management flags */ u32 flags; /* board management flags */
...@@ -1012,23 +994,16 @@ struct e100_private { ...@@ -1012,23 +994,16 @@ struct e100_private {
struct tasklet_struct polling_tasklet; struct tasklet_struct polling_tasklet;
#ifdef ETHTOOL_GWOL
/* WOL params for ethtool */ /* WOL params for ethtool */
u32 wolsupported; u32 wolsupported;
u32 wolopts; u32 wolopts;
u16 ip_lbytes; u16 ip_lbytes;
#endif
#ifdef ETHTOOL_TEST
struct ethtool_lpbk_data loopback; struct ethtool_lpbk_data loopback;
#endif
#ifdef ETHTOOL_PHYS_ID
struct timer_list blink_timer; /* led blink timer id */ struct timer_list blink_timer; /* led blink timer id */
#endif
#ifdef CONFIG_PM #ifdef CONFIG_PM
u32 pci_state[16]; u32 pci_state[16];
#endif #endif
}; };
#define E100_AUTONEG 0 #define E100_AUTONEG 0
...@@ -1056,8 +1031,6 @@ extern void e100_deisolate_driver(struct e100_private *bdp, ...@@ -1056,8 +1031,6 @@ extern void e100_deisolate_driver(struct e100_private *bdp,
extern unsigned char e100_hw_reset_recover(struct e100_private *bdp, extern unsigned char e100_hw_reset_recover(struct e100_private *bdp,
u32 reset_cmd); u32 reset_cmd);
#ifdef ETHTOOL_TEST
#define ROM_TEST_FAIL 0x01 #define ROM_TEST_FAIL 0x01
#define REGISTER_TEST_FAIL 0x02 #define REGISTER_TEST_FAIL 0x02
#define SELF_TEST_FAIL 0x04 #define SELF_TEST_FAIL 0x04
...@@ -1073,6 +1046,5 @@ enum test_offsets { ...@@ -1073,6 +1046,5 @@ enum test_offsets {
E100_LPBK_PHY_FAIL, E100_LPBK_PHY_FAIL,
E100_MAX_TEST_RES E100_MAX_TEST_RES
}; };
#endif
#endif #endif
...@@ -535,7 +535,6 @@ e100_config_long_rx(struct e100_private *bdp, unsigned char enable) ...@@ -535,7 +535,6 @@ e100_config_long_rx(struct e100_private *bdp, unsigned char enable)
} }
} }
#ifdef ETHTOOL_GWOL
/** /**
* e100_config_wol * e100_config_wol
* @bdp: atapter's private data struct * @bdp: atapter's private data struct
...@@ -560,7 +559,6 @@ e100_config_wol(struct e100_private *bdp) ...@@ -560,7 +559,6 @@ e100_config_wol(struct e100_private *bdp)
spin_unlock_bh(&(bdp->config_lock)); spin_unlock_bh(&(bdp->config_lock));
} }
#endif
/** /**
* e100_config_loopback_mode * e100_config_loopback_mode
...@@ -587,7 +585,7 @@ e100_config_loopback_mode(struct e100_private *bdp, u8 mode) ...@@ -587,7 +585,7 @@ e100_config_loopback_mode(struct e100_private *bdp, u8 mode)
config_byte = CB_CFIG_LOOPBACK_EXTERNAL; config_byte = CB_CFIG_LOOPBACK_EXTERNAL;
break; break;
default: default:
printk(KERN_NOTICE "e100_config_loopback_mode: " printk(KERN_NOTICE "e100: e100_config_loopback_mode: "
"Invalid argument 'mode': %d\n", mode); "Invalid argument 'mode': %d\n", mode);
goto exit; goto exit;
} }
......
...@@ -145,8 +145,6 @@ eeprom_set_semaphore(struct e100_private *adapter) ...@@ -145,8 +145,6 @@ eeprom_set_semaphore(struct e100_private *adapter)
data |= SCB_GCR2_EEPROM_ACCESS_SEMAPHORE; data |= SCB_GCR2_EEPROM_ACCESS_SEMAPHORE;
writeb(data, &CSR_GENERAL_CONTROL2_FIELD(adapter)); writeb(data, &CSR_GENERAL_CONTROL2_FIELD(adapter));
barrier();
// Check to see if this bit set or not. // Check to see if this bit set or not.
data = readb(&CSR_GENERAL_CONTROL2_FIELD(adapter)); data = readb(&CSR_GENERAL_CONTROL2_FIELD(adapter));
...@@ -224,6 +222,7 @@ e100_eeprom_size(struct e100_private *adapter) ...@@ -224,6 +222,7 @@ e100_eeprom_size(struct e100_private *adapter)
x &= ~EEDI; // address consists of all zeros x &= ~EEDI; // address consists of all zeros
writew(x, &CSR_EEPROM_CONTROL_FIELD(adapter)); writew(x, &CSR_EEPROM_CONTROL_FIELD(adapter));
readw(&(adapter->scb->scb_status));
udelay(EEPROM_STALL_TIME); udelay(EEPROM_STALL_TIME);
raise_clock(adapter, &x); raise_clock(adapter, &x);
lower_clock(adapter, &x); lower_clock(adapter, &x);
......
This diff is collapsed.
...@@ -100,6 +100,7 @@ e100_mdi_write(struct e100_private *bdp, u32 reg_addr, u32 phy_addr, u16 data) ...@@ -100,6 +100,7 @@ e100_mdi_write(struct e100_private *bdp, u32 reg_addr, u32 phy_addr, u16 data)
temp_val = (((u32) data) | (reg_addr << 16) | temp_val = (((u32) data) | (reg_addr << 16) |
(phy_addr << 21) | (MDI_WRITE << 26)); (phy_addr << 21) | (MDI_WRITE << 26));
writel(temp_val, &bdp->scb->scb_mdi_cntrl); writel(temp_val, &bdp->scb->scb_mdi_cntrl);
readw(&bdp->scb->scb_status);
/* wait 20usec before checking status */ /* wait 20usec before checking status */
udelay(20); udelay(20);
...@@ -144,6 +145,7 @@ e100_mdi_read(struct e100_private *bdp, u32 reg_addr, u32 phy_addr, u16 *data) ...@@ -144,6 +145,7 @@ e100_mdi_read(struct e100_private *bdp, u32 reg_addr, u32 phy_addr, u16 *data)
/* Issue the read command to the MDI control register. */ /* Issue the read command to the MDI control register. */
temp_val = ((reg_addr << 16) | (phy_addr << 21) | (MDI_READ << 26)); temp_val = ((reg_addr << 16) | (phy_addr << 21) | (MDI_READ << 26));
writel(temp_val, &bdp->scb->scb_mdi_cntrl); writel(temp_val, &bdp->scb->scb_mdi_cntrl);
readw(&bdp->scb->scb_status);
/* wait 20usec before checking status */ /* wait 20usec before checking status */
udelay(20); udelay(20);
...@@ -267,21 +269,22 @@ e100_phy_specific_setup(struct e100_private *bdp) ...@@ -267,21 +269,22 @@ e100_phy_specific_setup(struct e100_private *bdp)
case E100_AUTONEG: case E100_AUTONEG:
/* The adapter can't autoneg. so set to 10/HALF */ /* The adapter can't autoneg. so set to 10/HALF */
printk(KERN_INFO printk(KERN_INFO
"503 serial component detected which " "e100: 503 serial component detected which "
"cannot autonegotiate\n"); "cannot autonegotiate\n");
printk(KERN_INFO printk(KERN_INFO
"speed/duplex forced to 10Mbps / Half duplex\n"); "e100: speed/duplex forced to "
"10Mbps / Half duplex\n");
bdp->params.e100_speed_duplex = E100_SPEED_10_HALF; bdp->params.e100_speed_duplex = E100_SPEED_10_HALF;
break; break;
case E100_SPEED_100_HALF: case E100_SPEED_100_HALF:
case E100_SPEED_100_FULL: case E100_SPEED_100_FULL:
printk(KERN_ERR printk(KERN_ERR
"503 serial component detected which does not " "e100: 503 serial component detected "
"support 100Mbps\n"); "which does not support 100Mbps\n");
printk(KERN_ERR printk(KERN_ERR
"Change the forced speed/duplex to a supported " "e100: Change the forced speed/duplex "
"setting\n"); "to a supported setting\n");
return false; return false;
} }
...@@ -298,7 +301,7 @@ e100_phy_specific_setup(struct e100_private *bdp) ...@@ -298,7 +301,7 @@ e100_phy_specific_setup(struct e100_private *bdp)
if ((bdp->params.e100_speed_duplex != E100_AUTONEG) && if ((bdp->params.e100_speed_duplex != E100_AUTONEG) &&
(bdp->params.e100_speed_duplex != E100_SPEED_100_FULL)) { (bdp->params.e100_speed_duplex != E100_SPEED_100_FULL)) {
/* just inform user about 100 full */ /* just inform user about 100 full */
printk(KERN_ERR "NC3133 NIC can only run " printk(KERN_ERR "e100: NC3133 NIC can only run "
"at 100Mbps full duplex\n"); "at 100Mbps full duplex\n");
} }
......
This diff is collapsed.
...@@ -72,7 +72,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -72,7 +72,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "e100.h" #include "e100.h"
#include "e100_config.h" #include "e100_config.h"
#ifdef ETHTOOL_TEST
extern u16 e100_eeprom_read(struct e100_private *, u16); extern u16 e100_eeprom_read(struct e100_private *, u16);
extern int e100_wait_exec_cmplx(struct e100_private *, u32,u8); extern int e100_wait_exec_cmplx(struct e100_private *, u32,u8);
...@@ -380,11 +379,11 @@ e100_diag_loopback_cu_ru_exec(struct e100_private *bdp) ...@@ -380,11 +379,11 @@ e100_diag_loopback_cu_ru_exec(struct e100_private *bdp)
{ {
/*load CU & RU base */ /*load CU & RU base */
if (!e100_wait_exec_cmplx(bdp, 0, SCB_CUC_LOAD_BASE)) if (!e100_wait_exec_cmplx(bdp, 0, SCB_CUC_LOAD_BASE))
printk("@@@ SCB_CUC_LOAD_BASE failed\n"); printk("e100: SCB_CUC_LOAD_BASE failed\n");
if(!e100_wait_exec_cmplx(bdp, 0, SCB_RUC_LOAD_BASE)) if(!e100_wait_exec_cmplx(bdp, 0, SCB_RUC_LOAD_BASE))
printk("@@@ SCB_RUC_LOAD_BASE failed!\n"); printk("e100: SCB_RUC_LOAD_BASE failed!\n");
if(!e100_wait_exec_cmplx(bdp, bdp->loopback.dma_handle, SCB_RUC_START)) if(!e100_wait_exec_cmplx(bdp, bdp->loopback.dma_handle, SCB_RUC_START))
printk("@@@ SCB_RUC_START failed!\n"); printk("e100: SCB_RUC_START failed!\n");
bdp->next_cu_cmd = START_WAIT; bdp->next_cu_cmd = START_WAIT;
e100_start_cu(bdp, bdp->loopback.tcb); e100_start_cu(bdp, bdp->loopback.tcb);
...@@ -457,5 +456,3 @@ e100_diag_loopback_free (struct e100_private *bdp) ...@@ -457,5 +456,3 @@ e100_diag_loopback_free (struct e100_private *bdp)
bdp->loopback.dma_handle); bdp->loopback.dma_handle);
} }
#endif
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