Commit f5a702b2 authored by 's avatar Committed by Jeff Garzik

Automatic merge of /spare/repo/netdev-2.6 branch ns83820

parents 5ea6f2c3 c16ef1ce
#define _VERSION "0.20" #define VERSION "0.22"
/* ns83820.c by Benjamin LaHaise with contributions. /* ns83820.c by Benjamin LaHaise with contributions.
* *
* Questions/comments/discussion to linux-ns83820@kvack.org. * Questions/comments/discussion to linux-ns83820@kvack.org.
...@@ -63,9 +63,11 @@ ...@@ -63,9 +63,11 @@
* - fix missed txok introduced during performance * - fix missed txok introduced during performance
* tuning * tuning
* 0.20 - fix stupid RFEN thinko. i am such a smurf. * 0.20 - fix stupid RFEN thinko. i am such a smurf.
*
* 20040828 0.21 - add hardware vlan accleration * 20040828 0.21 - add hardware vlan accleration
* by Neil Horman <nhorman@redhat.com> * by Neil Horman <nhorman@redhat.com>
* 20050406 0.22 - improved DAC ifdefs from Andi Kleen
* - removal of dead code from Adrian Bunk
* - fix half duplex collision behaviour
* Driver Overview * Driver Overview
* =============== * ===============
* *
...@@ -129,18 +131,6 @@ static int lnksts = 0; /* CFG_LNKSTS bit polarity */ ...@@ -129,18 +131,6 @@ static int lnksts = 0; /* CFG_LNKSTS bit polarity */
#undef Dprintk #undef Dprintk
#define Dprintk dprintk #define Dprintk dprintk
#if defined(CONFIG_HIGHMEM64G) || defined(__ia64__)
#define USE_64BIT_ADDR "+"
#endif
#if defined(USE_64BIT_ADDR)
#define VERSION _VERSION USE_64BIT_ADDR
#define TRY_DAC 1
#else
#define VERSION _VERSION
#define TRY_DAC 0
#endif
/* tunables */ /* tunables */
#define RX_BUF_SIZE 1500 /* 8192 */ #define RX_BUF_SIZE 1500 /* 8192 */
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
...@@ -386,22 +376,16 @@ static int lnksts = 0; /* CFG_LNKSTS bit polarity */ ...@@ -386,22 +376,16 @@ static int lnksts = 0; /* CFG_LNKSTS bit polarity */
#define LINK_DOWN 0x02 #define LINK_DOWN 0x02
#define LINK_UP 0x04 #define LINK_UP 0x04
#ifdef USE_64BIT_ADDR #define HW_ADDR_LEN sizeof(dma_addr_t)
#define HW_ADDR_LEN 8
#define desc_addr_set(desc, addr) \ #define desc_addr_set(desc, addr) \
do { \ do { \
u64 __addr = (addr); \ ((desc)[0] = cpu_to_le32(addr)); \
(desc)[0] = cpu_to_le32(__addr); \ if (HW_ADDR_LEN == 8) \
(desc)[1] = cpu_to_le32(__addr >> 32); \ (desc)[1] = cpu_to_le32(((u64)addr) >> 32); \
} while(0) } while(0)
#define desc_addr_get(desc) \ #define desc_addr_get(desc) \
(((u64)le32_to_cpu((desc)[1]) << 32) \ (le32_to_cpu((desc)[0]) | \
| le32_to_cpu((desc)[0])) (HW_ADDR_LEN == 8 ? ((dma_addr_t)le32_to_cpu((desc)[1]))<<32 : 0))
#else
#define HW_ADDR_LEN 4
#define desc_addr_set(desc, addr) ((desc)[0] = cpu_to_le32(addr))
#define desc_addr_get(desc) (le32_to_cpu((desc)[0]))
#endif
#define DESC_LINK 0 #define DESC_LINK 0
#define DESC_BUFPTR (DESC_LINK + HW_ADDR_LEN/4) #define DESC_BUFPTR (DESC_LINK + HW_ADDR_LEN/4)
...@@ -727,11 +711,23 @@ static void fastcall phy_intr(struct net_device *ndev) ...@@ -727,11 +711,23 @@ static void fastcall phy_intr(struct net_device *ndev)
speed = ((cfg / CFG_SPDSTS0) & 3); speed = ((cfg / CFG_SPDSTS0) & 3);
fullduplex = (cfg & CFG_DUPSTS); fullduplex = (cfg & CFG_DUPSTS);
if (fullduplex) if (fullduplex) {
new_cfg |= CFG_SB; new_cfg |= CFG_SB;
writel(readl(dev->base + TXCFG)
| TXCFG_CSI | TXCFG_HBI,
dev->base + TXCFG);
writel(readl(dev->base + RXCFG) | RXCFG_RX_FD,
dev->base + RXCFG);
} else {
writel(readl(dev->base + TXCFG)
& ~(TXCFG_CSI | TXCFG_HBI),
dev->base + TXCFG);
writel(readl(dev->base + RXCFG) & ~(RXCFG_RX_FD),
dev->base + RXCFG);
}
if ((cfg & CFG_LNKSTS) && if ((cfg & CFG_LNKSTS) &&
((new_cfg ^ dev->CFG_cache) & CFG_MODE_1000)) { ((new_cfg ^ dev->CFG_cache) != 0)) {
writel(new_cfg, dev->base + CFG); writel(new_cfg, dev->base + CFG);
dev->CFG_cache = new_cfg; dev->CFG_cache = new_cfg;
} }
...@@ -1189,7 +1185,6 @@ again: ...@@ -1189,7 +1185,6 @@ again:
for (;;) { for (;;) {
volatile u32 *desc = dev->tx_descs + (free_idx * DESC_SIZE); volatile u32 *desc = dev->tx_descs + (free_idx * DESC_SIZE);
u32 residue = 0;
dprintk("frag[%3u]: %4u @ 0x%08Lx\n", free_idx, len, dprintk("frag[%3u]: %4u @ 0x%08Lx\n", free_idx, len,
(unsigned long long)buf); (unsigned long long)buf);
...@@ -1199,17 +1194,11 @@ again: ...@@ -1199,17 +1194,11 @@ again:
desc_addr_set(desc + DESC_BUFPTR, buf); desc_addr_set(desc + DESC_BUFPTR, buf);
desc[DESC_EXTSTS] = cpu_to_le32(extsts); desc[DESC_EXTSTS] = cpu_to_le32(extsts);
cmdsts = ((nr_frags|residue) ? CMDSTS_MORE : do_intr ? CMDSTS_INTR : 0); cmdsts = ((nr_frags) ? CMDSTS_MORE : do_intr ? CMDSTS_INTR : 0);
cmdsts |= (desc == first_desc) ? 0 : CMDSTS_OWN; cmdsts |= (desc == first_desc) ? 0 : CMDSTS_OWN;
cmdsts |= len; cmdsts |= len;
desc[DESC_CMDSTS] = cpu_to_le32(cmdsts); desc[DESC_CMDSTS] = cpu_to_le32(cmdsts);
if (residue) {
buf += len;
len = residue;
continue;
}
if (!nr_frags) if (!nr_frags)
break; break;
...@@ -1841,7 +1830,8 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_ ...@@ -1841,7 +1830,8 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_
int using_dac = 0; int using_dac = 0;
/* See if we can set the dma mask early on; failure is fatal. */ /* See if we can set the dma mask early on; failure is fatal. */
if (TRY_DAC && !pci_set_dma_mask(pci_dev, 0xffffffffffffffffULL)) { if (sizeof(dma_addr_t) == 8 &&
!pci_set_dma_mask(pci_dev, 0xffffffffffffffffULL)) {
using_dac = 1; using_dac = 1;
} else if (!pci_set_dma_mask(pci_dev, 0xffffffff)) { } else if (!pci_set_dma_mask(pci_dev, 0xffffffff)) {
using_dac = 0; using_dac = 0;
...@@ -1972,9 +1962,8 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_ ...@@ -1972,9 +1962,8 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_
/* When compiled with 64 bit addressing, we must always enable /* When compiled with 64 bit addressing, we must always enable
* the 64 bit descriptor format. * the 64 bit descriptor format.
*/ */
#ifdef USE_64BIT_ADDR if (sizeof(dma_addr_t) == 8)
dev->CFG_cache |= CFG_M64ADDR; dev->CFG_cache |= CFG_M64ADDR;
#endif
if (using_dac) if (using_dac)
dev->CFG_cache |= CFG_T64ADDR; dev->CFG_cache |= CFG_T64ADDR;
......
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