4 #include <linux/if_ether.h>
5 #include <linux/types.h>
21 #define Ctrl_LNibRead 0x08
22 #define Ctrl_HNibRead 0
23 #define Ctrl_LNibWrite 0x08
24 #define Ctrl_HNibWrite 0
25 #define Ctrl_SelData 0x04
26 #define Ctrl_IRQEN 0x10
53 #define ISR_TxErr 0x02
54 #define ISRh_RxErr 0x11
56 #define CMR1h_MUX 0x08
57 #define CMR1h_RESET 0x04
58 #define CMR1h_RxENABLE 0x02
59 #define CMR1h_TxENABLE 0x01
60 #define CMR1h_TxRxOFF 0x00
61 #define CMR1_ReXmit 0x08
62 #define CMR1_Xmit 0x04
64 #define CMR1_BufEnb 0x01
65 #define CMR1_NextPkt 0x01
69 #define CMR2_RAMTEST 10
70 #define CMR2_EEPROM 12
73 #define CMR2h_Physical 1
74 #define CMR2h_Normal 2
75 #define CMR2h_PROMISC 3
79 static inline unsigned char inbyte(
unsigned short port)
82 __asm__ __volatile__ (
"inb %w1,%b0" :
"=a" (_v):
"d" (port));
88 static inline unsigned char read_nibble(
short port,
unsigned char offset)
102 static inline unsigned char read_byte_mode0(
short ioaddr)
104 unsigned char low_nib;
108 low_nib = (inbyte(ioaddr +
PAR_STATUS) >> 3) & 0x0f;
112 return low_nib | ((inbyte(ioaddr +
PAR_STATUS) << 1) & 0xf0);
116 static inline unsigned char read_byte_mode2(
short ioaddr)
118 unsigned char low_nib;
122 low_nib = (inbyte(ioaddr +
PAR_STATUS) >> 3) & 0x0f;
125 return low_nib | ((inbyte(ioaddr +
PAR_STATUS) << 1) & 0xf0);
129 static inline unsigned char read_byte_mode4(
short ioaddr)
131 unsigned char low_nib;
134 low_nib = (inbyte(ioaddr +
PAR_STATUS) >> 3) & 0x0f;
136 return low_nib | ((inbyte(ioaddr +
PAR_STATUS) << 1) & 0xf0);
140 static inline unsigned char read_byte_mode6(
short ioaddr)
142 unsigned char low_nib;
146 low_nib = (inbyte(ioaddr +
PAR_STATUS) >> 3) & 0x0f;
149 return low_nib | ((inbyte(ioaddr +
PAR_STATUS) << 1) & 0xf0);
155 unsigned char outval;
172 write_reg_high(
short port,
unsigned char reg,
unsigned char value)
183 outval &=
HNib | 0x0f;
192 write_reg_byte(
short port,
unsigned char reg,
unsigned char value)
194 unsigned char outval;
200 outb((outval & 0xf0) | (value & 0x0f), port +
PAR_DATA);
217 static inline void write_byte_mode0(
short ioaddr,
unsigned char value)
223 static inline void write_byte_mode1(
short ioaddr,
unsigned char value)
232 static inline void write_word_mode0(
short ioaddr,
unsigned short value)
244 #define EE_SHIFT_CLK 0x04
246 #define EE_CLK_HIGH 0x12
247 #define EE_CLK_LOW 0x16
248 #define EE_DATA_WRITE 0x01
249 #define EE_DATA_READ 0x08
252 #define eeprom_delay(ticks) \
253 do { int _i = 40; while (--_i > 0) { __SLOW_DOWN_IO; }} while (0)
256 #define EE_WRITE_CMD(offset) (((5 << 6) + (offset)) << 17)
257 #define EE_READ(offset) (((6 << 6) + (offset)) << 17)
258 #define EE_ERASE(offset) (((7 << 6) + (offset)) << 17)
259 #define EE_CMD_SIZE 27