Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
sunlance.c File Reference
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/fcntl.h>
#include <linux/interrupt.h>
#include <linux/ioport.h>
#include <linux/in.h>
#include <linux/string.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/crc32.h>
#include <linux/errno.h>
#include <linux/socket.h>
#include <linux/route.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/ethtool.h>
#include <linux/bitops.h>
#include <linux/dma-mapping.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/gfp.h>
#include <asm/io.h>
#include <asm/dma.h>
#include <asm/pgtable.h>
#include <asm/byteorder.h>
#include <asm/idprom.h>
#include <asm/prom.h>
#include <asm/auxio.h>
#include <asm/irq.h>

Go to the source code of this file.

Data Structures

struct  lance_rx_desc
 
struct  lance_tx_desc
 
struct  lance_init_block
 
struct  lance_private
 

Macros

#define DRV_NAME   "sunlance"
 
#define DRV_VERSION   "2.02"
 
#define DRV_RELDATE   "8/24/03"
 
#define DRV_AUTHOR   "Miguel de Icaza (miguel@nuclecu.unam.mx)"
 
#define LANCE_LOG_TX_BUFFERS   4
 
#define LANCE_LOG_RX_BUFFERS   4
 
#define LE_CSR0   0
 
#define LE_CSR1   1
 
#define LE_CSR2   2
 
#define LE_CSR3   3
 
#define LE_MO_PROM   0x8000 /* Enable promiscuous mode */
 
#define LE_C0_ERR   0x8000 /* Error: set if BAB, SQE, MISS or ME is set */
 
#define LE_C0_BABL   0x4000 /* BAB: Babble: tx timeout. */
 
#define LE_C0_CERR   0x2000 /* SQE: Signal quality error */
 
#define LE_C0_MISS   0x1000 /* MISS: Missed a packet */
 
#define LE_C0_MERR   0x0800 /* ME: Memory error */
 
#define LE_C0_RINT   0x0400 /* Received interrupt */
 
#define LE_C0_TINT   0x0200 /* Transmitter Interrupt */
 
#define LE_C0_IDON   0x0100 /* IFIN: Init finished. */
 
#define LE_C0_INTR   0x0080 /* Interrupt or error */
 
#define LE_C0_INEA   0x0040 /* Interrupt enable */
 
#define LE_C0_RXON   0x0020 /* Receiver on */
 
#define LE_C0_TXON   0x0010 /* Transmitter on */
 
#define LE_C0_TDMD   0x0008 /* Transmitter demand */
 
#define LE_C0_STOP   0x0004 /* Stop the card */
 
#define LE_C0_STRT   0x0002 /* Start the card */
 
#define LE_C0_INIT   0x0001 /* Init the card */
 
#define LE_C3_BSWP   0x4 /* SWAP */
 
#define LE_C3_ACON   0x2 /* ALE Control */
 
#define LE_C3_BCON   0x1 /* Byte control */
 
#define LE_R1_OWN   0x80 /* Who owns the entry */
 
#define LE_R1_ERR   0x40 /* Error: if FRA, OFL, CRC or BUF is set */
 
#define LE_R1_FRA   0x20 /* FRA: Frame error */
 
#define LE_R1_OFL   0x10 /* OFL: Frame overflow */
 
#define LE_R1_CRC   0x08 /* CRC error */
 
#define LE_R1_BUF   0x04 /* BUF: Buffer error */
 
#define LE_R1_SOP   0x02 /* Start of packet */
 
#define LE_R1_EOP   0x01 /* End of packet */
 
#define LE_R1_POK   0x03 /* Packet is complete: SOP + EOP */
 
#define LE_T1_OWN   0x80 /* Lance owns the packet */
 
#define LE_T1_ERR   0x40 /* Error summary */
 
#define LE_T1_EMORE   0x10 /* Error: more than one retry needed */
 
#define LE_T1_EONE   0x08 /* Error: one retry needed */
 
#define LE_T1_EDEF   0x04 /* Error: deferred */
 
#define LE_T1_SOP   0x02 /* Start of packet */
 
#define LE_T1_EOP   0x01 /* End of packet */
 
#define LE_T1_POK   0x03 /* Packet is complete: SOP + EOP */
 
#define LE_T3_BUF   0x8000 /* Buffer error */
 
#define LE_T3_UFL   0x4000 /* Error underflow */
 
#define LE_T3_LCOL   0x1000 /* Error late collision */
 
#define LE_T3_CLOS   0x0800 /* Error carrier loss */
 
#define LE_T3_RTY   0x0400 /* Error retry */
 
#define LE_T3_TDR   0x03ff /* Time Domain Reflectometry counter */
 
#define TX_RING_SIZE   (1 << (LANCE_LOG_TX_BUFFERS))
 
#define TX_RING_MOD_MASK   (TX_RING_SIZE - 1)
 
#define TX_RING_LEN_BITS   ((LANCE_LOG_TX_BUFFERS) << 29)
 
#define TX_NEXT(__x)   (((__x)+1) & TX_RING_MOD_MASK)
 
#define RX_RING_SIZE   (1 << (LANCE_LOG_RX_BUFFERS))
 
#define RX_RING_MOD_MASK   (RX_RING_SIZE - 1)
 
#define RX_RING_LEN_BITS   ((LANCE_LOG_RX_BUFFERS) << 29)
 
#define RX_NEXT(__x)   (((__x)+1) & RX_RING_MOD_MASK)
 
#define PKT_BUF_SZ   1544
 
#define RX_BUFF_SIZE   PKT_BUF_SZ
 
#define TX_BUFF_SIZE   PKT_BUF_SZ
 
#define libdesc_offset(rt, elem)   ((__u32)(((unsigned long)(&(((struct lance_init_block *)0)->rt[elem])))))
 
#define libbuff_offset(rt, elem)   ((__u32)(((unsigned long)(&(((struct lance_init_block *)0)->rt[elem][0])))))
 
#define TX_BUFFS_AVAIL
 
#define RDP   0x00UL /* register data port */
 
#define RAP   0x02UL /* register address port */
 
#define LANCE_REG_SIZE   0x04UL
 
#define STOP_LANCE(__lp)
 
#define LANCE_ADDR(x)   ((long)(x) & ~0xff000000)
 

Functions

 MODULE_VERSION (DRV_VERSION)
 
 MODULE_AUTHOR (DRV_AUTHOR)
 
 MODULE_DESCRIPTION ("Sun Lance ethernet driver")
 
 MODULE_LICENSE ("GPL")
 
 MODULE_DEVICE_TABLE (of, sunlance_sbus_match)
 
 module_platform_driver (sunlance_sbus_driver)
 

Variables

int sparc_lance_debug = 2
 

Macro Definition Documentation

#define DRV_AUTHOR   "Miguel de Icaza (miguel@nuclecu.unam.mx)"

Definition at line 110 of file sunlance.c.

#define DRV_NAME   "sunlance"

Definition at line 107 of file sunlance.c.

#define DRV_RELDATE   "8/24/03"

Definition at line 109 of file sunlance.c.

#define DRV_VERSION   "2.02"

Definition at line 108 of file sunlance.c.

#define LANCE_ADDR (   x)    ((long)(x) & ~0xff000000)

Definition at line 297 of file sunlance.c.

#define LANCE_LOG_RX_BUFFERS   4

Definition at line 123 of file sunlance.c.

#define LANCE_LOG_TX_BUFFERS   4

Definition at line 122 of file sunlance.c.

#define LANCE_REG_SIZE   0x04UL

Definition at line 279 of file sunlance.c.

#define LE_C0_BABL   0x4000 /* BAB: Babble: tx timeout. */

Definition at line 134 of file sunlance.c.

#define LE_C0_CERR   0x2000 /* SQE: Signal quality error */

Definition at line 135 of file sunlance.c.

#define LE_C0_ERR   0x8000 /* Error: set if BAB, SQE, MISS or ME is set */

Definition at line 133 of file sunlance.c.

#define LE_C0_IDON   0x0100 /* IFIN: Init finished. */

Definition at line 140 of file sunlance.c.

#define LE_C0_INEA   0x0040 /* Interrupt enable */

Definition at line 142 of file sunlance.c.

#define LE_C0_INIT   0x0001 /* Init the card */

Definition at line 148 of file sunlance.c.

#define LE_C0_INTR   0x0080 /* Interrupt or error */

Definition at line 141 of file sunlance.c.

#define LE_C0_MERR   0x0800 /* ME: Memory error */

Definition at line 137 of file sunlance.c.

#define LE_C0_MISS   0x1000 /* MISS: Missed a packet */

Definition at line 136 of file sunlance.c.

#define LE_C0_RINT   0x0400 /* Received interrupt */

Definition at line 138 of file sunlance.c.

#define LE_C0_RXON   0x0020 /* Receiver on */

Definition at line 143 of file sunlance.c.

#define LE_C0_STOP   0x0004 /* Stop the card */

Definition at line 146 of file sunlance.c.

#define LE_C0_STRT   0x0002 /* Start the card */

Definition at line 147 of file sunlance.c.

#define LE_C0_TDMD   0x0008 /* Transmitter demand */

Definition at line 145 of file sunlance.c.

#define LE_C0_TINT   0x0200 /* Transmitter Interrupt */

Definition at line 139 of file sunlance.c.

#define LE_C0_TXON   0x0010 /* Transmitter on */

Definition at line 144 of file sunlance.c.

#define LE_C3_ACON   0x2 /* ALE Control */

Definition at line 151 of file sunlance.c.

#define LE_C3_BCON   0x1 /* Byte control */

Definition at line 152 of file sunlance.c.

#define LE_C3_BSWP   0x4 /* SWAP */

Definition at line 150 of file sunlance.c.

#define LE_CSR0   0

Definition at line 126 of file sunlance.c.

#define LE_CSR1   1

Definition at line 127 of file sunlance.c.

#define LE_CSR2   2

Definition at line 128 of file sunlance.c.

#define LE_CSR3   3

Definition at line 129 of file sunlance.c.

#define LE_MO_PROM   0x8000 /* Enable promiscuous mode */

Definition at line 131 of file sunlance.c.

#define LE_R1_BUF   0x04 /* BUF: Buffer error */

Definition at line 160 of file sunlance.c.

#define LE_R1_CRC   0x08 /* CRC error */

Definition at line 159 of file sunlance.c.

#define LE_R1_EOP   0x01 /* End of packet */

Definition at line 162 of file sunlance.c.

#define LE_R1_ERR   0x40 /* Error: if FRA, OFL, CRC or BUF is set */

Definition at line 156 of file sunlance.c.

#define LE_R1_FRA   0x20 /* FRA: Frame error */

Definition at line 157 of file sunlance.c.

#define LE_R1_OFL   0x10 /* OFL: Frame overflow */

Definition at line 158 of file sunlance.c.

#define LE_R1_OWN   0x80 /* Who owns the entry */

Definition at line 155 of file sunlance.c.

#define LE_R1_POK   0x03 /* Packet is complete: SOP + EOP */

Definition at line 163 of file sunlance.c.

#define LE_R1_SOP   0x02 /* Start of packet */

Definition at line 161 of file sunlance.c.

#define LE_T1_EDEF   0x04 /* Error: deferred */

Definition at line 169 of file sunlance.c.

#define LE_T1_EMORE   0x10 /* Error: more than one retry needed */

Definition at line 167 of file sunlance.c.

#define LE_T1_EONE   0x08 /* Error: one retry needed */

Definition at line 168 of file sunlance.c.

#define LE_T1_EOP   0x01 /* End of packet */

Definition at line 171 of file sunlance.c.

#define LE_T1_ERR   0x40 /* Error summary */

Definition at line 166 of file sunlance.c.

#define LE_T1_OWN   0x80 /* Lance owns the packet */

Definition at line 165 of file sunlance.c.

#define LE_T1_POK   0x03 /* Packet is complete: SOP + EOP */

Definition at line 172 of file sunlance.c.

#define LE_T1_SOP   0x02 /* Start of packet */

Definition at line 170 of file sunlance.c.

#define LE_T3_BUF   0x8000 /* Buffer error */

Definition at line 174 of file sunlance.c.

#define LE_T3_CLOS   0x0800 /* Error carrier loss */

Definition at line 177 of file sunlance.c.

#define LE_T3_LCOL   0x1000 /* Error late collision */

Definition at line 176 of file sunlance.c.

#define LE_T3_RTY   0x0400 /* Error retry */

Definition at line 178 of file sunlance.c.

#define LE_T3_TDR   0x03ff /* Time Domain Reflectometry counter */

Definition at line 179 of file sunlance.c.

#define LE_T3_UFL   0x4000 /* Error underflow */

Definition at line 175 of file sunlance.c.

#define libbuff_offset (   rt,
  elem 
)    ((__u32)(((unsigned long)(&(((struct lance_init_block *)0)->rt[elem][0])))))

Definition at line 238 of file sunlance.c.

#define libdesc_offset (   rt,
  elem 
)    ((__u32)(((unsigned long)(&(((struct lance_init_block *)0)->rt[elem])))))

Definition at line 235 of file sunlance.c.

#define PKT_BUF_SZ   1544

Definition at line 191 of file sunlance.c.

#define RAP   0x02UL /* register address port */

Definition at line 278 of file sunlance.c.

#define RDP   0x00UL /* register data port */

Definition at line 277 of file sunlance.c.

#define RX_BUFF_SIZE   PKT_BUF_SZ

Definition at line 192 of file sunlance.c.

#define RX_NEXT (   __x)    (((__x)+1) & RX_RING_MOD_MASK)

Definition at line 189 of file sunlance.c.

#define RX_RING_LEN_BITS   ((LANCE_LOG_RX_BUFFERS) << 29)

Definition at line 188 of file sunlance.c.

#define RX_RING_MOD_MASK   (RX_RING_SIZE - 1)

Definition at line 187 of file sunlance.c.

#define RX_RING_SIZE   (1 << (LANCE_LOG_RX_BUFFERS))

Definition at line 186 of file sunlance.c.

#define STOP_LANCE (   __lp)
Value:
do { void __iomem *__base = (__lp)->lregs; \
sbus_writew(LE_CSR0, __base + RAP); \
sbus_writew(LE_C0_STOP, __base + RDP); \
} while (0)

Definition at line 281 of file sunlance.c.

#define TX_BUFF_SIZE   PKT_BUF_SZ

Definition at line 193 of file sunlance.c.

#define TX_BUFFS_AVAIL
Value:
((lp->tx_old<=lp->tx_new)?\
lp->tx_old+TX_RING_MOD_MASK-lp->tx_new:\
lp->tx_old - lp->tx_new-1)

Definition at line 272 of file sunlance.c.

#define TX_NEXT (   __x)    (((__x)+1) & TX_RING_MOD_MASK)

Definition at line 184 of file sunlance.c.

#define TX_RING_LEN_BITS   ((LANCE_LOG_TX_BUFFERS) << 29)

Definition at line 183 of file sunlance.c.

#define TX_RING_MOD_MASK   (TX_RING_SIZE - 1)

Definition at line 182 of file sunlance.c.

#define TX_RING_SIZE   (1 << (LANCE_LOG_TX_BUFFERS))

Definition at line 181 of file sunlance.c.

Function Documentation

MODULE_AUTHOR ( DRV_AUTHOR  )
MODULE_DESCRIPTION ( "Sun Lance ethernet driver )
MODULE_DEVICE_TABLE ( of  ,
sunlance_sbus_match   
)
MODULE_LICENSE ( "GPL"  )
module_platform_driver ( sunlance_sbus_driver  )
MODULE_VERSION ( DRV_VERSION  )

Variable Documentation

int sparc_lance_debug = 2

Definition at line 287 of file sunlance.c.