···11-/* $Id: ethernet.c,v 1.31 2004/10/18 14:49:03 starvik Exp $22- *11+/*32 * e100net.c: A network driver for the ETRAX 100LX network controller.43 *54 * Copyright (c) 1998-2002 Axis Communications AB.65 *76 * The outline of this driver comes from skeleton.c.88- *99- * $Log: ethernet.c,v $1010- * Revision 1.31 2004/10/18 14:49:03 starvik1111- * Use RX interrupt as random source1212- *1313- * Revision 1.30 2004/09/29 10:44:04 starvik1414- * Enabed MAC-address output again1515- *1616- * Revision 1.29 2004/08/24 07:14:05 starvik1717- * Make use of generic MDIO interface and constants.1818- *1919- * Revision 1.28 2004/08/20 09:37:11 starvik2020- * Added support for Intel LXT972A. Creds to Randy Scarborough.2121- *2222- * Revision 1.27 2004/08/16 12:37:22 starvik2323- * Merge of Linux 2.6.82424- *2525- * Revision 1.25 2004/06/21 10:29:57 starvik2626- * Merge of Linux 2.6.72727- *2828- * Revision 1.23 2004/06/09 05:29:22 starvik2929- * Avoid any race where R_DMA_CH1_FIRST is NULL (may trigger cache bug).3030- *3131- * Revision 1.22 2004/05/14 07:58:03 starvik3232- * Merge of changes from 2.43333- *3434- * Revision 1.20 2004/03/11 11:38:40 starvik3535- * Merge of Linux 2.6.43636- *3737- * Revision 1.18 2003/12/03 13:45:46 starvik3838- * Use hardware pad for short packets to prevent information leakage.3939- *4040- * Revision 1.17 2003/07/04 08:27:37 starvik4141- * Merge of Linux 2.5.744242- *4343- * Revision 1.16 2003/04/24 08:28:22 starvik4444- * New LED behaviour: LED off when no link4545- *4646- * Revision 1.15 2003/04/09 05:20:47 starvik4747- * Merge of Linux 2.5.674848- *4949- * Revision 1.13 2003/03/06 16:11:01 henriken5050- * Off by one error in group address register setting.5151- *5252- * Revision 1.12 2003/02/27 17:24:19 starvik5353- * Corrected Rev to Revision5454- *5555- * Revision 1.11 2003/01/24 09:53:21 starvik5656- * Oops. Initialize GA to 0, not to 15757- *5858- * Revision 1.10 2003/01/24 09:50:55 starvik5959- * Initialize GA_0 and GA_1 to 0 to avoid matching of unwanted packets6060- *6161- * Revision 1.9 2002/12/13 07:40:58 starvik6262- * Added basic ethtool interface6363- * Handled out of memory when allocating new buffers6464- *6565- * Revision 1.8 2002/12/11 13:13:57 starvik6666- * Added arch/ to v10 specific includes6767- * Added fix from Linux 2.4 in serial.c (flush_to_flip_buffer)6868- *6969- * Revision 1.7 2002/11/26 09:41:42 starvik7070- * Added e100_set_config (standard interface to set media type)7171- * Added protection against preemptive scheduling7272- * Added standard MII ioctls7373- *7474- * Revision 1.6 2002/11/21 07:18:18 starvik7575- * Timers must be initialized in 2.5.487676- *7777- * Revision 1.5 2002/11/20 11:56:11 starvik7878- * Merge of Linux 2.5.487979- *8080- * Revision 1.4 2002/11/18 07:26:46 starvik8181- * Linux 2.5 port of latest Linux 2.4 ethernet driver8282- *8383- * Revision 1.33 2002/10/02 20:16:17 hp8484- * SETF, SETS: Use underscored IO_x_ macros rather than incorrect token concatenation8585- *8686- * Revision 1.32 2002/09/16 06:05:58 starvik8787- * Align memory returned by dev_alloc_skb8888- * Moved handling of sent packets to interrupt to avoid reference counting problem8989- *9090- * Revision 1.31 2002/09/10 13:28:23 larsv9191- * Return -EINVAL for unknown ioctls to avoid confusing tools that tests9292- * for supported functionality by issuing special ioctls, i.e. wireless9393- * extensions.9494- *9595- * Revision 1.30 2002/05/07 18:50:08 johana9696- * Correct spelling in comments.9797- *9898- * Revision 1.29 2002/05/06 05:38:49 starvik9999- * Performance improvements:100100- * Large packets are not copied (breakpoint set to 256 bytes)101101- * The cache bug workaround is delayed until half of the receive list102102- * has been used103103- * Added transmit list104104- * Transmit interrupts are only enabled when transmit queue is full105105- *106106- * Revision 1.28.2.1 2002/04/30 08:15:51 starvik107107- * Performance improvements:108108- * Large packets are not copied (breakpoint set to 256 bytes)109109- * The cache bug workaround is delayed until half of the receive list110110- * has been used.111111- * Added transmit list112112- * Transmit interrupts are only enabled when transmit queue is full113113- *114114- * Revision 1.28 2002/04/22 11:47:21 johana115115- * Fix according to 2.4.19-pre7. time_after/time_before and116116- * missing end of comment.117117- * The patch has a typo for ethernet.c in e100_clear_network_leds(),118118- * that is fixed here.119119- *120120- * Revision 1.27 2002/04/12 11:55:11 bjornw121121- * Added TODO122122- *123123- * Revision 1.26 2002/03/15 17:11:02 bjornw124124- * Use prepare_rx_descriptor after the CPU has touched the receiving descs125125- *126126- * Revision 1.25 2002/03/08 13:07:53 bjornw127127- * Unnecessary spinlock removed128128- *129129- * Revision 1.24 2002/02/20 12:57:43 fredriks130130- * Replaced MIN() with min().131131- *132132- * Revision 1.23 2002/02/20 10:58:14 fredriks133133- * Strip the Ethernet checksum (4 bytes) before forwarding a frame to upper layers.134134- *135135- * Revision 1.22 2002/01/30 07:48:22 matsfg136136- * Initiate R_NETWORK_TR_CTRL137137- *138138- * Revision 1.21 2001/11/23 11:54:49 starvik139139- * Added IFF_PROMISC and IFF_ALLMULTI handling in set_multicast_list140140- * Removed compiler warnings141141- *142142- * Revision 1.20 2001/11/12 19:26:00 pkj143143- * * Corrected e100_negotiate() to not assign half to current_duplex when144144- * it was supposed to compare them...145145- * * Cleaned up failure handling in e100_open().146146- * * Fixed compiler warnings.147147- *148148- * Revision 1.19 2001/11/09 07:43:09 starvik149149- * Added full duplex support150150- * Added ioctl to set speed and duplex151151- * Clear LED timer only runs when LED is lit152152- *153153- * Revision 1.18 2001/10/03 14:40:43 jonashg154154- * Update rx_bytes counter.155155- *156156- * Revision 1.17 2001/06/11 12:43:46 olof157157- * Modified defines for network LED behavior158158- *159159- * Revision 1.16 2001/05/30 06:12:46 markusl160160- * TxDesc.next should not be set to NULL161161- *162162- * Revision 1.15 2001/05/29 10:27:04 markusl163163- * Updated after review remarks:164164- * +Use IO_EXTRACT165165- * +Handle underrun166166- *167167- * Revision 1.14 2001/05/29 09:20:14 jonashg168168- * Use driver name on printk output so one can tell which driver that complains.169169- *170170- * Revision 1.13 2001/05/09 12:35:59 johana171171- * Use DMA_NBR and IRQ_NBR defines from dma.h and irq.h172172- *173173- * Revision 1.12 2001/04/05 11:43:11 tobiasa174174- * Check dev before panic.175175- *176176- * Revision 1.11 2001/04/04 11:21:05 markusl177177- * Updated according to review remarks178178- *179179- * Revision 1.10 2001/03/26 16:03:06 bjornw180180- * Needs linux/config.h181181- *182182- * Revision 1.9 2001/03/19 14:47:48 pkj183183- * * Make sure there is always a pause after the network LEDs are184184- * changed so they will not look constantly lit during heavy traffic.185185- * * Always use HZ when setting times relative to jiffies.186186- * * Use LED_NETWORK_SET() when setting the network LEDs.187187- *188188- * Revision 1.8 2001/02/27 13:52:48 bjornw189189- * malloc.h -> slab.h190190- *191191- * Revision 1.7 2001/02/23 13:46:38 bjornw192192- * Spellling check193193- *194194- * Revision 1.6 2001/01/26 15:21:04 starvik195195- * Don't disable interrupts while reading MDIO registers (MDIO is slow)196196- * Corrected promiscuous mode197197- * Improved deallocation of IRQs ("ifconfig eth0 down" now works)198198- *199199- * Revision 1.5 2000/11/29 17:22:22 bjornw200200- * Get rid of the udword types legacy stuff201201- *202202- * Revision 1.4 2000/11/22 16:36:09 bjornw203203- * Please marketing by using the correct case when spelling Etrax.204204- *205205- * Revision 1.3 2000/11/21 16:43:04 bjornw206206- * Minor short->int change207207- *208208- * Revision 1.2 2000/11/08 14:27:57 bjornw209209- * 2.4 port210210- *211211- * Revision 1.1 2000/11/06 13:56:00 bjornw212212- * Verbatim copy of the 1.24 version of e100net.c from elinux213213- *214214- * Revision 1.24 2000/10/04 15:55:23 bjornw215215- * * Use virt_to_phys etc. for DMA addresses216216- * * Removed bogus CHECKSUM_UNNECESSARY217217- *2187 *2198 */2209···33244#include <linux/ethtool.h>3424535246#include <asm/arch/svinto.h>/* DMA and register descriptions */3636-#include <asm/io.h> /* LED_* I/O functions */247247+#include <asm/io.h> /* CRIS_LED_* I/O functions */37248#include <asm/irq.h>38249#include <asm/dma.h>39250#include <asm/system.h>···16881899 if (!current_speed) {16891900 /* Make LED red, link is down */16901901#if defined(CONFIG_ETRAX_NETWORK_RED_ON_NO_CONNECTION)16911691- LED_NETWORK_SET(LED_RED);19021902+ CRIS_LED_NETWORK_SET(CRIS_LED_RED);16921903#else16931693- LED_NETWORK_SET(LED_OFF);19041904+ CRIS_LED_NETWORK_SET(CRIS_LED_OFF);16941905#endif16951906 } else if (light_leds) {16961907 if (current_speed == 10) {16971697- LED_NETWORK_SET(LED_ORANGE);19081908+ CRIS_LED_NETWORK_SET(CRIS_LED_ORANGE);16981909 } else {16991699- LED_NETWORK_SET(LED_GREEN);19101910+ CRIS_LED_NETWORK_SET(CRIS_LED_GREEN);17001911 }17011912 } else {17021702- LED_NETWORK_SET(LED_OFF);19131913+ CRIS_LED_NETWORK_SET(CRIS_LED_OFF);17031914 }17041915}17051916