Skip to content

Commit d658aa1

Browse files
committed
ODROID-C2: net/usb: add missing header file in pull request
This commit is to add missing header file 'drivers/net/usb/ax88179_178a.h' from the pull request torvalds#353, hardkernel#353 Change-Id: I48cebb977e4fda437eebd62d4cee65adf6e41ed6 Signed-off-by: Dongjin Kim <tobetter@gmail.com>
1 parent 8b8bb4c commit d658aa1

File tree

1 file changed

+364
-0
lines changed

1 file changed

+364
-0
lines changed

drivers/net/usb/ax88179_178a.h

Lines changed: 364 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,364 @@
1+
#ifndef __LINUX_USBNET_ASIX_H
2+
#define __LINUX_USBNET_ASIX_H
3+
4+
//#define RX_SKB_COPY
5+
6+
#define AX88179_PHY_ID 0x03
7+
#define AX_MCAST_FILTER_SIZE 8
8+
#define AX_MAX_MCAST 64
9+
#define AX_EEPROM_LEN 0x40
10+
#define AX_RX_CHECKSUM 1
11+
#define AX_TX_CHECKSUM 2
12+
13+
#define AX_BULKIN_24K 0x18; /* 24k */
14+
15+
#define AX_ACCESS_MAC 0x01
16+
#define AX_ACCESS_PHY 0x02
17+
#define AX_ACCESS_WAKEUP 0x03
18+
#define AX_ACCESS_EEPROM 0x04
19+
#define AX_ACCESS_EFUSE 0x05
20+
#define AX_RELOAD_EEPROM_EFUSE 0x06
21+
#define AX_WRITE_EFUSE_EN 0x09
22+
#define AX_WRITE_EFUSE_DIS 0x0A
23+
#define AX_ACCESS_MFAB 0x10
24+
25+
#define PHYSICAL_LINK_STATUS 0x02
26+
#define AX_USB_SS 0x04
27+
#define AX_USB_HS 0x02
28+
#define AX_USB_FS 0x01
29+
30+
#define GENERAL_STATUS 0x03
31+
/* Check AX88179 version. UA1:Bit2 = 0, UA2:Bit2 = 1 */
32+
#define AX_SECLD 0x04
33+
34+
35+
36+
#define AX_SROM_ADDR 0x07
37+
#define AX_SROM_CMD 0x0a
38+
#define EEP_RD 0x04 /* EEprom read command */
39+
#define EEP_WR 0x08 /* EEprom write command */
40+
#define EEP_BUSY 0x10 /* EEprom access module busy */
41+
42+
43+
#define AX_SROM_DATA_LOW 0x08
44+
#define AX_SROM_DATA_HIGH 0x09
45+
46+
#define AX_RX_CTL 0x0b
47+
#define AX_RX_CTL_DROPCRCERR 0x0100 /* Drop CRC error packet */
48+
#define AX_RX_CTL_IPE 0x0200 /* Enable IP header in receive buffer aligned on 32-bit aligment */
49+
#define AX_RX_CTL_TXPADCRC 0x0400 /* checksum value in rx header 3 */
50+
#define AX_RX_CTL_START 0x0080 /* Ethernet MAC start */
51+
#define AX_RX_CTL_AP 0x0020 /* Accept physcial address from Multicast array */
52+
#define AX_RX_CTL_AM 0x0010 /* Accetp Brocadcast frames*/
53+
#define AX_RX_CTL_AB 0x0008 /* HW auto-added 8-bytes data when meet USB bulk in transfer boundary (1024/512/64)*/
54+
#define AX_RX_CTL_HA8B 0x0004
55+
#define AX_RX_CTL_AMALL 0x0002 /* Accetp all multicast frames */
56+
#define AX_RX_CTL_PRO 0x0001 /* Promiscuous Mode */
57+
#define AX_RX_CTL_STOP 0x0000 /* Stop MAC */
58+
59+
#define AX_NODE_ID 0x10
60+
#define AX_MULTI_FILTER_ARRY 0x16
61+
62+
#define AX_MEDIUM_STATUS_MODE 0x22
63+
#define AX_MEDIUM_GIGAMODE 0x01
64+
#define AX_MEDIUM_FULL_DUPLEX 0x02
65+
// #define AX_MEDIUM_ALWAYS_ONE 0x04
66+
#define AX_MEDIUM_RXFLOW_CTRLEN 0x10
67+
#define AX_MEDIUM_TXFLOW_CTRLEN 0x20
68+
#define AX_MEDIUM_RECEIVE_EN 0x100
69+
#define AX_MEDIUM_PS 0x200
70+
#define AX_MEDIUM_JUMBO_EN 0x8040
71+
72+
#define AX_MONITOR_MODE 0x24
73+
#define AX_MONITOR_MODE_RWLC 0x02
74+
#define AX_MONITOR_MODE_RWMP 0x04
75+
#define AX_MONITOR_MODE_RWWF 0x08
76+
#define AX_MONITOR_MODE_RW_FLAG 0x10
77+
#define AX_MONITOR_MODE_PMEPOL 0x20
78+
#define AX_MONITOR_MODE_PMETYPE 0x40
79+
80+
#define AX_GPIO_CTRL 0x25
81+
#define AX_GPIO_CTRL_GPIO3EN 0x80
82+
#define AX_GPIO_CTRL_GPIO2EN 0x40
83+
#define AX_GPIO_CTRL_GPIO1EN 0x20
84+
85+
#define AX_PHYPWR_RSTCTL 0x26
86+
#define AX_PHYPWR_RSTCTL_BZ 0x0010
87+
#define AX_PHYPWR_RSTCTL_IPRL 0x0020
88+
#define AX_PHYPWR_RSTCTL_AUTODETACH 0x1000
89+
90+
#define AX_RX_BULKIN_QCTRL 0x2e
91+
#define AX_RX_BULKIN_QCTRL_TIME 0x01
92+
#define AX_RX_BULKIN_QCTRL_IFG 0x02
93+
#define AX_RX_BULKIN_QCTRL_SIZE 0x04
94+
95+
#define AX_RX_BULKIN_QTIMR_LOW 0x2f
96+
#define AX_RX_BULKIN_QTIMR_HIGH 0x30
97+
#define AX_RX_BULKIN_QSIZE 0x31
98+
#define AX_RX_BULKIN_QIFG 0x32
99+
100+
#define AX_CLK_SELECT 0x33
101+
#define AX_CLK_SELECT_BCS 0x01
102+
#define AX_CLK_SELECT_ACS 0x02
103+
#define AX_CLK_SELECT_ACSREQ 0x10
104+
#define AX_CLK_SELECT_ULR 0x08
105+
106+
#define AX_RXCOE_CTL 0x34
107+
#define AX_RXCOE_IP 0x01
108+
#define AX_RXCOE_TCP 0x02
109+
#define AX_RXCOE_UDP 0x04
110+
#define AX_RXCOE_ICMP 0x08
111+
#define AX_RXCOE_IGMP 0x10
112+
#define AX_RXCOE_TCPV6 0x20
113+
#define AX_RXCOE_UDPV6 0x40
114+
#define AX_RXCOE_ICMV6 0x80
115+
116+
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22)
117+
#define AX_RXCOE_DEF_CSUM (AX_RXCOE_IP | AX_RXCOE_TCP | \
118+
AX_RXCOE_UDP | AX_RXCOE_ICMV6 | \
119+
AX_RXCOE_TCPV6 | AX_RXCOE_UDPV6)
120+
#else
121+
#define AX_RXCOE_DEF_CSUM (AX_RXCOE_IP | AX_RXCOE_TCP | \
122+
AX_RXCOE_UDP)
123+
#endif
124+
125+
#define AX_TXCOE_CTL 0x35
126+
#define AX_TXCOE_IP 0x01
127+
#define AX_TXCOE_TCP 0x02
128+
#define AX_TXCOE_UDP 0x04
129+
#define AX_TXCOE_ICMP 0x08
130+
#define AX_TXCOE_IGMP 0x10
131+
#define AX_TXCOE_TCPV6 0x20
132+
#define AX_TXCOE_UDPV6 0x40
133+
#define AX_TXCOE_ICMV6 0x80
134+
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22)
135+
#define AX_TXCOE_DEF_CSUM (AX_TXCOE_TCP | AX_TXCOE_UDP | \
136+
AX_TXCOE_TCPV6 | AX_TXCOE_UDPV6)
137+
#else
138+
#define AX_TXCOE_DEF_CSUM (AX_TXCOE_TCP | AX_TXCOE_UDP)
139+
#endif
140+
141+
#define AX_PAUSE_WATERLVL_HIGH 0x54
142+
#define AX_PAUSE_WATERLVL_LOW 0x55
143+
144+
145+
#define AX_EEP_EFUSE_CORRECT 0x00
146+
#define AX88179_EEPROM_MAGIC 0x17900b95
147+
148+
149+
/*****************************************************************************/
150+
/* GMII register definitions */
151+
#define GMII_PHY_CONTROL 0x00 /* control reg */
152+
/* Bit definitions: GMII Control */
153+
#define GMII_CONTROL_RESET 0x8000 /* reset bit in control reg */
154+
#define GMII_CONTROL_LOOPBACK 0x4000 /* loopback bit in control reg */
155+
#define GMII_CONTROL_10MB 0x0000 /* 10 Mbit */
156+
#define GMII_CONTROL_100MB 0x2000 /* 100Mbit */
157+
#define GMII_CONTROL_1000MB 0x0040 /* 1000Mbit */
158+
#define GMII_CONTROL_SPEED_BITS 0x2040 /* speed bit mask */
159+
#define GMII_CONTROL_ENABLE_AUTO 0x1000 /* autonegotiate enable */
160+
#define GMII_CONTROL_POWER_DOWN 0x0800
161+
#define GMII_CONTROL_ISOLATE 0x0400 /* islolate bit */
162+
#define GMII_CONTROL_START_AUTO 0x0200 /* restart autonegotiate */
163+
#define GMII_CONTROL_FULL_DUPLEX 0x0100
164+
165+
#define GMII_PHY_STATUS 0x01 /* status reg */
166+
/* Bit definitions: GMII Status */
167+
#define GMII_STATUS_100MB_MASK 0xE000 /* any of these indicate 100 Mbit */
168+
#define GMII_STATUS_10MB_MASK 0x1800 /* either of these indicate 10 Mbit */
169+
#define GMII_STATUS_AUTO_DONE 0x0020 /* auto negotiation complete */
170+
#define GMII_STATUS_AUTO 0x0008 /* auto negotiation is available */
171+
#define GMII_STATUS_LINK_UP 0x0004 /* link status bit */
172+
#define GMII_STATUS_EXTENDED 0x0001 /* extended regs exist */
173+
#define GMII_STATUS_100T4 0x8000 /* capable of 100BT4 */
174+
#define GMII_STATUS_100TXFD 0x4000 /* capable of 100BTX full duplex */
175+
#define GMII_STATUS_100TX 0x2000 /* capable of 100BTX */
176+
#define GMII_STATUS_10TFD 0x1000 /* capable of 10BT full duplex */
177+
#define GMII_STATUS_10T 0x0800 /* capable of 10BT */
178+
179+
#define GMII_PHY_OUI 0x02 /* most of the OUI bits */
180+
#define GMII_PHY_MODEL 0x03 /* model/rev bits, and rest of OUI */
181+
#define GMII_PHY_ANAR 0x04 /* AN advertisement reg */
182+
/* Bit definitions: Auto-Negotiation Advertisement */
183+
#define GMII_ANAR_ASYM_PAUSE 0x0800 /* support asymetric pause */
184+
#define GMII_ANAR_PAUSE 0x0400 /* support pause packets */
185+
#define GMII_ANAR_100T4 0x0200 /* support 100BT4 */
186+
#define GMII_ANAR_100TXFD 0x0100 /* support 100BTX full duplex */
187+
#define GMII_ANAR_100TX 0x0080 /* support 100BTX half duplex */
188+
#define GMII_ANAR_10TFD 0x0040 /* support 10BT full duplex */
189+
#define GMII_ANAR_10T 0x0020 /* support 10BT half duplex */
190+
#define GMII_SELECTOR_FIELD 0x001F /* selector field. */
191+
192+
#define GMII_PHY_ANLPAR 0x05 /* AN Link Partner */
193+
/* Bit definitions: Auto-Negotiation Link Partner Ability */
194+
#define GMII_ANLPAR_100T4 0x0200 /* support 100BT4 */
195+
#define GMII_ANLPAR_100TXFD 0x0100 /* support 100BTX full duplex */
196+
#define GMII_ANLPAR_100TX 0x0080 /* support 100BTX half duplex */
197+
#define GMII_ANLPAR_10TFD 0x0040 /* support 10BT full duplex */
198+
#define GMII_ANLPAR_10T 0x0020 /* support 10BT half duplex */
199+
#define GMII_ANLPAR_PAUSE 0x0400 /* support pause packets */
200+
#define GMII_ANLPAR_ASYM_PAUSE 0x0800 /* support asymetric pause */
201+
#define GMII_ANLPAR_ACK 0x4000 /* means LCB was successfully rx'd */
202+
#define GMII_SELECTOR_8023 0x0001;
203+
204+
#define GMII_PHY_ANER 0x06 /* AN expansion reg */
205+
#define GMII_PHY_1000BT_CONTROL 0x09 /* control reg for 1000BT */
206+
#define GMII_PHY_1000BT_STATUS 0x0A /* status reg for 1000BT */
207+
208+
#define GMII_PHY_MACR 0x0D
209+
#define GMII_PHY_MAADR 0x0E
210+
211+
#define GMII_PHY_PHYSR 0x11 /* PHY specific status register */
212+
#define GMII_PHY_PHYSR_SMASK 0xc000
213+
#define GMII_PHY_PHYSR_GIGA 0x8000
214+
#define GMII_PHY_PHYSR_100 0x4000
215+
#define GMII_PHY_PHYSR_FULL 0x2000
216+
#define GMII_PHY_PHYSR_LINK 0x400
217+
218+
/* Bit definitions: 1000BaseT AUX Control */
219+
#define GMII_1000_AUX_CTRL_MASTER_SLAVE 0x1000
220+
#define GMII_1000_AUX_CTRL_FD_CAPABLE 0x0200 /* full duplex capable */
221+
#define GMII_1000_AUX_CTRL_HD_CAPABLE 0x0100 /* half duplex capable */
222+
223+
/* Bit definitions: 1000BaseT AUX Status */
224+
#define GMII_1000_AUX_STATUS_FD_CAPABLE 0x0800 /* full duplex capable */
225+
#define GMII_1000_AUX_STATUS_HD_CAPABLE 0x0400 /* half duplex capable */
226+
227+
/*Cicada MII Registers */
228+
#define GMII_AUX_CTRL_STATUS 0x1C
229+
#define GMII_AUX_ANEG_CPLT 0x8000
230+
#define GMII_AUX_FDX 0x0020
231+
#define GMII_AUX_SPEED_1000 0x0010
232+
#define GMII_AUX_SPEED_100 0x0008
233+
234+
#define GMII_LED_ACTIVE 0x1a
235+
#define GMII_LED_ACTIVE_MASK 0xff8f
236+
#define GMII_LED0_ACTIVE (1 << 4)
237+
#define GMII_LED1_ACTIVE (1 << 5)
238+
#define GMII_LED2_ACTIVE (1 << 6)
239+
240+
#define GMII_LED_LINK 0x1c
241+
#define GMII_LED_LINK_MASK 0xf888
242+
#define GMII_LED0_LINK_10 (1 << 0)
243+
#define GMII_LED0_LINK_100 (1 << 1)
244+
#define GMII_LED0_LINK_1000 (1 << 2)
245+
#define GMII_LED1_LINK_10 (1 << 4)
246+
#define GMII_LED1_LINK_100 (1 << 5)
247+
#define GMII_LED1_LINK_1000 (1 << 6)
248+
#define GMII_LED2_LINK_10 (1 << 8)
249+
#define GMII_LED2_LINK_100 (1 << 9)
250+
#define GMII_LED2_LINK_1000 (1 << 10)
251+
252+
#define LED_VALID (1 << 15) /* UA2 LED Setting */
253+
254+
#define LED0_ACTIVE (1 << 0)
255+
#define LED0_LINK_10 (1 << 1)
256+
#define LED0_LINK_100 (1 << 2)
257+
#define LED0_LINK_1000 (1 << 3)
258+
#define LED0_FD (1 << 4)
259+
#define LED0_USB3_MASK 0x001f
260+
261+
#define LED1_ACTIVE (1 << 5)
262+
#define LED1_LINK_10 (1 << 6)
263+
#define LED1_LINK_100 (1 << 7)
264+
#define LED1_LINK_1000 (1 << 8)
265+
#define LED1_FD (1 << 9)
266+
#define LED1_USB3_MASK 0x03e0
267+
268+
#define LED2_ACTIVE (1 << 10)
269+
#define LED2_LINK_1000 (1 << 13)
270+
#define LED2_LINK_100 (1 << 12)
271+
#define LED2_LINK_10 (1 << 11)
272+
#define LED2_FD (1 << 14)
273+
#define LED2_USB3_MASK 0x7c00
274+
275+
#define GMII_PHYPAGE 0x1e
276+
277+
#define GMII_PHY_PAGE_SELECT 0x1f
278+
#define GMII_PHY_PAGE_SELECT_EXT 0x0007
279+
#define GMII_PHY_PAGE_SELECT_PAGE0 0X0000
280+
#define GMII_PHY_PAGE_SELECT_PAGE1 0X0001
281+
#define GMII_PHY_PAGE_SELECT_PAGE2 0X0002
282+
#define GMII_PHY_PAGE_SELECT_PAGE3 0X0003
283+
#define GMII_PHY_PAGE_SELECT_PAGE4 0X0004
284+
#define GMII_PHY_PAGE_SELECT_PAGE5 0X0005
285+
#define GMII_PHY_PAGE_SELECT_PAGE6 0X0006
286+
287+
/******************************************************************************/
288+
289+
struct ax88179_data {
290+
u16 rxctl;
291+
u8 checksum;
292+
} __attribute__ ((packed));
293+
294+
struct ax88179_async_handle {
295+
struct usb_ctrlrequest *req;
296+
u8 m_filter[8];
297+
u16 rxctl;
298+
} __attribute__ ((packed));
299+
300+
struct ax88179_int_data {
301+
__le16 res1;
302+
#define AX_INT_PPLS_LINK (1 << 0)
303+
#define AX_INT_SPLS_LINK (1 << 1)
304+
#define AX_INT_CABOFF_UNPLUG (1 << 7)
305+
u8 link;
306+
__le16 res2;
307+
u8 status;
308+
__le16 res3;
309+
} __attribute__ ((packed));
310+
311+
#define AX_RXHDR_L4_ERR (1 << 8)
312+
#define AX_RXHDR_L3_ERR (1 << 9)
313+
314+
315+
#define AX_RXHDR_L4_TYPE_ICMP 2
316+
#define AX_RXHDR_L4_TYPE_IGMP 3
317+
#define AX_RXHDR_L4_TYPE_TCMPV6 5
318+
319+
#define AX_RXHDR_L3_TYPE_IP 1
320+
#define AX_RXHDR_L3_TYPE_IPV6 2
321+
322+
#define AX_RXHDR_L4_TYPE_MASK 0x1c
323+
#define AX_RXHDR_L4_TYPE_UDP 4
324+
#define AX_RXHDR_L4_TYPE_TCP 16
325+
#define AX_RXHDR_L3CSUM_ERR 2
326+
#define AX_RXHDR_L4CSUM_ERR 1
327+
#define AX_RXHDR_CRC_ERR 0x20000000
328+
#define AX_RXHDR_MII_ERR 0x40000000
329+
#define AX_RXHDR_DROP_ERR 0x80000000
330+
#if 0
331+
struct ax88179_rx_pkt_header {
332+
333+
u8 l4_csum_err:1,
334+
l3_csum_err:1,
335+
l4_type:3,
336+
l3_type:2,
337+
ce:1;
338+
339+
u8 vlan_ind:3,
340+
rx_ok:1,
341+
pri:3,
342+
bmc:1;
343+
344+
u16 len:13,
345+
crc:1,
346+
mii:1,
347+
drop:1;
348+
349+
} __attribute__ ((packed));
350+
#endif
351+
static struct {unsigned char ctrl, timer_l, timer_h, size, ifg; }
352+
AX88179_BULKIN_SIZE[] = {
353+
{7, 0x4f, 0, 0x12, 0xff},
354+
{7, 0x20, 3, 0x16, 0xff},
355+
{7, 0xae, 7, 0x18, 0xff},
356+
{7, 0xcc, 0x4c, 0x18, 8},
357+
};
358+
359+
static int ax88179_reset(struct usbnet *dev);
360+
static int ax88179_link_reset(struct usbnet *dev);
361+
static int ax88179_AutoDetach(struct usbnet *dev, int in_pm);
362+
363+
#endif /* __LINUX_USBNET_ASIX_H */
364+

0 commit comments

Comments
 (0)