xref: /openbmc/linux/drivers/net/ethernet/davicom/dm9000.h (revision 498495dba268b20e8eadd7fe93c140c68b6cc9d2)
1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2d7058a79SJeff Kirsher /*
3d7058a79SJeff Kirsher  * dm9000 Ethernet
4d7058a79SJeff Kirsher  */
5d7058a79SJeff Kirsher 
6d7058a79SJeff Kirsher #ifndef _DM9000X_H_
7d7058a79SJeff Kirsher #define _DM9000X_H_
8d7058a79SJeff Kirsher 
9d7058a79SJeff Kirsher #define DM9000_ID		0x90000A46
10d7058a79SJeff Kirsher 
11d7058a79SJeff Kirsher /* although the registers are 16 bit, they are 32-bit aligned.
12d7058a79SJeff Kirsher  */
13d7058a79SJeff Kirsher 
14d7058a79SJeff Kirsher #define DM9000_NCR             0x00
15d7058a79SJeff Kirsher #define DM9000_NSR             0x01
16d7058a79SJeff Kirsher #define DM9000_TCR             0x02
17d7058a79SJeff Kirsher #define DM9000_TSR1            0x03
18d7058a79SJeff Kirsher #define DM9000_TSR2            0x04
19d7058a79SJeff Kirsher #define DM9000_RCR             0x05
20d7058a79SJeff Kirsher #define DM9000_RSR             0x06
21d7058a79SJeff Kirsher #define DM9000_ROCR            0x07
22d7058a79SJeff Kirsher #define DM9000_BPTR            0x08
23d7058a79SJeff Kirsher #define DM9000_FCTR            0x09
24d7058a79SJeff Kirsher #define DM9000_FCR             0x0A
25d7058a79SJeff Kirsher #define DM9000_EPCR            0x0B
26d7058a79SJeff Kirsher #define DM9000_EPAR            0x0C
27d7058a79SJeff Kirsher #define DM9000_EPDRL           0x0D
28d7058a79SJeff Kirsher #define DM9000_EPDRH           0x0E
29d7058a79SJeff Kirsher #define DM9000_WCR             0x0F
30d7058a79SJeff Kirsher 
31d7058a79SJeff Kirsher #define DM9000_PAR             0x10
32d7058a79SJeff Kirsher #define DM9000_MAR             0x16
33d7058a79SJeff Kirsher 
34d7058a79SJeff Kirsher #define DM9000_GPCR	       0x1e
35d7058a79SJeff Kirsher #define DM9000_GPR             0x1f
36d7058a79SJeff Kirsher #define DM9000_TRPAL           0x22
37d7058a79SJeff Kirsher #define DM9000_TRPAH           0x23
38d7058a79SJeff Kirsher #define DM9000_RWPAL           0x24
39d7058a79SJeff Kirsher #define DM9000_RWPAH           0x25
40d7058a79SJeff Kirsher 
41d7058a79SJeff Kirsher #define DM9000_VIDL            0x28
42d7058a79SJeff Kirsher #define DM9000_VIDH            0x29
43d7058a79SJeff Kirsher #define DM9000_PIDL            0x2A
44d7058a79SJeff Kirsher #define DM9000_PIDH            0x2B
45d7058a79SJeff Kirsher 
46d7058a79SJeff Kirsher #define DM9000_CHIPR           0x2C
47d7058a79SJeff Kirsher #define DM9000_SMCR            0x2F
48d7058a79SJeff Kirsher 
49d7058a79SJeff Kirsher #define DM9000_ETXCSR          0x30
50d7058a79SJeff Kirsher #define DM9000_TCCR	       0x31
51d7058a79SJeff Kirsher #define DM9000_RCSR	       0x32
52d7058a79SJeff Kirsher 
53d7058a79SJeff Kirsher #define CHIPR_DM9000A	       0x19
54d7058a79SJeff Kirsher #define CHIPR_DM9000B	       0x1A
55d7058a79SJeff Kirsher 
56d7058a79SJeff Kirsher #define DM9000_MRCMDX          0xF0
57d7058a79SJeff Kirsher #define DM9000_MRCMD           0xF2
58d7058a79SJeff Kirsher #define DM9000_MRRL            0xF4
59d7058a79SJeff Kirsher #define DM9000_MRRH            0xF5
60d7058a79SJeff Kirsher #define DM9000_MWCMDX          0xF6
61d7058a79SJeff Kirsher #define DM9000_MWCMD           0xF8
62d7058a79SJeff Kirsher #define DM9000_MWRL            0xFA
63d7058a79SJeff Kirsher #define DM9000_MWRH            0xFB
64d7058a79SJeff Kirsher #define DM9000_TXPLL           0xFC
65d7058a79SJeff Kirsher #define DM9000_TXPLH           0xFD
66d7058a79SJeff Kirsher #define DM9000_ISR             0xFE
67d7058a79SJeff Kirsher #define DM9000_IMR             0xFF
68d7058a79SJeff Kirsher 
69d7058a79SJeff Kirsher #define NCR_EXT_PHY         (1<<7)
70d7058a79SJeff Kirsher #define NCR_WAKEEN          (1<<6)
71d7058a79SJeff Kirsher #define NCR_FCOL            (1<<4)
72d7058a79SJeff Kirsher #define NCR_FDX             (1<<3)
736741f40dSJoseph CHANG 
746741f40dSJoseph CHANG #define NCR_RESERVED        (3<<1)
756741f40dSJoseph CHANG #define NCR_MAC_LBK         (1<<1)
76d7058a79SJeff Kirsher #define NCR_RST	            (1<<0)
77d7058a79SJeff Kirsher 
78d7058a79SJeff Kirsher #define NSR_SPEED           (1<<7)
79d7058a79SJeff Kirsher #define NSR_LINKST          (1<<6)
80d7058a79SJeff Kirsher #define NSR_WAKEST          (1<<5)
81d7058a79SJeff Kirsher #define NSR_TX2END          (1<<3)
82d7058a79SJeff Kirsher #define NSR_TX1END          (1<<2)
83d7058a79SJeff Kirsher #define NSR_RXOV            (1<<1)
84d7058a79SJeff Kirsher 
85d7058a79SJeff Kirsher #define TCR_TJDIS           (1<<6)
86d7058a79SJeff Kirsher #define TCR_EXCECM          (1<<5)
87d7058a79SJeff Kirsher #define TCR_PAD_DIS2        (1<<4)
88d7058a79SJeff Kirsher #define TCR_CRC_DIS2        (1<<3)
89d7058a79SJeff Kirsher #define TCR_PAD_DIS1        (1<<2)
90d7058a79SJeff Kirsher #define TCR_CRC_DIS1        (1<<1)
91d7058a79SJeff Kirsher #define TCR_TXREQ           (1<<0)
92d7058a79SJeff Kirsher 
93d7058a79SJeff Kirsher #define TSR_TJTO            (1<<7)
94d7058a79SJeff Kirsher #define TSR_LC              (1<<6)
95d7058a79SJeff Kirsher #define TSR_NC              (1<<5)
96d7058a79SJeff Kirsher #define TSR_LCOL            (1<<4)
97d7058a79SJeff Kirsher #define TSR_COL             (1<<3)
98d7058a79SJeff Kirsher #define TSR_EC              (1<<2)
99d7058a79SJeff Kirsher 
100d7058a79SJeff Kirsher #define RCR_WTDIS           (1<<6)
101d7058a79SJeff Kirsher #define RCR_DIS_LONG        (1<<5)
102d7058a79SJeff Kirsher #define RCR_DIS_CRC         (1<<4)
103d7058a79SJeff Kirsher #define RCR_ALL	            (1<<3)
104d7058a79SJeff Kirsher #define RCR_RUNT            (1<<2)
105d7058a79SJeff Kirsher #define RCR_PRMSC           (1<<1)
106d7058a79SJeff Kirsher #define RCR_RXEN            (1<<0)
107d7058a79SJeff Kirsher 
108d7058a79SJeff Kirsher #define RSR_RF              (1<<7)
109d7058a79SJeff Kirsher #define RSR_MF              (1<<6)
110d7058a79SJeff Kirsher #define RSR_LCS             (1<<5)
111d7058a79SJeff Kirsher #define RSR_RWTO            (1<<4)
112d7058a79SJeff Kirsher #define RSR_PLE             (1<<3)
113d7058a79SJeff Kirsher #define RSR_AE              (1<<2)
114d7058a79SJeff Kirsher #define RSR_CE              (1<<1)
115d7058a79SJeff Kirsher #define RSR_FOE             (1<<0)
116d7058a79SJeff Kirsher 
117d7058a79SJeff Kirsher #define WCR_LINKEN		(1 << 5)
118d7058a79SJeff Kirsher #define WCR_SAMPLEEN		(1 << 4)
119d7058a79SJeff Kirsher #define WCR_MAGICEN		(1 << 3)
120d7058a79SJeff Kirsher #define WCR_LINKST		(1 << 2)
121d7058a79SJeff Kirsher #define WCR_SAMPLEST		(1 << 1)
122d7058a79SJeff Kirsher #define WCR_MAGICST		(1 << 0)
123d7058a79SJeff Kirsher 
124d7058a79SJeff Kirsher #define FCTR_HWOT(ot)	(( ot & 0xf ) << 4 )
125d7058a79SJeff Kirsher #define FCTR_LWOT(ot)	( ot & 0xf )
126d7058a79SJeff Kirsher 
127d7058a79SJeff Kirsher #define IMR_PAR             (1<<7)
128d7058a79SJeff Kirsher #define IMR_ROOM            (1<<3)
129d7058a79SJeff Kirsher #define IMR_ROM             (1<<2)
130d7058a79SJeff Kirsher #define IMR_PTM             (1<<1)
131d7058a79SJeff Kirsher #define IMR_PRM             (1<<0)
132d7058a79SJeff Kirsher 
133d7058a79SJeff Kirsher #define ISR_ROOS            (1<<3)
134d7058a79SJeff Kirsher #define ISR_ROS             (1<<2)
135d7058a79SJeff Kirsher #define ISR_PTS             (1<<1)
136d7058a79SJeff Kirsher #define ISR_PRS             (1<<0)
137d7058a79SJeff Kirsher #define ISR_CLR_STATUS      (ISR_ROOS | ISR_ROS | ISR_PTS | ISR_PRS)
138d7058a79SJeff Kirsher 
139d7058a79SJeff Kirsher #define EPCR_REEP           (1<<5)
140d7058a79SJeff Kirsher #define EPCR_WEP            (1<<4)
141d7058a79SJeff Kirsher #define EPCR_EPOS           (1<<3)
142d7058a79SJeff Kirsher #define EPCR_ERPRR          (1<<2)
143d7058a79SJeff Kirsher #define EPCR_ERPRW          (1<<1)
144d7058a79SJeff Kirsher #define EPCR_ERRE           (1<<0)
145d7058a79SJeff Kirsher 
146d7058a79SJeff Kirsher #define GPCR_GEP_CNTL       (1<<0)
147d7058a79SJeff Kirsher 
148d7058a79SJeff Kirsher #define TCCR_IP		    (1<<0)
149d7058a79SJeff Kirsher #define TCCR_TCP	    (1<<1)
150d7058a79SJeff Kirsher #define TCCR_UDP	    (1<<2)
151d7058a79SJeff Kirsher 
152d7058a79SJeff Kirsher #define RCSR_UDP_BAD	    (1<<7)
153d7058a79SJeff Kirsher #define RCSR_TCP_BAD	    (1<<6)
154d7058a79SJeff Kirsher #define RCSR_IP_BAD	    (1<<5)
155d7058a79SJeff Kirsher #define RCSR_UDP	    (1<<4)
156d7058a79SJeff Kirsher #define RCSR_TCP	    (1<<3)
157d7058a79SJeff Kirsher #define RCSR_IP		    (1<<2)
158d7058a79SJeff Kirsher #define RCSR_CSUM	    (1<<1)
159d7058a79SJeff Kirsher #define RCSR_DISCARD	    (1<<0)
160d7058a79SJeff Kirsher 
161d7058a79SJeff Kirsher #define DM9000_PKT_RDY		0x01	/* Packet ready to receive */
162d7058a79SJeff Kirsher #define DM9000_PKT_ERR		0x02
163d7058a79SJeff Kirsher #define DM9000_PKT_MAX		1536	/* Received packet max size */
164d7058a79SJeff Kirsher 
165d7058a79SJeff Kirsher /* DM9000A / DM9000B definitions */
166d7058a79SJeff Kirsher 
167d7058a79SJeff Kirsher #define IMR_LNKCHNG		(1<<5)
168d7058a79SJeff Kirsher #define IMR_UNDERRUN		(1<<4)
169d7058a79SJeff Kirsher 
170d7058a79SJeff Kirsher #define ISR_LNKCHNG		(1<<5)
171d7058a79SJeff Kirsher #define ISR_UNDERRUN		(1<<4)
172d7058a79SJeff Kirsher 
1736741f40dSJoseph CHANG /* Davicom MII registers.
1746741f40dSJoseph CHANG  */
1756741f40dSJoseph CHANG 
1766741f40dSJoseph CHANG #define MII_DM_DSPCR		0x1b    /* DSP Control Register */
1776741f40dSJoseph CHANG 
1786741f40dSJoseph CHANG #define DSPCR_INIT_PARAM	0xE100	/* DSP init parameter */
1796741f40dSJoseph CHANG 
180d7058a79SJeff Kirsher #endif /* _DM9000X_H_ */
181d7058a79SJeff Kirsher 
182