7 #define LINUX_OUT_MACROS 16 #define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr)) 17 #define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr)) 19 #define TX_RING_SIZE 2 20 #define RX_RING_SIZE 2 22 #define PKT_BUF_SZ 1536 40 #define TD_STDFLAGS TD_LASTDESC 49 #define delay(nanosec) do { int _i = 3; while (--_i > 0) \ 50 { __SLOW_DOWN_IO; }} while (0) 57 unsigned int type,
unsigned int len,
const char *
data);
61 static int mii_read(
int phy_id,
int location);
86 static unsigned short eeprom[64];
88 static signed char phys[4];
97 #define rx_ring epic100_bufs.rx_ring 98 #define tx_ring epic100_bufs.tx_ring 99 #define rx_packet epic100_bufs.rx_packet 100 #define tx_packet epic100_bufs.tx_packet 112 unsigned int phy, phy_idx;
163 for (i = 0; i < 16; i++) {
169 unsigned short sum = 0;
170 unsigned short value;
171 for (i = 0; i < 64; i++) {
179 printf(
"EEPROM contents\n");
180 for (i = 0; i < 64; i++) {
188 for (i = 0; i < 3; i++)
194 for (phy = 0, phy_idx = 0; phy < 32 && phy_idx <
sizeof(
phys); phy++) {
197 if (mii_status != 0xffff && mii_status != 0x0000) {
198 phys[phy_idx++] = phy;
200 printf(
"MII transceiver found at address %d.\n", phy);
206 printf(
"***WARNING***: No MII transceiver found!\n");
220 unsigned char mc_filter[8];
222 memset(mc_filter, 0xff,
sizeof(mc_filter));
224 for(i = 0; i < 4; i++)
225 outw(((
unsigned short *)mc_filter)[i],
mc0 + i*4);
245 if (mii_reg5 != 0xffff && (mii_reg5 & 0x0100)) {
246 printf(
" full-duplex mode");
306 unsigned int len,
const char *
data)
308 unsigned short nstype;
317 printf(
"eth_transmit: Unable to transmit. status=%4.4lx. Resetting...\n",
329 memcpy(txp + 12, (
char*)&nstype, 2);
358 printf(
"Oops, transmitter timeout, status=%4.4lX\n",
385 if ( ! retrieve )
return 1;
391 printf(
"epic_poll: entry %d status %hX\n", entry,
status);
396 printf(
"epic_poll: Giant packet\n");
398 }
else if (
status & 0x0006) {
400 printf(
"epic_poll: Frame received with errors\n");
443 #define EE_SHIFT_CLK 0x04 445 #define EE_DATA_WRITE 0x08 446 #define EE_WRITE_0 0x01 447 #define EE_WRITE_1 0x09 448 #define EE_DATA_READ 0x10 449 #define EE_ENB (0x0001 | EE_CS) 452 #define EE_WRITE_CMD (5 << 6) 453 #define EE_READ_CMD (6 << 6) 454 #define EE_ERASE_CMD (7 << 6) 456 #define eeprom_delay(n) delay(n) 469 for (i = 10; i >= 0; i--) {
480 for (i = 16; i > 0; i--) {
496 #define MII_WRITEOP 2 506 for (i = 4000; i > 0; i--)
521 PCI_ROM(0x10b8, 0x0005,
"epic100",
"SMC EtherPowerII", 0),
522 PCI_ROM(0x10b8, 0x0006,
"smc-83c175",
"SMC EPIC/C 83c175", 0),
static int read_eeprom(unsigned long ioaddr, int location, int addr_len)
int printf(const char *fmt,...)
Write a formatted string to the console.
uint16_t inw(volatile uint16_t *io_addr)
Read 16-bit word from I/O-mapped device.
#define le32_to_cpu(value)
#define outw(data, io_addr)
unsigned long ioaddr
I/O address.
#define GC_RX_FIFO_THR_64
uint32_t type
Operating system type.
static int epic100_poll(struct nic *nic, int retrieve)
static void epic100_disable(struct nic *nic)
static unsigned int cur_tx
static int epic100_probe(struct nic *nic, struct pci_device *pci)
int dummy_connect(struct nic *nic __unused)
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static signed char phys[4]
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
static void epic100_init_ring(void)
pseudo_bit_t value[0x00020]
#define __unused
Declare a variable or data structure as unused.
A 16-bit general register.
DRIVER("EPIC100", nic_driver, pci_driver, epic100_driver, epic100_probe, epic100_disable)
#define cpu_to_le32(value)
#define outl(data, io_addr)
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
A PCI device ID list entry.
static void set_rx_mode(void)
static struct nic_operations epic100_operations
#define TC_EARLY_TX_ENABLE
unsigned char * node_addr
static struct pci_device_id epic100_nics[]
static unsigned int cur_rx
uint32_t inl(volatile uint32_t *io_addr)
Read 32-bit dword from I/O-mapped device.
static void epic100_irq(struct nic *nic, irq_action_t action)
#define virt_to_le32desc(addr)
uint8_t data[48]
Additional event data.
static int mii_read(int phy_id, int location)
unsigned long currticks(void)
Get current system time in ticks.
#define DBG(...)
Print a debugging message.
struct nic_operations * nic_op
static struct command_descriptor read_cmd
"read" command descriptor
int(* connect)(struct nic *)
int putchar(int character)
Write a single character to each console device.
static void epic100_transmit(struct nic *nic, const char *destaddr, unsigned int type, unsigned int len, const char *data)
#define PCI_ROM(_vendor, _device, _name, _description, _data)
FILE_LICENCE(GPL2_OR_LATER)
void * memset(void *dest, int character, size_t len) __nonnull
static void epic100_open(void)
PCI_DRIVER(epic100_driver, epic100_nics, PCI_NO_CLASS)