···1-/* $Id: ethernet.c,v 1.31 2004/10/18 14:49:03 starvik Exp $2- *3 * e100net.c: A network driver for the ETRAX 100LX network controller.4 *5 * Copyright (c) 1998-2002 Axis Communications AB.6 *7 * The outline of this driver comes from skeleton.c.8- *9- * $Log: ethernet.c,v $10- * Revision 1.31 2004/10/18 14:49:03 starvik11- * Use RX interrupt as random source12- *13- * Revision 1.30 2004/09/29 10:44:04 starvik14- * Enabed MAC-address output again15- *16- * Revision 1.29 2004/08/24 07:14:05 starvik17- * Make use of generic MDIO interface and constants.18- *19- * Revision 1.28 2004/08/20 09:37:11 starvik20- * Added support for Intel LXT972A. Creds to Randy Scarborough.21- *22- * Revision 1.27 2004/08/16 12:37:22 starvik23- * Merge of Linux 2.6.824- *25- * Revision 1.25 2004/06/21 10:29:57 starvik26- * Merge of Linux 2.6.727- *28- * Revision 1.23 2004/06/09 05:29:22 starvik29- * 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 starvik32- * Merge of changes from 2.433- *34- * Revision 1.20 2004/03/11 11:38:40 starvik35- * Merge of Linux 2.6.436- *37- * Revision 1.18 2003/12/03 13:45:46 starvik38- * Use hardware pad for short packets to prevent information leakage.39- *40- * Revision 1.17 2003/07/04 08:27:37 starvik41- * Merge of Linux 2.5.7442- *43- * Revision 1.16 2003/04/24 08:28:22 starvik44- * New LED behaviour: LED off when no link45- *46- * Revision 1.15 2003/04/09 05:20:47 starvik47- * Merge of Linux 2.5.6748- *49- * Revision 1.13 2003/03/06 16:11:01 henriken50- * Off by one error in group address register setting.51- *52- * Revision 1.12 2003/02/27 17:24:19 starvik53- * Corrected Rev to Revision54- *55- * Revision 1.11 2003/01/24 09:53:21 starvik56- * Oops. Initialize GA to 0, not to 157- *58- * Revision 1.10 2003/01/24 09:50:55 starvik59- * Initialize GA_0 and GA_1 to 0 to avoid matching of unwanted packets60- *61- * Revision 1.9 2002/12/13 07:40:58 starvik62- * Added basic ethtool interface63- * Handled out of memory when allocating new buffers64- *65- * Revision 1.8 2002/12/11 13:13:57 starvik66- * Added arch/ to v10 specific includes67- * Added fix from Linux 2.4 in serial.c (flush_to_flip_buffer)68- *69- * Revision 1.7 2002/11/26 09:41:42 starvik70- * Added e100_set_config (standard interface to set media type)71- * Added protection against preemptive scheduling72- * Added standard MII ioctls73- *74- * Revision 1.6 2002/11/21 07:18:18 starvik75- * Timers must be initialized in 2.5.4876- *77- * Revision 1.5 2002/11/20 11:56:11 starvik78- * Merge of Linux 2.5.4879- *80- * Revision 1.4 2002/11/18 07:26:46 starvik81- * Linux 2.5 port of latest Linux 2.4 ethernet driver82- *83- * Revision 1.33 2002/10/02 20:16:17 hp84- * SETF, SETS: Use underscored IO_x_ macros rather than incorrect token concatenation85- *86- * Revision 1.32 2002/09/16 06:05:58 starvik87- * Align memory returned by dev_alloc_skb88- * Moved handling of sent packets to interrupt to avoid reference counting problem89- *90- * Revision 1.31 2002/09/10 13:28:23 larsv91- * Return -EINVAL for unknown ioctls to avoid confusing tools that tests92- * for supported functionality by issuing special ioctls, i.e. wireless93- * extensions.94- *95- * Revision 1.30 2002/05/07 18:50:08 johana96- * Correct spelling in comments.97- *98- * Revision 1.29 2002/05/06 05:38:49 starvik99- * 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 list102- * has been used103- * Added transmit list104- * Transmit interrupts are only enabled when transmit queue is full105- *106- * Revision 1.28.2.1 2002/04/30 08:15:51 starvik107- * 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 list110- * has been used.111- * Added transmit list112- * Transmit interrupts are only enabled when transmit queue is full113- *114- * Revision 1.28 2002/04/22 11:47:21 johana115- * Fix according to 2.4.19-pre7. time_after/time_before and116- * 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 bjornw121- * Added TODO122- *123- * Revision 1.26 2002/03/15 17:11:02 bjornw124- * Use prepare_rx_descriptor after the CPU has touched the receiving descs125- *126- * Revision 1.25 2002/03/08 13:07:53 bjornw127- * Unnecessary spinlock removed128- *129- * Revision 1.24 2002/02/20 12:57:43 fredriks130- * Replaced MIN() with min().131- *132- * Revision 1.23 2002/02/20 10:58:14 fredriks133- * Strip the Ethernet checksum (4 bytes) before forwarding a frame to upper layers.134- *135- * Revision 1.22 2002/01/30 07:48:22 matsfg136- * Initiate R_NETWORK_TR_CTRL137- *138- * Revision 1.21 2001/11/23 11:54:49 starvik139- * Added IFF_PROMISC and IFF_ALLMULTI handling in set_multicast_list140- * Removed compiler warnings141- *142- * Revision 1.20 2001/11/12 19:26:00 pkj143- * * Corrected e100_negotiate() to not assign half to current_duplex when144- * 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 starvik149- * Added full duplex support150- * Added ioctl to set speed and duplex151- * Clear LED timer only runs when LED is lit152- *153- * Revision 1.18 2001/10/03 14:40:43 jonashg154- * Update rx_bytes counter.155- *156- * Revision 1.17 2001/06/11 12:43:46 olof157- * Modified defines for network LED behavior158- *159- * Revision 1.16 2001/05/30 06:12:46 markusl160- * TxDesc.next should not be set to NULL161- *162- * Revision 1.15 2001/05/29 10:27:04 markusl163- * Updated after review remarks:164- * +Use IO_EXTRACT165- * +Handle underrun166- *167- * Revision 1.14 2001/05/29 09:20:14 jonashg168- * 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 johana171- * Use DMA_NBR and IRQ_NBR defines from dma.h and irq.h172- *173- * Revision 1.12 2001/04/05 11:43:11 tobiasa174- * Check dev before panic.175- *176- * Revision 1.11 2001/04/04 11:21:05 markusl177- * Updated according to review remarks178- *179- * Revision 1.10 2001/03/26 16:03:06 bjornw180- * Needs linux/config.h181- *182- * Revision 1.9 2001/03/19 14:47:48 pkj183- * * Make sure there is always a pause after the network LEDs are184- * 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 bjornw189- * malloc.h -> slab.h190- *191- * Revision 1.7 2001/02/23 13:46:38 bjornw192- * Spellling check193- *194- * Revision 1.6 2001/01/26 15:21:04 starvik195- * Don't disable interrupts while reading MDIO registers (MDIO is slow)196- * Corrected promiscuous mode197- * Improved deallocation of IRQs ("ifconfig eth0 down" now works)198- *199- * Revision 1.5 2000/11/29 17:22:22 bjornw200- * Get rid of the udword types legacy stuff201- *202- * Revision 1.4 2000/11/22 16:36:09 bjornw203- * Please marketing by using the correct case when spelling Etrax.204- *205- * Revision 1.3 2000/11/21 16:43:04 bjornw206- * Minor short->int change207- *208- * Revision 1.2 2000/11/08 14:27:57 bjornw209- * 2.4 port210- *211- * Revision 1.1 2000/11/06 13:56:00 bjornw212- * Verbatim copy of the 1.24 version of e100net.c from elinux213- *214- * Revision 1.24 2000/10/04 15:55:23 bjornw215- * * Use virt_to_phys etc. for DMA addresses216- * * Removed bogus CHECKSUM_UNNECESSARY217- *218 *219 */220···33#include <linux/ethtool.h>3435#include <asm/arch/svinto.h>/* DMA and register descriptions */36-#include <asm/io.h> /* LED_* I/O functions */37#include <asm/irq.h>38#include <asm/dma.h>39#include <asm/system.h>···1688 if (!current_speed) {1689 /* Make LED red, link is down */1690#if defined(CONFIG_ETRAX_NETWORK_RED_ON_NO_CONNECTION)1691- LED_NETWORK_SET(LED_RED);1692#else1693- LED_NETWORK_SET(LED_OFF);1694#endif1695 } else if (light_leds) {1696 if (current_speed == 10) {1697- LED_NETWORK_SET(LED_ORANGE);1698 } else {1699- LED_NETWORK_SET(LED_GREEN);1700 }1701 } else {1702- LED_NETWORK_SET(LED_OFF);1703 }1704}1705
···1+/*02 * e100net.c: A network driver for the ETRAX 100LX network controller.3 *4 * Copyright (c) 1998-2002 Axis Communications AB.5 *6 * The outline of this driver comes from skeleton.c.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007 *8 */9···244#include <linux/ethtool.h>245246#include <asm/arch/svinto.h>/* DMA and register descriptions */247+#include <asm/io.h> /* CRIS_LED_* I/O functions */248#include <asm/irq.h>249#include <asm/dma.h>250#include <asm/system.h>···1899 if (!current_speed) {1900 /* Make LED red, link is down */1901#if defined(CONFIG_ETRAX_NETWORK_RED_ON_NO_CONNECTION)1902+ CRIS_LED_NETWORK_SET(CRIS_LED_RED);1903#else1904+ CRIS_LED_NETWORK_SET(CRIS_LED_OFF);1905#endif1906 } else if (light_leds) {1907 if (current_speed == 10) {1908+ CRIS_LED_NETWORK_SET(CRIS_LED_ORANGE);1909 } else {1910+ CRIS_LED_NETWORK_SET(CRIS_LED_GREEN);1911 }1912 } else {1913+ CRIS_LED_NETWORK_SET(CRIS_LED_OFF);1914 }1915}1916