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.c86
1 files changed, 42 insertions, 44 deletions
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c
index ef54ebeb29b..e4d50f0de93 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.
@@ -100,7 +100,6 @@
100 100
101/* Always include 'config.h' first in case the user wants to turn on 101/* Always include 'config.h' first in case the user wants to turn on
102 or override something. */ 102 or override something. */
103#include <linux/config.h>
104#include <linux/module.h> 103#include <linux/module.h>
105 104
106/* 105/*
@@ -164,12 +163,12 @@ static char version[] __initdata =
164/* First, a few definitions that the brave might change. 163/* First, a few definitions that the brave might change.
165 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..
166 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
167 the page window before probing 166 the page window before probing
168 Addr & 3 = Reset the page window and probe 167 Addr & 3 = Reset the page window and probe
169 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,
170 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
171 slots. */ 170 slots. */
172/* 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
173 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
174 the configuration of the Cirrus Eval board for this chip. */ 173 the configuration of the Cirrus Eval board for this chip. */
175#ifdef CONFIG_ARCH_CLPS7500 174#ifdef CONFIG_ARCH_CLPS7500
@@ -300,7 +299,7 @@ static int __init media_fn(char *str)
300 299
301__setup("cs89x0_media=", media_fn); 300__setup("cs89x0_media=", media_fn);
302 301
303 302
304/* 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.
305 If dev->base_addr == 0, probe all likely locations. 304 If dev->base_addr == 0, probe all likely locations.
306 If dev->base_addr == 1, always return failure. 305 If dev->base_addr == 1, always return failure.
@@ -631,7 +630,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular)
631 dev->base_addr); 630 dev->base_addr);
632 631
633 reset_chip(dev); 632 reset_chip(dev);
634 633
635 /* Here we read the current configuration of the chip. If there 634 /* Here we read the current configuration of the chip. If there
636 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
637 configuration, it should have been correctly setup by automatic 636 configuration, it should have been correctly setup by automatic
@@ -655,7 +654,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular)
655 cnt = (*confd++ & 0x00ff) >> 1; 654 cnt = (*confd++ & 0x00ff) >> 1;
656 while (--cnt > 0) { 655 while (--cnt > 0) {
657 __u16 j = *confd++; 656 __u16 j = *confd++;
658 657
659 switch (j & 0x0fff) { 658 switch (j & 0x0fff) {
660 case PP_IA: 659 case PP_IA:
661 for (i = 0; i < ETH_ALEN/2; i++) { 660 for (i = 0; i < ETH_ALEN/2; i++) {
@@ -671,7 +670,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular)
671 } else 670 } else
672#endif 671#endif
673 672
674 if ((readreg(dev, PP_SelfST) & (EEPROM_OK | EEPROM_PRESENT)) == 673 if ((readreg(dev, PP_SelfST) & (EEPROM_OK | EEPROM_PRESENT)) ==
675 (EEPROM_OK|EEPROM_PRESENT)) { 674 (EEPROM_OK|EEPROM_PRESENT)) {
676 /* Load the MAC. */ 675 /* Load the MAC. */
677 for (i=0; i < ETH_ALEN/2; i++) { 676 for (i=0; i < ETH_ALEN/2; i++) {
@@ -680,17 +679,17 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular)
680 dev->dev_addr[i*2] = Addr & 0xFF; 679 dev->dev_addr[i*2] = Addr & 0xFF;
681 dev->dev_addr[i*2+1] = Addr >> 8; 680 dev->dev_addr[i*2+1] = Addr >> 8;
682 } 681 }
683 682
684 /* Load the Adapter Configuration. 683 /* Load the Adapter Configuration.
685 Note: Barring any more specific information from some 684 Note: Barring any more specific information from some
686 other source (ie EEPROM+Schematics), we would not know 685 other source (ie EEPROM+Schematics), we would not know
687 how to operate a 10Base2 interface on the AUI port. 686 how to operate a 10Base2 interface on the AUI port.
688 However, since we do read the status of HCB1 and use 687 However, since we do read the status of HCB1 and use
689 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)
690 a BNC interface should work if the enable pin 689 a BNC interface should work if the enable pin
691 (dc/dc converter) is on HCB1. It will be called AUI 690 (dc/dc converter) is on HCB1. It will be called AUI
692 however. */ 691 however. */
693 692
694 lp->adapter_cnf = 0; 693 lp->adapter_cnf = 0;
695 i = readreg(dev, PP_LineCTL); 694 i = readreg(dev, PP_LineCTL);
696 /* Preserve the setting of the HCB1 pin. */ 695 /* Preserve the setting of the HCB1 pin. */
@@ -707,22 +706,22 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular)
707 lp->adapter_cnf |= A_CNF_AUI | A_CNF_MEDIA_AUI; 706 lp->adapter_cnf |= A_CNF_AUI | A_CNF_MEDIA_AUI;
708 /* Check if the card is in Auto mode. */ 707 /* Check if the card is in Auto mode. */
709 if ((i & (AUI_ONLY | AUTO_AUI_10BASET)) == AUTO_AUI_10BASET) 708 if ((i & (AUI_ONLY | AUTO_AUI_10BASET)) == AUTO_AUI_10BASET)
710 lp->adapter_cnf |= A_CNF_AUI | A_CNF_10B_T | 709 lp->adapter_cnf |= A_CNF_AUI | A_CNF_10B_T |
711 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;
712 711
713 if (net_debug > 1) 712 if (net_debug > 1)
714 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",
715 dev->name, i, lp->adapter_cnf); 714 dev->name, i, lp->adapter_cnf);
716 715
717 /* IRQ. Other chips already probe, see below. */ 716 /* IRQ. Other chips already probe, see below. */
718 if (lp->chip_type == CS8900) 717 if (lp->chip_type == CS8900)
719 lp->isa_config = readreg(dev, PP_CS8900_ISAINT) & INT_NO_MASK; 718 lp->isa_config = readreg(dev, PP_CS8900_ISAINT) & INT_NO_MASK;
720 719
721 printk( "[Cirrus EEPROM] "); 720 printk( "[Cirrus EEPROM] ");
722 } 721 }
723 722
724 printk("\n"); 723 printk("\n");
725 724
726 /* First check to see if an EEPROM is attached. */ 725 /* First check to see if an EEPROM is attached. */
727#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 */
728 if (1) { 727 if (1) {
@@ -737,13 +736,13 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular)
737 /* 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
738 at 0 in the EEPROM*/ 737 at 0 in the EEPROM*/
739 if ((readreg(dev, PP_SelfST) & (EEPROM_OK | EEPROM_PRESENT)) != 738 if ((readreg(dev, PP_SelfST) & (EEPROM_OK | EEPROM_PRESENT)) !=
740 (EEPROM_OK|EEPROM_PRESENT)) 739 (EEPROM_OK|EEPROM_PRESENT))
741 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");
742 741
743 } else { 742 } else {
744 /* This reads an extended EEPROM that is not documented 743 /* This reads an extended EEPROM that is not documented
745 in the CS8900 datasheet. */ 744 in the CS8900 datasheet. */
746 745
747 /* get transmission control word but keep the autonegotiation bits */ 746 /* get transmission control word but keep the autonegotiation bits */
748 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];
749 /* Store adapter configuration */ 748 /* Store adapter configuration */
@@ -811,7 +810,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular)
811 printk("\ncs89x0: invalid ISA interrupt number %d\n", i); 810 printk("\ncs89x0: invalid ISA interrupt number %d\n", i);
812 else 811 else
813 i = cs8900_irq_map[i]; 812 i = cs8900_irq_map[i];
814 813
815 lp->irq_map = CS8900_IRQ_MAP; /* fixed IRQ map for CS8900 */ 814 lp->irq_map = CS8900_IRQ_MAP; /* fixed IRQ map for CS8900 */
816 } else { 815 } else {
817 int irq_map_buff[IRQ_MAP_LEN/2]; 816 int irq_map_buff[IRQ_MAP_LEN/2];
@@ -876,7 +875,7 @@ out1:
876 return retval; 875 return retval;
877} 876}
878 877
879 878
880/********************************* 879/*********************************
881 * This page contains DMA routines 880 * This page contains DMA routines
882**********************************/ 881**********************************/
@@ -1065,14 +1064,14 @@ void __init reset_chip(struct net_device *dev)
1065 ; 1064 ;
1066} 1065}
1067 1066
1068 1067
1069static void 1068static void
1070control_dc_dc(struct net_device *dev, int on_not_off) 1069control_dc_dc(struct net_device *dev, int on_not_off)
1071{ 1070{
1072 struct net_local *lp = netdev_priv(dev); 1071 struct net_local *lp = netdev_priv(dev);
1073 unsigned int selfcontrol; 1072 unsigned int selfcontrol;
1074 int timenow = jiffies; 1073 int timenow = jiffies;
1075 /* control the DC to DC convertor in the SelfControl register. 1074 /* control the DC to DC convertor in the SelfControl register.
1076 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
1077 always be a DC to DC convertor. */ 1076 always be a DC to DC convertor. */
1078 1077
@@ -1241,7 +1240,7 @@ detect_bnc(struct net_device *dev)
1241 return DETECTED_NONE; 1240 return DETECTED_NONE;
1242} 1241}
1243 1242
1244 1243
1245static void 1244static void
1246write_irq(struct net_device *dev, int chip_type, int irq) 1245write_irq(struct net_device *dev, int chip_type, int irq)
1247{ 1246{
@@ -1545,7 +1544,7 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev)
1545 * Gasp! It hasn't. But that shouldn't happen since 1544 * Gasp! It hasn't. But that shouldn't happen since
1546 * 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.
1547 */ 1546 */
1548 1547
1549 spin_unlock_irq(&lp->lock); 1548 spin_unlock_irq(&lp->lock);
1550 if (net_debug) printk("cs89x0: Tx buffer not free!\n"); 1549 if (net_debug) printk("cs89x0: Tx buffer not free!\n");
1551 return 1; 1550 return 1;
@@ -1570,10 +1569,10 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev)
1570 1569
1571 return 0; 1570 return 0;
1572} 1571}
1573 1572
1574/* The typical workload of the driver: 1573/* The typical workload of the driver:
1575 Handle the network interface interrupts. */ 1574 Handle the network interface interrupts. */
1576 1575
1577static 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)
1578{ 1577{
1579 struct net_device *dev = dev_id; 1578 struct net_device *dev = dev_id;
@@ -1741,7 +1740,7 @@ net_close(struct net_device *dev)
1741#endif 1740#endif
1742 1741
1743 netif_stop_queue(dev); 1742 netif_stop_queue(dev);
1744 1743
1745 writereg(dev, PP_RxCFG, 0); 1744 writereg(dev, PP_RxCFG, 0);
1746 writereg(dev, PP_TxCFG, 0); 1745 writereg(dev, PP_TxCFG, 0);
1747 writereg(dev, PP_BufCFG, 0); 1746 writereg(dev, PP_BufCFG, 0);
@@ -1792,7 +1791,7 @@ static void set_multicast_list(struct net_device *dev)
1792 /* The multicast-accept list is initialized to accept-all, and we 1791 /* The multicast-accept list is initialized to accept-all, and we
1793 rely on higher-level filtering for now. */ 1792 rely on higher-level filtering for now. */
1794 lp->rx_mode = RX_MULTCAST_ACCEPT; 1793 lp->rx_mode = RX_MULTCAST_ACCEPT;
1795 } 1794 }
1796 else 1795 else
1797 lp->rx_mode = 0; 1796 lp->rx_mode = 0;
1798 1797
@@ -1834,8 +1833,8 @@ static int set_mac_address(struct net_device *dev, void *p)
1834static struct net_device *dev_cs89x0; 1833static struct net_device *dev_cs89x0;
1835 1834
1836/* 1835/*
1837 * 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
1838 * avoid breaking someone's startup scripts 1837 * avoid breaking someone's startup scripts
1839 */ 1838 */
1840 1839
1841static int io; 1840static int io;
@@ -1906,8 +1905,7 @@ MODULE_LICENSE("GPL");
1906 1905
1907*/ 1906*/
1908 1907
1909int 1908int __init init_module(void)
1910init_module(void)
1911{ 1909{
1912 struct net_device *dev = alloc_etherdev(sizeof(struct net_local)); 1910 struct net_device *dev = alloc_etherdev(sizeof(struct net_local));
1913 struct net_local *lp; 1911 struct net_local *lp;
@@ -1985,7 +1983,7 @@ cleanup_module(void)
1985 free_netdev(dev_cs89x0); 1983 free_netdev(dev_cs89x0);
1986} 1984}
1987#endif /* MODULE */ 1985#endif /* MODULE */
1988 1986
1989/* 1987/*
1990 * Local variables: 1988 * Local variables:
1991 * version-control: t 1989 * version-control: t