aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cs89x0.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/cs89x0.c')
-rw-r--r--drivers/net/cs89x0.c82
1 files changed, 41 insertions, 41 deletions
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c
index 2dcca79b1f6a..e4d50f0de930 100644
--- a/drivers/net/cs89x0.c
+++ b/drivers/net/cs89x0.c
@@ -15,13 +15,13 @@
15 Changelog: 15 Changelog:
16 16
17 Mike Cruse : mcruse@cti-ltd.com 17 Mike Cruse : mcruse@cti-ltd.com
18 : Changes for Linux 2.0 compatibility. 18 : Changes for Linux 2.0 compatibility.
19 : Added dev_id parameter in net_interrupt(), 19 : Added dev_id parameter in net_interrupt(),
20 : request_irq() and free_irq(). Just NULL for now. 20 : request_irq() and free_irq(). Just NULL for now.
21 21
22 Mike Cruse : Added MOD_INC_USE_COUNT and MOD_DEC_USE_COUNT macros 22 Mike Cruse : Added MOD_INC_USE_COUNT and MOD_DEC_USE_COUNT macros
23 : in net_open() and net_close() so kerneld would know 23 : in net_open() and net_close() so kerneld would know
24 : that the module is in use and wouldn't eject the 24 : that the module is in use and wouldn't eject the
25 : driver prematurely. 25 : driver prematurely.
26 26
27 Mike Cruse : Rewrote init_module() and cleanup_module using 8390.c 27 Mike Cruse : Rewrote init_module() and cleanup_module using 8390.c
@@ -31,7 +31,7 @@
31 31
32 Russ Nelson : Jul 13 1998. Added RxOnly DMA support. 32 Russ Nelson : Jul 13 1998. Added RxOnly DMA support.
33 33
34 Melody Lee : Aug 10 1999. Changes for Linux 2.2.5 compatibility. 34 Melody Lee : Aug 10 1999. Changes for Linux 2.2.5 compatibility.
35 : email: ethernet@crystal.cirrus.com 35 : email: ethernet@crystal.cirrus.com
36 36
37 Alan Cox : Removed 1.2 support, added 2.1 extra counters. 37 Alan Cox : Removed 1.2 support, added 2.1 extra counters.
@@ -163,12 +163,12 @@ static char version[] __initdata =
163/* First, a few definitions that the brave might change. 163/* First, a few definitions that the brave might change.
164 A zero-terminated list of I/O addresses to be probed. Some special flags.. 164 A zero-terminated list of I/O addresses to be probed. Some special flags..
165 Addr & 1 = Read back the address port, look for signature and reset 165 Addr & 1 = Read back the address port, look for signature and reset
166 the page window before probing 166 the page window before probing
167 Addr & 3 = Reset the page window and probe 167 Addr & 3 = Reset the page window and probe
168 The CLPS eval board has the Cirrus chip at 0x80090300, in ARM IO space, 168 The CLPS eval board has the Cirrus chip at 0x80090300, in ARM IO space,
169 but it is possible that a Cirrus board could be plugged into the ISA 169 but it is possible that a Cirrus board could be plugged into the ISA
170 slots. */ 170 slots. */
171/* The cs8900 has 4 IRQ pins, software selectable. cs8900_irq_map maps 171/* The cs8900 has 4 IRQ pins, software selectable. cs8900_irq_map maps
172 them to system IRQ numbers. This mapping is card specific and is set to 172 them to system IRQ numbers. This mapping is card specific and is set to
173 the configuration of the Cirrus Eval board for this chip. */ 173 the configuration of the Cirrus Eval board for this chip. */
174#ifdef CONFIG_ARCH_CLPS7500 174#ifdef CONFIG_ARCH_CLPS7500
@@ -299,7 +299,7 @@ static int __init media_fn(char *str)
299 299
300__setup("cs89x0_media=", media_fn); 300__setup("cs89x0_media=", media_fn);
301 301
302 302
303/* Check for a network adaptor of this type, and return '0' iff one exists. 303/* Check for a network adaptor of this type, and return '0' iff one exists.
304 If dev->base_addr == 0, probe all likely locations. 304 If dev->base_addr == 0, probe all likely locations.
305 If dev->base_addr == 1, always return failure. 305 If dev->base_addr == 1, always return failure.
@@ -630,7 +630,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular)
630 dev->base_addr); 630 dev->base_addr);
631 631
632 reset_chip(dev); 632 reset_chip(dev);
633 633
634 /* Here we read the current configuration of the chip. If there 634 /* Here we read the current configuration of the chip. If there
635 is no Extended EEPROM then the idea is to not disturb the chip 635 is no Extended EEPROM then the idea is to not disturb the chip
636 configuration, it should have been correctly setup by automatic 636 configuration, it should have been correctly setup by automatic
@@ -654,7 +654,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular)
654 cnt = (*confd++ & 0x00ff) >> 1; 654 cnt = (*confd++ & 0x00ff) >> 1;
655 while (--cnt > 0) { 655 while (--cnt > 0) {
656 __u16 j = *confd++; 656 __u16 j = *confd++;
657 657
658 switch (j & 0x0fff) { 658 switch (j & 0x0fff) {
659 case PP_IA: 659 case PP_IA:
660 for (i = 0; i < ETH_ALEN/2; i++) { 660 for (i = 0; i < ETH_ALEN/2; i++) {
@@ -670,7 +670,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular)
670 } else 670 } else
671#endif 671#endif
672 672
673 if ((readreg(dev, PP_SelfST) & (EEPROM_OK | EEPROM_PRESENT)) == 673 if ((readreg(dev, PP_SelfST) & (EEPROM_OK | EEPROM_PRESENT)) ==
674 (EEPROM_OK|EEPROM_PRESENT)) { 674 (EEPROM_OK|EEPROM_PRESENT)) {
675 /* Load the MAC. */ 675 /* Load the MAC. */
676 for (i=0; i < ETH_ALEN/2; i++) { 676 for (i=0; i < ETH_ALEN/2; i++) {
@@ -679,17 +679,17 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular)
679 dev->dev_addr[i*2] = Addr & 0xFF; 679 dev->dev_addr[i*2] = Addr & 0xFF;
680 dev->dev_addr[i*2+1] = Addr >> 8; 680 dev->dev_addr[i*2+1] = Addr >> 8;
681 } 681 }
682 682
683 /* Load the Adapter Configuration. 683 /* Load the Adapter Configuration.
684 Note: Barring any more specific information from some 684 Note: Barring any more specific information from some
685 other source (ie EEPROM+Schematics), we would not know 685 other source (ie EEPROM+Schematics), we would not know
686 how to operate a 10Base2 interface on the AUI port. 686 how to operate a 10Base2 interface on the AUI port.
687 However, since we do read the status of HCB1 and use 687 However, since we do read the status of HCB1 and use
688 settings that always result in calls to control_dc_dc(dev,0) 688 settings that always result in calls to control_dc_dc(dev,0)
689 a BNC interface should work if the enable pin 689 a BNC interface should work if the enable pin
690 (dc/dc converter) is on HCB1. It will be called AUI 690 (dc/dc converter) is on HCB1. It will be called AUI
691 however. */ 691 however. */
692 692
693 lp->adapter_cnf = 0; 693 lp->adapter_cnf = 0;
694 i = readreg(dev, PP_LineCTL); 694 i = readreg(dev, PP_LineCTL);
695 /* Preserve the setting of the HCB1 pin. */ 695 /* Preserve the setting of the HCB1 pin. */
@@ -706,22 +706,22 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular)
706 lp->adapter_cnf |= A_CNF_AUI | A_CNF_MEDIA_AUI; 706 lp->adapter_cnf |= A_CNF_AUI | A_CNF_MEDIA_AUI;
707 /* Check if the card is in Auto mode. */ 707 /* Check if the card is in Auto mode. */
708 if ((i & (AUI_ONLY | AUTO_AUI_10BASET)) == AUTO_AUI_10BASET) 708 if ((i & (AUI_ONLY | AUTO_AUI_10BASET)) == AUTO_AUI_10BASET)
709 lp->adapter_cnf |= A_CNF_AUI | A_CNF_10B_T | 709 lp->adapter_cnf |= A_CNF_AUI | A_CNF_10B_T |
710 A_CNF_MEDIA_AUI | A_CNF_MEDIA_10B_T | A_CNF_MEDIA_AUTO; 710 A_CNF_MEDIA_AUI | A_CNF_MEDIA_10B_T | A_CNF_MEDIA_AUTO;
711 711
712 if (net_debug > 1) 712 if (net_debug > 1)
713 printk(KERN_INFO "%s: PP_LineCTL=0x%x, adapter_cnf=0x%x\n", 713 printk(KERN_INFO "%s: PP_LineCTL=0x%x, adapter_cnf=0x%x\n",
714 dev->name, i, lp->adapter_cnf); 714 dev->name, i, lp->adapter_cnf);
715 715
716 /* IRQ. Other chips already probe, see below. */ 716 /* IRQ. Other chips already probe, see below. */
717 if (lp->chip_type == CS8900) 717 if (lp->chip_type == CS8900)
718 lp->isa_config = readreg(dev, PP_CS8900_ISAINT) & INT_NO_MASK; 718 lp->isa_config = readreg(dev, PP_CS8900_ISAINT) & INT_NO_MASK;
719 719
720 printk( "[Cirrus EEPROM] "); 720 printk( "[Cirrus EEPROM] ");
721 } 721 }
722 722
723 printk("\n"); 723 printk("\n");
724 724
725 /* First check to see if an EEPROM is attached. */ 725 /* First check to see if an EEPROM is attached. */
726#ifdef CONFIG_SH_HICOSH4 /* no EEPROM on HiCO, don't hazzle with it here */ 726#ifdef CONFIG_SH_HICOSH4 /* no EEPROM on HiCO, don't hazzle with it here */
727 if (1) { 727 if (1) {
@@ -736,13 +736,13 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular)
736 /* Check if the chip was able to read its own configuration starting 736 /* Check if the chip was able to read its own configuration starting
737 at 0 in the EEPROM*/ 737 at 0 in the EEPROM*/
738 if ((readreg(dev, PP_SelfST) & (EEPROM_OK | EEPROM_PRESENT)) != 738 if ((readreg(dev, PP_SelfST) & (EEPROM_OK | EEPROM_PRESENT)) !=
739 (EEPROM_OK|EEPROM_PRESENT)) 739 (EEPROM_OK|EEPROM_PRESENT))
740 printk(KERN_WARNING "cs89x0: Extended EEPROM checksum bad and no Cirrus EEPROM, relying on command line\n"); 740 printk(KERN_WARNING "cs89x0: Extended EEPROM checksum bad and no Cirrus EEPROM, relying on command line\n");
741 741
742 } else { 742 } else {
743 /* This reads an extended EEPROM that is not documented 743 /* This reads an extended EEPROM that is not documented
744 in the CS8900 datasheet. */ 744 in the CS8900 datasheet. */
745 745
746 /* get transmission control word but keep the autonegotiation bits */ 746 /* get transmission control word but keep the autonegotiation bits */
747 if (!lp->auto_neg_cnf) lp->auto_neg_cnf = eeprom_buff[AUTO_NEG_CNF_OFFSET/2]; 747 if (!lp->auto_neg_cnf) lp->auto_neg_cnf = eeprom_buff[AUTO_NEG_CNF_OFFSET/2];
748 /* Store adapter configuration */ 748 /* Store adapter configuration */
@@ -810,7 +810,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular)
810 printk("\ncs89x0: invalid ISA interrupt number %d\n", i); 810 printk("\ncs89x0: invalid ISA interrupt number %d\n", i);
811 else 811 else
812 i = cs8900_irq_map[i]; 812 i = cs8900_irq_map[i];
813 813
814 lp->irq_map = CS8900_IRQ_MAP; /* fixed IRQ map for CS8900 */ 814 lp->irq_map = CS8900_IRQ_MAP; /* fixed IRQ map for CS8900 */
815 } else { 815 } else {
816 int irq_map_buff[IRQ_MAP_LEN/2]; 816 int irq_map_buff[IRQ_MAP_LEN/2];
@@ -875,7 +875,7 @@ out1:
875 return retval; 875 return retval;
876} 876}
877 877
878 878
879/********************************* 879/*********************************
880 * This page contains DMA routines 880 * This page contains DMA routines
881**********************************/ 881**********************************/
@@ -1064,14 +1064,14 @@ void __init reset_chip(struct net_device *dev)
1064 ; 1064 ;
1065} 1065}
1066 1066
1067 1067
1068static void 1068static void
1069control_dc_dc(struct net_device *dev, int on_not_off) 1069control_dc_dc(struct net_device *dev, int on_not_off)
1070{ 1070{
1071 struct net_local *lp = netdev_priv(dev); 1071 struct net_local *lp = netdev_priv(dev);
1072 unsigned int selfcontrol; 1072 unsigned int selfcontrol;
1073 int timenow = jiffies; 1073 int timenow = jiffies;
1074 /* control the DC to DC convertor in the SelfControl register. 1074 /* control the DC to DC convertor in the SelfControl register.
1075 Note: This is hooked up to a general purpose pin, might not 1075 Note: This is hooked up to a general purpose pin, might not
1076 always be a DC to DC convertor. */ 1076 always be a DC to DC convertor. */
1077 1077
@@ -1240,7 +1240,7 @@ detect_bnc(struct net_device *dev)
1240 return DETECTED_NONE; 1240 return DETECTED_NONE;
1241} 1241}
1242 1242
1243 1243
1244static void 1244static void
1245write_irq(struct net_device *dev, int chip_type, int irq) 1245write_irq(struct net_device *dev, int chip_type, int irq)
1246{ 1246{
@@ -1544,7 +1544,7 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev)
1544 * Gasp! It hasn't. But that shouldn't happen since 1544 * Gasp! It hasn't. But that shouldn't happen since
1545 * we're waiting for TxOk, so return 1 and requeue this packet. 1545 * we're waiting for TxOk, so return 1 and requeue this packet.
1546 */ 1546 */
1547 1547
1548 spin_unlock_irq(&lp->lock); 1548 spin_unlock_irq(&lp->lock);
1549 if (net_debug) printk("cs89x0: Tx buffer not free!\n"); 1549 if (net_debug) printk("cs89x0: Tx buffer not free!\n");
1550 return 1; 1550 return 1;
@@ -1569,10 +1569,10 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev)
1569 1569
1570 return 0; 1570 return 0;
1571} 1571}
1572 1572
1573/* The typical workload of the driver: 1573/* The typical workload of the driver:
1574 Handle the network interface interrupts. */ 1574 Handle the network interface interrupts. */
1575 1575
1576static irqreturn_t net_interrupt(int irq, void *dev_id, struct pt_regs * regs) 1576static irqreturn_t net_interrupt(int irq, void *dev_id, struct pt_regs * regs)
1577{ 1577{
1578 struct net_device *dev = dev_id; 1578 struct net_device *dev = dev_id;
@@ -1740,7 +1740,7 @@ net_close(struct net_device *dev)
1740#endif 1740#endif
1741 1741
1742 netif_stop_queue(dev); 1742 netif_stop_queue(dev);
1743 1743
1744 writereg(dev, PP_RxCFG, 0); 1744 writereg(dev, PP_RxCFG, 0);
1745 writereg(dev, PP_TxCFG, 0); 1745 writereg(dev, PP_TxCFG, 0);
1746 writereg(dev, PP_BufCFG, 0); 1746 writereg(dev, PP_BufCFG, 0);
@@ -1791,7 +1791,7 @@ static void set_multicast_list(struct net_device *dev)
1791 /* The multicast-accept list is initialized to accept-all, and we 1791 /* The multicast-accept list is initialized to accept-all, and we
1792 rely on higher-level filtering for now. */ 1792 rely on higher-level filtering for now. */
1793 lp->rx_mode = RX_MULTCAST_ACCEPT; 1793 lp->rx_mode = RX_MULTCAST_ACCEPT;
1794 } 1794 }
1795 else 1795 else
1796 lp->rx_mode = 0; 1796 lp->rx_mode = 0;
1797 1797
@@ -1833,8 +1833,8 @@ static int set_mac_address(struct net_device *dev, void *p)
1833static struct net_device *dev_cs89x0; 1833static struct net_device *dev_cs89x0;
1834 1834
1835/* 1835/*
1836 * Support the 'debug' module parm even if we're compiled for non-debug to 1836 * Support the 'debug' module parm even if we're compiled for non-debug to
1837 * avoid breaking someone's startup scripts 1837 * avoid breaking someone's startup scripts
1838 */ 1838 */
1839 1839
1840static int io; 1840static int io;
@@ -1983,7 +1983,7 @@ cleanup_module(void)
1983 free_netdev(dev_cs89x0); 1983 free_netdev(dev_cs89x0);
1984} 1984}
1985#endif /* MODULE */ 1985#endif /* MODULE */
1986 1986
1987/* 1987/*
1988 * Local variables: 1988 * Local variables:
1989 * version-control: t 1989 * version-control: t