Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 103200
b: refs/heads/master
c: 28f49d8
h: refs/heads/master
v: v3
  • Loading branch information
David S. Miller committed Jun 29, 2008
1 parent db217cd commit ddaf1b1
Show file tree
Hide file tree
Showing 98 changed files with 1,505 additions and 975 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ff28bd94e307c67abb1bccda5d3a9018bd798e08
refs/heads/master: 28f49d8fec19833672a6a813bfde0068fee50bc9
167 changes: 167 additions & 0 deletions trunk/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.
6 changes: 3 additions & 3 deletions trunk/Documentation/networking/s2io.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ Valid range: Limited by memory on system
Default: 30

e. intr_type
Specifies interrupt type. Possible values 1(INTA), 2(MSI), 3(MSI-X)
Valid range: 1-3
Default: 1
Specifies interrupt type. Possible values 0(INTA), 2(MSI-X)
Valid values: 0, 2
Default: 2

5. Performance suggestions
General:
Expand Down
7 changes: 6 additions & 1 deletion trunk/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 trunk/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 trunk/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
40 changes: 40 additions & 0 deletions trunk/drivers/connector/connector.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include <linux/moduleparam.h>
#include <linux/connector.h>
#include <linux/mutex.h>
#include <linux/proc_fs.h>
#include <linux/spinlock.h>

#include <net/sock.h>

Expand Down Expand Up @@ -403,6 +405,40 @@ static void cn_callback(void *data)
mutex_unlock(&notify_lock);
}

static int cn_proc_show(struct seq_file *m, void *v)
{
struct cn_queue_dev *dev = cdev.cbdev;
struct cn_callback_entry *cbq;

seq_printf(m, "Name ID\n");

spin_lock_bh(&dev->queue_lock);

list_for_each_entry(cbq, &dev->queue_list, callback_entry) {
seq_printf(m, "%-15s %u:%u\n",
cbq->id.name,
cbq->id.id.idx,
cbq->id.id.val);
}

spin_unlock_bh(&dev->queue_lock);

return 0;
}

static int cn_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, cn_proc_show, NULL);
}

static const struct file_operations cn_file_ops = {
.owner = THIS_MODULE,
.open = cn_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release
};

static int __devinit cn_init(void)
{
struct cn_dev *dev = &cdev;
Expand Down Expand Up @@ -434,6 +470,8 @@ static int __devinit cn_init(void)
return -EINVAL;
}

proc_net_fops_create(&init_net, "connector", S_IRUGO, &cn_file_ops);

return 0;
}

Expand All @@ -443,6 +481,8 @@ static void __devexit cn_fini(void)

cn_already_initialized = 0;

proc_net_remove(&init_net, "connector");

cn_del_callback(&dev->id);
cn_queue_free_dev(dev->cbdev);
netlink_kernel_release(dev->nls);
Expand Down
5 changes: 3 additions & 2 deletions trunk/drivers/net/3c59x.c
Original file line number Diff line number Diff line change
Expand Up @@ -1768,9 +1768,10 @@ vortex_timer(unsigned long data)
case XCVR_MII: case XCVR_NWAY:
{
ok = 1;
spin_lock_bh(&vp->lock);
/* Interrupts are already disabled */
spin_lock(&vp->lock);
vortex_check_media(dev, 0);
spin_unlock_bh(&vp->lock);
spin_unlock(&vp->lock);
}
break;
default: /* Other media types handled by Tx timeouts. */
Expand Down
1 change: 0 additions & 1 deletion trunk/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 trunk/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
Loading

0 comments on commit ddaf1b1

Please sign in to comment.