Skip to content

Commit

Permalink
Merge branch 'davem-next' of master.kernel.org:/pub/scm/linux/kernel/…
Browse files Browse the repository at this point in the history
…git/jgarzik/netdev-2.6
  • Loading branch information
David S. Miller committed Jun 29, 2008
2 parents 1b63ba8 + be0976b commit 332e4af
Show file tree
Hide file tree
Showing 42 changed files with 1,142 additions and 758 deletions.
167 changes: 167 additions & 0 deletions Documentation/networking/dm9000.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
DM9000 Network driver
=====================

Copyright 2008 Simtec Electronics,
Ben Dooks <ben@simtec.co.uk> <ben-linux@fluff.org>


Introduction
------------

This file describes how to use the DM9000 platform-device based network driver
that is contained in the files drivers/net/dm9000.c and drivers/net/dm9000.h.

The driver supports three DM9000 variants, the DM9000E which is the first chip
supported as well as the newer DM9000A and DM9000B devices. It is currently
maintained and tested by Ben Dooks, who should be CC: to any patches for this
driver.


Defining the platform device
----------------------------

The minimum set of resources attached to the platform device are as follows:

1) The physical address of the address register
2) The physical address of the data register
3) The IRQ line the device's interrupt pin is connected to.

These resources should be specified in that order, as the ordering of the
two address regions is important (the driver expects these to be address
and then data).

An example from arch/arm/mach-s3c2410/mach-bast.c is:

static struct resource bast_dm9k_resource[] = {
[0] = {
.start = S3C2410_CS5 + BAST_PA_DM9000,
.end = S3C2410_CS5 + BAST_PA_DM9000 + 3,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = S3C2410_CS5 + BAST_PA_DM9000 + 0x40,
.end = S3C2410_CS5 + BAST_PA_DM9000 + 0x40 + 0x3f,
.flags = IORESOURCE_MEM,
},
[2] = {
.start = IRQ_DM9000,
.end = IRQ_DM9000,
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
}
};

static struct platform_device bast_device_dm9k = {
.name = "dm9000",
.id = 0,
.num_resources = ARRAY_SIZE(bast_dm9k_resource),
.resource = bast_dm9k_resource,
};

Note the setting of the IRQ trigger flag in bast_dm9k_resource[2].flags,
as this will generate a warning if it is not present. The trigger from
the flags field will be passed to request_irq() when registering the IRQ
handler to ensure that the IRQ is setup correctly.

This shows a typical platform device, without the optional configuration
platform data supplied. The next example uses the same resources, but adds
the optional platform data to pass extra configuration data:

static struct dm9000_plat_data bast_dm9k_platdata = {
.flags = DM9000_PLATF_16BITONLY,
};

static struct platform_device bast_device_dm9k = {
.name = "dm9000",
.id = 0,
.num_resources = ARRAY_SIZE(bast_dm9k_resource),
.resource = bast_dm9k_resource,
.dev = {
.platform_data = &bast_dm9k_platdata,
}
};

The platform data is defined in include/linux/dm9000.h and described below.


Platform data
-------------

Extra platform data for the DM9000 can describe the IO bus width to the
device, whether or not an external PHY is attached to the device and
the availability of an external configuration EEPROM.

The flags for the platform data .flags field are as follows:

DM9000_PLATF_8BITONLY

The IO should be done with 8bit operations.

DM9000_PLATF_16BITONLY

The IO should be done with 16bit operations.

DM9000_PLATF_32BITONLY

The IO should be done with 32bit operations.

DM9000_PLATF_EXT_PHY

The chip is connected to an external PHY.

DM9000_PLATF_NO_EEPROM

This can be used to signify that the board does not have an
EEPROM, or that the EEPROM should be hidden from the user.

DM9000_PLATF_SIMPLE_PHY

Switch to using the simpler PHY polling method which does not
try and read the MII PHY state regularly. This is only available
when using the internal PHY. See the section on link state polling
for more information.

The config symbol DM9000_FORCE_SIMPLE_PHY_POLL, Kconfig entry
"Force simple NSR based PHY polling" allows this flag to be
forced on at build time.


PHY Link state polling
----------------------

The driver keeps track of the link state and informs the network core
about link (carrier) availablilty. This is managed by several methods
depending on the version of the chip and on which PHY is being used.

For the internal PHY, the original (and currently default) method is
to read the MII state, either when the status changes if we have the
necessary interrupt support in the chip or every two seconds via a
periodic timer.

To reduce the overhead for the internal PHY, there is now the option
of using the DM9000_FORCE_SIMPLE_PHY_POLL config, or DM9000_PLATF_SIMPLE_PHY
platform data option to read the summary information without the
expensive MII accesses. This method is faster, but does not print
as much information.

When using an external PHY, the driver currently has to poll the MII
link status as there is no method for getting an interrupt on link change.


DM9000A / DM9000B
-----------------

These chips are functionally similar to the DM9000E and are supported easily
by the same driver. The features are:

1) Interrupt on internal PHY state change. This means that the periodic
polling of the PHY status may be disabled on these devices when using
the internal PHY.

2) TCP/UDP checksum offloading, which the driver does not currently support.


ethtool
-------

The driver supports the ethtool interface for access to the driver
state information, the PHY state and the EEPROM.
7 changes: 6 additions & 1 deletion arch/blackfin/mach-bf527/boards/ezkit.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,15 @@ static struct platform_device smc91x_device = {
static struct resource dm9000_resources[] = {
[0] = {
.start = 0x203FB800,
.end = 0x203FB800 + 8,
.end = 0x203FB800 + 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = 0x203FB800 + 4,
.end = 0x203FB800 + 5,
.flags = IORESOURCE_MEM,
},
[2] = {
.start = IRQ_PF9,
.end = IRQ_PF9,
.flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
Expand Down
7 changes: 6 additions & 1 deletion arch/blackfin/mach-bf533/boards/H8606.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,15 @@ static struct platform_device rtc_device = {
static struct resource dm9000_resources[] = {
[0] = {
.start = 0x20300000,
.end = 0x20300000 + 8,
.end = 0x20300000 + 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = 0x20300000 + 4,
.end = 0x20300000 + 5,
.flags = IORESOURCE_MEM,
},
[2] = {
.start = IRQ_PF10,
.end = IRQ_PF10,
.flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
Expand Down
7 changes: 6 additions & 1 deletion arch/blackfin/mach-bf537/boards/generic_board.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,15 @@ static struct platform_device smc91x_device = {
static struct resource dm9000_resources[] = {
[0] = {
.start = 0x203FB800,
.end = 0x203FB800 + 8,
.end = 0x203FB800 + 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = 0x203FB800 + 4,
.end = 0x203FB800 + 5,
.flags = IORESOURCE_MEM,
},
[2] = {
.start = IRQ_PF9,
.end = IRQ_PF9,
.flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
Expand Down
1 change: 0 additions & 1 deletion drivers/net/8139cp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1213,7 +1213,6 @@ static int cp_close (struct net_device *dev)

spin_unlock_irqrestore(&cp->lock, flags);

synchronize_irq(dev->irq);
free_irq(dev->irq, dev);

cp_free_rings(cp);
Expand Down
13 changes: 6 additions & 7 deletions drivers/net/8139too.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@
#include <linux/mii.h>
#include <linux/completion.h>
#include <linux/crc32.h>
#include <asm/io.h>
#include <asm/uaccess.h>
#include <linux/io.h>
#include <linux/uaccess.h>
#include <asm/irq.h>

#define RTL8139_DRIVER_NAME DRV_NAME " Fast Ethernet driver " DRV_VERSION
Expand All @@ -134,7 +134,7 @@

#if RTL8139_DEBUG
/* note: prints function name for you */
# define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
# define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __func__ , ## args)
#else
# define DPRINTK(fmt, args...)
#endif
Expand All @@ -145,7 +145,7 @@
# define assert(expr) \
if(unlikely(!(expr))) { \
printk(KERN_ERR "Assertion failed! %s,%s,%s,line=%d\n", \
#expr,__FILE__,__FUNCTION__,__LINE__); \
#expr, __FILE__, __func__, __LINE__); \
}
#endif

Expand Down Expand Up @@ -219,7 +219,7 @@ enum {
#define RTL8139B_IO_SIZE 256

#define RTL8129_CAPS HAS_MII_XCVR
#define RTL8139_CAPS HAS_CHIP_XCVR|HAS_LNK_CHNG
#define RTL8139_CAPS (HAS_CHIP_XCVR|HAS_LNK_CHNG)

typedef enum {
RTL8139 = 0,
Expand Down Expand Up @@ -1889,7 +1889,7 @@ static void rtl8139_rx_err (u32 rx_status, struct net_device *dev,
}

#if RX_BUF_IDX == 3
static __inline__ void wrap_copy(struct sk_buff *skb, const unsigned char *ring,
static inline void wrap_copy(struct sk_buff *skb, const unsigned char *ring,
u32 offset, unsigned int size)
{
u32 left = RX_BUF_LEN - offset;
Expand Down Expand Up @@ -2231,7 +2231,6 @@ static int rtl8139_close (struct net_device *dev)

spin_unlock_irqrestore (&tp->lock, flags);

synchronize_irq (dev->irq); /* racy, but that's ok here */
free_irq (dev->irq, dev);

rtl8139_tx_clear (tp);
Expand Down
31 changes: 19 additions & 12 deletions drivers/net/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,23 @@ config DM9000
To compile this driver as a module, choose M here. The module
will be called dm9000.

config DM9000_DEBUGLEVEL
int "DM9000 maximum debug level"
depends on DM9000
default 4
help
The maximum level of debugging code compiled into the DM9000
driver.

config DM9000_FORCE_SIMPLE_PHY_POLL
bool "Force simple NSR based PHY polling"
depends on DM9000
---help---
This configuration forces the DM9000 to use the NSR's LinkStatus
bit to determine if the link is up or down instead of the more
costly MII PHY reads. Note, this will not work if the chip is
operating with an external PHY.

config ENC28J60
tristate "ENC28J60 support"
depends on EXPERIMENTAL && SPI && NET_ETHERNET
Expand All @@ -955,14 +972,6 @@ config ENC28J60_WRITEVERIFY
Enable the verify after the buffer write useful for debugging purpose.
If unsure, say N.

config DM9000_DEBUGLEVEL
int "DM9000 maximum debug level"
depends on DM9000
default 4
help
The maximum level of debugging code compiled into the DM9000
driver.

config SMC911X
tristate "SMSC LAN911[5678] support"
select CRC32
Expand Down Expand Up @@ -2025,9 +2034,6 @@ config E1000E
To compile this driver as a module, choose M here. The module
will be called e1000e.

config E1000E_ENABLED
def_bool E1000E != n

config IP1000
tristate "IP1000 Gigabit Ethernet support"
depends on PCI && EXPERIMENTAL
Expand Down Expand Up @@ -2462,7 +2468,8 @@ config EHEA

config IXGBE
tristate "Intel(R) 10GbE PCI Express adapters support"
depends on PCI
depends on PCI && INET
select INET_LRO
---help---
This driver supports Intel(R) 10GbE PCI Express family of
adapters. For more information on how to identify your adapter, go
Expand Down
21 changes: 20 additions & 1 deletion drivers/net/cxgb3/cxgb3_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,25 @@ static inline void unregister_tdev(struct t3cdev *tdev)
mutex_unlock(&cxgb3_db_lock);
}

static inline int adap2type(struct adapter *adapter)
{
int type = 0;

switch (adapter->params.rev) {
case T3_REV_A:
type = T3A;
break;
case T3_REV_B:
case T3_REV_B2:
type = T3B;
break;
case T3_REV_C:
type = T3C;
break;
}
return type;
}

void __devinit cxgb3_adapter_ofld(struct adapter *adapter)
{
struct t3cdev *tdev = &adapter->tdev;
Expand All @@ -1257,7 +1276,7 @@ void __devinit cxgb3_adapter_ofld(struct adapter *adapter)
cxgb3_set_dummy_ops(tdev);
tdev->send = t3_offload_tx;
tdev->ctl = cxgb_offload_ctl;
tdev->type = adapter->params.rev == 0 ? T3A : T3B;
tdev->type = adap2type(adapter);

register_tdev(tdev);
}
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/cxgb3/t3cdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ struct cxgb3_client;

enum t3ctype {
T3A = 0,
T3B
T3B,
T3C,
};

struct t3cdev {
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/dl2k.c
Original file line number Diff line number Diff line change
Expand Up @@ -1753,7 +1753,7 @@ rio_close (struct net_device *dev)

/* Stop Tx and Rx logics */
writel (TxDisable | RxDisable | StatsDisable, ioaddr + MACCtrl);
synchronize_irq (dev->irq);

free_irq (dev->irq, dev);
del_timer_sync (&np->timer);

Expand Down
Loading

0 comments on commit 332e4af

Please sign in to comment.