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 dmfe_bufs NIC_FAKE_BSS ( struct dmfe_bss ) 221 #define txd dmfe_bufs.txd 222 #define txb dmfe_bufs.txb 223 #define rxd dmfe_bufs.rxd 224 #define rxb dmfe_bufs.rxb 340 void hex_dump(
const char *
data,
const unsigned int len);
351 if (
rdes0 & 0x80000000)
357 if ((
rdes0 & 0x300) != 0x300) {
359 printf(
"strange Packet\n");
366 if (
rdes0 & 0x8000) {
370 if (!(
rdes0 & 0x8000) ||
373 printf(
"Silly check mode\n");
451 #define board_found 1 462 printf(
"dmfe.c: Found %s Vendor=0x%hX Device=0x%hX\n",
467 dprintf((
"Revision %lX\n", dev_rev));
478 if ((pci_pmr == 0x10000) && (dev_rev == 0x02000031))
486 for (i = 0; i < 64; i++)
490 for (i = 0; i < 6; i++)
494 DBG (
"%s: %s at ioaddr %4.4lx\n",
530 txd[i].tx_buf_ptr = &
txb[i];
535 txd[i].next_tx_desc = &
txd[i + 1];
539 txd[i - 1].next_tx_desc = &
txd[0];
549 rxd[i].next_rx_desc = &
rxd[i + 1];
553 rxd[i - 1].next_rx_desc = &
rxd[0];
566 cr6_tmp = cr6_data & ~0x2002;
586 u16 i, hash_table[4];
588 dprintf((
"dm9132_id_table\n"));
590 printf(
"FIXME: This function is broken. If you have this card contact " 591 "Timothy Legge at the etherboot-user list\n");
606 for (i = 0; i < 4; i++)
610 hash_table[3] = 0x8000;
613 for (mcptr = mc_list, i = 0; i < mc_cnt; i++, mcptr = mcptr->next) {
614 hash_val = cal_CRC((
char *) mcptr->dmi_addr, 6, 0) & 0x3f;
615 hash_table[hash_val / 16] |= (
u16) 1 << (hash_val % 16);
619 for (i = 0; i < 4; i++,
ioaddr += 4)
636 dprintf((
"send_filter_frame\n"));
642 for (i = 0; i < 192; i++)
679 for (i = 5; i >= 0; i--) {
687 for (i = 16; i > 0; i--) {
718 if ((phy_mode & 0x24) == 0x24) {
805 if (!(phy_reg & 0x01e0)) {
849 if (!(phy_reg & 0x1)) {
883 u16 phy_data,
u32 chip_id)
896 for (i = 0; i < 35; i++)
908 for (i = 0x10; i > 0; i = i >> 1)
914 for (i = 0x10; i > 0; i = i >> 1)
924 for (i = 0x8000; i > 0; i >>= 1)
952 for (i = 0; i < 35; i++)
964 for (i = 0x10; i > 0; i = i >> 1)
970 for (i = 0x10; i > 0; i = i >> 1)
979 for (phy_data = 0, i = 0; i < 16; i++) {
1028 unsigned char *srom =
db->
srom;
1029 int dmfe_mode, tmp_reg;
1040 for (tmp_reg = 1; tmp_reg < 0x10; tmp_reg <<= 1) {
1058 dmfe_mode = *((
int *) srom + 34) & *((
int *) srom + 36);
1059 switch (dmfe_mode) {
1077 if ((
SF_mode & 0x1) || (srom[43] & 0x80))
1081 if ((
SF_mode & 0x2) || (srom[40] & 0x1))
1085 if ((
SF_mode & 0x4) || (srom[40] & 0xe))
1131 if ((tmp_reg & 0xfff0) == 0xb900) {
1212 PCI_ROM(0x1282, 0x9009,
"dmfe9009",
"Davicom 9009", 0),
1213 PCI_ROM(0x1282, 0x9100,
"dmfe9100",
"Davicom 9100", 0),
1214 PCI_ROM(0x1282, 0x9102,
"dmfe9102",
"Davicom 9102", 0),
1215 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.
uint16_t size
Buffer size.
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
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
uint16_t device
Device ID.
int pci_read_config_dword(struct pci_device *pci, unsigned int where, uint32_t *value)
Read 32-bit dword from PCI configuration space.
#define __unused
Declare a variable or data structure as unused.
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.
unsigned char rxb[RX_ALLOC_SIZE *RX_DESC_CNT]
static void send_filter_frame(struct nic *nic)
static struct pci_device_id dmfe_nics[]
#define cpu_to_le32(value)
static void dmfe_disable(struct nic *nic __unused, void *hwdev __unused)
unsigned char txb[TX_BUF_ALLOC *TX_DESC_CNT]
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 u8 HPNA_NoiseFloor
static void update_cr6(u32, unsigned long)
static struct nic_operations dmfe_operations
struct tx_desc txd[TX_DESC_CNT]
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 data[48]
Additional event data.
#define PCI_REVISION
PCI revision.
static void dmfe_program_DM9802(struct nic *nic)
struct rx_desc rxd[RX_DESC_CNT]
static void dmfe_irq(struct nic *nic __unused, irq_action_t action __unused)
uint16_t offset
Offset to command line.
#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)
DRIVER("DMFE/PCI", nic_driver, pci_driver, dmfe_driver, dmfe_probe, dmfe_disable, dmfe_bufs)
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)