aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeer Chen <Peer.Chen@uli.com.tw>2005-08-20 01:10:06 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-08-20 01:10:06 -0400
commit945a787675cc5ba362f5d4ce135d2a2c20be5985 (patch)
treed9b8730281fc4635b280840c1fe989d2e5a91f50
parentea8f400c98ec9ae0604bc5a6721174ef68635815 (diff)
[netdrvr uli526x] fix problems found in review
- s/DEVICE/net_device/ - improve formatting - remove dead code - check return value, in several areas
-rw-r--r--drivers/net/tulip/uli526x.c207
1 files changed, 93 insertions, 114 deletions
diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/tulip/uli526x.c
index 27f99e087f79..5ae22b7bc5ca 100644
--- a/drivers/net/tulip/uli526x.c
+++ b/drivers/net/tulip/uli526x.c
@@ -56,8 +56,7 @@
56#define RX_ALLOC_SIZE 0x620 56#define RX_ALLOC_SIZE 0x620
57#define ULI526X_RESET 1 57#define ULI526X_RESET 1
58#define CR0_DEFAULT 0 58#define CR0_DEFAULT 0
59#define CR6_DEFAULT 0x00080000 /* HD */ 59#define CR6_DEFAULT 0x22200000
60#define CR6_DEFAULT_A 0x22240000
61#define CR7_DEFAULT 0x180c1 60#define CR7_DEFAULT 0x180c1
62#define CR15_DEFAULT 0x06 /* TxJabber RxWatchdog */ 61#define CR15_DEFAULT 0x06 /* TxJabber RxWatchdog */
63#define TDES0_ERR_MASK 0x4302 /* TXJT, LC, EC, FUE */ 62#define TDES0_ERR_MASK 0x4302 /* TXJT, LC, EC, FUE */
@@ -103,10 +102,13 @@
103 102
104#define SROM_V41_CODE 0x14 103#define SROM_V41_CODE 0x14
105 104
106#define SROM_CLK_WRITE(data, ioaddr) outl(data|CR9_SROM_READ|CR9_SRCS,ioaddr);udelay(5);outl(data|CR9_SROM_READ|CR9_SRCS|CR9_SRCLK,ioaddr);udelay(5);outl(data|CR9_SROM_READ|CR9_SRCS,ioaddr);udelay(5); 105#define SROM_CLK_WRITE(data, ioaddr) \
107 106 outl(data|CR9_SROM_READ|CR9_SRCS,ioaddr); \
108/* Sten Check */ 107 udelay(5); \
109#define DEVICE net_device 108 outl(data|CR9_SROM_READ|CR9_SRCS|CR9_SRCLK,ioaddr); \
109 udelay(5); \
110 outl(data|CR9_SROM_READ|CR9_SRCS,ioaddr); \
111 udelay(5);
110 112
111/* Structure/enum declaration ------------------------------- */ 113/* Structure/enum declaration ------------------------------- */
112struct tx_desc { 114struct tx_desc {
@@ -123,7 +125,7 @@ struct rx_desc {
123 125
124struct uli526x_board_info { 126struct uli526x_board_info {
125 u32 chip_id; /* Chip vendor/Device ID */ 127 u32 chip_id; /* Chip vendor/Device ID */
126 struct DEVICE *next_dev; /* next device */ 128 struct net_device *next_dev; /* next device */
127 struct pci_dev *pdev; /* PCI device */ 129 struct pci_dev *pdev; /* PCI device */
128 spinlock_t lock; 130 spinlock_t lock;
129 131
@@ -212,22 +214,21 @@ static u32 uli526x_cr6_user_set;
212/* For module input parameter */ 214/* For module input parameter */
213static int debug; 215static int debug;
214static u32 cr6set; 216static u32 cr6set;
215static u32 m526x_id;
216static unsigned char mode = 8; 217static unsigned char mode = 8;
217 218
218/* function declaration ------------------------------------- */ 219/* function declaration ------------------------------------- */
219static int uli526x_open(struct DEVICE *); 220static int uli526x_open(struct net_device *);
220static int uli526x_start_xmit(struct sk_buff *, struct DEVICE *); 221static int uli526x_start_xmit(struct sk_buff *, struct net_device *);
221static int uli526x_stop(struct DEVICE *); 222static int uli526x_stop(struct net_device *);
222static struct net_device_stats * uli526x_get_stats(struct DEVICE *); 223static struct net_device_stats * uli526x_get_stats(struct net_device *);
223static void uli526x_set_filter_mode(struct DEVICE *); 224static void uli526x_set_filter_mode(struct net_device *);
224static struct ethtool_ops netdev_ethtool_ops; 225static struct ethtool_ops netdev_ethtool_ops;
225static u16 read_srom_word(long ,int); 226static u16 read_srom_word(long, int);
226static irqreturn_t uli526x_interrupt(int , void *, struct pt_regs *); 227static irqreturn_t uli526x_interrupt(int, void *, struct pt_regs *);
227static void uli526x_descriptor_init(struct uli526x_board_info *, unsigned long); 228static void uli526x_descriptor_init(struct uli526x_board_info *, unsigned long);
228static void allocate_rx_buffer(struct uli526x_board_info *); 229static void allocate_rx_buffer(struct uli526x_board_info *);
229static void update_cr6(u32, unsigned long); 230static void update_cr6(u32, unsigned long);
230static void send_filter_frame(struct DEVICE * ,int); 231static void send_filter_frame(struct net_device *, int);
231static u16 phy_read(unsigned long, u8, u8, u32); 232static u16 phy_read(unsigned long, u8, u8, u32);
232static u16 phy_readby_cr10(unsigned long, u8, u8); 233static u16 phy_readby_cr10(unsigned long, u8, u8);
233static void phy_write(unsigned long, u8, u8, u16, u32); 234static void phy_write(unsigned long, u8, u8, u16, u32);
@@ -237,18 +238,18 @@ static u16 phy_read_1bit(unsigned long, u32);
237static u8 uli526x_sense_speed(struct uli526x_board_info *); 238static u8 uli526x_sense_speed(struct uli526x_board_info *);
238static void uli526x_process_mode(struct uli526x_board_info *); 239static void uli526x_process_mode(struct uli526x_board_info *);
239static void uli526x_timer(unsigned long); 240static void uli526x_timer(unsigned long);
240static void uli526x_rx_packet(struct DEVICE *, struct uli526x_board_info *); 241static void uli526x_rx_packet(struct net_device *, struct uli526x_board_info *);
241static void uli526x_free_tx_pkt(struct DEVICE *, struct uli526x_board_info *); 242static void uli526x_free_tx_pkt(struct net_device *, struct uli526x_board_info *);
242static void uli526x_reuse_skb(struct uli526x_board_info *, struct sk_buff *); 243static void uli526x_reuse_skb(struct uli526x_board_info *, struct sk_buff *);
243static void uli526x_dynamic_reset(struct DEVICE *); 244static void uli526x_dynamic_reset(struct net_device *);
244static void uli526x_free_rxbuffer(struct uli526x_board_info *); 245static void uli526x_free_rxbuffer(struct uli526x_board_info *);
245static void uli526x_init(struct DEVICE *); 246static void uli526x_init(struct net_device *);
246static void uli526x_set_phyxcer(struct uli526x_board_info *); 247static void uli526x_set_phyxcer(struct uli526x_board_info *);
247 248
248/* ULI526X network baord routine ---------------------------- */ 249/* ULI526X network board routine ---------------------------- */
249 250
250/* 251/*
251 * Search ULI526X board ,allocate space and register it 252 * Search ULI526X board, allocate space and register it
252 */ 253 */
253 254
254static int __devinit uli526x_init_one (struct pci_dev *pdev, 255static int __devinit uli526x_init_one (struct pci_dev *pdev,
@@ -257,8 +258,7 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev,
257 struct uli526x_board_info *db; /* board information structure */ 258 struct uli526x_board_info *db; /* board information structure */
258 struct net_device *dev; 259 struct net_device *dev;
259 int i, err; 260 int i, err;
260 u32 configval; 261
261
262 ULI526X_DBUG(0, "uli526x_init_one()", 0); 262 ULI526X_DBUG(0, "uli526x_init_one()", 0);
263 263
264 if (!printed_version++) 264 if (!printed_version++)
@@ -271,7 +271,7 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev,
271 SET_MODULE_OWNER(dev); 271 SET_MODULE_OWNER(dev);
272 SET_NETDEV_DEV(dev, &pdev->dev); 272 SET_NETDEV_DEV(dev, &pdev->dev);
273 273
274 if (pci_set_dma_mask(pdev, 0xffffffff)) { 274 if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) {
275 printk(KERN_WARNING DRV_NAME ": 32-bit PCI DMA not available.\n"); 275 printk(KERN_WARNING DRV_NAME ": 32-bit PCI DMA not available.\n");
276 err = -ENODEV; 276 err = -ENODEV;
277 goto err_out_free; 277 goto err_out_free;
@@ -300,23 +300,23 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev,
300 goto err_out_disable; 300 goto err_out_disable;
301 } 301 }
302 302
303 //add by clearzhang 2004/7/8
304 pci_read_config_dword(pdev,0x0,&configval);
305 m526x_id = configval;
306 if(configval == 0x526310b9)
307 {
308 //printk("is m5263\n");
309 pci_read_config_dword(pdev,0x0c,&configval);
310 configval = ((configval & 0xffff00ff) | 0x8000);
311 pci_write_config_dword(pdev,0x0c,configval);
312 }
313 /* Init system & device */ 303 /* Init system & device */
314 db = netdev_priv(dev); 304 db = netdev_priv(dev);
315 305
316 /* Allocate Tx/Rx descriptor memory */ 306 /* Allocate Tx/Rx descriptor memory */
317 db->desc_pool_ptr = pci_alloc_consistent(pdev, sizeof(struct tx_desc) * DESC_ALL_CNT + 0x20, &db->desc_pool_dma_ptr); 307 db->desc_pool_ptr = pci_alloc_consistent(pdev, sizeof(struct tx_desc) * DESC_ALL_CNT + 0x20, &db->desc_pool_dma_ptr);
308 if(db->desc_pool_ptr == NULL)
309 {
310 err = -ENOMEM;
311 goto err_out_nomem;
312 }
318 db->buf_pool_ptr = pci_alloc_consistent(pdev, TX_BUF_ALLOC * TX_DESC_CNT + 4, &db->buf_pool_dma_ptr); 313 db->buf_pool_ptr = pci_alloc_consistent(pdev, TX_BUF_ALLOC * TX_DESC_CNT + 4, &db->buf_pool_dma_ptr);
319 314 if(db->buf_pool_ptr == NULL)
315 {
316 err = -ENOMEM;
317 goto err_out_nomem;
318 }
319
320 db->first_tx_desc = (struct tx_desc *) db->desc_pool_ptr; 320 db->first_tx_desc = (struct tx_desc *) db->desc_pool_ptr;
321 db->first_tx_desc_dma = db->desc_pool_dma_ptr; 321 db->first_tx_desc_dma = db->desc_pool_dma_ptr;
322 db->buf_pool_start = db->buf_pool_ptr; 322 db->buf_pool_start = db->buf_pool_ptr;
@@ -347,7 +347,7 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev,
347 ((u16 *) db->srom)[i] = cpu_to_le16(read_srom_word(db->ioaddr, i)); 347 ((u16 *) db->srom)[i] = cpu_to_le16(read_srom_word(db->ioaddr, i));
348 348
349 /* Set Node address */ 349 /* Set Node address */
350 if(((u16 *) db->srom)[0] == 0xffff) /* SROM absent, so read MAC address from ID Table */ 350 if(((u16 *) db->srom)[0] == 0xffff || ((u16 *) db->srom)[0] == 0) /* SROM absent, so read MAC address from ID Table */
351 { 351 {
352 outl(0x10000, db->ioaddr + DCR0); //Diagnosis mode 352 outl(0x10000, db->ioaddr + DCR0); //Diagnosis mode
353 outl(0x1c0, db->ioaddr + DCR13); //Reset dianostic pointer port 353 outl(0x1c0, db->ioaddr + DCR13); //Reset dianostic pointer port
@@ -385,6 +385,14 @@ static int __devinit uli526x_init_one (struct pci_dev *pdev,
385 385
386err_out_res: 386err_out_res:
387 pci_release_regions(pdev); 387 pci_release_regions(pdev);
388err_out_nomem:
389 if(db->desc_pool_ptr)
390 pci_free_consistent(pdev, sizeof(struct tx_desc) * DESC_ALL_CNT + 0x20,
391 db->desc_pool_ptr, db->desc_pool_dma_ptr);
392
393 if(db->buf_pool_ptr != NULL)
394 pci_free_consistent(pdev, TX_BUF_ALLOC * TX_DESC_CNT + 4,
395 db->buf_pool_ptr, db->buf_pool_dma_ptr);
388err_out_disable: 396err_out_disable:
389 pci_disable_device(pdev); 397 pci_disable_device(pdev);
390err_out_free: 398err_out_free:
@@ -402,32 +410,30 @@ static void __devexit uli526x_remove_one (struct pci_dev *pdev)
402 410
403 ULI526X_DBUG(0, "uli526x_remove_one()", 0); 411 ULI526X_DBUG(0, "uli526x_remove_one()", 0);
404 412
405 if (dev) { 413 pci_free_consistent(db->pdev, sizeof(struct tx_desc) *
406 pci_free_consistent(db->pdev, sizeof(struct tx_desc) * 414 DESC_ALL_CNT + 0x20, db->desc_pool_ptr,
407 DESC_ALL_CNT + 0x20, db->desc_pool_ptr, 415 db->desc_pool_dma_ptr);
408 db->desc_pool_dma_ptr); 416 pci_free_consistent(db->pdev, TX_BUF_ALLOC * TX_DESC_CNT + 4,
409 pci_free_consistent(db->pdev, TX_BUF_ALLOC * TX_DESC_CNT + 4, 417 db->buf_pool_ptr, db->buf_pool_dma_ptr);
410 db->buf_pool_ptr, db->buf_pool_dma_ptr); 418 unregister_netdev(dev);
411 unregister_netdev(dev); 419 pci_release_regions(pdev);
412 pci_release_regions(pdev); 420 free_netdev(dev); /* free board information */
413 free_netdev(dev); /* free board information */ 421 pci_set_drvdata(pdev, NULL);
414 pci_set_drvdata(pdev, NULL); 422 pci_disable_device(pdev);
415 }
416
417 ULI526X_DBUG(0, "uli526x_remove_one() exit", 0); 423 ULI526X_DBUG(0, "uli526x_remove_one() exit", 0);
418} 424}
419 425
420 426
421/* 427/*
422 * Open the interface. 428 * Open the interface.
423 * The interface is opened whenever "ifconfig" actives it. 429 * The interface is opened whenever "ifconfig" activates it.
424 */ 430 */
425 431
426static int uli526x_open(struct DEVICE *dev) 432static int uli526x_open(struct net_device *dev)
427{ 433{
428 int ret; 434 int ret;
429 struct uli526x_board_info *db = netdev_priv(dev); 435 struct uli526x_board_info *db = netdev_priv(dev);
430 436
431 ULI526X_DBUG(0, "uli526x_open", 0); 437 ULI526X_DBUG(0, "uli526x_open", 0);
432 438
433 ret = request_irq(dev->irq, &uli526x_interrupt, SA_SHIRQ, dev->name, dev); 439 ret = request_irq(dev->irq, &uli526x_interrupt, SA_SHIRQ, dev->name, dev);
@@ -436,11 +442,6 @@ static int uli526x_open(struct DEVICE *dev)
436 442
437 /* system variable init */ 443 /* system variable init */
438 db->cr6_data = CR6_DEFAULT | uli526x_cr6_user_set; 444 db->cr6_data = CR6_DEFAULT | uli526x_cr6_user_set;
439 if(m526x_id == 0x526310b9)
440 {
441 //printk("is 5263\n");
442 db->cr6_data = CR6_DEFAULT_A | uli526x_cr6_user_set;
443 }
444 db->tx_packet_cnt = 0; 445 db->tx_packet_cnt = 0;
445 db->rx_avail_cnt = 0; 446 db->rx_avail_cnt = 0;
446 db->link_failed = 1; 447 db->link_failed = 1;
@@ -454,7 +455,7 @@ static int uli526x_open(struct DEVICE *dev)
454 db->cr6_data |= ULI526X_TXTH_256; 455 db->cr6_data |= ULI526X_TXTH_256;
455 db->cr0_data = CR0_DEFAULT; 456 db->cr0_data = CR0_DEFAULT;
456 457
457 /* Initilize ULI526X board */ 458 /* Initialize ULI526X board */
458 uli526x_init(dev); 459 uli526x_init(dev);
459 460
460 /* Active System Interface */ 461 /* Active System Interface */
@@ -471,14 +472,14 @@ static int uli526x_open(struct DEVICE *dev)
471} 472}
472 473
473 474
474/* Initilize ULI526X board 475/* Initialize ULI526X board
475 * Reset ULI526X board 476 * Reset ULI526X board
476 * Initilize TX/Rx descriptor chain structure 477 * Initialize TX/Rx descriptor chain structure
477 * Send the set-up frame 478 * Send the set-up frame
478 * Enable Tx/Rx machine 479 * Enable Tx/Rx machine
479 */ 480 */
480 481
481static void uli526x_init(struct DEVICE *dev) 482static void uli526x_init(struct net_device *dev)
482{ 483{
483 struct uli526x_board_info *db = netdev_priv(dev); 484 struct uli526x_board_info *db = netdev_priv(dev);
484 unsigned long ioaddr = db->ioaddr; 485 unsigned long ioaddr = db->ioaddr;
@@ -510,11 +511,6 @@ static void uli526x_init(struct DEVICE *dev)
510 /* Parser SROM and media mode */ 511 /* Parser SROM and media mode */
511 db->media_mode = uli526x_media_mode; 512 db->media_mode = uli526x_media_mode;
512 513
513 //add by clearzhang 2004/7/8
514 /* RESET Phyxcer Chip by GPR port bit 7 */
515 //outl(0x180, ioaddr + DCR12); /* Let bit 7 output port */
516 //outl(0x0, ioaddr + DCR12); /* Clear RESET signal */
517
518 /* Phyxcer capability setting */ 514 /* Phyxcer capability setting */
519 phy_reg_reset = phy_read(db->ioaddr, db->phy_addr, 0, db->chip_id); 515 phy_reg_reset = phy_read(db->ioaddr, db->phy_addr, 0, db->chip_id);
520 phy_reg_reset = (phy_reg_reset | 0x8000); 516 phy_reg_reset = (phy_reg_reset | 0x8000);
@@ -528,7 +524,7 @@ static void uli526x_init(struct DEVICE *dev)
528 if ( !(db->media_mode & ULI526X_AUTO) ) 524 if ( !(db->media_mode & ULI526X_AUTO) )
529 db->op_mode = db->media_mode; /* Force Mode */ 525 db->op_mode = db->media_mode; /* Force Mode */
530 526
531 /* Initiliaze Transmit/Receive decriptor and CR3/4 */ 527 /* Initialize Transmit/Receive decriptor and CR3/4 */
532 uli526x_descriptor_init(db, ioaddr); 528 uli526x_descriptor_init(db, ioaddr);
533 529
534 /* Init CR6 to program M526X operation */ 530 /* Init CR6 to program M526X operation */
@@ -555,7 +551,7 @@ static void uli526x_init(struct DEVICE *dev)
555 * Send a packet to media from the upper layer. 551 * Send a packet to media from the upper layer.
556 */ 552 */
557 553
558static int uli526x_start_xmit(struct sk_buff *skb, struct DEVICE *dev) 554static int uli526x_start_xmit(struct sk_buff *skb, struct net_device *dev)
559{ 555{
560 struct uli526x_board_info *db = netdev_priv(dev); 556 struct uli526x_board_info *db = netdev_priv(dev);
561 struct tx_desc *txptr; 557 struct tx_desc *txptr;
@@ -621,7 +617,7 @@ static int uli526x_start_xmit(struct sk_buff *skb, struct DEVICE *dev)
621 * The interface is stopped when it is brought. 617 * The interface is stopped when it is brought.
622 */ 618 */
623 619
624static int uli526x_stop(struct DEVICE *dev) 620static int uli526x_stop(struct net_device *dev)
625{ 621{
626 struct uli526x_board_info *db = netdev_priv(dev); 622 struct uli526x_board_info *db = netdev_priv(dev);
627 unsigned long ioaddr = dev->base_addr; 623 unsigned long ioaddr = dev->base_addr;
@@ -665,19 +661,16 @@ static int uli526x_stop(struct DEVICE *dev)
665 661
666static irqreturn_t uli526x_interrupt(int irq, void *dev_id, struct pt_regs *regs) 662static irqreturn_t uli526x_interrupt(int irq, void *dev_id, struct pt_regs *regs)
667{ 663{
668 struct DEVICE *dev = dev_id; 664 struct net_device *dev = dev_id;
669 struct uli526x_board_info *db = netdev_priv(dev); 665 struct uli526x_board_info *db = netdev_priv(dev);
670 unsigned long ioaddr = dev->base_addr; 666 unsigned long ioaddr = dev->base_addr;
671 unsigned long flags; 667 unsigned long flags;
672 668
673 //ULI526X_DBUG(0, "uli526x_interrupt()", 0);
674
675 if (!dev) { 669 if (!dev) {
676 ULI526X_DBUG(1, "uli526x_interrupt() without DEVICE arg", 0); 670 ULI526X_DBUG(1, "uli526x_interrupt() without DEVICE arg", 0);
677 return IRQ_NONE; 671 return IRQ_NONE;
678 } 672 }
679 673
680 //outl(0, ioaddr + DCR7);
681 spin_lock_irqsave(&db->lock, flags); 674 spin_lock_irqsave(&db->lock, flags);
682 outl(0, ioaddr + DCR7); 675 outl(0, ioaddr + DCR7);
683 676
@@ -690,9 +683,6 @@ static irqreturn_t uli526x_interrupt(int irq, void *dev_id, struct pt_regs *regs
690 return IRQ_HANDLED; 683 return IRQ_HANDLED;
691 } 684 }
692 685
693 /* Disable all interrupt in CR7 to solve the interrupt edge problem */
694 //outl(0, ioaddr + DCR7);
695
696 /* Check system status */ 686 /* Check system status */
697 if (db->cr5_data & 0x2000) { 687 if (db->cr5_data & 0x2000) {
698 /* system bus error happen */ 688 /* system bus error happen */
@@ -727,10 +717,9 @@ static irqreturn_t uli526x_interrupt(int irq, void *dev_id, struct pt_regs *regs
727 * Free TX resource after TX complete 717 * Free TX resource after TX complete
728 */ 718 */
729 719
730static void uli526x_free_tx_pkt(struct DEVICE *dev, struct uli526x_board_info * db) 720static void uli526x_free_tx_pkt(struct net_device *dev, struct uli526x_board_info * db)
731{ 721{
732 struct tx_desc *txptr; 722 struct tx_desc *txptr;
733// unsigned long ioaddr = dev->base_addr;
734 u32 tdes0; 723 u32 tdes0;
735 724
736 txptr = db->tx_remove_ptr; 725 txptr = db->tx_remove_ptr;
@@ -787,7 +776,7 @@ static void uli526x_free_tx_pkt(struct DEVICE *dev, struct uli526x_board_info *
787 * Receive the come packet and pass to upper layer 776 * Receive the come packet and pass to upper layer
788 */ 777 */
789 778
790static void uli526x_rx_packet(struct DEVICE *dev, struct uli526x_board_info * db) 779static void uli526x_rx_packet(struct net_device *dev, struct uli526x_board_info * db)
791{ 780{
792 struct rx_desc *rxptr; 781 struct rx_desc *rxptr;
793 struct sk_buff *skb; 782 struct sk_buff *skb;
@@ -871,7 +860,7 @@ static void uli526x_rx_packet(struct DEVICE *dev, struct uli526x_board_info * db
871 * Get statistics from driver. 860 * Get statistics from driver.
872 */ 861 */
873 862
874static struct net_device_stats * uli526x_get_stats(struct DEVICE *dev) 863static struct net_device_stats * uli526x_get_stats(struct net_device *dev)
875{ 864{
876 struct uli526x_board_info *db = netdev_priv(dev); 865 struct uli526x_board_info *db = netdev_priv(dev);
877 866
@@ -884,7 +873,7 @@ static struct net_device_stats * uli526x_get_stats(struct DEVICE *dev)
884 * Set ULI526X multicast address 873 * Set ULI526X multicast address
885 */ 874 */
886 875
887static void uli526x_set_filter_mode(struct DEVICE * dev) 876static void uli526x_set_filter_mode(struct net_device * dev)
888{ 877{
889 struct uli526x_board_info *db = dev->priv; 878 struct uli526x_board_info *db = dev->priv;
890 unsigned long flags; 879 unsigned long flags;
@@ -916,34 +905,26 @@ static void uli526x_set_filter_mode(struct DEVICE * dev)
916static void 905static void
917ULi_ethtool_gset(struct uli526x_board_info *db, struct ethtool_cmd *ecmd) 906ULi_ethtool_gset(struct uli526x_board_info *db, struct ethtool_cmd *ecmd)
918{ 907{
919 //struct e1000_hw *hw = &adapter->hw; 908 ecmd->supported = (SUPPORTED_10baseT_Half |
920 909 SUPPORTED_10baseT_Full |
921 { 910 SUPPORTED_100baseT_Half |
922 911 SUPPORTED_100baseT_Full |
923 ecmd->supported = (SUPPORTED_10baseT_Half | 912 SUPPORTED_Autoneg |
924 SUPPORTED_10baseT_Full | 913 SUPPORTED_MII);
925 SUPPORTED_100baseT_Half |
926 SUPPORTED_100baseT_Full |
927 SUPPORTED_Autoneg |
928 SUPPORTED_MII);
929 914
930 ecmd->advertising = (ADVERTISED_10baseT_Half | 915 ecmd->advertising = (ADVERTISED_10baseT_Half |
931 ADVERTISED_10baseT_Full | 916 ADVERTISED_10baseT_Full |
932 ADVERTISED_100baseT_Half | 917 ADVERTISED_100baseT_Half |
933 ADVERTISED_100baseT_Full | 918 ADVERTISED_100baseT_Full |
934 ADVERTISED_Autoneg | 919 ADVERTISED_Autoneg |
935 ADVERTISED_MII); 920 ADVERTISED_MII);
936 921
937 922
938 ecmd->port = PORT_MII; 923 ecmd->port = PORT_MII;
939 ecmd->phy_address = db->phy_addr; 924 ecmd->phy_address = db->phy_addr;
940 925
941 ecmd->transceiver = XCVR_EXTERNAL; 926 ecmd->transceiver = XCVR_EXTERNAL;
942 927
943
944 }
945
946
947 ecmd->speed = 10; 928 ecmd->speed = 10;
948 ecmd->duplex = DUPLEX_HALF; 929 ecmd->duplex = DUPLEX_HALF;
949 930
@@ -965,8 +946,6 @@ ULi_ethtool_gset(struct uli526x_board_info *db, struct ethtool_cmd *ecmd)
965 { 946 {
966 ecmd->autoneg = AUTONEG_ENABLE; 947 ecmd->autoneg = AUTONEG_ENABLE;
967 } 948 }
968
969
970} 949}
971 950
972static void netdev_get_drvinfo(struct net_device *dev, 951static void netdev_get_drvinfo(struct net_device *dev,
@@ -1022,7 +1001,7 @@ static void uli526x_timer(unsigned long data)
1022{ 1001{
1023 u32 tmp_cr8; 1002 u32 tmp_cr8;
1024 unsigned char tmp_cr12=0; 1003 unsigned char tmp_cr12=0;
1025 struct DEVICE *dev = (struct DEVICE *) data; 1004 struct net_device *dev = (struct net_device *) data;
1026 struct uli526x_board_info *db = netdev_priv(dev); 1005 struct uli526x_board_info *db = netdev_priv(dev);
1027 unsigned long flags; 1006 unsigned long flags;
1028 u8 TmpSpeed=10; 1007 u8 TmpSpeed=10;
@@ -1135,10 +1114,10 @@ static void uli526x_timer(unsigned long data)
1135 * Stop ULI526X board 1114 * Stop ULI526X board
1136 * Free Tx/Rx allocated memory 1115 * Free Tx/Rx allocated memory
1137 * Reset ULI526X board 1116 * Reset ULI526X board
1138 * Re-initilize ULI526X board 1117 * Re-initialize ULI526X board
1139 */ 1118 */
1140 1119
1141static void uli526x_dynamic_reset(struct DEVICE *dev) 1120static void uli526x_dynamic_reset(struct net_device *dev)
1142{ 1121{
1143 struct uli526x_board_info *db = netdev_priv(dev); 1122 struct uli526x_board_info *db = netdev_priv(dev);
1144 1123
@@ -1163,7 +1142,7 @@ static void uli526x_dynamic_reset(struct DEVICE *dev)
1163 db->init=1; 1142 db->init=1;
1164 db->wait_reset = 0; 1143 db->wait_reset = 0;
1165 1144
1166 /* Re-initilize ULI526X board */ 1145 /* Re-initialize ULI526X board */
1167 uli526x_init(dev); 1146 uli526x_init(dev);
1168 1147
1169 /* Restart upper layer interface */ 1148 /* Restart upper layer interface */
@@ -1273,7 +1252,7 @@ static void uli526x_descriptor_init(struct uli526x_board_info *db, unsigned long
1273 1252
1274/* 1253/*
1275 * Update CR6 value 1254 * Update CR6 value
1276 * Firstly stop ULI526X , then written value and start 1255 * Firstly stop ULI526X, then written value and start
1277 */ 1256 */
1278 1257
1279static void update_cr6(u32 cr6_data, unsigned long ioaddr) 1258static void update_cr6(u32 cr6_data, unsigned long ioaddr)
@@ -1286,10 +1265,10 @@ static void update_cr6(u32 cr6_data, unsigned long ioaddr)
1286 1265
1287/* 1266/*
1288 * Send a setup frame for M5261/M5263 1267 * Send a setup frame for M5261/M5263
1289 * This setup frame initilize ULI526X address filter mode 1268 * This setup frame initialize ULI526X address filter mode
1290 */ 1269 */
1291 1270
1292static void send_filter_frame(struct DEVICE *dev, int mc_cnt) 1271static void send_filter_frame(struct net_device *dev, int mc_cnt)
1293{ 1272{
1294 struct uli526x_board_info *db = netdev_priv(dev); 1273 struct uli526x_board_info *db = netdev_priv(dev);
1295 struct dev_mc_list *mcptr; 1274 struct dev_mc_list *mcptr;
@@ -1718,7 +1697,7 @@ MODULE_PARM_DESC(mode, "ULi M5261/M5263: Bit 0: 10/100Mbps, bit 2: duplex, bit 8
1718 1697
1719/* Description: 1698/* Description:
1720 * when user used insmod to add module, system invoked init_module() 1699 * when user used insmod to add module, system invoked init_module()
1721 * to initilize and register. 1700 * to register the services.
1722 */ 1701 */
1723 1702
1724static int __init uli526x_init_module(void) 1703static int __init uli526x_init_module(void)