19#define RTL_BAR_SIZE 0x100
34#define RTL_DESC_SIZE_MASK 0x3fff
51#define RTL_RING_ALIGN 256
79#define RTL_TSD(n) ( 0x10 + 4 * (n) )
80#define RTL_TSD_ERTXTH(x) ( (x) << 16 )
81#define RTL_TSD_ERTXTH_DEFAULT RTL_TSD_ERTXTH ( 256 / 32 )
82#define RTL_TSD_OWN 0x00002000UL
85#define RTL_TSAD(n) ( 0x20 + 4 * (n) )
94#define RTL_NUM_TX_DESC 4
97#define RTL_RBSTART 0x30
100#define RTL_RXBUF_LEN 8192
103#define RTL_RXBUF_PAD 2038
106#define RTL_RXBUF_ALIGN 16
110#define RTL_CR_RST 0x10
111#define RTL_CR_RE 0x08
112#define RTL_CR_TE 0x04
113#define RTL_CR_BUFE 0x01
116#define RTL_RESET_MAX_WAIT_MS 100
122#define RTL_TPPOLL_8169 0x38
123#define RTL_TPPOLL_NPQ 0x40
127#define RTL_IRQ_PUN_LINKCHG 0x0020
128#define RTL_IRQ_TER 0x0008
129#define RTL_IRQ_TOK 0x0004
130#define RTL_IRQ_RER 0x0002
131#define RTL_IRQ_ROK 0x0001
138#define RTL_TCR_MXDMA(x) ( (x) << 8 )
139#define RTL_TCR_MXDMA_MASK RTL_TCR_MXDMA ( 0x7 )
140#define RTL_TCR_MXDMA_DEFAULT RTL_TCR_MXDMA ( 0x7 )
144#define RTL_RCR_STOP_WORKING 0x01000000UL
145#define RTL_RCR_RXFTH(x) ( (x) << 13 )
146#define RTL_RCR_RXFTH_MASK RTL_RCR_RXFTH ( 0x7 )
147#define RTL_RCR_RXFTH_DEFAULT RTL_RCR_RXFTH ( 0x7 )
148#define RTL_RCR_RBLEN(x) ( (x) << 11 )
149#define RTL_RCR_RBLEN_MASK RTL_RCR_RBLEN ( 0x3 )
150#define RTL_RCR_RBLEN_DEFAULT RTL_RCR_RBLEN ( 0 )
151#define RTL_RCR_MXDMA(x) ( (x) << 8 )
152#define RTL_RCR_MXDMA_MASK RTL_RCR_MXDMA ( 0x7 )
153#define RTL_RCR_MXDMA_DEFAULT RTL_RCR_MXDMA ( 0x7 )
154#define RTL_RCR_WRAP 0x00000080UL
155#define RTL_RCR_9356SEL 0x00000040UL
156#define RTL_RCR_AB 0x00000008UL
157#define RTL_RCR_AM 0x00000004UL
158#define RTL_RCR_APM 0x00000002UL
159#define RTL_RCR_AAP 0x00000001UL
162#define RTL_9346CR 0x50
163#define RTL_9346CR_EEM(x) ( (x) << 6 )
164#define RTL_9346CR_EEM_EEPROM RTL_9346CR_EEM ( 0x2 )
165#define RTL_9346CR_EEM_NORMAL RTL_9346CR_EEM ( 0x0 )
166#define RTL_9346CR_EECS 0x08
167#define RTL_9346CR_EESK 0x04
168#define RTL_9346CR_EEDI 0x02
169#define RTL_9346CR_EEDO 0x01
172#define RTL_EEPROM_ID ( 0x00 / 2 )
175#define RTL_EEPROM_ID_MAGIC 0x8129
178#define RTL_EEPROM_MAC ( 0x0e / 2 )
181#define RTL_EEPROM_VPD ( 0x40 / 2 )
184#define RTL_EEPROM_VPD_LEN 0x40
187#define RTL_CONFIG1 0x52
188#define RTL_CONFIG1_VPD 0x02
192#define RTL_MSR_TXFCE 0x80
193#define RTL_MSR_RXFCE 0x40
194#define RTL_MSR_AUX_STATUS 0x10
195#define RTL_MSR_SPEED_10 0x08
196#define RTL_MSR_LINKB 0x04
197#define RTL_MSR_TXPF 0x02
198#define RTL_MSR_RXPF 0x01
201#define RTL_PHYAR 0x60
202#define RTL_PHYAR_FLAG 0x80000000UL
205#define RTL_PHYAR_VALUE( flag, reg, data ) ( (flag) | ( (reg) << 16 ) | (data) )
208#define RTL_PHYAR_DATA( value ) ( (value) & 0xffff )
211#define RTL_MII_MAX_WAIT_US 500
214#define RTL_PHYSTATUS 0x6c
215#define RTL_PHYSTATUS_ENTBI 0x80
216#define RTL_PHYSTATUS_TXFLOW 0x40
217#define RTL_PHYSTATUS_RXFLOW 0x20
218#define RTL_PHYSTATUS_1000MF 0x10
219#define RTL_PHYSTATUS_100M 0x08
220#define RTL_PHYSTATUS_10M 0x04
221#define RTL_PHYSTATUS_LINKSTS 0x02
222#define RTL_PHYSTATUS_FULLDUP 0x01
225#define RTL_TPPOLL_8139CP 0xd9
232#define RTL_CPCR_VLAN 0x0040
233#define RTL_CPCR_DAC 0x0010
234#define RTL_CPCR_MULRW 0x0008
235#define RTL_CPCR_CPRX 0x0002
236#define RTL_CPCR_CPTX 0x0001
239#define RTL_RDSAR 0xe4
242#define RTL_NUM_RX_DESC 4
245#define RTL_RX_MAX_LEN \
246 ( ETH_FRAME_LEN + 4 + 4 + 4 )
unsigned long long uint64_t
static unsigned int count
Number of entries.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
static unsigned int unsigned int reg
Non-volatile stored options.
static void realtek_init_ring(struct realtek_ring *ring, unsigned int count, unsigned int reg)
Initialise descriptor ring.
realtek_descriptor_flags
Packet descriptor flags.
@ RTL_DESC_OWN
Descriptor is owned by NIC.
@ RTL_DESC_RES
Receive error summary.
@ RTL_DESC_LS
Last segment descriptor.
@ RTL_DESC_EOR
End of descriptor ring.
@ RTL_DESC_FS
First segment descriptor.
#define RTL_NUM_RX_DESC
Number of receive descriptors.
realtek_legacy_status
Legacy mode status bits.
@ RTL_STAT_ROK
Received OK.
SPI bit-bashing interface.
A block of non-volatile stored options.
uint32_t reserved
Reserved.
uint16_t length
Buffer size.
uint64_t address
Buffer address.
struct realtek_rx_buffer rxbuf
Receive buffer (legacy mode)
int have_phy_regs
PHYAR and PHYSTATUS registers are present.
int legacy
Legacy datapath mode.
struct io_buffer * rx_iobuf[RTL_NUM_RX_DESC]
Receive I/O buffers.
struct mii_device mii
MII device.
struct nvo_block nvo
Non-volatile options.
struct spi_device eeprom
EEPROM.
struct dma_device * dma
DMA device.
unsigned int tppoll
TPPoll register offset.
struct spi_bit_basher spibit
SPI bit-bashing interface.
struct realtek_ring tx
Transmit descriptor ring.
struct realtek_ring rx
Receive descriptor ring.
struct mii_interface mdio
MII interface.
A Realtek descriptor ring.
unsigned int prod
Producer index.
unsigned int cons
Consumer index.
size_t len
Length (in bytes)
struct dma_mapping map
Descriptor ring DMA mapping.
unsigned int reg
Descriptor start address register.
struct realtek_descriptor * desc
Descriptors.
Receive buffer (legacy mode *)
struct dma_mapping map
Buffer DMA mapping.
unsigned int offset
Offset within buffer.