1 // SPDX-License-Identifier: GPL-2.0+
3 * USB 338x super/high/full speed USB device controller.
4 * Unlike many such controllers, this one talks PCI.
6 * Copyright (C) 2002 NetChip Technology, Inc. (http://www.netchip.com)
7 * Copyright (C) 2003 David Brownell
8 * Copyright (C) 2014 Ricardo Ribalda - Qtechnology/AS
11 #ifndef __LINUX_USB_USB338X_H
12 #define __LINUX_USB_USB338X_H
14 #include <linux/usb/net2280.h>
17 * Extra defined bits for net2280 registers
21 #define DEFECT7374_FSM_FIELD 28
23 #define DMA_REQUEST_OUTSTANDING 5
24 #define DMA_PAUSE_DONE_INTERRUPT 26
25 #define SET_ISOCHRONOUS_DELAY 24
27 #define SUPER_SPEED_MODE 8
30 #define MAX_BURST_SIZE 24
31 #define EP_FIFO_BYTE_COUNT 16
32 #define IN_ENDPOINT_ENABLE 14
33 #define IN_ENDPOINT_TYPE 12
34 #define OUT_ENDPOINT_ENABLE 10
35 #define OUT_ENDPOINT_TYPE 8
36 #define USB3380_EP_CFG_MASK_IN ((0x3 << IN_ENDPOINT_TYPE) | \
37 BIT(IN_ENDPOINT_ENABLE))
38 #define USB3380_EP_CFG_MASK_OUT ((0x3 << OUT_ENDPOINT_TYPE) | \
39 BIT(OUT_ENDPOINT_ENABLE))
41 struct usb338x_usb_ext_regs {
43 #define DEVICE_PROTOCOL 16
44 #define DEVICE_SUB_CLASS 8
45 #define DEVICE_CLASS 0
47 #define U2_SYSTEM_EXIT_LATENCY 8
48 #define U1_SYSTEM_EXIT_LATENCY 0
50 #define U2_DEVICE_EXIT_LATENCY 8
51 #define U1_DEVICE_EXIT_LATENCY 0
53 #define USB_L1_LPM_HIRD 2
54 #define USB_L1_LPM_REMOTE_WAKE 1
55 #define USB_L1_LPM_SUPPORT 0
57 #define BELT_MULTIPLIER 10
58 #define BEST_EFFORT_LATENCY_TOLERANCE 0
63 #define FUNCTION_SUSPEND 4
64 #define USB3_CORE_ENABLE 3
65 #define USB2_CORE_ENABLE 2
66 #define SERIAL_NUMBER_STRING_ENABLE 0
68 #define GPEP3_TIMEOUT 19
69 #define GPEP2_TIMEOUT 18
70 #define GPEP1_TIMEOUT 17
71 #define GPEP0_TIMEOUT 16
72 #define GPEP3_TIMEOUT_VALUE 13
73 #define GPEP3_TIMEOUT_ENABLE 12
74 #define GPEP2_TIMEOUT_VALUE 9
75 #define GPEP2_TIMEOUT_ENABLE 8
76 #define GPEP1_TIMEOUT_VALUE 5
77 #define GPEP1_TIMEOUT_ENABLE 4
78 #define GPEP0_TIMEOUT_VALUE 1
79 #define GPEP0_TIMEOUT_ENABLE 0
81 #define ISOCHRONOUS_DELAY 0
84 struct usb338x_fifo_regs {
85 /* offset 0x0500, 0x0520, 0x0540, 0x0560, 0x0580 */
86 u32 ep_fifo_size_base;
87 #define IN_FIFO_BASE_ADDRESS 22
88 #define IN_FIFO_SIZE 16
89 #define OUT_FIFO_BASE_ADDRESS 6
90 #define OUT_FIFO_SIZE 0
91 u32 ep_fifo_out_wrptr;
92 u32 ep_fifo_out_rdptr;
100 struct usb338x_ll_regs {
109 u32 ll_general_ctrl0;
110 u32 ll_general_ctrl1;
111 #define PM_U3_AUTO_EXIT 29
112 #define PM_U2_AUTO_EXIT 28
113 #define PM_U1_AUTO_EXIT 27
114 #define PM_FORCE_U2_ENTRY 26
115 #define PM_FORCE_U1_ENTRY 25
116 #define PM_LGO_COLLISION_SEND_LAU 24
117 #define PM_DIR_LINK_REJECT 23
118 #define PM_FORCE_LINK_ACCEPT 22
119 #define PM_DIR_ENTRY_U3 20
120 #define PM_DIR_ENTRY_U2 19
121 #define PM_DIR_ENTRY_U1 18
122 #define PM_U2_ENABLE 17
123 #define PM_U1_ENABLE 16
124 #define SKP_THRESHOLD_ADJUST_FMW 8
125 #define RESEND_DPP_ON_LRTY_FMW 7
126 #define DL_BIT_VALUE_FMW 6
127 #define FORCE_DL_BIT 5
128 u32 ll_general_ctrl2;
129 #define SELECT_INVERT_LANE_POLARITY 7
130 #define FORCE_INVERT_LANE_POLARITY 6
133 u32 ll_general_ctrl3;
134 u32 ll_general_ctrl4;
144 #define TIMER_LFPS_6US 16
146 #define TIMER_LFPS_80US 0
153 u32 ll_tsn_counters_2;
154 #define HOT_TX_NORESET_TS2 24
157 u32 ll_tsn_counters_3;
158 #define HOT_RX_RESET_TS2 0
163 u32 ll_lfps_timers_2;
164 #define LFPS_TIMERS_2_WORKAROUND_VALUE 0x084d
166 u32 ll_tsn_chicken_bit;
167 #define RECOVERY_IDLE_TO_RECOVER_FMW 3
171 struct usb338x_pl_regs {
178 /* Protocol Layer Endpoint Control*/
179 #define PL_EP_CTRL 0x810
180 #define ENDPOINT_SELECT 0
182 #define EP_INITIALIZED 16
183 #define SEQUENCE_NUMBER_RESET 17
184 #define CLEAR_ACK_ERROR_CODE 20
189 /* Protocol Layer Endpoint Status 1*/
190 #define PL_EP_STATUS_1 0x820
192 #define ACK_GOOD_NORMAL 0x11
193 #define ACK_GOOD_MORE_ACKS_TO_COME 0x16
196 /* Protocol Layer Endpoint Status 3*/
197 #define PL_EP_STATUS_3 0x828
198 #define SEQUENCE_NUMBER 0
200 /* Protocol Layer Endpoint Status 4*/
201 #define PL_EP_STATUS_4 0x82c
203 /* Protocol Layer Endpoint Configuration 4*/
204 #define PL_EP_CFG_4 0x830
205 #define NON_CTRL_IN_TOLERATE_BAD_DIR 6
208 #endif /* __LINUX_USB_USB338X_H */