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
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
22 #ifndef __LINUX_USB_USB338X_H
23 #define __LINUX_USB_USB338X_H
25 #include <linux/usb/net2280.h>
28 * Extra defined bits for net2280 registers
32 #define DEFECT7374_FSM_FIELD 28
34 #define DMA_REQUEST_OUTSTANDING 5
35 #define DMA_PAUSE_DONE_INTERRUPT 26
36 #define SET_ISOCHRONOUS_DELAY 24
38 #define SUPER_SPEED_MODE 8
41 #define MAX_BURST_SIZE 24
42 #define EP_FIFO_BYTE_COUNT 16
43 #define IN_ENDPOINT_ENABLE 14
44 #define IN_ENDPOINT_TYPE 12
45 #define OUT_ENDPOINT_ENABLE 10
46 #define OUT_ENDPOINT_TYPE 8
47 #define USB3380_EP_CFG_MASK_IN ((0x3 << IN_ENDPOINT_TYPE) | \
48 BIT(IN_ENDPOINT_ENABLE))
49 #define USB3380_EP_CFG_MASK_OUT ((0x3 << OUT_ENDPOINT_TYPE) | \
50 BIT(OUT_ENDPOINT_ENABLE))
52 struct usb338x_usb_ext_regs {
54 #define DEVICE_PROTOCOL 16
55 #define DEVICE_SUB_CLASS 8
56 #define DEVICE_CLASS 0
58 #define U2_SYSTEM_EXIT_LATENCY 8
59 #define U1_SYSTEM_EXIT_LATENCY 0
61 #define U2_DEVICE_EXIT_LATENCY 8
62 #define U1_DEVICE_EXIT_LATENCY 0
64 #define USB_L1_LPM_HIRD 2
65 #define USB_L1_LPM_REMOTE_WAKE 1
66 #define USB_L1_LPM_SUPPORT 0
68 #define BELT_MULTIPLIER 10
69 #define BEST_EFFORT_LATENCY_TOLERANCE 0
74 #define FUNCTION_SUSPEND 4
75 #define USB3_CORE_ENABLE 3
76 #define USB2_CORE_ENABLE 2
77 #define SERIAL_NUMBER_STRING_ENABLE 0
79 #define GPEP3_TIMEOUT 19
80 #define GPEP2_TIMEOUT 18
81 #define GPEP1_TIMEOUT 17
82 #define GPEP0_TIMEOUT 16
83 #define GPEP3_TIMEOUT_VALUE 13
84 #define GPEP3_TIMEOUT_ENABLE 12
85 #define GPEP2_TIMEOUT_VALUE 9
86 #define GPEP2_TIMEOUT_ENABLE 8
87 #define GPEP1_TIMEOUT_VALUE 5
88 #define GPEP1_TIMEOUT_ENABLE 4
89 #define GPEP0_TIMEOUT_VALUE 1
90 #define GPEP0_TIMEOUT_ENABLE 0
92 #define ISOCHRONOUS_DELAY 0
95 struct usb338x_fifo_regs {
96 /* offset 0x0500, 0x0520, 0x0540, 0x0560, 0x0580 */
97 u32 ep_fifo_size_base;
98 #define IN_FIFO_BASE_ADDRESS 22
99 #define IN_FIFO_SIZE 16
100 #define OUT_FIFO_BASE_ADDRESS 6
101 #define OUT_FIFO_SIZE 0
102 u32 ep_fifo_out_wrptr;
103 u32 ep_fifo_out_rdptr;
104 u32 ep_fifo_in_wrptr;
105 u32 ep_fifo_in_rdptr;
111 struct usb338x_ll_regs {
120 u32 ll_general_ctrl0;
121 u32 ll_general_ctrl1;
122 #define PM_U3_AUTO_EXIT 29
123 #define PM_U2_AUTO_EXIT 28
124 #define PM_U1_AUTO_EXIT 27
125 #define PM_FORCE_U2_ENTRY 26
126 #define PM_FORCE_U1_ENTRY 25
127 #define PM_LGO_COLLISION_SEND_LAU 24
128 #define PM_DIR_LINK_REJECT 23
129 #define PM_FORCE_LINK_ACCEPT 22
130 #define PM_DIR_ENTRY_U3 20
131 #define PM_DIR_ENTRY_U2 19
132 #define PM_DIR_ENTRY_U1 18
133 #define PM_U2_ENABLE 17
134 #define PM_U1_ENABLE 16
135 #define SKP_THRESHOLD_ADJUST_FMW 8
136 #define RESEND_DPP_ON_LRTY_FMW 7
137 #define DL_BIT_VALUE_FMW 6
138 #define FORCE_DL_BIT 5
139 u32 ll_general_ctrl2;
140 #define SELECT_INVERT_LANE_POLARITY 7
141 #define FORCE_INVERT_LANE_POLARITY 6
144 u32 ll_general_ctrl3;
145 u32 ll_general_ctrl4;
155 #define TIMER_LFPS_6US 16
157 #define TIMER_LFPS_80US 0
164 u32 ll_tsn_counters_2;
165 #define HOT_TX_NORESET_TS2 24
168 u32 ll_tsn_counters_3;
169 #define HOT_RX_RESET_TS2 0
174 u32 ll_lfps_timers_2;
175 #define LFPS_TIMERS_2_WORKAROUND_VALUE 0x084d
177 u32 ll_tsn_chicken_bit;
178 #define RECOVERY_IDLE_TO_RECOVER_FMW 3
182 struct usb338x_pl_regs {
189 /* Protocol Layer Endpoint Control*/
190 #define PL_EP_CTRL 0x810
191 #define ENDPOINT_SELECT 0
193 #define EP_INITIALIZED 16
194 #define SEQUENCE_NUMBER_RESET 17
195 #define CLEAR_ACK_ERROR_CODE 20
200 /* Protocol Layer Endpoint Status 1*/
201 #define PL_EP_STATUS_1 0x820
203 #define ACK_GOOD_NORMAL 0x11
204 #define ACK_GOOD_MORE_ACKS_TO_COME 0x16
207 /* Protocol Layer Endpoint Status 3*/
208 #define PL_EP_STATUS_3 0x828
209 #define SEQUENCE_NUMBER 0
211 /* Protocol Layer Endpoint Status 4*/
212 #define PL_EP_STATUS_4 0x82c
214 /* Protocol Layer Endpoint Configuration 4*/
215 #define PL_EP_CFG_4 0x830
216 #define NON_CTRL_IN_TOLERATE_BAD_DIR 6
219 #endif /* __LINUX_USB_USB338X_H */