diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-09-14 08:19:08 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-09-14 08:19:08 -0400 |
commit | 905ec87e93bc9e01b15c60035cd6a50c636cbaef (patch) | |
tree | 46fd7618d6511611ffc19eb0dd4d7bc6b90a41c2 /drivers/net | |
parent | 1d6ae775d7a948c9575658eb41184fd2e506c0df (diff) | |
parent | 2f4ba45a75d6383b4a1201169a808ffea416ffa0 (diff) |
Merge /spare/repo/linux-2.6/
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/Kconfig | 13 | ||||
-rw-r--r-- | drivers/net/atari_bionet.c | 2 | ||||
-rw-r--r-- | drivers/net/atari_pamsnet.c | 2 | ||||
-rw-r--r-- | drivers/net/bnx2.c | 9 | ||||
-rw-r--r-- | drivers/net/bnx2.h | 1 | ||||
-rw-r--r-- | drivers/net/bsd_comp.c | 28 | ||||
-rw-r--r-- | drivers/net/cris/eth_v10.c | 6 | ||||
-rw-r--r-- | drivers/net/cs89x0.c | 19 | ||||
-rw-r--r-- | drivers/net/fec.c | 478 | ||||
-rw-r--r-- | drivers/net/fec.h | 7 | ||||
-rw-r--r-- | drivers/net/hamradio/6pack.c | 2 | ||||
-rw-r--r-- | drivers/net/hamradio/baycom_epp.c | 17 | ||||
-rw-r--r-- | drivers/net/hamradio/bpqether.c | 2 | ||||
-rw-r--r-- | drivers/net/hamradio/dmascc.c | 10 | ||||
-rw-r--r-- | drivers/net/hamradio/hdlcdrv.c | 16 | ||||
-rw-r--r-- | drivers/net/hamradio/mkiss.c | 2 | ||||
-rw-r--r-- | drivers/net/hamradio/scc.c | 2 | ||||
-rw-r--r-- | drivers/net/hamradio/yam.c | 30 | ||||
-rw-r--r-- | drivers/net/irda/irda-usb.c | 13 | ||||
-rw-r--r-- | drivers/net/irda/vlsi_ir.h | 6 | ||||
-rw-r--r-- | drivers/net/mv643xx_eth.c | 2 | ||||
-rw-r--r-- | drivers/net/ppp_generic.c | 23 | ||||
-rw-r--r-- | drivers/net/sungem.c | 36 | ||||
-rw-r--r-- | drivers/net/sunhme.c | 43 | ||||
-rw-r--r-- | drivers/net/tg3.c | 10 | ||||
-rw-r--r-- | drivers/net/tulip/de4x5.c | 4 |
26 files changed, 377 insertions, 406 deletions
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 6bb9232514b4..54fff9c2e802 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -1738,11 +1738,18 @@ config 68360_ENET | |||
1738 | the Motorola 68360 processor. | 1738 | the Motorola 68360 processor. |
1739 | 1739 | ||
1740 | config FEC | 1740 | config FEC |
1741 | bool "FEC ethernet controller (of ColdFire 5272)" | 1741 | bool "FEC ethernet controller (of ColdFire CPUs)" |
1742 | depends on M5272 || M5282 | 1742 | depends on M523x || M527x || M5272 || M528x |
1743 | help | 1743 | help |
1744 | Say Y here if you want to use the built-in 10/100 Fast ethernet | 1744 | Say Y here if you want to use the built-in 10/100 Fast ethernet |
1745 | controller on the Motorola ColdFire 5272 processor. | 1745 | controller on some Motorola ColdFire processors. |
1746 | |||
1747 | config FEC2 | ||
1748 | bool "Second FEC ethernet controller (on some ColdFire CPUs)" | ||
1749 | depends on FEC | ||
1750 | help | ||
1751 | Say Y here if you want to use the second built-in 10/100 Fast | ||
1752 | ethernet controller on some Motorola ColdFire processors. | ||
1746 | 1753 | ||
1747 | config NE_H8300 | 1754 | config NE_H8300 |
1748 | tristate "NE2000 compatible support for H8/300" | 1755 | tristate "NE2000 compatible support for H8/300" |
diff --git a/drivers/net/atari_bionet.c b/drivers/net/atari_bionet.c index 1798ce7262c9..0095384ff454 100644 --- a/drivers/net/atari_bionet.c +++ b/drivers/net/atari_bionet.c | |||
@@ -155,7 +155,7 @@ static int bionet_close(struct net_device *dev); | |||
155 | static struct net_device_stats *net_get_stats(struct net_device *dev); | 155 | static struct net_device_stats *net_get_stats(struct net_device *dev); |
156 | static void bionet_tick(unsigned long); | 156 | static void bionet_tick(unsigned long); |
157 | 157 | ||
158 | static struct timer_list bionet_timer = TIMER_INITIALIZER(bionet_tick, 0, 0); | 158 | static DEFINE_TIMER(bionet_timer, bionet_tick, 0, 0); |
159 | 159 | ||
160 | #define STRAM_ADDR(a) (((a) & 0xff000000) == 0) | 160 | #define STRAM_ADDR(a) (((a) & 0xff000000) == 0) |
161 | 161 | ||
diff --git a/drivers/net/atari_pamsnet.c b/drivers/net/atari_pamsnet.c index 81c362c8cb97..8b997809f9de 100644 --- a/drivers/net/atari_pamsnet.c +++ b/drivers/net/atari_pamsnet.c | |||
@@ -165,7 +165,7 @@ static void pamsnet_tick(unsigned long); | |||
165 | 165 | ||
166 | static irqreturn_t pamsnet_intr(int irq, void *data, struct pt_regs *fp); | 166 | static irqreturn_t pamsnet_intr(int irq, void *data, struct pt_regs *fp); |
167 | 167 | ||
168 | static struct timer_list pamsnet_timer = TIMER_INITIALIZER(pamsnet_tick, 0, 0); | 168 | static DEFINE_TIMER(pamsnet_timer, pamsnet_tick, 0, 0); |
169 | 169 | ||
170 | #define STRAM_ADDR(a) (((a) & 0xff000000) == 0) | 170 | #define STRAM_ADDR(a) (((a) & 0xff000000) == 0) |
171 | 171 | ||
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 55a72c7ad001..3a2ace01e444 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
@@ -14,8 +14,8 @@ | |||
14 | 14 | ||
15 | #define DRV_MODULE_NAME "bnx2" | 15 | #define DRV_MODULE_NAME "bnx2" |
16 | #define PFX DRV_MODULE_NAME ": " | 16 | #define PFX DRV_MODULE_NAME ": " |
17 | #define DRV_MODULE_VERSION "1.2.20" | 17 | #define DRV_MODULE_VERSION "1.2.21" |
18 | #define DRV_MODULE_RELDATE "August 22, 2005" | 18 | #define DRV_MODULE_RELDATE "September 7, 2005" |
19 | 19 | ||
20 | #define RUN_AT(x) (jiffies + (x)) | 20 | #define RUN_AT(x) (jiffies + (x)) |
21 | 21 | ||
@@ -1533,6 +1533,7 @@ bnx2_msi(int irq, void *dev_instance, struct pt_regs *regs) | |||
1533 | struct net_device *dev = dev_instance; | 1533 | struct net_device *dev = dev_instance; |
1534 | struct bnx2 *bp = dev->priv; | 1534 | struct bnx2 *bp = dev->priv; |
1535 | 1535 | ||
1536 | prefetch(bp->status_blk); | ||
1536 | REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, | 1537 | REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, |
1537 | BNX2_PCICFG_INT_ACK_CMD_USE_INT_HC_PARAM | | 1538 | BNX2_PCICFG_INT_ACK_CMD_USE_INT_HC_PARAM | |
1538 | BNX2_PCICFG_INT_ACK_CMD_MASK_INT); | 1539 | BNX2_PCICFG_INT_ACK_CMD_MASK_INT); |
@@ -1558,7 +1559,7 @@ bnx2_interrupt(int irq, void *dev_instance, struct pt_regs *regs) | |||
1558 | * When using MSI, the MSI message will always complete after | 1559 | * When using MSI, the MSI message will always complete after |
1559 | * the status block write. | 1560 | * the status block write. |
1560 | */ | 1561 | */ |
1561 | if ((bp->status_blk->status_idx == bp->last_status_idx) || | 1562 | if ((bp->status_blk->status_idx == bp->last_status_idx) && |
1562 | (REG_RD(bp, BNX2_PCICFG_MISC_STATUS) & | 1563 | (REG_RD(bp, BNX2_PCICFG_MISC_STATUS) & |
1563 | BNX2_PCICFG_MISC_STATUS_INTA_VALUE)) | 1564 | BNX2_PCICFG_MISC_STATUS_INTA_VALUE)) |
1564 | return IRQ_NONE; | 1565 | return IRQ_NONE; |
@@ -5014,6 +5015,7 @@ static struct ethtool_ops bnx2_ethtool_ops = { | |||
5014 | .phys_id = bnx2_phys_id, | 5015 | .phys_id = bnx2_phys_id, |
5015 | .get_stats_count = bnx2_get_stats_count, | 5016 | .get_stats_count = bnx2_get_stats_count, |
5016 | .get_ethtool_stats = bnx2_get_ethtool_stats, | 5017 | .get_ethtool_stats = bnx2_get_ethtool_stats, |
5018 | .get_perm_addr = ethtool_op_get_perm_addr, | ||
5017 | }; | 5019 | }; |
5018 | 5020 | ||
5019 | /* Called with rtnl_lock */ | 5021 | /* Called with rtnl_lock */ |
@@ -5441,6 +5443,7 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
5441 | pci_set_drvdata(pdev, dev); | 5443 | pci_set_drvdata(pdev, dev); |
5442 | 5444 | ||
5443 | memcpy(dev->dev_addr, bp->mac_addr, 6); | 5445 | memcpy(dev->dev_addr, bp->mac_addr, 6); |
5446 | memcpy(dev->perm_addr, bp->mac_addr, 6); | ||
5444 | bp->name = board_info[ent->driver_data].name, | 5447 | bp->name = board_info[ent->driver_data].name, |
5445 | printk(KERN_INFO "%s: %s (%c%d) PCI%s %s %dMHz found at mem %lx, " | 5448 | printk(KERN_INFO "%s: %s (%c%d) PCI%s %s %dMHz found at mem %lx, " |
5446 | "IRQ %d, ", | 5449 | "IRQ %d, ", |
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h index 9ad3f5740cd8..62857b6a6ee4 100644 --- a/drivers/net/bnx2.h +++ b/drivers/net/bnx2.h | |||
@@ -50,6 +50,7 @@ | |||
50 | #endif | 50 | #endif |
51 | #include <linux/workqueue.h> | 51 | #include <linux/workqueue.h> |
52 | #include <linux/crc32.h> | 52 | #include <linux/crc32.h> |
53 | #include <linux/prefetch.h> | ||
53 | 54 | ||
54 | /* Hardware data structures and register definitions automatically | 55 | /* Hardware data structures and register definitions automatically |
55 | * generated from RTL code. Do not modify. | 56 | * generated from RTL code. Do not modify. |
diff --git a/drivers/net/bsd_comp.c b/drivers/net/bsd_comp.c index 3d88ad622bdb..fb4098ed469e 100644 --- a/drivers/net/bsd_comp.c +++ b/drivers/net/bsd_comp.c | |||
@@ -323,33 +323,27 @@ static void bsd_reset (void *state) | |||
323 | */ | 323 | */ |
324 | 324 | ||
325 | static void bsd_free (void *state) | 325 | static void bsd_free (void *state) |
326 | { | 326 | { |
327 | struct bsd_db *db = (struct bsd_db *) state; | 327 | struct bsd_db *db = state; |
328 | 328 | ||
329 | if (db) | 329 | if (!db) |
330 | { | 330 | return; |
331 | |||
331 | /* | 332 | /* |
332 | * Release the dictionary | 333 | * Release the dictionary |
333 | */ | 334 | */ |
334 | if (db->dict) | 335 | vfree(db->dict); |
335 | { | 336 | db->dict = NULL; |
336 | vfree (db->dict); | ||
337 | db->dict = NULL; | ||
338 | } | ||
339 | /* | 337 | /* |
340 | * Release the string buffer | 338 | * Release the string buffer |
341 | */ | 339 | */ |
342 | if (db->lens) | 340 | vfree(db->lens); |
343 | { | 341 | db->lens = NULL; |
344 | vfree (db->lens); | ||
345 | db->lens = NULL; | ||
346 | } | ||
347 | /* | 342 | /* |
348 | * Finally release the structure itself. | 343 | * Finally release the structure itself. |
349 | */ | 344 | */ |
350 | kfree (db); | 345 | kfree(db); |
351 | } | 346 | } |
352 | } | ||
353 | 347 | ||
354 | /* | 348 | /* |
355 | * Allocate space for a (de) compressor. | 349 | * Allocate space for a (de) compressor. |
diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c index 442670860fca..b68b9cad76e9 100644 --- a/drivers/net/cris/eth_v10.c +++ b/drivers/net/cris/eth_v10.c | |||
@@ -384,8 +384,8 @@ static unsigned int mdio_phy_addr; /* Transciever address */ | |||
384 | static unsigned int network_tr_ctrl_shadow = 0; | 384 | static unsigned int network_tr_ctrl_shadow = 0; |
385 | 385 | ||
386 | /* Network speed indication. */ | 386 | /* Network speed indication. */ |
387 | static struct timer_list speed_timer = TIMER_INITIALIZER(NULL, 0, 0); | 387 | static DEFINE_TIMER(speed_timer, NULL, 0, 0); |
388 | static struct timer_list clear_led_timer = TIMER_INITIALIZER(NULL, 0, 0); | 388 | static DEFINE_TIMER(clear_led_timer, NULL, 0, 0); |
389 | static int current_speed; /* Speed read from transceiver */ | 389 | static int current_speed; /* Speed read from transceiver */ |
390 | static int current_speed_selection; /* Speed selected by user */ | 390 | static int current_speed_selection; /* Speed selected by user */ |
391 | static unsigned long led_next_time; | 391 | static unsigned long led_next_time; |
@@ -393,7 +393,7 @@ static int led_active; | |||
393 | static int rx_queue_len; | 393 | static int rx_queue_len; |
394 | 394 | ||
395 | /* Duplex */ | 395 | /* Duplex */ |
396 | static struct timer_list duplex_timer = TIMER_INITIALIZER(NULL, 0, 0); | 396 | static DEFINE_TIMER(duplex_timer, NULL, 0, 0); |
397 | static int full_duplex; | 397 | static int full_duplex; |
398 | static enum duplex current_duplex; | 398 | static enum duplex current_duplex; |
399 | 399 | ||
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index b780307093eb..cdc07ccd7332 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c | |||
@@ -247,6 +247,9 @@ static int get_eeprom_data(struct net_device *dev, int off, int len, int *buffer | |||
247 | static int get_eeprom_cksum(int off, int len, int *buffer); | 247 | static int get_eeprom_cksum(int off, int len, int *buffer); |
248 | static int set_mac_address(struct net_device *dev, void *addr); | 248 | static int set_mac_address(struct net_device *dev, void *addr); |
249 | static void count_rx_errors(int status, struct net_local *lp); | 249 | static void count_rx_errors(int status, struct net_local *lp); |
250 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
251 | static void net_poll_controller(struct net_device *dev); | ||
252 | #endif | ||
250 | #if ALLOW_DMA | 253 | #if ALLOW_DMA |
251 | static void get_dma_channel(struct net_device *dev); | 254 | static void get_dma_channel(struct net_device *dev); |
252 | static void release_dma_buff(struct net_local *lp); | 255 | static void release_dma_buff(struct net_local *lp); |
@@ -405,6 +408,19 @@ get_eeprom_cksum(int off, int len, int *buffer) | |||
405 | return -1; | 408 | return -1; |
406 | } | 409 | } |
407 | 410 | ||
411 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
412 | /* | ||
413 | * Polling receive - used by netconsole and other diagnostic tools | ||
414 | * to allow network i/o with interrupts disabled. | ||
415 | */ | ||
416 | static void net_poll_controller(struct net_device *dev) | ||
417 | { | ||
418 | disable_irq(dev->irq); | ||
419 | net_interrupt(dev->irq, dev, NULL); | ||
420 | enable_irq(dev->irq); | ||
421 | } | ||
422 | #endif | ||
423 | |||
408 | /* This is the real probe routine. Linux has a history of friendly device | 424 | /* This is the real probe routine. Linux has a history of friendly device |
409 | probes on the ISA bus. A good device probes avoids doing writes, and | 425 | probes on the ISA bus. A good device probes avoids doing writes, and |
410 | verifies that the correct device exists and functions. | 426 | verifies that the correct device exists and functions. |
@@ -760,6 +776,9 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
760 | dev->get_stats = net_get_stats; | 776 | dev->get_stats = net_get_stats; |
761 | dev->set_multicast_list = set_multicast_list; | 777 | dev->set_multicast_list = set_multicast_list; |
762 | dev->set_mac_address = set_mac_address; | 778 | dev->set_mac_address = set_mac_address; |
779 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
780 | dev->poll_controller = net_poll_controller; | ||
781 | #endif | ||
763 | 782 | ||
764 | printk("\n"); | 783 | printk("\n"); |
765 | if (net_debug) | 784 | if (net_debug) |
diff --git a/drivers/net/fec.c b/drivers/net/fec.c index 2c7008491378..85504fb900da 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c | |||
@@ -8,7 +8,7 @@ | |||
8 | * describes connections using the internal parallel port I/O, which | 8 | * describes connections using the internal parallel port I/O, which |
9 | * is basically all of Port D. | 9 | * is basically all of Port D. |
10 | * | 10 | * |
11 | * Right now, I am very watseful with the buffers. I allocate memory | 11 | * Right now, I am very wasteful with the buffers. I allocate memory |
12 | * pages and then divide them into 2K frame buffers. This way I know I | 12 | * pages and then divide them into 2K frame buffers. This way I know I |
13 | * have buffers large enough to hold one frame within one buffer descriptor. | 13 | * have buffers large enough to hold one frame within one buffer descriptor. |
14 | * Once I get this working, I will use 64 or 128 byte CPM buffers, which | 14 | * Once I get this working, I will use 64 or 128 byte CPM buffers, which |
@@ -19,7 +19,10 @@ | |||
19 | * Copyright (c) 2000 Ericsson Radio Systems AB. | 19 | * Copyright (c) 2000 Ericsson Radio Systems AB. |
20 | * | 20 | * |
21 | * Support for FEC controller of ColdFire/5270/5271/5272/5274/5275/5280/5282. | 21 | * Support for FEC controller of ColdFire/5270/5271/5272/5274/5275/5280/5282. |
22 | * Copyrught (c) 2001-2004 Greg Ungerer (gerg@snapgear.com) | 22 | * Copyright (c) 2001-2004 Greg Ungerer (gerg@snapgear.com) |
23 | * | ||
24 | * Bug fixes and cleanup by Philippe De Muyter (phdm@macqel.be) | ||
25 | * Copyright (c) 2004-2005 Macq Electronique SA. | ||
23 | */ | 26 | */ |
24 | 27 | ||
25 | #include <linux/config.h> | 28 | #include <linux/config.h> |
@@ -46,7 +49,8 @@ | |||
46 | #include <asm/io.h> | 49 | #include <asm/io.h> |
47 | #include <asm/pgtable.h> | 50 | #include <asm/pgtable.h> |
48 | 51 | ||
49 | #if defined(CONFIG_M527x) || defined(CONFIG_M5272) || defined(CONFIG_M528x) | 52 | #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || \ |
53 | defined(CONFIG_M5272) || defined(CONFIG_M528x) | ||
50 | #include <asm/coldfire.h> | 54 | #include <asm/coldfire.h> |
51 | #include <asm/mcfsim.h> | 55 | #include <asm/mcfsim.h> |
52 | #include "fec.h" | 56 | #include "fec.h" |
@@ -71,7 +75,7 @@ static unsigned int fec_hw[] = { | |||
71 | #elif defined(CONFIG_M527x) | 75 | #elif defined(CONFIG_M527x) |
72 | (MCF_MBAR + 0x1000), | 76 | (MCF_MBAR + 0x1000), |
73 | (MCF_MBAR + 0x1800), | 77 | (MCF_MBAR + 0x1800), |
74 | #elif defined(CONFIG_M528x) | 78 | #elif defined(CONFIG_M523x) || defined(CONFIG_M528x) |
75 | (MCF_MBAR + 0x1000), | 79 | (MCF_MBAR + 0x1000), |
76 | #else | 80 | #else |
77 | &(((immap_t *)IMAP_ADDR)->im_cpm.cp_fec), | 81 | &(((immap_t *)IMAP_ADDR)->im_cpm.cp_fec), |
@@ -94,12 +98,14 @@ static unsigned char fec_mac_default[] = { | |||
94 | #define FEC_FLASHMAC 0xffe04000 | 98 | #define FEC_FLASHMAC 0xffe04000 |
95 | #elif defined(CONFIG_CANCam) | 99 | #elif defined(CONFIG_CANCam) |
96 | #define FEC_FLASHMAC 0xf0020000 | 100 | #define FEC_FLASHMAC 0xf0020000 |
101 | #elif defined (CONFIG_M5272C3) | ||
102 | #define FEC_FLASHMAC (0xffe04000 + 4) | ||
103 | #elif defined(CONFIG_MOD5272) | ||
104 | #define FEC_FLASHMAC 0xffc0406b | ||
97 | #else | 105 | #else |
98 | #define FEC_FLASHMAC 0 | 106 | #define FEC_FLASHMAC 0 |
99 | #endif | 107 | #endif |
100 | 108 | ||
101 | unsigned char *fec_flashmac = (unsigned char *) FEC_FLASHMAC; | ||
102 | |||
103 | /* Forward declarations of some structures to support different PHYs | 109 | /* Forward declarations of some structures to support different PHYs |
104 | */ | 110 | */ |
105 | 111 | ||
@@ -158,7 +164,7 @@ typedef struct { | |||
158 | * size bits. Other FEC hardware does not, so we need to take that into | 164 | * size bits. Other FEC hardware does not, so we need to take that into |
159 | * account when setting it. | 165 | * account when setting it. |
160 | */ | 166 | */ |
161 | #if defined(CONFIG_M527x) || defined(CONFIG_M528x) | 167 | #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) |
162 | #define OPT_FRAME_SIZE (PKT_MAXBUF_SIZE << 16) | 168 | #define OPT_FRAME_SIZE (PKT_MAXBUF_SIZE << 16) |
163 | #else | 169 | #else |
164 | #define OPT_FRAME_SIZE 0 | 170 | #define OPT_FRAME_SIZE 0 |
@@ -196,7 +202,7 @@ struct fec_enet_private { | |||
196 | uint phy_id_done; | 202 | uint phy_id_done; |
197 | uint phy_status; | 203 | uint phy_status; |
198 | uint phy_speed; | 204 | uint phy_speed; |
199 | phy_info_t *phy; | 205 | phy_info_t const *phy; |
200 | struct work_struct phy_task; | 206 | struct work_struct phy_task; |
201 | 207 | ||
202 | uint sequence_done; | 208 | uint sequence_done; |
@@ -209,7 +215,6 @@ struct fec_enet_private { | |||
209 | int link; | 215 | int link; |
210 | int old_link; | 216 | int old_link; |
211 | int full_duplex; | 217 | int full_duplex; |
212 | unsigned char mac_addr[ETH_ALEN]; | ||
213 | }; | 218 | }; |
214 | 219 | ||
215 | static int fec_enet_open(struct net_device *dev); | 220 | static int fec_enet_open(struct net_device *dev); |
@@ -237,10 +242,10 @@ typedef struct mii_list { | |||
237 | } mii_list_t; | 242 | } mii_list_t; |
238 | 243 | ||
239 | #define NMII 20 | 244 | #define NMII 20 |
240 | mii_list_t mii_cmds[NMII]; | 245 | static mii_list_t mii_cmds[NMII]; |
241 | mii_list_t *mii_free; | 246 | static mii_list_t *mii_free; |
242 | mii_list_t *mii_head; | 247 | static mii_list_t *mii_head; |
243 | mii_list_t *mii_tail; | 248 | static mii_list_t *mii_tail; |
244 | 249 | ||
245 | static int mii_queue(struct net_device *dev, int request, | 250 | static int mii_queue(struct net_device *dev, int request, |
246 | void (*func)(uint, struct net_device *)); | 251 | void (*func)(uint, struct net_device *)); |
@@ -425,7 +430,7 @@ fec_timeout(struct net_device *dev) | |||
425 | } | 430 | } |
426 | } | 431 | } |
427 | #endif | 432 | #endif |
428 | fec_restart(dev, 0); | 433 | fec_restart(dev, fep->full_duplex); |
429 | netif_wake_queue(dev); | 434 | netif_wake_queue(dev); |
430 | } | 435 | } |
431 | 436 | ||
@@ -757,45 +762,52 @@ static void mii_parse_sr(uint mii_reg, struct net_device *dev) | |||
757 | { | 762 | { |
758 | struct fec_enet_private *fep = netdev_priv(dev); | 763 | struct fec_enet_private *fep = netdev_priv(dev); |
759 | volatile uint *s = &(fep->phy_status); | 764 | volatile uint *s = &(fep->phy_status); |
765 | uint status; | ||
760 | 766 | ||
761 | *s &= ~(PHY_STAT_LINK | PHY_STAT_FAULT | PHY_STAT_ANC); | 767 | status = *s & ~(PHY_STAT_LINK | PHY_STAT_FAULT | PHY_STAT_ANC); |
762 | 768 | ||
763 | if (mii_reg & 0x0004) | 769 | if (mii_reg & 0x0004) |
764 | *s |= PHY_STAT_LINK; | 770 | status |= PHY_STAT_LINK; |
765 | if (mii_reg & 0x0010) | 771 | if (mii_reg & 0x0010) |
766 | *s |= PHY_STAT_FAULT; | 772 | status |= PHY_STAT_FAULT; |
767 | if (mii_reg & 0x0020) | 773 | if (mii_reg & 0x0020) |
768 | *s |= PHY_STAT_ANC; | 774 | status |= PHY_STAT_ANC; |
775 | |||
776 | *s = status; | ||
769 | } | 777 | } |
770 | 778 | ||
771 | static void mii_parse_cr(uint mii_reg, struct net_device *dev) | 779 | static void mii_parse_cr(uint mii_reg, struct net_device *dev) |
772 | { | 780 | { |
773 | struct fec_enet_private *fep = netdev_priv(dev); | 781 | struct fec_enet_private *fep = netdev_priv(dev); |
774 | volatile uint *s = &(fep->phy_status); | 782 | volatile uint *s = &(fep->phy_status); |
783 | uint status; | ||
775 | 784 | ||
776 | *s &= ~(PHY_CONF_ANE | PHY_CONF_LOOP); | 785 | status = *s & ~(PHY_CONF_ANE | PHY_CONF_LOOP); |
777 | 786 | ||
778 | if (mii_reg & 0x1000) | 787 | if (mii_reg & 0x1000) |
779 | *s |= PHY_CONF_ANE; | 788 | status |= PHY_CONF_ANE; |
780 | if (mii_reg & 0x4000) | 789 | if (mii_reg & 0x4000) |
781 | *s |= PHY_CONF_LOOP; | 790 | status |= PHY_CONF_LOOP; |
791 | *s = status; | ||
782 | } | 792 | } |
783 | 793 | ||
784 | static void mii_parse_anar(uint mii_reg, struct net_device *dev) | 794 | static void mii_parse_anar(uint mii_reg, struct net_device *dev) |
785 | { | 795 | { |
786 | struct fec_enet_private *fep = netdev_priv(dev); | 796 | struct fec_enet_private *fep = netdev_priv(dev); |
787 | volatile uint *s = &(fep->phy_status); | 797 | volatile uint *s = &(fep->phy_status); |
798 | uint status; | ||
788 | 799 | ||
789 | *s &= ~(PHY_CONF_SPMASK); | 800 | status = *s & ~(PHY_CONF_SPMASK); |
790 | 801 | ||
791 | if (mii_reg & 0x0020) | 802 | if (mii_reg & 0x0020) |
792 | *s |= PHY_CONF_10HDX; | 803 | status |= PHY_CONF_10HDX; |
793 | if (mii_reg & 0x0040) | 804 | if (mii_reg & 0x0040) |
794 | *s |= PHY_CONF_10FDX; | 805 | status |= PHY_CONF_10FDX; |
795 | if (mii_reg & 0x0080) | 806 | if (mii_reg & 0x0080) |
796 | *s |= PHY_CONF_100HDX; | 807 | status |= PHY_CONF_100HDX; |
797 | if (mii_reg & 0x00100) | 808 | if (mii_reg & 0x00100) |
798 | *s |= PHY_CONF_100FDX; | 809 | status |= PHY_CONF_100FDX; |
810 | *s = status; | ||
799 | } | 811 | } |
800 | 812 | ||
801 | /* ------------------------------------------------------------------------- */ | 813 | /* ------------------------------------------------------------------------- */ |
@@ -811,37 +823,34 @@ static void mii_parse_lxt970_csr(uint mii_reg, struct net_device *dev) | |||
811 | { | 823 | { |
812 | struct fec_enet_private *fep = netdev_priv(dev); | 824 | struct fec_enet_private *fep = netdev_priv(dev); |
813 | volatile uint *s = &(fep->phy_status); | 825 | volatile uint *s = &(fep->phy_status); |
826 | uint status; | ||
814 | 827 | ||
815 | *s &= ~(PHY_STAT_SPMASK); | 828 | status = *s & ~(PHY_STAT_SPMASK); |
816 | |||
817 | if (mii_reg & 0x0800) { | 829 | if (mii_reg & 0x0800) { |
818 | if (mii_reg & 0x1000) | 830 | if (mii_reg & 0x1000) |
819 | *s |= PHY_STAT_100FDX; | 831 | status |= PHY_STAT_100FDX; |
820 | else | 832 | else |
821 | *s |= PHY_STAT_100HDX; | 833 | status |= PHY_STAT_100HDX; |
822 | } else { | 834 | } else { |
823 | if (mii_reg & 0x1000) | 835 | if (mii_reg & 0x1000) |
824 | *s |= PHY_STAT_10FDX; | 836 | status |= PHY_STAT_10FDX; |
825 | else | 837 | else |
826 | *s |= PHY_STAT_10HDX; | 838 | status |= PHY_STAT_10HDX; |
827 | } | 839 | } |
840 | *s = status; | ||
828 | } | 841 | } |
829 | 842 | ||
830 | static phy_info_t phy_info_lxt970 = { | 843 | static phy_cmd_t const phy_cmd_lxt970_config[] = { |
831 | 0x07810000, | ||
832 | "LXT970", | ||
833 | |||
834 | (const phy_cmd_t []) { /* config */ | ||
835 | { mk_mii_read(MII_REG_CR), mii_parse_cr }, | 844 | { mk_mii_read(MII_REG_CR), mii_parse_cr }, |
836 | { mk_mii_read(MII_REG_ANAR), mii_parse_anar }, | 845 | { mk_mii_read(MII_REG_ANAR), mii_parse_anar }, |
837 | { mk_mii_end, } | 846 | { mk_mii_end, } |
838 | }, | 847 | }; |
839 | (const phy_cmd_t []) { /* startup - enable interrupts */ | 848 | static phy_cmd_t const phy_cmd_lxt970_startup[] = { /* enable interrupts */ |
840 | { mk_mii_write(MII_LXT970_IER, 0x0002), NULL }, | 849 | { mk_mii_write(MII_LXT970_IER, 0x0002), NULL }, |
841 | { mk_mii_write(MII_REG_CR, 0x1200), NULL }, /* autonegotiate */ | 850 | { mk_mii_write(MII_REG_CR, 0x1200), NULL }, /* autonegotiate */ |
842 | { mk_mii_end, } | 851 | { mk_mii_end, } |
843 | }, | 852 | }; |
844 | (const phy_cmd_t []) { /* ack_int */ | 853 | static phy_cmd_t const phy_cmd_lxt970_ack_int[] = { |
845 | /* read SR and ISR to acknowledge */ | 854 | /* read SR and ISR to acknowledge */ |
846 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, | 855 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, |
847 | { mk_mii_read(MII_LXT970_ISR), NULL }, | 856 | { mk_mii_read(MII_LXT970_ISR), NULL }, |
@@ -849,11 +858,18 @@ static phy_info_t phy_info_lxt970 = { | |||
849 | /* find out the current status */ | 858 | /* find out the current status */ |
850 | { mk_mii_read(MII_LXT970_CSR), mii_parse_lxt970_csr }, | 859 | { mk_mii_read(MII_LXT970_CSR), mii_parse_lxt970_csr }, |
851 | { mk_mii_end, } | 860 | { mk_mii_end, } |
852 | }, | 861 | }; |
853 | (const phy_cmd_t []) { /* shutdown - disable interrupts */ | 862 | static phy_cmd_t const phy_cmd_lxt970_shutdown[] = { /* disable interrupts */ |
854 | { mk_mii_write(MII_LXT970_IER, 0x0000), NULL }, | 863 | { mk_mii_write(MII_LXT970_IER, 0x0000), NULL }, |
855 | { mk_mii_end, } | 864 | { mk_mii_end, } |
856 | }, | 865 | }; |
866 | static phy_info_t const phy_info_lxt970 = { | ||
867 | .id = 0x07810000, | ||
868 | .name = "LXT970", | ||
869 | .config = phy_cmd_lxt970_config, | ||
870 | .startup = phy_cmd_lxt970_startup, | ||
871 | .ack_int = phy_cmd_lxt970_ack_int, | ||
872 | .shutdown = phy_cmd_lxt970_shutdown | ||
857 | }; | 873 | }; |
858 | 874 | ||
859 | /* ------------------------------------------------------------------------- */ | 875 | /* ------------------------------------------------------------------------- */ |
@@ -878,45 +894,44 @@ static void mii_parse_lxt971_sr2(uint mii_reg, struct net_device *dev) | |||
878 | { | 894 | { |
879 | struct fec_enet_private *fep = netdev_priv(dev); | 895 | struct fec_enet_private *fep = netdev_priv(dev); |
880 | volatile uint *s = &(fep->phy_status); | 896 | volatile uint *s = &(fep->phy_status); |
897 | uint status; | ||
881 | 898 | ||
882 | *s &= ~(PHY_STAT_SPMASK | PHY_STAT_LINK | PHY_STAT_ANC); | 899 | status = *s & ~(PHY_STAT_SPMASK | PHY_STAT_LINK | PHY_STAT_ANC); |
883 | 900 | ||
884 | if (mii_reg & 0x0400) { | 901 | if (mii_reg & 0x0400) { |
885 | fep->link = 1; | 902 | fep->link = 1; |
886 | *s |= PHY_STAT_LINK; | 903 | status |= PHY_STAT_LINK; |
887 | } else { | 904 | } else { |
888 | fep->link = 0; | 905 | fep->link = 0; |
889 | } | 906 | } |
890 | if (mii_reg & 0x0080) | 907 | if (mii_reg & 0x0080) |
891 | *s |= PHY_STAT_ANC; | 908 | status |= PHY_STAT_ANC; |
892 | if (mii_reg & 0x4000) { | 909 | if (mii_reg & 0x4000) { |
893 | if (mii_reg & 0x0200) | 910 | if (mii_reg & 0x0200) |
894 | *s |= PHY_STAT_100FDX; | 911 | status |= PHY_STAT_100FDX; |
895 | else | 912 | else |
896 | *s |= PHY_STAT_100HDX; | 913 | status |= PHY_STAT_100HDX; |
897 | } else { | 914 | } else { |
898 | if (mii_reg & 0x0200) | 915 | if (mii_reg & 0x0200) |
899 | *s |= PHY_STAT_10FDX; | 916 | status |= PHY_STAT_10FDX; |
900 | else | 917 | else |
901 | *s |= PHY_STAT_10HDX; | 918 | status |= PHY_STAT_10HDX; |
902 | } | 919 | } |
903 | if (mii_reg & 0x0008) | 920 | if (mii_reg & 0x0008) |
904 | *s |= PHY_STAT_FAULT; | 921 | status |= PHY_STAT_FAULT; |
905 | } | ||
906 | 922 | ||
907 | static phy_info_t phy_info_lxt971 = { | 923 | *s = status; |
908 | 0x0001378e, | 924 | } |
909 | "LXT971", | ||
910 | 925 | ||
911 | (const phy_cmd_t []) { /* config */ | 926 | static phy_cmd_t const phy_cmd_lxt971_config[] = { |
912 | /* limit to 10MBit because my protorype board | 927 | /* limit to 10MBit because my prototype board |
913 | * doesn't work with 100. */ | 928 | * doesn't work with 100. */ |
914 | { mk_mii_read(MII_REG_CR), mii_parse_cr }, | 929 | { mk_mii_read(MII_REG_CR), mii_parse_cr }, |
915 | { mk_mii_read(MII_REG_ANAR), mii_parse_anar }, | 930 | { mk_mii_read(MII_REG_ANAR), mii_parse_anar }, |
916 | { mk_mii_read(MII_LXT971_SR2), mii_parse_lxt971_sr2 }, | 931 | { mk_mii_read(MII_LXT971_SR2), mii_parse_lxt971_sr2 }, |
917 | { mk_mii_end, } | 932 | { mk_mii_end, } |
918 | }, | 933 | }; |
919 | (const phy_cmd_t []) { /* startup - enable interrupts */ | 934 | static phy_cmd_t const phy_cmd_lxt971_startup[] = { /* enable interrupts */ |
920 | { mk_mii_write(MII_LXT971_IER, 0x00f2), NULL }, | 935 | { mk_mii_write(MII_LXT971_IER, 0x00f2), NULL }, |
921 | { mk_mii_write(MII_REG_CR, 0x1200), NULL }, /* autonegotiate */ | 936 | { mk_mii_write(MII_REG_CR, 0x1200), NULL }, /* autonegotiate */ |
922 | { mk_mii_write(MII_LXT971_LCR, 0xd422), NULL }, /* LED config */ | 937 | { mk_mii_write(MII_LXT971_LCR, 0xd422), NULL }, /* LED config */ |
@@ -925,19 +940,26 @@ static phy_info_t phy_info_lxt971 = { | |||
925 | * read here to get a valid value in ack_int */ | 940 | * read here to get a valid value in ack_int */ |
926 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, | 941 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, |
927 | { mk_mii_end, } | 942 | { mk_mii_end, } |
928 | }, | 943 | }; |
929 | (const phy_cmd_t []) { /* ack_int */ | 944 | static phy_cmd_t const phy_cmd_lxt971_ack_int[] = { |
945 | /* acknowledge the int before reading status ! */ | ||
946 | { mk_mii_read(MII_LXT971_ISR), NULL }, | ||
930 | /* find out the current status */ | 947 | /* find out the current status */ |
931 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, | 948 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, |
932 | { mk_mii_read(MII_LXT971_SR2), mii_parse_lxt971_sr2 }, | 949 | { mk_mii_read(MII_LXT971_SR2), mii_parse_lxt971_sr2 }, |
933 | /* we only need to read ISR to acknowledge */ | ||
934 | { mk_mii_read(MII_LXT971_ISR), NULL }, | ||
935 | { mk_mii_end, } | 950 | { mk_mii_end, } |
936 | }, | 951 | }; |
937 | (const phy_cmd_t []) { /* shutdown - disable interrupts */ | 952 | static phy_cmd_t const phy_cmd_lxt971_shutdown[] = { /* disable interrupts */ |
938 | { mk_mii_write(MII_LXT971_IER, 0x0000), NULL }, | 953 | { mk_mii_write(MII_LXT971_IER, 0x0000), NULL }, |
939 | { mk_mii_end, } | 954 | { mk_mii_end, } |
940 | }, | 955 | }; |
956 | static phy_info_t const phy_info_lxt971 = { | ||
957 | .id = 0x0001378e, | ||
958 | .name = "LXT971", | ||
959 | .config = phy_cmd_lxt971_config, | ||
960 | .startup = phy_cmd_lxt971_startup, | ||
961 | .ack_int = phy_cmd_lxt971_ack_int, | ||
962 | .shutdown = phy_cmd_lxt971_shutdown | ||
941 | }; | 963 | }; |
942 | 964 | ||
943 | /* ------------------------------------------------------------------------- */ | 965 | /* ------------------------------------------------------------------------- */ |
@@ -956,22 +978,21 @@ static void mii_parse_qs6612_pcr(uint mii_reg, struct net_device *dev) | |||
956 | { | 978 | { |
957 | struct fec_enet_private *fep = netdev_priv(dev); | 979 | struct fec_enet_private *fep = netdev_priv(dev); |
958 | volatile uint *s = &(fep->phy_status); | 980 | volatile uint *s = &(fep->phy_status); |
981 | uint status; | ||
959 | 982 | ||
960 | *s &= ~(PHY_STAT_SPMASK); | 983 | status = *s & ~(PHY_STAT_SPMASK); |
961 | 984 | ||
962 | switch((mii_reg >> 2) & 7) { | 985 | switch((mii_reg >> 2) & 7) { |
963 | case 1: *s |= PHY_STAT_10HDX; break; | 986 | case 1: status |= PHY_STAT_10HDX; break; |
964 | case 2: *s |= PHY_STAT_100HDX; break; | 987 | case 2: status |= PHY_STAT_100HDX; break; |
965 | case 5: *s |= PHY_STAT_10FDX; break; | 988 | case 5: status |= PHY_STAT_10FDX; break; |
966 | case 6: *s |= PHY_STAT_100FDX; break; | 989 | case 6: status |= PHY_STAT_100FDX; break; |
967 | } | ||
968 | } | 990 | } |
969 | 991 | ||
970 | static phy_info_t phy_info_qs6612 = { | 992 | *s = status; |
971 | 0x00181440, | 993 | } |
972 | "QS6612", | 994 | |
973 | 995 | static phy_cmd_t const phy_cmd_qs6612_config[] = { | |
974 | (const phy_cmd_t []) { /* config */ | ||
975 | /* The PHY powers up isolated on the RPX, | 996 | /* The PHY powers up isolated on the RPX, |
976 | * so send a command to allow operation. | 997 | * so send a command to allow operation. |
977 | */ | 998 | */ |
@@ -981,13 +1002,13 @@ static phy_info_t phy_info_qs6612 = { | |||
981 | { mk_mii_read(MII_REG_CR), mii_parse_cr }, | 1002 | { mk_mii_read(MII_REG_CR), mii_parse_cr }, |
982 | { mk_mii_read(MII_REG_ANAR), mii_parse_anar }, | 1003 | { mk_mii_read(MII_REG_ANAR), mii_parse_anar }, |
983 | { mk_mii_end, } | 1004 | { mk_mii_end, } |
984 | }, | 1005 | }; |
985 | (const phy_cmd_t []) { /* startup - enable interrupts */ | 1006 | static phy_cmd_t const phy_cmd_qs6612_startup[] = { /* enable interrupts */ |
986 | { mk_mii_write(MII_QS6612_IMR, 0x003a), NULL }, | 1007 | { mk_mii_write(MII_QS6612_IMR, 0x003a), NULL }, |
987 | { mk_mii_write(MII_REG_CR, 0x1200), NULL }, /* autonegotiate */ | 1008 | { mk_mii_write(MII_REG_CR, 0x1200), NULL }, /* autonegotiate */ |
988 | { mk_mii_end, } | 1009 | { mk_mii_end, } |
989 | }, | 1010 | }; |
990 | (const phy_cmd_t []) { /* ack_int */ | 1011 | static phy_cmd_t const phy_cmd_qs6612_ack_int[] = { |
991 | /* we need to read ISR, SR and ANER to acknowledge */ | 1012 | /* we need to read ISR, SR and ANER to acknowledge */ |
992 | { mk_mii_read(MII_QS6612_ISR), NULL }, | 1013 | { mk_mii_read(MII_QS6612_ISR), NULL }, |
993 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, | 1014 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, |
@@ -996,11 +1017,18 @@ static phy_info_t phy_info_qs6612 = { | |||
996 | /* read pcr to get info */ | 1017 | /* read pcr to get info */ |
997 | { mk_mii_read(MII_QS6612_PCR), mii_parse_qs6612_pcr }, | 1018 | { mk_mii_read(MII_QS6612_PCR), mii_parse_qs6612_pcr }, |
998 | { mk_mii_end, } | 1019 | { mk_mii_end, } |
999 | }, | 1020 | }; |
1000 | (const phy_cmd_t []) { /* shutdown - disable interrupts */ | 1021 | static phy_cmd_t const phy_cmd_qs6612_shutdown[] = { /* disable interrupts */ |
1001 | { mk_mii_write(MII_QS6612_IMR, 0x0000), NULL }, | 1022 | { mk_mii_write(MII_QS6612_IMR, 0x0000), NULL }, |
1002 | { mk_mii_end, } | 1023 | { mk_mii_end, } |
1003 | }, | 1024 | }; |
1025 | static phy_info_t const phy_info_qs6612 = { | ||
1026 | .id = 0x00181440, | ||
1027 | .name = "QS6612", | ||
1028 | .config = phy_cmd_qs6612_config, | ||
1029 | .startup = phy_cmd_qs6612_startup, | ||
1030 | .ack_int = phy_cmd_qs6612_ack_int, | ||
1031 | .shutdown = phy_cmd_qs6612_shutdown | ||
1004 | }; | 1032 | }; |
1005 | 1033 | ||
1006 | /* ------------------------------------------------------------------------- */ | 1034 | /* ------------------------------------------------------------------------- */ |
@@ -1020,49 +1048,54 @@ static void mii_parse_am79c874_dr(uint mii_reg, struct net_device *dev) | |||
1020 | { | 1048 | { |
1021 | struct fec_enet_private *fep = netdev_priv(dev); | 1049 | struct fec_enet_private *fep = netdev_priv(dev); |
1022 | volatile uint *s = &(fep->phy_status); | 1050 | volatile uint *s = &(fep->phy_status); |
1051 | uint status; | ||
1023 | 1052 | ||
1024 | *s &= ~(PHY_STAT_SPMASK | PHY_STAT_ANC); | 1053 | status = *s & ~(PHY_STAT_SPMASK | PHY_STAT_ANC); |
1025 | 1054 | ||
1026 | if (mii_reg & 0x0080) | 1055 | if (mii_reg & 0x0080) |
1027 | *s |= PHY_STAT_ANC; | 1056 | status |= PHY_STAT_ANC; |
1028 | if (mii_reg & 0x0400) | 1057 | if (mii_reg & 0x0400) |
1029 | *s |= ((mii_reg & 0x0800) ? PHY_STAT_100FDX : PHY_STAT_100HDX); | 1058 | status |= ((mii_reg & 0x0800) ? PHY_STAT_100FDX : PHY_STAT_100HDX); |
1030 | else | 1059 | else |
1031 | *s |= ((mii_reg & 0x0800) ? PHY_STAT_10FDX : PHY_STAT_10HDX); | 1060 | status |= ((mii_reg & 0x0800) ? PHY_STAT_10FDX : PHY_STAT_10HDX); |
1061 | |||
1062 | *s = status; | ||
1032 | } | 1063 | } |
1033 | 1064 | ||
1034 | static phy_info_t phy_info_am79c874 = { | 1065 | static phy_cmd_t const phy_cmd_am79c874_config[] = { |
1035 | 0x00022561, | ||
1036 | "AM79C874", | ||
1037 | |||
1038 | (const phy_cmd_t []) { /* config */ | ||
1039 | /* limit to 10MBit because my protorype board | ||
1040 | * doesn't work with 100. */ | ||
1041 | { mk_mii_read(MII_REG_CR), mii_parse_cr }, | 1066 | { mk_mii_read(MII_REG_CR), mii_parse_cr }, |
1042 | { mk_mii_read(MII_REG_ANAR), mii_parse_anar }, | 1067 | { mk_mii_read(MII_REG_ANAR), mii_parse_anar }, |
1043 | { mk_mii_read(MII_AM79C874_DR), mii_parse_am79c874_dr }, | 1068 | { mk_mii_read(MII_AM79C874_DR), mii_parse_am79c874_dr }, |
1044 | { mk_mii_end, } | 1069 | { mk_mii_end, } |
1045 | }, | 1070 | }; |
1046 | (const phy_cmd_t []) { /* startup - enable interrupts */ | 1071 | static phy_cmd_t const phy_cmd_am79c874_startup[] = { /* enable interrupts */ |
1047 | { mk_mii_write(MII_AM79C874_ICSR, 0xff00), NULL }, | 1072 | { mk_mii_write(MII_AM79C874_ICSR, 0xff00), NULL }, |
1048 | { mk_mii_write(MII_REG_CR, 0x1200), NULL }, /* autonegotiate */ | 1073 | { mk_mii_write(MII_REG_CR, 0x1200), NULL }, /* autonegotiate */ |
1049 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, | 1074 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, |
1050 | { mk_mii_end, } | 1075 | { mk_mii_end, } |
1051 | }, | 1076 | }; |
1052 | (const phy_cmd_t []) { /* ack_int */ | 1077 | static phy_cmd_t const phy_cmd_am79c874_ack_int[] = { |
1053 | /* find out the current status */ | 1078 | /* find out the current status */ |
1054 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, | 1079 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, |
1055 | { mk_mii_read(MII_AM79C874_DR), mii_parse_am79c874_dr }, | 1080 | { mk_mii_read(MII_AM79C874_DR), mii_parse_am79c874_dr }, |
1056 | /* we only need to read ISR to acknowledge */ | 1081 | /* we only need to read ISR to acknowledge */ |
1057 | { mk_mii_read(MII_AM79C874_ICSR), NULL }, | 1082 | { mk_mii_read(MII_AM79C874_ICSR), NULL }, |
1058 | { mk_mii_end, } | 1083 | { mk_mii_end, } |
1059 | }, | 1084 | }; |
1060 | (const phy_cmd_t []) { /* shutdown - disable interrupts */ | 1085 | static phy_cmd_t const phy_cmd_am79c874_shutdown[] = { /* disable interrupts */ |
1061 | { mk_mii_write(MII_AM79C874_ICSR, 0x0000), NULL }, | 1086 | { mk_mii_write(MII_AM79C874_ICSR, 0x0000), NULL }, |
1062 | { mk_mii_end, } | 1087 | { mk_mii_end, } |
1063 | }, | 1088 | }; |
1089 | static phy_info_t const phy_info_am79c874 = { | ||
1090 | .id = 0x00022561, | ||
1091 | .name = "AM79C874", | ||
1092 | .config = phy_cmd_am79c874_config, | ||
1093 | .startup = phy_cmd_am79c874_startup, | ||
1094 | .ack_int = phy_cmd_am79c874_ack_int, | ||
1095 | .shutdown = phy_cmd_am79c874_shutdown | ||
1064 | }; | 1096 | }; |
1065 | 1097 | ||
1098 | |||
1066 | /* ------------------------------------------------------------------------- */ | 1099 | /* ------------------------------------------------------------------------- */ |
1067 | /* Kendin KS8721BL phy */ | 1100 | /* Kendin KS8721BL phy */ |
1068 | 1101 | ||
@@ -1072,37 +1105,40 @@ static phy_info_t phy_info_am79c874 = { | |||
1072 | #define MII_KS8721BL_ICSR 22 | 1105 | #define MII_KS8721BL_ICSR 22 |
1073 | #define MII_KS8721BL_PHYCR 31 | 1106 | #define MII_KS8721BL_PHYCR 31 |
1074 | 1107 | ||
1075 | static phy_info_t phy_info_ks8721bl = { | 1108 | static phy_cmd_t const phy_cmd_ks8721bl_config[] = { |
1076 | 0x00022161, | ||
1077 | "KS8721BL", | ||
1078 | |||
1079 | (const phy_cmd_t []) { /* config */ | ||
1080 | { mk_mii_read(MII_REG_CR), mii_parse_cr }, | 1109 | { mk_mii_read(MII_REG_CR), mii_parse_cr }, |
1081 | { mk_mii_read(MII_REG_ANAR), mii_parse_anar }, | 1110 | { mk_mii_read(MII_REG_ANAR), mii_parse_anar }, |
1082 | { mk_mii_end, } | 1111 | { mk_mii_end, } |
1083 | }, | 1112 | }; |
1084 | (const phy_cmd_t []) { /* startup */ | 1113 | static phy_cmd_t const phy_cmd_ks8721bl_startup[] = { /* enable interrupts */ |
1085 | { mk_mii_write(MII_KS8721BL_ICSR, 0xff00), NULL }, | 1114 | { mk_mii_write(MII_KS8721BL_ICSR, 0xff00), NULL }, |
1086 | { mk_mii_write(MII_REG_CR, 0x1200), NULL }, /* autonegotiate */ | 1115 | { mk_mii_write(MII_REG_CR, 0x1200), NULL }, /* autonegotiate */ |
1087 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, | 1116 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, |
1088 | { mk_mii_end, } | 1117 | { mk_mii_end, } |
1089 | }, | 1118 | }; |
1090 | (const phy_cmd_t []) { /* ack_int */ | 1119 | static phy_cmd_t const phy_cmd_ks8721bl_ack_int[] = { |
1091 | /* find out the current status */ | 1120 | /* find out the current status */ |
1092 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, | 1121 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, |
1093 | /* we only need to read ISR to acknowledge */ | 1122 | /* we only need to read ISR to acknowledge */ |
1094 | { mk_mii_read(MII_KS8721BL_ICSR), NULL }, | 1123 | { mk_mii_read(MII_KS8721BL_ICSR), NULL }, |
1095 | { mk_mii_end, } | 1124 | { mk_mii_end, } |
1096 | }, | 1125 | }; |
1097 | (const phy_cmd_t []) { /* shutdown */ | 1126 | static phy_cmd_t const phy_cmd_ks8721bl_shutdown[] = { /* disable interrupts */ |
1098 | { mk_mii_write(MII_KS8721BL_ICSR, 0x0000), NULL }, | 1127 | { mk_mii_write(MII_KS8721BL_ICSR, 0x0000), NULL }, |
1099 | { mk_mii_end, } | 1128 | { mk_mii_end, } |
1100 | }, | 1129 | }; |
1130 | static phy_info_t const phy_info_ks8721bl = { | ||
1131 | .id = 0x00022161, | ||
1132 | .name = "KS8721BL", | ||
1133 | .config = phy_cmd_ks8721bl_config, | ||
1134 | .startup = phy_cmd_ks8721bl_startup, | ||
1135 | .ack_int = phy_cmd_ks8721bl_ack_int, | ||
1136 | .shutdown = phy_cmd_ks8721bl_shutdown | ||
1101 | }; | 1137 | }; |
1102 | 1138 | ||
1103 | /* ------------------------------------------------------------------------- */ | 1139 | /* ------------------------------------------------------------------------- */ |
1104 | 1140 | ||
1105 | static phy_info_t *phy_info[] = { | 1141 | static phy_info_t const * const phy_info[] = { |
1106 | &phy_info_lxt970, | 1142 | &phy_info_lxt970, |
1107 | &phy_info_lxt971, | 1143 | &phy_info_lxt971, |
1108 | &phy_info_qs6612, | 1144 | &phy_info_qs6612, |
@@ -1129,16 +1165,23 @@ mii_link_interrupt(int irq, void * dev_id, struct pt_regs * regs); | |||
1129 | static void __inline__ fec_request_intrs(struct net_device *dev) | 1165 | static void __inline__ fec_request_intrs(struct net_device *dev) |
1130 | { | 1166 | { |
1131 | volatile unsigned long *icrp; | 1167 | volatile unsigned long *icrp; |
1168 | static const struct idesc { | ||
1169 | char *name; | ||
1170 | unsigned short irq; | ||
1171 | irqreturn_t (*handler)(int, void *, struct pt_regs *); | ||
1172 | } *idp, id[] = { | ||
1173 | { "fec(RX)", 86, fec_enet_interrupt }, | ||
1174 | { "fec(TX)", 87, fec_enet_interrupt }, | ||
1175 | { "fec(OTHER)", 88, fec_enet_interrupt }, | ||
1176 | { "fec(MII)", 66, mii_link_interrupt }, | ||
1177 | { NULL }, | ||
1178 | }; | ||
1132 | 1179 | ||
1133 | /* Setup interrupt handlers. */ | 1180 | /* Setup interrupt handlers. */ |
1134 | if (request_irq(86, fec_enet_interrupt, 0, "fec(RX)", dev) != 0) | 1181 | for (idp = id; idp->name; idp++) { |
1135 | printk("FEC: Could not allocate FEC(RC) IRQ(86)!\n"); | 1182 | if (request_irq(idp->irq, idp->handler, 0, idp->name, dev) != 0) |
1136 | if (request_irq(87, fec_enet_interrupt, 0, "fec(TX)", dev) != 0) | 1183 | printk("FEC: Could not allocate %s IRQ(%d)!\n", idp->name, idp->irq); |
1137 | printk("FEC: Could not allocate FEC(RC) IRQ(87)!\n"); | 1184 | } |
1138 | if (request_irq(88, fec_enet_interrupt, 0, "fec(OTHER)", dev) != 0) | ||
1139 | printk("FEC: Could not allocate FEC(OTHER) IRQ(88)!\n"); | ||
1140 | if (request_irq(66, mii_link_interrupt, 0, "fec(MII)", dev) != 0) | ||
1141 | printk("FEC: Could not allocate MII IRQ(66)!\n"); | ||
1142 | 1185 | ||
1143 | /* Unmask interrupt at ColdFire 5272 SIM */ | 1186 | /* Unmask interrupt at ColdFire 5272 SIM */ |
1144 | icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR3); | 1187 | icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR3); |
@@ -1169,17 +1212,16 @@ static void __inline__ fec_get_mac(struct net_device *dev) | |||
1169 | { | 1212 | { |
1170 | struct fec_enet_private *fep = netdev_priv(dev); | 1213 | struct fec_enet_private *fep = netdev_priv(dev); |
1171 | volatile fec_t *fecp; | 1214 | volatile fec_t *fecp; |
1172 | unsigned char *iap, tmpaddr[6]; | 1215 | unsigned char *iap, tmpaddr[ETH_ALEN]; |
1173 | int i; | ||
1174 | 1216 | ||
1175 | fecp = fep->hwp; | 1217 | fecp = fep->hwp; |
1176 | 1218 | ||
1177 | if (fec_flashmac) { | 1219 | if (FEC_FLASHMAC) { |
1178 | /* | 1220 | /* |
1179 | * Get MAC address from FLASH. | 1221 | * Get MAC address from FLASH. |
1180 | * If it is all 1's or 0's, use the default. | 1222 | * If it is all 1's or 0's, use the default. |
1181 | */ | 1223 | */ |
1182 | iap = fec_flashmac; | 1224 | iap = (unsigned char *)FEC_FLASHMAC; |
1183 | if ((iap[0] == 0) && (iap[1] == 0) && (iap[2] == 0) && | 1225 | if ((iap[0] == 0) && (iap[1] == 0) && (iap[2] == 0) && |
1184 | (iap[3] == 0) && (iap[4] == 0) && (iap[5] == 0)) | 1226 | (iap[3] == 0) && (iap[4] == 0) && (iap[5] == 0)) |
1185 | iap = fec_mac_default; | 1227 | iap = fec_mac_default; |
@@ -1192,14 +1234,11 @@ static void __inline__ fec_get_mac(struct net_device *dev) | |||
1192 | iap = &tmpaddr[0]; | 1234 | iap = &tmpaddr[0]; |
1193 | } | 1235 | } |
1194 | 1236 | ||
1195 | for (i=0; i<ETH_ALEN; i++) | 1237 | memcpy(dev->dev_addr, iap, ETH_ALEN); |
1196 | dev->dev_addr[i] = fep->mac_addr[i] = *iap++; | ||
1197 | 1238 | ||
1198 | /* Adjust MAC if using default MAC address */ | 1239 | /* Adjust MAC if using default MAC address */ |
1199 | if (iap == fec_mac_default) { | 1240 | if (iap == fec_mac_default) |
1200 | dev->dev_addr[ETH_ALEN-1] = fep->mac_addr[ETH_ALEN-1] = | 1241 | dev->dev_addr[ETH_ALEN-1] = fec_mac_default[ETH_ALEN-1] + fep->index; |
1201 | iap[ETH_ALEN-1] + fep->index; | ||
1202 | } | ||
1203 | } | 1242 | } |
1204 | 1243 | ||
1205 | static void __inline__ fec_enable_phy_intr(void) | 1244 | static void __inline__ fec_enable_phy_intr(void) |
@@ -1234,48 +1273,44 @@ static void __inline__ fec_uncache(unsigned long addr) | |||
1234 | 1273 | ||
1235 | /* ------------------------------------------------------------------------- */ | 1274 | /* ------------------------------------------------------------------------- */ |
1236 | 1275 | ||
1237 | #elif defined(CONFIG_M527x) || defined(CONFIG_M528x) | 1276 | #elif defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) |
1238 | 1277 | ||
1239 | /* | 1278 | /* |
1240 | * Code specific to Coldfire 5270/5271/5274/5275 and 5280/5282 setups. | 1279 | * Code specific to Coldfire 5230/5231/5232/5234/5235, |
1280 | * the 5270/5271/5274/5275 and 5280/5282 setups. | ||
1241 | */ | 1281 | */ |
1242 | static void __inline__ fec_request_intrs(struct net_device *dev) | 1282 | static void __inline__ fec_request_intrs(struct net_device *dev) |
1243 | { | 1283 | { |
1244 | struct fec_enet_private *fep; | 1284 | struct fec_enet_private *fep; |
1245 | int b; | 1285 | int b; |
1286 | static const struct idesc { | ||
1287 | char *name; | ||
1288 | unsigned short irq; | ||
1289 | } *idp, id[] = { | ||
1290 | { "fec(TXF)", 23 }, | ||
1291 | { "fec(TXB)", 24 }, | ||
1292 | { "fec(TXFIFO)", 25 }, | ||
1293 | { "fec(TXCR)", 26 }, | ||
1294 | { "fec(RXF)", 27 }, | ||
1295 | { "fec(RXB)", 28 }, | ||
1296 | { "fec(MII)", 29 }, | ||
1297 | { "fec(LC)", 30 }, | ||
1298 | { "fec(HBERR)", 31 }, | ||
1299 | { "fec(GRA)", 32 }, | ||
1300 | { "fec(EBERR)", 33 }, | ||
1301 | { "fec(BABT)", 34 }, | ||
1302 | { "fec(BABR)", 35 }, | ||
1303 | { NULL }, | ||
1304 | }; | ||
1246 | 1305 | ||
1247 | fep = netdev_priv(dev); | 1306 | fep = netdev_priv(dev); |
1248 | b = (fep->index) ? 128 : 64; | 1307 | b = (fep->index) ? 128 : 64; |
1249 | 1308 | ||
1250 | /* Setup interrupt handlers. */ | 1309 | /* Setup interrupt handlers. */ |
1251 | if (request_irq(b+23, fec_enet_interrupt, 0, "fec(TXF)", dev) != 0) | 1310 | for (idp = id; idp->name; idp++) { |
1252 | printk("FEC: Could not allocate FEC(TXF) IRQ(%d+23)!\n", b); | 1311 | if (request_irq(b+idp->irq, fec_enet_interrupt, 0, idp->name, dev) != 0) |
1253 | if (request_irq(b+24, fec_enet_interrupt, 0, "fec(TXB)", dev) != 0) | 1312 | printk("FEC: Could not allocate %s IRQ(%d)!\n", idp->name, b+idp->irq); |
1254 | printk("FEC: Could not allocate FEC(TXB) IRQ(%d+24)!\n", b); | 1313 | } |
1255 | if (request_irq(b+25, fec_enet_interrupt, 0, "fec(TXFIFO)", dev) != 0) | ||
1256 | printk("FEC: Could not allocate FEC(TXFIFO) IRQ(%d+25)!\n", b); | ||
1257 | if (request_irq(b+26, fec_enet_interrupt, 0, "fec(TXCR)", dev) != 0) | ||
1258 | printk("FEC: Could not allocate FEC(TXCR) IRQ(%d+26)!\n", b); | ||
1259 | |||
1260 | if (request_irq(b+27, fec_enet_interrupt, 0, "fec(RXF)", dev) != 0) | ||
1261 | printk("FEC: Could not allocate FEC(RXF) IRQ(%d+27)!\n", b); | ||
1262 | if (request_irq(b+28, fec_enet_interrupt, 0, "fec(RXB)", dev) != 0) | ||
1263 | printk("FEC: Could not allocate FEC(RXB) IRQ(%d+28)!\n", b); | ||
1264 | |||
1265 | if (request_irq(b+29, fec_enet_interrupt, 0, "fec(MII)", dev) != 0) | ||
1266 | printk("FEC: Could not allocate FEC(MII) IRQ(%d+29)!\n", b); | ||
1267 | if (request_irq(b+30, fec_enet_interrupt, 0, "fec(LC)", dev) != 0) | ||
1268 | printk("FEC: Could not allocate FEC(LC) IRQ(%d+30)!\n", b); | ||
1269 | if (request_irq(b+31, fec_enet_interrupt, 0, "fec(HBERR)", dev) != 0) | ||
1270 | printk("FEC: Could not allocate FEC(HBERR) IRQ(%d+31)!\n", b); | ||
1271 | if (request_irq(b+32, fec_enet_interrupt, 0, "fec(GRA)", dev) != 0) | ||
1272 | printk("FEC: Could not allocate FEC(GRA) IRQ(%d+32)!\n", b); | ||
1273 | if (request_irq(b+33, fec_enet_interrupt, 0, "fec(EBERR)", dev) != 0) | ||
1274 | printk("FEC: Could not allocate FEC(EBERR) IRQ(%d+33)!\n", b); | ||
1275 | if (request_irq(b+34, fec_enet_interrupt, 0, "fec(BABT)", dev) != 0) | ||
1276 | printk("FEC: Could not allocate FEC(BABT) IRQ(%d+34)!\n", b); | ||
1277 | if (request_irq(b+35, fec_enet_interrupt, 0, "fec(BABR)", dev) != 0) | ||
1278 | printk("FEC: Could not allocate FEC(BABR) IRQ(%d+35)!\n", b); | ||
1279 | 1314 | ||
1280 | /* Unmask interrupts at ColdFire 5280/5282 interrupt controller */ | 1315 | /* Unmask interrupts at ColdFire 5280/5282 interrupt controller */ |
1281 | { | 1316 | { |
@@ -1300,11 +1335,13 @@ static void __inline__ fec_request_intrs(struct net_device *dev) | |||
1300 | #if defined(CONFIG_M528x) | 1335 | #if defined(CONFIG_M528x) |
1301 | /* Set up gpio outputs for MII lines */ | 1336 | /* Set up gpio outputs for MII lines */ |
1302 | { | 1337 | { |
1303 | volatile unsigned short *gpio_paspar; | 1338 | volatile u16 *gpio_paspar; |
1339 | volatile u8 *gpio_pehlpar; | ||
1304 | 1340 | ||
1305 | gpio_paspar = (volatile unsigned short *) (MCF_IPSBAR + | 1341 | gpio_paspar = (volatile u16 *) (MCF_IPSBAR + 0x100056); |
1306 | 0x100056); | 1342 | gpio_pehlpar = (volatile u16 *) (MCF_IPSBAR + 0x100058); |
1307 | *gpio_paspar = 0x0f00; | 1343 | *gpio_paspar |= 0x0f00; |
1344 | *gpio_pehlpar = 0xc0; | ||
1308 | } | 1345 | } |
1309 | #endif | 1346 | #endif |
1310 | } | 1347 | } |
@@ -1331,17 +1368,16 @@ static void __inline__ fec_get_mac(struct net_device *dev) | |||
1331 | { | 1368 | { |
1332 | struct fec_enet_private *fep = netdev_priv(dev); | 1369 | struct fec_enet_private *fep = netdev_priv(dev); |
1333 | volatile fec_t *fecp; | 1370 | volatile fec_t *fecp; |
1334 | unsigned char *iap, tmpaddr[6]; | 1371 | unsigned char *iap, tmpaddr[ETH_ALEN]; |
1335 | int i; | ||
1336 | 1372 | ||
1337 | fecp = fep->hwp; | 1373 | fecp = fep->hwp; |
1338 | 1374 | ||
1339 | if (fec_flashmac) { | 1375 | if (FEC_FLASHMAC) { |
1340 | /* | 1376 | /* |
1341 | * Get MAC address from FLASH. | 1377 | * Get MAC address from FLASH. |
1342 | * If it is all 1's or 0's, use the default. | 1378 | * If it is all 1's or 0's, use the default. |
1343 | */ | 1379 | */ |
1344 | iap = fec_flashmac; | 1380 | iap = FEC_FLASHMAC; |
1345 | if ((iap[0] == 0) && (iap[1] == 0) && (iap[2] == 0) && | 1381 | if ((iap[0] == 0) && (iap[1] == 0) && (iap[2] == 0) && |
1346 | (iap[3] == 0) && (iap[4] == 0) && (iap[5] == 0)) | 1382 | (iap[3] == 0) && (iap[4] == 0) && (iap[5] == 0)) |
1347 | iap = fec_mac_default; | 1383 | iap = fec_mac_default; |
@@ -1354,14 +1390,11 @@ static void __inline__ fec_get_mac(struct net_device *dev) | |||
1354 | iap = &tmpaddr[0]; | 1390 | iap = &tmpaddr[0]; |
1355 | } | 1391 | } |
1356 | 1392 | ||
1357 | for (i=0; i<ETH_ALEN; i++) | 1393 | memcpy(dev->dev_addr, iap, ETH_ALEN); |
1358 | dev->dev_addr[i] = fep->mac_addr[i] = *iap++; | ||
1359 | 1394 | ||
1360 | /* Adjust MAC if using default MAC address */ | 1395 | /* Adjust MAC if using default MAC address */ |
1361 | if (iap == fec_mac_default) { | 1396 | if (iap == fec_mac_default) |
1362 | dev->dev_addr[ETH_ALEN-1] = fep->mac_addr[ETH_ALEN-1] = | 1397 | dev->dev_addr[ETH_ALEN-1] = fec_mac_default[ETH_ALEN-1] + fep->index; |
1363 | iap[ETH_ALEN-1] + fep->index; | ||
1364 | } | ||
1365 | } | 1398 | } |
1366 | 1399 | ||
1367 | static void __inline__ fec_enable_phy_intr(void) | 1400 | static void __inline__ fec_enable_phy_intr(void) |
@@ -1392,7 +1425,7 @@ static void __inline__ fec_uncache(unsigned long addr) | |||
1392 | #else | 1425 | #else |
1393 | 1426 | ||
1394 | /* | 1427 | /* |
1395 | * Code sepcific to the MPC860T setup. | 1428 | * Code specific to the MPC860T setup. |
1396 | */ | 1429 | */ |
1397 | static void __inline__ fec_request_intrs(struct net_device *dev) | 1430 | static void __inline__ fec_request_intrs(struct net_device *dev) |
1398 | { | 1431 | { |
@@ -1424,13 +1457,10 @@ static void __inline__ fec_request_intrs(struct net_device *dev) | |||
1424 | 1457 | ||
1425 | static void __inline__ fec_get_mac(struct net_device *dev) | 1458 | static void __inline__ fec_get_mac(struct net_device *dev) |
1426 | { | 1459 | { |
1427 | struct fec_enet_private *fep = netdev_priv(dev); | ||
1428 | unsigned char *iap, tmpaddr[6]; | ||
1429 | bd_t *bd; | 1460 | bd_t *bd; |
1430 | int i; | ||
1431 | 1461 | ||
1432 | iap = bd->bi_enetaddr; | ||
1433 | bd = (bd_t *)__res; | 1462 | bd = (bd_t *)__res; |
1463 | memcpy(dev->dev_addr, bd->bi_enetaddr, ETH_ALEN); | ||
1434 | 1464 | ||
1435 | #ifdef CONFIG_RPXCLASSIC | 1465 | #ifdef CONFIG_RPXCLASSIC |
1436 | /* The Embedded Planet boards have only one MAC address in | 1466 | /* The Embedded Planet boards have only one MAC address in |
@@ -1439,14 +1469,8 @@ static void __inline__ fec_get_mac(struct net_device *dev) | |||
1439 | * the address bits above something that would have (up to | 1469 | * the address bits above something that would have (up to |
1440 | * now) been allocated. | 1470 | * now) been allocated. |
1441 | */ | 1471 | */ |
1442 | for (i=0; i<6; i++) | 1472 | dev->dev_adrd[3] |= 0x80; |
1443 | tmpaddr[i] = *iap++; | ||
1444 | tmpaddr[3] |= 0x80; | ||
1445 | iap = tmpaddr; | ||
1446 | #endif | 1473 | #endif |
1447 | |||
1448 | for (i=0; i<6; i++) | ||
1449 | dev->dev_addr[i] = fep->mac_addr[i] = *iap++; | ||
1450 | } | 1474 | } |
1451 | 1475 | ||
1452 | static void __inline__ fec_set_mii(struct net_device *dev, struct fec_enet_private *fep) | 1476 | static void __inline__ fec_set_mii(struct net_device *dev, struct fec_enet_private *fep) |
@@ -1556,7 +1580,7 @@ static void mii_display_status(struct net_device *dev) | |||
1556 | static void mii_display_config(struct net_device *dev) | 1580 | static void mii_display_config(struct net_device *dev) |
1557 | { | 1581 | { |
1558 | struct fec_enet_private *fep = netdev_priv(dev); | 1582 | struct fec_enet_private *fep = netdev_priv(dev); |
1559 | volatile uint *s = &(fep->phy_status); | 1583 | uint status = fep->phy_status; |
1560 | 1584 | ||
1561 | /* | 1585 | /* |
1562 | ** When we get here, phy_task is already removed from | 1586 | ** When we get here, phy_task is already removed from |
@@ -1565,23 +1589,23 @@ static void mii_display_config(struct net_device *dev) | |||
1565 | fep->mii_phy_task_queued = 0; | 1589 | fep->mii_phy_task_queued = 0; |
1566 | printk("%s: config: auto-negotiation ", dev->name); | 1590 | printk("%s: config: auto-negotiation ", dev->name); |
1567 | 1591 | ||
1568 | if (*s & PHY_CONF_ANE) | 1592 | if (status & PHY_CONF_ANE) |
1569 | printk("on"); | 1593 | printk("on"); |
1570 | else | 1594 | else |
1571 | printk("off"); | 1595 | printk("off"); |
1572 | 1596 | ||
1573 | if (*s & PHY_CONF_100FDX) | 1597 | if (status & PHY_CONF_100FDX) |
1574 | printk(", 100FDX"); | 1598 | printk(", 100FDX"); |
1575 | if (*s & PHY_CONF_100HDX) | 1599 | if (status & PHY_CONF_100HDX) |
1576 | printk(", 100HDX"); | 1600 | printk(", 100HDX"); |
1577 | if (*s & PHY_CONF_10FDX) | 1601 | if (status & PHY_CONF_10FDX) |
1578 | printk(", 10FDX"); | 1602 | printk(", 10FDX"); |
1579 | if (*s & PHY_CONF_10HDX) | 1603 | if (status & PHY_CONF_10HDX) |
1580 | printk(", 10HDX"); | 1604 | printk(", 10HDX"); |
1581 | if (!(*s & PHY_CONF_SPMASK)) | 1605 | if (!(status & PHY_CONF_SPMASK)) |
1582 | printk(", No speed/duplex selected?"); | 1606 | printk(", No speed/duplex selected?"); |
1583 | 1607 | ||
1584 | if (*s & PHY_CONF_LOOP) | 1608 | if (status & PHY_CONF_LOOP) |
1585 | printk(", loopback enabled"); | 1609 | printk(", loopback enabled"); |
1586 | 1610 | ||
1587 | printk(".\n"); | 1611 | printk(".\n"); |
@@ -1639,7 +1663,7 @@ static void mii_queue_relink(uint mii_reg, struct net_device *dev) | |||
1639 | schedule_work(&fep->phy_task); | 1663 | schedule_work(&fep->phy_task); |
1640 | } | 1664 | } |
1641 | 1665 | ||
1642 | /* mii_queue_config is called in user context from fec_enet_open */ | 1666 | /* mii_queue_config is called in interrupt context from fec_enet_mii */ |
1643 | static void mii_queue_config(uint mii_reg, struct net_device *dev) | 1667 | static void mii_queue_config(uint mii_reg, struct net_device *dev) |
1644 | { | 1668 | { |
1645 | struct fec_enet_private *fep = netdev_priv(dev); | 1669 | struct fec_enet_private *fep = netdev_priv(dev); |
@@ -1652,14 +1676,14 @@ static void mii_queue_config(uint mii_reg, struct net_device *dev) | |||
1652 | schedule_work(&fep->phy_task); | 1676 | schedule_work(&fep->phy_task); |
1653 | } | 1677 | } |
1654 | 1678 | ||
1655 | 1679 | phy_cmd_t const phy_cmd_relink[] = { | |
1656 | 1680 | { mk_mii_read(MII_REG_CR), mii_queue_relink }, | |
1657 | phy_cmd_t phy_cmd_relink[] = { { mk_mii_read(MII_REG_CR), mii_queue_relink }, | 1681 | { mk_mii_end, } |
1658 | { mk_mii_end, } }; | 1682 | }; |
1659 | phy_cmd_t phy_cmd_config[] = { { mk_mii_read(MII_REG_CR), mii_queue_config }, | 1683 | phy_cmd_t const phy_cmd_config[] = { |
1660 | { mk_mii_end, } }; | 1684 | { mk_mii_read(MII_REG_CR), mii_queue_config }, |
1661 | 1685 | { mk_mii_end, } | |
1662 | 1686 | }; | |
1663 | 1687 | ||
1664 | /* Read remainder of PHY ID. | 1688 | /* Read remainder of PHY ID. |
1665 | */ | 1689 | */ |
@@ -1897,17 +1921,15 @@ static void set_multicast_list(struct net_device *dev) | |||
1897 | static void | 1921 | static void |
1898 | fec_set_mac_address(struct net_device *dev) | 1922 | fec_set_mac_address(struct net_device *dev) |
1899 | { | 1923 | { |
1900 | struct fec_enet_private *fep; | ||
1901 | volatile fec_t *fecp; | 1924 | volatile fec_t *fecp; |
1902 | 1925 | ||
1903 | fep = netdev_priv(dev); | 1926 | fecp = ((struct fec_enet_private *)netdev_priv(dev))->hwp; |
1904 | fecp = fep->hwp; | ||
1905 | 1927 | ||
1906 | /* Set station address. */ | 1928 | /* Set station address. */ |
1907 | fecp->fec_addr_low = fep->mac_addr[3] | (fep->mac_addr[2] << 8) | | 1929 | fecp->fec_addr_low = dev->dev_addr[3] | (dev->dev_addr[2] << 8) | |
1908 | (fep->mac_addr[1] << 16) | (fep->mac_addr[0] << 24); | 1930 | (dev->dev_addr[1] << 16) | (dev->dev_addr[0] << 24); |
1909 | fecp->fec_addr_high = (fep->mac_addr[5] << 16) | | 1931 | fecp->fec_addr_high = (dev->dev_addr[5] << 16) | |
1910 | (fep->mac_addr[4] << 24); | 1932 | (dev->dev_addr[4] << 24); |
1911 | 1933 | ||
1912 | } | 1934 | } |
1913 | 1935 | ||
@@ -1943,7 +1965,7 @@ int __init fec_enet_init(struct net_device *dev) | |||
1943 | udelay(10); | 1965 | udelay(10); |
1944 | 1966 | ||
1945 | /* Clear and enable interrupts */ | 1967 | /* Clear and enable interrupts */ |
1946 | fecp->fec_ievent = 0xffc0; | 1968 | fecp->fec_ievent = 0xffc00000; |
1947 | fecp->fec_imask = (FEC_ENET_TXF | FEC_ENET_TXB | | 1969 | fecp->fec_imask = (FEC_ENET_TXF | FEC_ENET_TXB | |
1948 | FEC_ENET_RXF | FEC_ENET_RXB | FEC_ENET_MII); | 1970 | FEC_ENET_RXF | FEC_ENET_RXB | FEC_ENET_MII); |
1949 | fecp->fec_hash_table_high = 0; | 1971 | fecp->fec_hash_table_high = 0; |
@@ -2063,11 +2085,6 @@ int __init fec_enet_init(struct net_device *dev) | |||
2063 | /* setup MII interface */ | 2085 | /* setup MII interface */ |
2064 | fec_set_mii(dev, fep); | 2086 | fec_set_mii(dev, fep); |
2065 | 2087 | ||
2066 | printk("%s: FEC ENET Version 0.2, ", dev->name); | ||
2067 | for (i=0; i<5; i++) | ||
2068 | printk("%02x:", dev->dev_addr[i]); | ||
2069 | printk("%02x\n", dev->dev_addr[5]); | ||
2070 | |||
2071 | /* Queue up command to detect the PHY and initialize the | 2088 | /* Queue up command to detect the PHY and initialize the |
2072 | * remainder of the interface. | 2089 | * remainder of the interface. |
2073 | */ | 2090 | */ |
@@ -2106,18 +2123,12 @@ fec_restart(struct net_device *dev, int duplex) | |||
2106 | 2123 | ||
2107 | /* Clear any outstanding interrupt. | 2124 | /* Clear any outstanding interrupt. |
2108 | */ | 2125 | */ |
2109 | fecp->fec_ievent = 0xffc0; | 2126 | fecp->fec_ievent = 0xffc00000; |
2110 | fec_enable_phy_intr(); | 2127 | fec_enable_phy_intr(); |
2111 | 2128 | ||
2112 | /* Set station address. | 2129 | /* Set station address. |
2113 | */ | 2130 | */ |
2114 | fecp->fec_addr_low = fep->mac_addr[3] | (fep->mac_addr[2] << 8) | | 2131 | fec_set_mac_address(dev); |
2115 | (fep->mac_addr[1] << 16) | (fep->mac_addr[0] << 24); | ||
2116 | fecp->fec_addr_high = (fep->mac_addr[5] << 16) | | ||
2117 | (fep->mac_addr[4] << 24); | ||
2118 | |||
2119 | for (i=0; i<ETH_ALEN; i++) | ||
2120 | dev->dev_addr[i] = fep->mac_addr[i]; | ||
2121 | 2132 | ||
2122 | /* Reset all multicast. | 2133 | /* Reset all multicast. |
2123 | */ | 2134 | */ |
@@ -2215,7 +2226,7 @@ fec_stop(struct net_device *dev) | |||
2215 | 2226 | ||
2216 | fecp->fec_x_cntrl = 0x01; /* Graceful transmit stop */ | 2227 | fecp->fec_x_cntrl = 0x01; /* Graceful transmit stop */ |
2217 | 2228 | ||
2218 | while(!(fecp->fec_ievent & 0x10000000)); | 2229 | while(!(fecp->fec_ievent & FEC_ENET_GRA)); |
2219 | 2230 | ||
2220 | /* Whack a reset. We should wait for this. | 2231 | /* Whack a reset. We should wait for this. |
2221 | */ | 2232 | */ |
@@ -2234,7 +2245,9 @@ fec_stop(struct net_device *dev) | |||
2234 | static int __init fec_enet_module_init(void) | 2245 | static int __init fec_enet_module_init(void) |
2235 | { | 2246 | { |
2236 | struct net_device *dev; | 2247 | struct net_device *dev; |
2237 | int i, err; | 2248 | int i, j, err; |
2249 | |||
2250 | printk("FEC ENET Version 0.2\n"); | ||
2238 | 2251 | ||
2239 | for (i = 0; (i < FEC_MAX_PORTS); i++) { | 2252 | for (i = 0; (i < FEC_MAX_PORTS); i++) { |
2240 | dev = alloc_etherdev(sizeof(struct fec_enet_private)); | 2253 | dev = alloc_etherdev(sizeof(struct fec_enet_private)); |
@@ -2250,6 +2263,11 @@ static int __init fec_enet_module_init(void) | |||
2250 | free_netdev(dev); | 2263 | free_netdev(dev); |
2251 | return -EIO; | 2264 | return -EIO; |
2252 | } | 2265 | } |
2266 | |||
2267 | printk("%s: ethernet ", dev->name); | ||
2268 | for (j = 0; (j < 5); j++) | ||
2269 | printk("%02x:", dev->dev_addr[j]); | ||
2270 | printk("%02x\n", dev->dev_addr[5]); | ||
2253 | } | 2271 | } |
2254 | return 0; | 2272 | return 0; |
2255 | } | 2273 | } |
diff --git a/drivers/net/fec.h b/drivers/net/fec.h index c6e4f979ff5d..045761b8a600 100644 --- a/drivers/net/fec.h +++ b/drivers/net/fec.h | |||
@@ -1,8 +1,9 @@ | |||
1 | /****************************************************************************/ | 1 | /****************************************************************************/ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * fec.h -- Fast Ethernet Controller for Motorola ColdFire 5270, | 4 | * fec.h -- Fast Ethernet Controller for Motorola ColdFire 5230, |
5 | 5271, 5272, 5274, 5275, 5280 and 5282. | 5 | * 5231, 5232, 5234, 5235, 5270, 5271, 5272, 5274, 5275, |
6 | * 5280 and 5282. | ||
6 | * | 7 | * |
7 | * (C) Copyright 2000-2003, Greg Ungerer (gerg@snapgear.com) | 8 | * (C) Copyright 2000-2003, Greg Ungerer (gerg@snapgear.com) |
8 | * (C) Copyright 2000-2001, Lineo (www.lineo.com) | 9 | * (C) Copyright 2000-2001, Lineo (www.lineo.com) |
@@ -13,7 +14,7 @@ | |||
13 | #define FEC_H | 14 | #define FEC_H |
14 | /****************************************************************************/ | 15 | /****************************************************************************/ |
15 | 16 | ||
16 | #if defined(CONFIG_M527x) || defined(CONFIG_M528x) | 17 | #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) |
17 | /* | 18 | /* |
18 | * Just figures, Motorola would have to change the offsets for | 19 | * Just figures, Motorola would have to change the offsets for |
19 | * registers in the same peripheral device on different models | 20 | * registers in the same peripheral device on different models |
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c index 0b230222bfea..90999867a32c 100644 --- a/drivers/net/hamradio/6pack.c +++ b/drivers/net/hamradio/6pack.c | |||
@@ -293,7 +293,7 @@ static int sp_header(struct sk_buff *skb, struct net_device *dev, | |||
293 | { | 293 | { |
294 | #ifdef CONFIG_INET | 294 | #ifdef CONFIG_INET |
295 | if (type != htons(ETH_P_AX25)) | 295 | if (type != htons(ETH_P_AX25)) |
296 | return ax25_encapsulate(skb, dev, type, daddr, saddr, len); | 296 | return ax25_hard_header(skb, dev, type, daddr, saddr, len); |
297 | #endif | 297 | #endif |
298 | return 0; | 298 | return 0; |
299 | } | 299 | } |
diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c index 5298096afbdb..e4188d082f01 100644 --- a/drivers/net/hamradio/baycom_epp.c +++ b/drivers/net/hamradio/baycom_epp.c | |||
@@ -40,7 +40,7 @@ | |||
40 | 40 | ||
41 | /*****************************************************************************/ | 41 | /*****************************************************************************/ |
42 | 42 | ||
43 | #include <linux/config.h> | 43 | #include <linux/crc-ccitt.h> |
44 | #include <linux/module.h> | 44 | #include <linux/module.h> |
45 | #include <linux/kernel.h> | 45 | #include <linux/kernel.h> |
46 | #include <linux/init.h> | 46 | #include <linux/init.h> |
@@ -48,18 +48,12 @@ | |||
48 | #include <linux/workqueue.h> | 48 | #include <linux/workqueue.h> |
49 | #include <linux/fs.h> | 49 | #include <linux/fs.h> |
50 | #include <linux/parport.h> | 50 | #include <linux/parport.h> |
51 | #include <linux/smp_lock.h> | ||
52 | #include <asm/uaccess.h> | ||
53 | #include <linux/if_arp.h> | 51 | #include <linux/if_arp.h> |
54 | #include <linux/kmod.h> | ||
55 | #include <linux/hdlcdrv.h> | 52 | #include <linux/hdlcdrv.h> |
56 | #include <linux/baycom.h> | 53 | #include <linux/baycom.h> |
57 | #include <linux/jiffies.h> | 54 | #include <linux/jiffies.h> |
58 | #if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) | ||
59 | /* prototypes for ax25_encapsulate and ax25_rebuild_header */ | ||
60 | #include <net/ax25.h> | 55 | #include <net/ax25.h> |
61 | #endif /* CONFIG_AX25 || CONFIG_AX25_MODULE */ | 56 | #include <asm/uaccess.h> |
62 | #include <linux/crc-ccitt.h> | ||
63 | 57 | ||
64 | /* --------------------------------------------------------------------- */ | 58 | /* --------------------------------------------------------------------- */ |
65 | 59 | ||
@@ -1177,13 +1171,8 @@ static void baycom_probe(struct net_device *dev) | |||
1177 | /* Fill in the fields of the device structure */ | 1171 | /* Fill in the fields of the device structure */ |
1178 | bc->skb = NULL; | 1172 | bc->skb = NULL; |
1179 | 1173 | ||
1180 | #if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) | 1174 | dev->hard_header = ax25_hard_header; |
1181 | dev->hard_header = ax25_encapsulate; | ||
1182 | dev->rebuild_header = ax25_rebuild_header; | 1175 | dev->rebuild_header = ax25_rebuild_header; |
1183 | #else /* CONFIG_AX25 || CONFIG_AX25_MODULE */ | ||
1184 | dev->hard_header = NULL; | ||
1185 | dev->rebuild_header = NULL; | ||
1186 | #endif /* CONFIG_AX25 || CONFIG_AX25_MODULE */ | ||
1187 | dev->set_mac_address = baycom_set_mac_address; | 1176 | dev->set_mac_address = baycom_set_mac_address; |
1188 | 1177 | ||
1189 | dev->type = ARPHRD_AX25; /* AF_AX25 device */ | 1178 | dev->type = ARPHRD_AX25; /* AF_AX25 device */ |
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c index 2946e037a9b1..1756f0ed54cc 100644 --- a/drivers/net/hamradio/bpqether.c +++ b/drivers/net/hamradio/bpqether.c | |||
@@ -488,7 +488,7 @@ static void bpq_setup(struct net_device *dev) | |||
488 | dev->flags = 0; | 488 | dev->flags = 0; |
489 | 489 | ||
490 | #if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) | 490 | #if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) |
491 | dev->hard_header = ax25_encapsulate; | 491 | dev->hard_header = ax25_hard_header; |
492 | dev->rebuild_header = ax25_rebuild_header; | 492 | dev->rebuild_header = ax25_rebuild_header; |
493 | #endif | 493 | #endif |
494 | 494 | ||
diff --git a/drivers/net/hamradio/dmascc.c b/drivers/net/hamradio/dmascc.c index f515245a3fd0..3be3f916643a 100644 --- a/drivers/net/hamradio/dmascc.c +++ b/drivers/net/hamradio/dmascc.c | |||
@@ -449,12 +449,12 @@ module_exit(dmascc_exit); | |||
449 | static void dev_setup(struct net_device *dev) | 449 | static void dev_setup(struct net_device *dev) |
450 | { | 450 | { |
451 | dev->type = ARPHRD_AX25; | 451 | dev->type = ARPHRD_AX25; |
452 | dev->hard_header_len = 73; | 452 | dev->hard_header_len = AX25_MAX_HEADER_LEN; |
453 | dev->mtu = 1500; | 453 | dev->mtu = 1500; |
454 | dev->addr_len = 7; | 454 | dev->addr_len = AX25_ADDR_LEN; |
455 | dev->tx_queue_len = 64; | 455 | dev->tx_queue_len = 64; |
456 | memcpy(dev->broadcast, ax25_broadcast, 7); | 456 | memcpy(dev->broadcast, ax25_broadcast, AX25_ADDR_LEN); |
457 | memcpy(dev->dev_addr, ax25_test, 7); | 457 | memcpy(dev->dev_addr, ax25_test, AX25_ADDR_LEN); |
458 | } | 458 | } |
459 | 459 | ||
460 | static int __init setup_adapter(int card_base, int type, int n) | 460 | static int __init setup_adapter(int card_base, int type, int n) |
@@ -600,7 +600,7 @@ static int __init setup_adapter(int card_base, int type, int n) | |||
600 | dev->do_ioctl = scc_ioctl; | 600 | dev->do_ioctl = scc_ioctl; |
601 | dev->hard_start_xmit = scc_send_packet; | 601 | dev->hard_start_xmit = scc_send_packet; |
602 | dev->get_stats = scc_get_stats; | 602 | dev->get_stats = scc_get_stats; |
603 | dev->hard_header = ax25_encapsulate; | 603 | dev->hard_header = ax25_hard_header; |
604 | dev->rebuild_header = ax25_rebuild_header; | 604 | dev->rebuild_header = ax25_rebuild_header; |
605 | dev->set_mac_address = scc_set_mac_address; | 605 | dev->set_mac_address = scc_set_mac_address; |
606 | } | 606 | } |
diff --git a/drivers/net/hamradio/hdlcdrv.c b/drivers/net/hamradio/hdlcdrv.c index b4c836e4fe86..dacc7687b97f 100644 --- a/drivers/net/hamradio/hdlcdrv.c +++ b/drivers/net/hamradio/hdlcdrv.c | |||
@@ -42,7 +42,6 @@ | |||
42 | 42 | ||
43 | /*****************************************************************************/ | 43 | /*****************************************************************************/ |
44 | 44 | ||
45 | #include <linux/config.h> | ||
46 | #include <linux/module.h> | 45 | #include <linux/module.h> |
47 | #include <linux/types.h> | 46 | #include <linux/types.h> |
48 | #include <linux/net.h> | 47 | #include <linux/net.h> |
@@ -52,20 +51,14 @@ | |||
52 | #include <linux/errno.h> | 51 | #include <linux/errno.h> |
53 | #include <linux/init.h> | 52 | #include <linux/init.h> |
54 | #include <linux/bitops.h> | 53 | #include <linux/bitops.h> |
55 | #include <asm/uaccess.h> | ||
56 | 54 | ||
57 | #include <linux/netdevice.h> | 55 | #include <linux/netdevice.h> |
58 | #include <linux/if_arp.h> | 56 | #include <linux/if_arp.h> |
59 | #include <linux/etherdevice.h> | ||
60 | #include <linux/skbuff.h> | 57 | #include <linux/skbuff.h> |
61 | #include <linux/hdlcdrv.h> | 58 | #include <linux/hdlcdrv.h> |
62 | /* prototypes for ax25_encapsulate and ax25_rebuild_header */ | ||
63 | #include <net/ax25.h> | 59 | #include <net/ax25.h> |
60 | #include <asm/uaccess.h> | ||
64 | 61 | ||
65 | /* make genksyms happy */ | ||
66 | #include <linux/ip.h> | ||
67 | #include <linux/udp.h> | ||
68 | #include <linux/tcp.h> | ||
69 | #include <linux/crc-ccitt.h> | 62 | #include <linux/crc-ccitt.h> |
70 | 63 | ||
71 | /* --------------------------------------------------------------------- */ | 64 | /* --------------------------------------------------------------------- */ |
@@ -708,13 +701,8 @@ static void hdlcdrv_setup(struct net_device *dev) | |||
708 | 701 | ||
709 | s->skb = NULL; | 702 | s->skb = NULL; |
710 | 703 | ||
711 | #if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) | 704 | dev->hard_header = ax25_hard_header; |
712 | dev->hard_header = ax25_encapsulate; | ||
713 | dev->rebuild_header = ax25_rebuild_header; | 705 | dev->rebuild_header = ax25_rebuild_header; |
714 | #else /* CONFIG_AX25 || CONFIG_AX25_MODULE */ | ||
715 | dev->hard_header = NULL; | ||
716 | dev->rebuild_header = NULL; | ||
717 | #endif /* CONFIG_AX25 || CONFIG_AX25_MODULE */ | ||
718 | dev->set_mac_address = hdlcdrv_set_mac_address; | 706 | dev->set_mac_address = hdlcdrv_set_mac_address; |
719 | 707 | ||
720 | dev->type = ARPHRD_AX25; /* AF_AX25 device */ | 708 | dev->type = ARPHRD_AX25; /* AF_AX25 device */ |
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c index 63b1a2b86acb..d9fe64b46f4b 100644 --- a/drivers/net/hamradio/mkiss.c +++ b/drivers/net/hamradio/mkiss.c | |||
@@ -500,7 +500,7 @@ static int ax_header(struct sk_buff *skb, struct net_device *dev, unsigned short | |||
500 | { | 500 | { |
501 | #ifdef CONFIG_INET | 501 | #ifdef CONFIG_INET |
502 | if (type != htons(ETH_P_AX25)) | 502 | if (type != htons(ETH_P_AX25)) |
503 | return ax25_encapsulate(skb, dev, type, daddr, saddr, len); | 503 | return ax25_hard_header(skb, dev, type, daddr, saddr, len); |
504 | #endif | 504 | #endif |
505 | return 0; | 505 | return 0; |
506 | } | 506 | } |
diff --git a/drivers/net/hamradio/scc.c b/drivers/net/hamradio/scc.c index c27e417f32bf..6ace0e914fd1 100644 --- a/drivers/net/hamradio/scc.c +++ b/drivers/net/hamradio/scc.c | |||
@@ -1557,7 +1557,7 @@ static void scc_net_setup(struct net_device *dev) | |||
1557 | dev->stop = scc_net_close; | 1557 | dev->stop = scc_net_close; |
1558 | 1558 | ||
1559 | dev->hard_start_xmit = scc_net_tx; | 1559 | dev->hard_start_xmit = scc_net_tx; |
1560 | dev->hard_header = ax25_encapsulate; | 1560 | dev->hard_header = ax25_hard_header; |
1561 | dev->rebuild_header = ax25_rebuild_header; | 1561 | dev->rebuild_header = ax25_rebuild_header; |
1562 | dev->set_mac_address = scc_net_set_mac_address; | 1562 | dev->set_mac_address = scc_net_set_mac_address; |
1563 | dev->get_stats = scc_net_get_stats; | 1563 | dev->get_stats = scc_net_get_stats; |
diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c index 41213ef602dc..fe22479eb202 100644 --- a/drivers/net/hamradio/yam.c +++ b/drivers/net/hamradio/yam.c | |||
@@ -60,15 +60,7 @@ | |||
60 | #include <linux/if_arp.h> | 60 | #include <linux/if_arp.h> |
61 | #include <linux/etherdevice.h> | 61 | #include <linux/etherdevice.h> |
62 | #include <linux/skbuff.h> | 62 | #include <linux/skbuff.h> |
63 | #if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) | ||
64 | /* prototypes for ax25_encapsulate and ax25_rebuild_header */ | ||
65 | #include <net/ax25.h> | 63 | #include <net/ax25.h> |
66 | #endif /* CONFIG_AX25 || CONFIG_AX25_MODULE */ | ||
67 | |||
68 | /* make genksyms happy */ | ||
69 | #include <linux/ip.h> | ||
70 | #include <linux/udp.h> | ||
71 | #include <linux/tcp.h> | ||
72 | 64 | ||
73 | #include <linux/kernel.h> | 65 | #include <linux/kernel.h> |
74 | #include <linux/proc_fs.h> | 66 | #include <linux/proc_fs.h> |
@@ -170,7 +162,7 @@ static char ax25_bcast[7] = | |||
170 | static char ax25_test[7] = | 162 | static char ax25_test[7] = |
171 | {'L' << 1, 'I' << 1, 'N' << 1, 'U' << 1, 'X' << 1, ' ' << 1, '1' << 1}; | 163 | {'L' << 1, 'I' << 1, 'N' << 1, 'U' << 1, 'X' << 1, ' ' << 1, '1' << 1}; |
172 | 164 | ||
173 | static struct timer_list yam_timer = TIMER_INITIALIZER(NULL, 0, 0); | 165 | static DEFINE_TIMER(yam_timer, NULL, 0, 0); |
174 | 166 | ||
175 | /* --------------------------------------------------------------------- */ | 167 | /* --------------------------------------------------------------------- */ |
176 | 168 | ||
@@ -1116,23 +1108,17 @@ static void yam_setup(struct net_device *dev) | |||
1116 | 1108 | ||
1117 | skb_queue_head_init(&yp->send_queue); | 1109 | skb_queue_head_init(&yp->send_queue); |
1118 | 1110 | ||
1119 | #if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) | 1111 | dev->hard_header = ax25_hard_header; |
1120 | dev->hard_header = ax25_encapsulate; | ||
1121 | dev->rebuild_header = ax25_rebuild_header; | 1112 | dev->rebuild_header = ax25_rebuild_header; |
1122 | #else /* CONFIG_AX25 || CONFIG_AX25_MODULE */ | ||
1123 | dev->hard_header = NULL; | ||
1124 | dev->rebuild_header = NULL; | ||
1125 | #endif /* CONFIG_AX25 || CONFIG_AX25_MODULE */ | ||
1126 | 1113 | ||
1127 | dev->set_mac_address = yam_set_mac_address; | 1114 | dev->set_mac_address = yam_set_mac_address; |
1128 | 1115 | ||
1129 | dev->type = ARPHRD_AX25; /* AF_AX25 device */ | 1116 | dev->type = ARPHRD_AX25; |
1130 | dev->hard_header_len = 73; /* We do digipeaters now */ | 1117 | dev->hard_header_len = AX25_MAX_HEADER_LEN; |
1131 | dev->mtu = 256; /* AX25 is the default */ | 1118 | dev->mtu = AX25_MTU; |
1132 | dev->addr_len = 7; /* sizeof an ax.25 address */ | 1119 | dev->addr_len = AX25_ADDR_LEN; |
1133 | memcpy(dev->broadcast, ax25_bcast, 7); | 1120 | memcpy(dev->broadcast, ax25_bcast, AX25_ADDR_LEN); |
1134 | memcpy(dev->dev_addr, ax25_test, 7); | 1121 | memcpy(dev->dev_addr, ax25_test, AX25_ADDR_LEN); |
1135 | |||
1136 | } | 1122 | } |
1137 | 1123 | ||
1138 | static int __init yam_init_driver(void) | 1124 | static int __init yam_init_driver(void) |
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c index 46e0022d3258..6c766fdc51a6 100644 --- a/drivers/net/irda/irda-usb.c +++ b/drivers/net/irda/irda-usb.c | |||
@@ -267,7 +267,7 @@ static void irda_usb_change_speed_xbofs(struct irda_usb_cb *self) | |||
267 | frame, IRDA_USB_SPEED_MTU, | 267 | frame, IRDA_USB_SPEED_MTU, |
268 | speed_bulk_callback, self); | 268 | speed_bulk_callback, self); |
269 | urb->transfer_buffer_length = USB_IRDA_HEADER; | 269 | urb->transfer_buffer_length = USB_IRDA_HEADER; |
270 | urb->transfer_flags = URB_ASYNC_UNLINK; | 270 | urb->transfer_flags = 0; |
271 | 271 | ||
272 | /* Irq disabled -> GFP_ATOMIC */ | 272 | /* Irq disabled -> GFP_ATOMIC */ |
273 | if ((ret = usb_submit_urb(urb, GFP_ATOMIC))) { | 273 | if ((ret = usb_submit_urb(urb, GFP_ATOMIC))) { |
@@ -401,15 +401,12 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
401 | skb->data, IRDA_SKB_MAX_MTU, | 401 | skb->data, IRDA_SKB_MAX_MTU, |
402 | write_bulk_callback, skb); | 402 | write_bulk_callback, skb); |
403 | urb->transfer_buffer_length = skb->len; | 403 | urb->transfer_buffer_length = skb->len; |
404 | /* Note : unlink *must* be Asynchronous because of the code in | ||
405 | * irda_usb_net_timeout() -> call in irq - Jean II */ | ||
406 | urb->transfer_flags = URB_ASYNC_UNLINK; | ||
407 | /* This flag (URB_ZERO_PACKET) indicates that what we send is not | 404 | /* This flag (URB_ZERO_PACKET) indicates that what we send is not |
408 | * a continuous stream of data but separate packets. | 405 | * a continuous stream of data but separate packets. |
409 | * In this case, the USB layer will insert an empty USB frame (TD) | 406 | * In this case, the USB layer will insert an empty USB frame (TD) |
410 | * after each of our packets that is exact multiple of the frame size. | 407 | * after each of our packets that is exact multiple of the frame size. |
411 | * This is how the dongle will detect the end of packet - Jean II */ | 408 | * This is how the dongle will detect the end of packet - Jean II */ |
412 | urb->transfer_flags |= URB_ZERO_PACKET; | 409 | urb->transfer_flags = URB_ZERO_PACKET; |
413 | 410 | ||
414 | /* Generate min turn time. FIXME: can we do better than this? */ | 411 | /* Generate min turn time. FIXME: can we do better than this? */ |
415 | /* Trying to a turnaround time at this level is trying to measure | 412 | /* Trying to a turnaround time at this level is trying to measure |
@@ -630,8 +627,6 @@ static void irda_usb_net_timeout(struct net_device *netdev) | |||
630 | * in completion handler, because urb->status will | 627 | * in completion handler, because urb->status will |
631 | * be -ENOENT. We will fix that at the next watchdog, | 628 | * be -ENOENT. We will fix that at the next watchdog, |
632 | * leaving more time to USB to recover... | 629 | * leaving more time to USB to recover... |
633 | * Also, we are in interrupt, so we need to have | ||
634 | * URB_ASYNC_UNLINK to work properly... | ||
635 | * Jean II */ | 630 | * Jean II */ |
636 | done = 1; | 631 | done = 1; |
637 | break; | 632 | break; |
@@ -1008,9 +1003,7 @@ static int irda_usb_net_close(struct net_device *netdev) | |||
1008 | } | 1003 | } |
1009 | } | 1004 | } |
1010 | /* Cancel Tx and speed URB - need to be synchronous to avoid races */ | 1005 | /* Cancel Tx and speed URB - need to be synchronous to avoid races */ |
1011 | self->tx_urb->transfer_flags &= ~URB_ASYNC_UNLINK; | ||
1012 | usb_kill_urb(self->tx_urb); | 1006 | usb_kill_urb(self->tx_urb); |
1013 | self->speed_urb->transfer_flags &= ~URB_ASYNC_UNLINK; | ||
1014 | usb_kill_urb(self->speed_urb); | 1007 | usb_kill_urb(self->speed_urb); |
1015 | 1008 | ||
1016 | /* Stop and remove instance of IrLAP */ | 1009 | /* Stop and remove instance of IrLAP */ |
@@ -1521,9 +1514,7 @@ static void irda_usb_disconnect(struct usb_interface *intf) | |||
1521 | usb_kill_urb(self->rx_urb[i]); | 1514 | usb_kill_urb(self->rx_urb[i]); |
1522 | /* Cancel Tx and speed URB. | 1515 | /* Cancel Tx and speed URB. |
1523 | * Toggle flags to make sure it's synchronous. */ | 1516 | * Toggle flags to make sure it's synchronous. */ |
1524 | self->tx_urb->transfer_flags &= ~URB_ASYNC_UNLINK; | ||
1525 | usb_kill_urb(self->tx_urb); | 1517 | usb_kill_urb(self->tx_urb); |
1526 | self->speed_urb->transfer_flags &= ~URB_ASYNC_UNLINK; | ||
1527 | usb_kill_urb(self->speed_urb); | 1518 | usb_kill_urb(self->speed_urb); |
1528 | } | 1519 | } |
1529 | 1520 | ||
diff --git a/drivers/net/irda/vlsi_ir.h b/drivers/net/irda/vlsi_ir.h index 414694abf588..741aecc655df 100644 --- a/drivers/net/irda/vlsi_ir.h +++ b/drivers/net/irda/vlsi_ir.h | |||
@@ -69,14 +69,8 @@ typedef void irqreturn_t; | |||
69 | 69 | ||
70 | #else /* 2.5 or later */ | 70 | #else /* 2.5 or later */ |
71 | 71 | ||
72 | /* recent 2.5/2.6 stores pci device names at varying places ;-) */ | ||
73 | #ifdef CONFIG_PCI_NAMES | ||
74 | /* human readable name */ | ||
75 | #define PCIDEV_NAME(pdev) ((pdev)->pretty_name) | ||
76 | #else | ||
77 | /* whatever we get from the associated struct device - bus:slot:dev.fn id */ | 72 | /* whatever we get from the associated struct device - bus:slot:dev.fn id */ |
78 | #define PCIDEV_NAME(pdev) (pci_name(pdev)) | 73 | #define PCIDEV_NAME(pdev) (pci_name(pdev)) |
79 | #endif | ||
80 | 74 | ||
81 | #endif | 75 | #endif |
82 | 76 | ||
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index 7c9dbc8c9423..25c9a99c377b 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -94,7 +94,7 @@ static char mv643xx_driver_version[] = "1.0"; | |||
94 | static void __iomem *mv643xx_eth_shared_base; | 94 | static void __iomem *mv643xx_eth_shared_base; |
95 | 95 | ||
96 | /* used to protect MV643XX_ETH_SMI_REG, which is shared across ports */ | 96 | /* used to protect MV643XX_ETH_SMI_REG, which is shared across ports */ |
97 | static spinlock_t mv643xx_eth_phy_lock = SPIN_LOCK_UNLOCKED; | 97 | static DEFINE_SPINLOCK(mv643xx_eth_phy_lock); |
98 | 98 | ||
99 | static inline u32 mv_read(int offset) | 99 | static inline u32 mv_read(int offset) |
100 | { | 100 | { |
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index bb71638a7c44..0df7e92b0bf8 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
@@ -1232,9 +1232,7 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb) | |||
1232 | navail = 0; /* total # of usable channels (not deregistered) */ | 1232 | navail = 0; /* total # of usable channels (not deregistered) */ |
1233 | hdrlen = (ppp->flags & SC_MP_XSHORTSEQ)? MPHDRLEN_SSN: MPHDRLEN; | 1233 | hdrlen = (ppp->flags & SC_MP_XSHORTSEQ)? MPHDRLEN_SSN: MPHDRLEN; |
1234 | i = 0; | 1234 | i = 0; |
1235 | list = &ppp->channels; | 1235 | list_for_each_entry(pch, &ppp->channels, clist) { |
1236 | while ((list = list->next) != &ppp->channels) { | ||
1237 | pch = list_entry(list, struct channel, clist); | ||
1238 | navail += pch->avail = (pch->chan != NULL); | 1236 | navail += pch->avail = (pch->chan != NULL); |
1239 | if (pch->avail) { | 1237 | if (pch->avail) { |
1240 | if (skb_queue_empty(&pch->file.xq) || | 1238 | if (skb_queue_empty(&pch->file.xq) || |
@@ -1280,6 +1278,7 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb) | |||
1280 | 1278 | ||
1281 | /* skip to the channel after the one we last used | 1279 | /* skip to the channel after the one we last used |
1282 | and start at that one */ | 1280 | and start at that one */ |
1281 | list = &ppp->channels; | ||
1283 | for (i = 0; i < ppp->nxchan; ++i) { | 1282 | for (i = 0; i < ppp->nxchan; ++i) { |
1284 | list = list->next; | 1283 | list = list->next; |
1285 | if (list == &ppp->channels) { | 1284 | if (list == &ppp->channels) { |
@@ -1730,7 +1729,7 @@ static void | |||
1730 | ppp_receive_mp_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch) | 1729 | ppp_receive_mp_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch) |
1731 | { | 1730 | { |
1732 | u32 mask, seq; | 1731 | u32 mask, seq; |
1733 | struct list_head *l; | 1732 | struct channel *ch; |
1734 | int mphdrlen = (ppp->flags & SC_MP_SHORTSEQ)? MPHDRLEN_SSN: MPHDRLEN; | 1733 | int mphdrlen = (ppp->flags & SC_MP_SHORTSEQ)? MPHDRLEN_SSN: MPHDRLEN; |
1735 | 1734 | ||
1736 | if (!pskb_may_pull(skb, mphdrlen) || ppp->mrru == 0) | 1735 | if (!pskb_may_pull(skb, mphdrlen) || ppp->mrru == 0) |
@@ -1784,8 +1783,7 @@ ppp_receive_mp_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch) | |||
1784 | * The list of channels can't change because we have the receive | 1783 | * The list of channels can't change because we have the receive |
1785 | * side of the ppp unit locked. | 1784 | * side of the ppp unit locked. |
1786 | */ | 1785 | */ |
1787 | for (l = ppp->channels.next; l != &ppp->channels; l = l->next) { | 1786 | list_for_each_entry(ch, &ppp->channels, clist) { |
1788 | struct channel *ch = list_entry(l, struct channel, clist); | ||
1789 | if (seq_before(ch->lastseq, seq)) | 1787 | if (seq_before(ch->lastseq, seq)) |
1790 | seq = ch->lastseq; | 1788 | seq = ch->lastseq; |
1791 | } | 1789 | } |
@@ -2271,10 +2269,8 @@ static struct compressor_entry * | |||
2271 | find_comp_entry(int proto) | 2269 | find_comp_entry(int proto) |
2272 | { | 2270 | { |
2273 | struct compressor_entry *ce; | 2271 | struct compressor_entry *ce; |
2274 | struct list_head *list = &compressor_list; | ||
2275 | 2272 | ||
2276 | while ((list = list->next) != &compressor_list) { | 2273 | list_for_each_entry(ce, &compressor_list, list) { |
2277 | ce = list_entry(list, struct compressor_entry, list); | ||
2278 | if (ce->comp->compress_proto == proto) | 2274 | if (ce->comp->compress_proto == proto) |
2279 | return ce; | 2275 | return ce; |
2280 | } | 2276 | } |
@@ -2540,20 +2536,15 @@ static struct channel * | |||
2540 | ppp_find_channel(int unit) | 2536 | ppp_find_channel(int unit) |
2541 | { | 2537 | { |
2542 | struct channel *pch; | 2538 | struct channel *pch; |
2543 | struct list_head *list; | ||
2544 | 2539 | ||
2545 | list = &new_channels; | 2540 | list_for_each_entry(pch, &new_channels, list) { |
2546 | while ((list = list->next) != &new_channels) { | ||
2547 | pch = list_entry(list, struct channel, list); | ||
2548 | if (pch->file.index == unit) { | 2541 | if (pch->file.index == unit) { |
2549 | list_del(&pch->list); | 2542 | list_del(&pch->list); |
2550 | list_add(&pch->list, &all_channels); | 2543 | list_add(&pch->list, &all_channels); |
2551 | return pch; | 2544 | return pch; |
2552 | } | 2545 | } |
2553 | } | 2546 | } |
2554 | list = &all_channels; | 2547 | list_for_each_entry(pch, &all_channels, list) { |
2555 | while ((list = list->next) != &all_channels) { | ||
2556 | pch = list_entry(list, struct channel, list); | ||
2557 | if (pch->file.index == unit) | 2548 | if (pch->file.index == unit) |
2558 | return pch; | 2549 | return pch; |
2559 | } | 2550 | } |
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c index 3f67a42e8503..de399563a9db 100644 --- a/drivers/net/sungem.c +++ b/drivers/net/sungem.c | |||
@@ -2817,7 +2817,7 @@ static int gem_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
2817 | 2817 | ||
2818 | #if (!defined(__sparc__) && !defined(CONFIG_PPC_PMAC)) | 2818 | #if (!defined(__sparc__) && !defined(CONFIG_PPC_PMAC)) |
2819 | /* Fetch MAC address from vital product data of PCI ROM. */ | 2819 | /* Fetch MAC address from vital product data of PCI ROM. */ |
2820 | static void find_eth_addr_in_vpd(void __iomem *rom_base, int len, unsigned char *dev_addr) | 2820 | static int find_eth_addr_in_vpd(void __iomem *rom_base, int len, unsigned char *dev_addr) |
2821 | { | 2821 | { |
2822 | int this_offset; | 2822 | int this_offset; |
2823 | 2823 | ||
@@ -2838,35 +2838,27 @@ static void find_eth_addr_in_vpd(void __iomem *rom_base, int len, unsigned char | |||
2838 | 2838 | ||
2839 | for (i = 0; i < 6; i++) | 2839 | for (i = 0; i < 6; i++) |
2840 | dev_addr[i] = readb(p + i); | 2840 | dev_addr[i] = readb(p + i); |
2841 | break; | 2841 | return 1; |
2842 | } | 2842 | } |
2843 | return 0; | ||
2843 | } | 2844 | } |
2844 | 2845 | ||
2845 | static void get_gem_mac_nonobp(struct pci_dev *pdev, unsigned char *dev_addr) | 2846 | static void get_gem_mac_nonobp(struct pci_dev *pdev, unsigned char *dev_addr) |
2846 | { | 2847 | { |
2847 | u32 rom_reg_orig; | 2848 | size_t size; |
2848 | void __iomem *p; | 2849 | void __iomem *p = pci_map_rom(pdev, &size); |
2849 | |||
2850 | if (pdev->resource[PCI_ROM_RESOURCE].parent == NULL) { | ||
2851 | if (pci_assign_resource(pdev, PCI_ROM_RESOURCE) < 0) | ||
2852 | goto use_random; | ||
2853 | } | ||
2854 | 2850 | ||
2855 | pci_read_config_dword(pdev, pdev->rom_base_reg, &rom_reg_orig); | 2851 | if (p) { |
2856 | pci_write_config_dword(pdev, pdev->rom_base_reg, | 2852 | int found; |
2857 | rom_reg_orig | PCI_ROM_ADDRESS_ENABLE); | ||
2858 | 2853 | ||
2859 | p = ioremap(pci_resource_start(pdev, PCI_ROM_RESOURCE), (64 * 1024)); | 2854 | found = readb(p) == 0x55 && |
2860 | if (p != NULL && readb(p) == 0x55 && readb(p + 1) == 0xaa) | 2855 | readb(p + 1) == 0xaa && |
2861 | find_eth_addr_in_vpd(p, (64 * 1024), dev_addr); | 2856 | find_eth_addr_in_vpd(p, (64 * 1024), dev_addr); |
2862 | 2857 | pci_unmap_rom(pdev, p); | |
2863 | if (p != NULL) | 2858 | if (found) |
2864 | iounmap(p); | 2859 | return; |
2865 | 2860 | } | |
2866 | pci_write_config_dword(pdev, pdev->rom_base_reg, rom_reg_orig); | ||
2867 | return; | ||
2868 | 2861 | ||
2869 | use_random: | ||
2870 | /* Sun MAC prefix then 3 random bytes. */ | 2862 | /* Sun MAC prefix then 3 random bytes. */ |
2871 | dev_addr[0] = 0x08; | 2863 | dev_addr[0] = 0x08; |
2872 | dev_addr[1] = 0x00; | 2864 | dev_addr[1] = 0x00; |
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c index f02fe4119b2c..9f046cae2f71 100644 --- a/drivers/net/sunhme.c +++ b/drivers/net/sunhme.c | |||
@@ -2954,7 +2954,7 @@ static int is_quattro_p(struct pci_dev *pdev) | |||
2954 | } | 2954 | } |
2955 | 2955 | ||
2956 | /* Fetch MAC address from vital product data of PCI ROM. */ | 2956 | /* Fetch MAC address from vital product data of PCI ROM. */ |
2957 | static void find_eth_addr_in_vpd(void __iomem *rom_base, int len, int index, unsigned char *dev_addr) | 2957 | static int find_eth_addr_in_vpd(void __iomem *rom_base, int len, int index, unsigned char *dev_addr) |
2958 | { | 2958 | { |
2959 | int this_offset; | 2959 | int this_offset; |
2960 | 2960 | ||
@@ -2977,42 +2977,33 @@ static void find_eth_addr_in_vpd(void __iomem *rom_base, int len, int index, uns | |||
2977 | 2977 | ||
2978 | for (i = 0; i < 6; i++) | 2978 | for (i = 0; i < 6; i++) |
2979 | dev_addr[i] = readb(p + i); | 2979 | dev_addr[i] = readb(p + i); |
2980 | break; | 2980 | return 1; |
2981 | } | 2981 | } |
2982 | index--; | 2982 | index--; |
2983 | } | 2983 | } |
2984 | return 0; | ||
2984 | } | 2985 | } |
2985 | 2986 | ||
2986 | static void get_hme_mac_nonsparc(struct pci_dev *pdev, unsigned char *dev_addr) | 2987 | static void get_hme_mac_nonsparc(struct pci_dev *pdev, unsigned char *dev_addr) |
2987 | { | 2988 | { |
2988 | u32 rom_reg_orig; | 2989 | size_t size; |
2989 | void __iomem *p; | 2990 | void __iomem *p = pci_map_rom(pdev, &size); |
2990 | int index; | ||
2991 | 2991 | ||
2992 | index = 0; | 2992 | if (p) { |
2993 | if (is_quattro_p(pdev)) | 2993 | int index = 0; |
2994 | index = PCI_SLOT(pdev->devfn); | 2994 | int found; |
2995 | |||
2996 | if (pdev->resource[PCI_ROM_RESOURCE].parent == NULL) { | ||
2997 | if (pci_assign_resource(pdev, PCI_ROM_RESOURCE) < 0) | ||
2998 | goto use_random; | ||
2999 | } | ||
3000 | 2995 | ||
3001 | pci_read_config_dword(pdev, pdev->rom_base_reg, &rom_reg_orig); | 2996 | if (is_quattro_p(pdev)) |
3002 | pci_write_config_dword(pdev, pdev->rom_base_reg, | 2997 | index = PCI_SLOT(pdev->devfn); |
3003 | rom_reg_orig | PCI_ROM_ADDRESS_ENABLE); | ||
3004 | 2998 | ||
3005 | p = ioremap(pci_resource_start(pdev, PCI_ROM_RESOURCE), (64 * 1024)); | 2999 | found = readb(p) == 0x55 && |
3006 | if (p != NULL && readb(p) == 0x55 && readb(p + 1) == 0xaa) | 3000 | readb(p + 1) == 0xaa && |
3007 | find_eth_addr_in_vpd(p, (64 * 1024), index, dev_addr); | 3001 | find_eth_addr_in_vpd(p, (64 * 1024), index, dev_addr); |
3008 | 3002 | pci_unmap_rom(pdev, p); | |
3009 | if (p != NULL) | 3003 | if (found) |
3010 | iounmap(p); | 3004 | return; |
3011 | 3005 | } | |
3012 | pci_write_config_dword(pdev, pdev->rom_base_reg, rom_reg_orig); | ||
3013 | return; | ||
3014 | 3006 | ||
3015 | use_random: | ||
3016 | /* Sun MAC prefix then 3 random bytes. */ | 3007 | /* Sun MAC prefix then 3 random bytes. */ |
3017 | dev_addr[0] = 0x08; | 3008 | dev_addr[0] = 0x08; |
3018 | dev_addr[1] = 0x00; | 3009 | dev_addr[1] = 0x00; |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index dc57352e5a97..7599f52e15b3 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -6893,8 +6893,7 @@ static struct net_device_stats *tg3_get_stats(struct net_device *dev) | |||
6893 | get_stat64(&hw_stats->tx_octets); | 6893 | get_stat64(&hw_stats->tx_octets); |
6894 | 6894 | ||
6895 | stats->rx_errors = old_stats->rx_errors + | 6895 | stats->rx_errors = old_stats->rx_errors + |
6896 | get_stat64(&hw_stats->rx_errors) + | 6896 | get_stat64(&hw_stats->rx_errors); |
6897 | get_stat64(&hw_stats->rx_discards); | ||
6898 | stats->tx_errors = old_stats->tx_errors + | 6897 | stats->tx_errors = old_stats->tx_errors + |
6899 | get_stat64(&hw_stats->tx_errors) + | 6898 | get_stat64(&hw_stats->tx_errors) + |
6900 | get_stat64(&hw_stats->tx_mac_errors) + | 6899 | get_stat64(&hw_stats->tx_mac_errors) + |
@@ -6922,6 +6921,9 @@ static struct net_device_stats *tg3_get_stats(struct net_device *dev) | |||
6922 | stats->rx_crc_errors = old_stats->rx_crc_errors + | 6921 | stats->rx_crc_errors = old_stats->rx_crc_errors + |
6923 | calc_crc_errors(tp); | 6922 | calc_crc_errors(tp); |
6924 | 6923 | ||
6924 | stats->rx_missed_errors = old_stats->rx_missed_errors + | ||
6925 | get_stat64(&hw_stats->rx_discards); | ||
6926 | |||
6925 | return stats; | 6927 | return stats; |
6926 | } | 6928 | } |
6927 | 6929 | ||
@@ -8303,6 +8305,7 @@ static struct ethtool_ops tg3_ethtool_ops = { | |||
8303 | .get_ethtool_stats = tg3_get_ethtool_stats, | 8305 | .get_ethtool_stats = tg3_get_ethtool_stats, |
8304 | .get_coalesce = tg3_get_coalesce, | 8306 | .get_coalesce = tg3_get_coalesce, |
8305 | .set_coalesce = tg3_set_coalesce, | 8307 | .set_coalesce = tg3_set_coalesce, |
8308 | .get_perm_addr = ethtool_op_get_perm_addr, | ||
8306 | }; | 8309 | }; |
8307 | 8310 | ||
8308 | static void __devinit tg3_get_eeprom_size(struct tg3 *tp) | 8311 | static void __devinit tg3_get_eeprom_size(struct tg3 *tp) |
@@ -9781,6 +9784,7 @@ static int __devinit tg3_get_macaddr_sparc(struct tg3 *tp) | |||
9781 | if (prom_getproplen(node, "local-mac-address") == 6) { | 9784 | if (prom_getproplen(node, "local-mac-address") == 6) { |
9782 | prom_getproperty(node, "local-mac-address", | 9785 | prom_getproperty(node, "local-mac-address", |
9783 | dev->dev_addr, 6); | 9786 | dev->dev_addr, 6); |
9787 | memcpy(dev->perm_addr, dev->dev_addr, 6); | ||
9784 | return 0; | 9788 | return 0; |
9785 | } | 9789 | } |
9786 | } | 9790 | } |
@@ -9792,6 +9796,7 @@ static int __devinit tg3_get_default_macaddr_sparc(struct tg3 *tp) | |||
9792 | struct net_device *dev = tp->dev; | 9796 | struct net_device *dev = tp->dev; |
9793 | 9797 | ||
9794 | memcpy(dev->dev_addr, idprom->id_ethaddr, 6); | 9798 | memcpy(dev->dev_addr, idprom->id_ethaddr, 6); |
9799 | memcpy(dev->perm_addr, idprom->id_ethaddr, 6); | ||
9795 | return 0; | 9800 | return 0; |
9796 | } | 9801 | } |
9797 | #endif | 9802 | #endif |
@@ -9861,6 +9866,7 @@ static int __devinit tg3_get_device_address(struct tg3 *tp) | |||
9861 | #endif | 9866 | #endif |
9862 | return -EINVAL; | 9867 | return -EINVAL; |
9863 | } | 9868 | } |
9869 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | ||
9864 | return 0; | 9870 | return 0; |
9865 | } | 9871 | } |
9866 | 9872 | ||
diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c index 93800c126e86..ee48bfd67349 100644 --- a/drivers/net/tulip/de4x5.c +++ b/drivers/net/tulip/de4x5.c | |||
@@ -2144,9 +2144,9 @@ srom_search(struct net_device *dev, struct pci_dev *pdev) | |||
2144 | u_long iobase = 0; /* Clear upper 32 bits in Alphas */ | 2144 | u_long iobase = 0; /* Clear upper 32 bits in Alphas */ |
2145 | int i, j, cfrv; | 2145 | int i, j, cfrv; |
2146 | struct de4x5_private *lp = netdev_priv(dev); | 2146 | struct de4x5_private *lp = netdev_priv(dev); |
2147 | struct list_head *walk = &pdev->bus_list; | 2147 | struct list_head *walk; |
2148 | 2148 | ||
2149 | for (walk = walk->next; walk != &pdev->bus_list; walk = walk->next) { | 2149 | list_for_each(walk, &pdev->bus_list) { |
2150 | struct pci_dev *this_dev = pci_dev_b(walk); | 2150 | struct pci_dev *this_dev = pci_dev_b(walk); |
2151 | 2151 | ||
2152 | /* Skip the pci_bus list entry */ | 2152 | /* Skip the pci_bus list entry */ |