52 #define dprintf(x) printf x 58 #define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr)) 59 #define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr)) 62 #define PCI_DM9132_ID 0x91321282 63 #define PCI_DM9102_ID 0x91021282 64 #define PCI_DM9100_ID 0x91001282 65 #define PCI_DM9009_ID 0x90091282 67 #define DM9102_IO_SIZE 0x80 68 #define DM9102A_IO_SIZE 0x100 69 #define TX_MAX_SEND_CNT 0x1 70 #define TX_DESC_CNT 0x10 71 #define RX_DESC_CNT 0x20 72 #define TX_FREE_DESC_CNT (TX_DESC_CNT - 2) 73 #define TX_WAKE_DESC_CNT (TX_DESC_CNT - 3) 74 #define DESC_ALL_CNT (TX_DESC_CNT + RX_DESC_CNT) 75 #define TX_BUF_ALLOC 0x600 76 #define RX_ALLOC_SIZE 0x620 77 #define DM910X_RESET 1 78 #define CR0_DEFAULT 0x00E00000 79 #define CR6_DEFAULT 0x00080000 80 #define CR7_DEFAULT 0x180c1 81 #define CR15_DEFAULT 0x06 82 #define TDES0_ERR_MASK 0x4302 83 #define MAX_PACKET_SIZE 1514 84 #define DMFE_MAX_MULTICAST 14 85 #define RX_COPY_SIZE 100 86 #define MAX_CHECK_PACKET 0x8000 87 #define DM9801_NOISE_FLOOR 8 88 #define DM9802_NOISE_FLOOR 5 95 #define DMFE_1M_HPNA 0x10 97 #define DMFE_TXTH_72 0x400000 98 #define DMFE_TXTH_96 0x404000 99 #define DMFE_TXTH_128 0x0000 100 #define DMFE_TXTH_256 0x4000 101 #define DMFE_TXTH_512 0x8000 102 #define DMFE_TXTH_1K 0xC000 104 #define DMFE_TIMER_WUT (jiffies + HZ * 1) 105 #define DMFE_TX_TIMEOUT ((3*HZ)/2) 106 #define DMFE_TX_KICK (HZ/2) 108 #define DMFE_DBUG(dbug_now, msg, value) if (dmfe_debug || (dbug_now)) printk(KERN_ERR DRV_NAME ": %s %lx\n", (msg), (long) (value)) 110 #define SHOW_MEDIA_TYPE(mode) printk(KERN_ERR DRV_NAME ": Change Speed to %sMhz %s duplex\n",mode & 1 ?"100":"10", mode & 4 ? "full":"half"); 114 #define CR9_SROM_READ 0x4800 116 #define CR9_SRCLK 0x2 117 #define CR9_CRDOUT 0x8 118 #define SROM_DATA_0 0x0 119 #define SROM_DATA_1 0x4 120 #define PHY_DATA_1 0x20000 121 #define PHY_DATA_0 0x00000 122 #define MDCLKH 0x10000 124 #define PHY_POWER_DOWN 0x800 126 #define SROM_V41_CODE 0x14 128 #define SROM_CLK_WRITE(data, ioaddr) outl(data|CR9_SROM_READ|CR9_SRCS,ioaddr);udelay(5);outl(data|CR9_SROM_READ|CR9_SRCS|CR9_SRCLK,ioaddr);udelay(5);outl(data|CR9_SROM_READ|CR9_SRCS,ioaddr);udelay(5); 130 #define __CHK_IO_SIZE(pci_id, dev_rev) ( ((pci_id)==PCI_DM9132_ID) || ((dev_rev) >= 0x02000030) ) ? DM9102A_IO_SIZE: DM9102_IO_SIZE 131 #define CHK_IO_SIZE(pci_dev, dev_rev) __CHK_IO_SIZE(((pci_dev)->device << 16) | (pci_dev)->vendor, dev_rev) 134 #define DEVICE net_device 220 #define txd dmfe_bufs.txd 221 #define txb dmfe_bufs.txb 222 #define rxd dmfe_bufs.rxd 223 #define rxb dmfe_bufs.rxb 339 void hex_dump(
const char *
data,
const unsigned int len);
350 if (
rdes0 & 0x80000000)
356 if ((
rdes0 & 0x300) != 0x300) {
358 printf(
"strange Packet\n");
365 if (
rdes0 & 0x8000) {
369 if (!(
rdes0 & 0x8000) ||
372 printf(
"Silly check mode\n");
450 #define board_found 1 461 printf(
"dmfe.c: Found %s Vendor=0x%hX Device=0x%hX\n",
466 dprintf((
"Revision %lX\n", dev_rev));
477 if ((pci_pmr == 0x10000) && (dev_rev == 0x02000031))
485 for (i = 0; i < 64; i++)
489 for (i = 0; i < 6; i++)
493 DBG (
"%s: %s at ioaddr %4.4lx\n",
529 txd[i].tx_buf_ptr = &
txb[i];
534 txd[i].next_tx_desc = &
txd[i + 1];
538 txd[i - 1].next_tx_desc = &
txd[0];
548 rxd[i].next_rx_desc = &
rxd[i + 1];
552 rxd[i - 1].next_rx_desc = &
rxd[0];
565 cr6_tmp = cr6_data & ~0x2002;
585 u16 i, hash_table[4];
587 dprintf((
"dm9132_id_table\n"));
589 printf(
"FIXME: This function is broken. If you have this card contact " 590 "Timothy Legge at the etherboot-user list\n");
605 for (i = 0; i < 4; i++)
609 hash_table[3] = 0x8000;
612 for (mcptr = mc_list, i = 0; i < mc_cnt; i++, mcptr = mcptr->next) {
613 hash_val = cal_CRC((
char *) mcptr->dmi_addr, 6, 0) & 0x3f;
614 hash_table[hash_val / 16] |= (
u16) 1 << (hash_val % 16);
618 for (i = 0; i < 4; i++,
ioaddr += 4)
635 dprintf((
"send_filter_frame\n"));
641 for (i = 0; i < 192; i++)
678 for (i = 5; i >= 0; i--) {
686 for (i = 16; i > 0; i--) {
717 if ((phy_mode & 0x24) == 0x24) {
804 if (!(phy_reg & 0x01e0)) {
848 if (!(phy_reg & 0x1)) {
882 u16 phy_data,
u32 chip_id)
895 for (i = 0; i < 35; i++)
907 for (i = 0x10; i > 0; i = i >> 1)
913 for (i = 0x10; i > 0; i = i >> 1)
923 for (i = 0x8000; i > 0; i >>= 1)
951 for (i = 0; i < 35; i++)
963 for (i = 0x10; i > 0; i = i >> 1)
969 for (i = 0x10; i > 0; i = i >> 1)
978 for (phy_data = 0, i = 0; i < 16; i++) {
1027 unsigned char *srom =
db->
srom;
1028 int dmfe_mode, tmp_reg;
1039 for (tmp_reg = 1; tmp_reg < 0x10; tmp_reg <<= 1) {
1057 dmfe_mode = *((
int *) srom + 34) & *((
int *) srom + 36);
1058 switch (dmfe_mode) {
1076 if ((
SF_mode & 0x1) || (srom[43] & 0x80))
1080 if ((
SF_mode & 0x2) || (srom[40] & 0x1))
1084 if ((
SF_mode & 0x4) || (srom[40] & 0xe))
1130 if ((tmp_reg & 0xfff0) == 0xb900) {
1211 PCI_ROM(0x1282, 0x9009,
"dmfe9009",
"Davicom 9009", 0),
1212 PCI_ROM(0x1282, 0x9100,
"dmfe9100",
"Davicom 9100", 0),
1213 PCI_ROM(0x1282, 0x9102,
"dmfe9102",
"Davicom 9102", 0),
1214 PCI_ROM(0x1282, 0x9132,
"dmfe9132",
"Davicom 9132", 0),
static void phy_write_1bit(unsigned long, u32)
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.
FILE_LICENCE(GPL2_OR_LATER)
#define le32_to_cpu(value)
static unsigned char dmfe_media_mode
#define virt_to_le32desc(addr)
#define outw(data, io_addr)
unsigned long ioaddr
I/O address.
uint32_t type
Operating system type.
static int dmfe_probe(struct nic *nic, struct pci_device *pci)
static void phy_write(unsigned long, u8, u8, u16, u32)
#define PCI_BASE_ADDRESS_0
static void dmfe_parse_srom(struct nic *nic)
#define DM9802_NOISE_FLOOR
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
int dummy_connect(struct nic *nic __unused)
static void dm9132_id_table(struct nic *nic)
#define SROM_CLK_WRITE(data, ioaddr)
PCI_DRIVER(dmfe_driver, dmfe_nics, PCI_NO_CLASS)
static unsigned long ioaddr
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define __unused
Declare a variable or data structure as unused.
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
uint16_t device
Device ID.
DRIVER("DMFE/PCI", nic_driver, pci_driver, dmfe_driver, dmfe_probe, dmfe_disable)
int pci_read_config_dword(struct pci_device *pci, unsigned int where, uint32_t *value)
Read 32-bit dword from PCI configuration space.
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
A 16-bit general register.
unsigned long pci_bar_start(struct pci_device *pci, unsigned int reg)
Find the start of a PCI BAR.
static void send_filter_frame(struct nic *nic)
static struct pci_device_id dmfe_nics[]
#define cpu_to_le32(value)
static void dmfe_transmit(struct nic *nic, const char *dest, unsigned int type, unsigned int size, const char *packet)
struct tx_desc * next_tx_desc
#define outl(data, io_addr)
static struct dmfe_private dfx
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
#define DM9801_NOISE_FLOOR
static u32 dmfe_cr6_user_set
struct rx_desc * next_rx_desc
A PCI device ID list entry.
uint16_t vendor
Vendor ID.
static void dmfe_reset(struct nic *nic)
static int dmfe_poll(struct nic *nic, int retrieve)
static struct dmfe_private * db
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
unsigned char * node_addr
static void dmfe_init_dm910x(struct nic *nic)
static u16 phy_read_1bit(unsigned long)
static void dmfe_disable(struct nic *nic __unused)
static u8 HPNA_NoiseFloor
static void update_cr6(u32, unsigned long)
static struct nic_operations dmfe_operations
uint32_t inl(volatile uint32_t *io_addr)
Read 32-bit dword from I/O-mapped device.
struct pci_device_id * id
Driver device ID.
#define cpu_to_le16(value)
if(len >=6 *4) __asm__ __volatile__("movsl" if(len >=5 *4) __asm__ __volatile__("movsl" if(len >=4 *4) __asm__ __volatile__("movsl" if(len >=3 *4) __asm__ __volatile__("movsl" if(len >=2 *4) __asm__ __volatile__("movsl" if(len >=1 *4) __asm__ __volatile__("movsl" if((len % 4) >=2) __asm__ __volatile__("movsw" if((len % 2) >=1) __asm__ __volatile__("movsb" return dest
uint8_t size
Entry size (in 32-bit words)
uint8_t data[48]
Additional event data.
#define PCI_REVISION
PCI revision.
static void dmfe_program_DM9802(struct nic *nic)
uint16_t offset
Offset to command line.
static void dmfe_irq(struct nic *nic __unused, irq_action_t action __unused)
#define DBG(...)
Print a debugging message.
struct nic_operations * nic_op
static u16 phy_read(unsigned long, u8, u8, u32)
int(* connect)(struct nic *)
#define PCI_ROM(_vendor, _device, _name, _description, _data)
static void dmfe_descriptor_init(struct nic *, unsigned long ioaddr)
static void dmfe_program_DM9801(struct nic *nic, int)
static void dmfe_set_phyxcer(struct nic *nic)
static u16 read_srom_word(long ioaddr, int offset)