diff options
Diffstat (limited to 'drivers/net/cris')
-rw-r--r-- | drivers/net/cris/eth_v10.c | 225 |
1 files changed, 7 insertions, 218 deletions
diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c index 917b7b46f1a7..65d0a9103297 100644 --- a/drivers/net/cris/eth_v10.c +++ b/drivers/net/cris/eth_v10.c | |||
@@ -1,221 +1,10 @@ | |||
1 | /* $Id: ethernet.c,v 1.31 2004/10/18 14:49:03 starvik Exp $ | 1 | /* |
2 | * | ||
3 | * e100net.c: A network driver for the ETRAX 100LX network controller. | 2 | * e100net.c: A network driver for the ETRAX 100LX network controller. |
4 | * | 3 | * |
5 | * Copyright (c) 1998-2002 Axis Communications AB. | 4 | * Copyright (c) 1998-2002 Axis Communications AB. |
6 | * | 5 | * |
7 | * The outline of this driver comes from skeleton.c. | 6 | * The outline of this driver comes from skeleton.c. |
8 | * | 7 | * |
9 | * $Log: ethernet.c,v $ | ||
10 | * Revision 1.31 2004/10/18 14:49:03 starvik | ||
11 | * Use RX interrupt as random source | ||
12 | * | ||
13 | * Revision 1.30 2004/09/29 10:44:04 starvik | ||
14 | * Enabed MAC-address output again | ||
15 | * | ||
16 | * Revision 1.29 2004/08/24 07:14:05 starvik | ||
17 | * Make use of generic MDIO interface and constants. | ||
18 | * | ||
19 | * Revision 1.28 2004/08/20 09:37:11 starvik | ||
20 | * Added support for Intel LXT972A. Creds to Randy Scarborough. | ||
21 | * | ||
22 | * Revision 1.27 2004/08/16 12:37:22 starvik | ||
23 | * Merge of Linux 2.6.8 | ||
24 | * | ||
25 | * Revision 1.25 2004/06/21 10:29:57 starvik | ||
26 | * Merge of Linux 2.6.7 | ||
27 | * | ||
28 | * Revision 1.23 2004/06/09 05:29:22 starvik | ||
29 | * Avoid any race where R_DMA_CH1_FIRST is NULL (may trigger cache bug). | ||
30 | * | ||
31 | * Revision 1.22 2004/05/14 07:58:03 starvik | ||
32 | * Merge of changes from 2.4 | ||
33 | * | ||
34 | * Revision 1.20 2004/03/11 11:38:40 starvik | ||
35 | * Merge of Linux 2.6.4 | ||
36 | * | ||
37 | * Revision 1.18 2003/12/03 13:45:46 starvik | ||
38 | * Use hardware pad for short packets to prevent information leakage. | ||
39 | * | ||
40 | * Revision 1.17 2003/07/04 08:27:37 starvik | ||
41 | * Merge of Linux 2.5.74 | ||
42 | * | ||
43 | * Revision 1.16 2003/04/24 08:28:22 starvik | ||
44 | * New LED behaviour: LED off when no link | ||
45 | * | ||
46 | * Revision 1.15 2003/04/09 05:20:47 starvik | ||
47 | * Merge of Linux 2.5.67 | ||
48 | * | ||
49 | * Revision 1.13 2003/03/06 16:11:01 henriken | ||
50 | * Off by one error in group address register setting. | ||
51 | * | ||
52 | * Revision 1.12 2003/02/27 17:24:19 starvik | ||
53 | * Corrected Rev to Revision | ||
54 | * | ||
55 | * Revision 1.11 2003/01/24 09:53:21 starvik | ||
56 | * Oops. Initialize GA to 0, not to 1 | ||
57 | * | ||
58 | * Revision 1.10 2003/01/24 09:50:55 starvik | ||
59 | * Initialize GA_0 and GA_1 to 0 to avoid matching of unwanted packets | ||
60 | * | ||
61 | * Revision 1.9 2002/12/13 07:40:58 starvik | ||
62 | * Added basic ethtool interface | ||
63 | * Handled out of memory when allocating new buffers | ||
64 | * | ||
65 | * Revision 1.8 2002/12/11 13:13:57 starvik | ||
66 | * Added arch/ to v10 specific includes | ||
67 | * Added fix from Linux 2.4 in serial.c (flush_to_flip_buffer) | ||
68 | * | ||
69 | * Revision 1.7 2002/11/26 09:41:42 starvik | ||
70 | * Added e100_set_config (standard interface to set media type) | ||
71 | * Added protection against preemptive scheduling | ||
72 | * Added standard MII ioctls | ||
73 | * | ||
74 | * Revision 1.6 2002/11/21 07:18:18 starvik | ||
75 | * Timers must be initialized in 2.5.48 | ||
76 | * | ||
77 | * Revision 1.5 2002/11/20 11:56:11 starvik | ||
78 | * Merge of Linux 2.5.48 | ||
79 | * | ||
80 | * Revision 1.4 2002/11/18 07:26:46 starvik | ||
81 | * Linux 2.5 port of latest Linux 2.4 ethernet driver | ||
82 | * | ||
83 | * Revision 1.33 2002/10/02 20:16:17 hp | ||
84 | * SETF, SETS: Use underscored IO_x_ macros rather than incorrect token concatenation | ||
85 | * | ||
86 | * Revision 1.32 2002/09/16 06:05:58 starvik | ||
87 | * Align memory returned by dev_alloc_skb | ||
88 | * Moved handling of sent packets to interrupt to avoid reference counting problem | ||
89 | * | ||
90 | * Revision 1.31 2002/09/10 13:28:23 larsv | ||
91 | * Return -EINVAL for unknown ioctls to avoid confusing tools that tests | ||
92 | * for supported functionality by issuing special ioctls, i.e. wireless | ||
93 | * extensions. | ||
94 | * | ||
95 | * Revision 1.30 2002/05/07 18:50:08 johana | ||
96 | * Correct spelling in comments. | ||
97 | * | ||
98 | * Revision 1.29 2002/05/06 05:38:49 starvik | ||
99 | * Performance improvements: | ||
100 | * Large packets are not copied (breakpoint set to 256 bytes) | ||
101 | * The cache bug workaround is delayed until half of the receive list | ||
102 | * has been used | ||
103 | * Added transmit list | ||
104 | * Transmit interrupts are only enabled when transmit queue is full | ||
105 | * | ||
106 | * Revision 1.28.2.1 2002/04/30 08:15:51 starvik | ||
107 | * Performance improvements: | ||
108 | * Large packets are not copied (breakpoint set to 256 bytes) | ||
109 | * The cache bug workaround is delayed until half of the receive list | ||
110 | * has been used. | ||
111 | * Added transmit list | ||
112 | * Transmit interrupts are only enabled when transmit queue is full | ||
113 | * | ||
114 | * Revision 1.28 2002/04/22 11:47:21 johana | ||
115 | * Fix according to 2.4.19-pre7. time_after/time_before and | ||
116 | * missing end of comment. | ||
117 | * The patch has a typo for ethernet.c in e100_clear_network_leds(), | ||
118 | * that is fixed here. | ||
119 | * | ||
120 | * Revision 1.27 2002/04/12 11:55:11 bjornw | ||
121 | * Added TODO | ||
122 | * | ||
123 | * Revision 1.26 2002/03/15 17:11:02 bjornw | ||
124 | * Use prepare_rx_descriptor after the CPU has touched the receiving descs | ||
125 | * | ||
126 | * Revision 1.25 2002/03/08 13:07:53 bjornw | ||
127 | * Unnecessary spinlock removed | ||
128 | * | ||
129 | * Revision 1.24 2002/02/20 12:57:43 fredriks | ||
130 | * Replaced MIN() with min(). | ||
131 | * | ||
132 | * Revision 1.23 2002/02/20 10:58:14 fredriks | ||
133 | * Strip the Ethernet checksum (4 bytes) before forwarding a frame to upper layers. | ||
134 | * | ||
135 | * Revision 1.22 2002/01/30 07:48:22 matsfg | ||
136 | * Initiate R_NETWORK_TR_CTRL | ||
137 | * | ||
138 | * Revision 1.21 2001/11/23 11:54:49 starvik | ||
139 | * Added IFF_PROMISC and IFF_ALLMULTI handling in set_multicast_list | ||
140 | * Removed compiler warnings | ||
141 | * | ||
142 | * Revision 1.20 2001/11/12 19:26:00 pkj | ||
143 | * * Corrected e100_negotiate() to not assign half to current_duplex when | ||
144 | * it was supposed to compare them... | ||
145 | * * Cleaned up failure handling in e100_open(). | ||
146 | * * Fixed compiler warnings. | ||
147 | * | ||
148 | * Revision 1.19 2001/11/09 07:43:09 starvik | ||
149 | * Added full duplex support | ||
150 | * Added ioctl to set speed and duplex | ||
151 | * Clear LED timer only runs when LED is lit | ||
152 | * | ||
153 | * Revision 1.18 2001/10/03 14:40:43 jonashg | ||
154 | * Update rx_bytes counter. | ||
155 | * | ||
156 | * Revision 1.17 2001/06/11 12:43:46 olof | ||
157 | * Modified defines for network LED behavior | ||
158 | * | ||
159 | * Revision 1.16 2001/05/30 06:12:46 markusl | ||
160 | * TxDesc.next should not be set to NULL | ||
161 | * | ||
162 | * Revision 1.15 2001/05/29 10:27:04 markusl | ||
163 | * Updated after review remarks: | ||
164 | * +Use IO_EXTRACT | ||
165 | * +Handle underrun | ||
166 | * | ||
167 | * Revision 1.14 2001/05/29 09:20:14 jonashg | ||
168 | * Use driver name on printk output so one can tell which driver that complains. | ||
169 | * | ||
170 | * Revision 1.13 2001/05/09 12:35:59 johana | ||
171 | * Use DMA_NBR and IRQ_NBR defines from dma.h and irq.h | ||
172 | * | ||
173 | * Revision 1.12 2001/04/05 11:43:11 tobiasa | ||
174 | * Check dev before panic. | ||
175 | * | ||
176 | * Revision 1.11 2001/04/04 11:21:05 markusl | ||
177 | * Updated according to review remarks | ||
178 | * | ||
179 | * Revision 1.10 2001/03/26 16:03:06 bjornw | ||
180 | * Needs linux/config.h | ||
181 | * | ||
182 | * Revision 1.9 2001/03/19 14:47:48 pkj | ||
183 | * * Make sure there is always a pause after the network LEDs are | ||
184 | * changed so they will not look constantly lit during heavy traffic. | ||
185 | * * Always use HZ when setting times relative to jiffies. | ||
186 | * * Use LED_NETWORK_SET() when setting the network LEDs. | ||
187 | * | ||
188 | * Revision 1.8 2001/02/27 13:52:48 bjornw | ||
189 | * malloc.h -> slab.h | ||
190 | * | ||
191 | * Revision 1.7 2001/02/23 13:46:38 bjornw | ||
192 | * Spellling check | ||
193 | * | ||
194 | * Revision 1.6 2001/01/26 15:21:04 starvik | ||
195 | * Don't disable interrupts while reading MDIO registers (MDIO is slow) | ||
196 | * Corrected promiscuous mode | ||
197 | * Improved deallocation of IRQs ("ifconfig eth0 down" now works) | ||
198 | * | ||
199 | * Revision 1.5 2000/11/29 17:22:22 bjornw | ||
200 | * Get rid of the udword types legacy stuff | ||
201 | * | ||
202 | * Revision 1.4 2000/11/22 16:36:09 bjornw | ||
203 | * Please marketing by using the correct case when spelling Etrax. | ||
204 | * | ||
205 | * Revision 1.3 2000/11/21 16:43:04 bjornw | ||
206 | * Minor short->int change | ||
207 | * | ||
208 | * Revision 1.2 2000/11/08 14:27:57 bjornw | ||
209 | * 2.4 port | ||
210 | * | ||
211 | * Revision 1.1 2000/11/06 13:56:00 bjornw | ||
212 | * Verbatim copy of the 1.24 version of e100net.c from elinux | ||
213 | * | ||
214 | * Revision 1.24 2000/10/04 15:55:23 bjornw | ||
215 | * * Use virt_to_phys etc. for DMA addresses | ||
216 | * * Removed bogus CHECKSUM_UNNECESSARY | ||
217 | * | ||
218 | * | ||
219 | */ | 8 | */ |
220 | 9 | ||
221 | 10 | ||
@@ -244,7 +33,7 @@ | |||
244 | #include <linux/ethtool.h> | 33 | #include <linux/ethtool.h> |
245 | 34 | ||
246 | #include <asm/arch/svinto.h>/* DMA and register descriptions */ | 35 | #include <asm/arch/svinto.h>/* DMA and register descriptions */ |
247 | #include <asm/io.h> /* LED_* I/O functions */ | 36 | #include <asm/io.h> /* CRIS_LED_* I/O functions */ |
248 | #include <asm/irq.h> | 37 | #include <asm/irq.h> |
249 | #include <asm/dma.h> | 38 | #include <asm/dma.h> |
250 | #include <asm/system.h> | 39 | #include <asm/system.h> |
@@ -1899,18 +1688,18 @@ e100_set_network_leds(int active) | |||
1899 | if (!current_speed) { | 1688 | if (!current_speed) { |
1900 | /* Make LED red, link is down */ | 1689 | /* Make LED red, link is down */ |
1901 | #if defined(CONFIG_ETRAX_NETWORK_RED_ON_NO_CONNECTION) | 1690 | #if defined(CONFIG_ETRAX_NETWORK_RED_ON_NO_CONNECTION) |
1902 | LED_NETWORK_SET(LED_RED); | 1691 | CRIS_LED_NETWORK_SET(CRIS_LED_RED); |
1903 | #else | 1692 | #else |
1904 | LED_NETWORK_SET(LED_OFF); | 1693 | CRIS_LED_NETWORK_SET(CRIS_LED_OFF); |
1905 | #endif | 1694 | #endif |
1906 | } else if (light_leds) { | 1695 | } else if (light_leds) { |
1907 | if (current_speed == 10) { | 1696 | if (current_speed == 10) { |
1908 | LED_NETWORK_SET(LED_ORANGE); | 1697 | CRIS_LED_NETWORK_SET(CRIS_LED_ORANGE); |
1909 | } else { | 1698 | } else { |
1910 | LED_NETWORK_SET(LED_GREEN); | 1699 | CRIS_LED_NETWORK_SET(CRIS_LED_GREEN); |
1911 | } | 1700 | } |
1912 | } else { | 1701 | } else { |
1913 | LED_NETWORK_SET(LED_OFF); | 1702 | CRIS_LED_NETWORK_SET(CRIS_LED_OFF); |
1914 | } | 1703 | } |
1915 | } | 1704 | } |
1916 | 1705 | ||