Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0+
0002 /*
0003  * USB 338x super/high/full speed USB device controller.
0004  * Unlike many such controllers, this one talks PCI.
0005  *
0006  * Copyright (C) 2002 NetChip Technology, Inc. (http://www.netchip.com)
0007  * Copyright (C) 2003 David Brownell
0008  * Copyright (C) 2014 Ricardo Ribalda - Qtechnology/AS
0009  */
0010 
0011 #ifndef __LINUX_USB_USB338X_H
0012 #define __LINUX_USB_USB338X_H
0013 
0014 #include <linux/usb/net2280.h>
0015 
0016 /*
0017  * Extra defined bits for net2280 registers
0018  */
0019 #define     SCRATCH               0x0b
0020 
0021 #define     DEFECT7374_FSM_FIELD                28
0022 #define     SUPER_SPEED              8
0023 #define     DMA_REQUEST_OUTSTANDING              5
0024 #define     DMA_PAUSE_DONE_INTERRUPT            26
0025 #define     SET_ISOCHRONOUS_DELAY               24
0026 #define     SET_SEL                             22
0027 #define     SUPER_SPEED_MODE                     8
0028 
0029 /*ep_cfg*/
0030 #define     MAX_BURST_SIZE                      24
0031 #define     EP_FIFO_BYTE_COUNT                  16
0032 #define     IN_ENDPOINT_ENABLE                  14
0033 #define     IN_ENDPOINT_TYPE                    12
0034 #define     OUT_ENDPOINT_ENABLE                 10
0035 #define     OUT_ENDPOINT_TYPE                    8
0036 #define USB3380_EP_CFG_MASK_IN ((0x3 << IN_ENDPOINT_TYPE) | \
0037                 BIT(IN_ENDPOINT_ENABLE))
0038 #define USB3380_EP_CFG_MASK_OUT ((0x3 << OUT_ENDPOINT_TYPE) | \
0039                 BIT(OUT_ENDPOINT_ENABLE))
0040 
0041 struct usb338x_usb_ext_regs {
0042     u32     usbclass;
0043 #define     DEVICE_PROTOCOL                     16
0044 #define     DEVICE_SUB_CLASS                     8
0045 #define     DEVICE_CLASS                         0
0046     u32     ss_sel;
0047 #define     U2_SYSTEM_EXIT_LATENCY               8
0048 #define     U1_SYSTEM_EXIT_LATENCY               0
0049     u32     ss_del;
0050 #define     U2_DEVICE_EXIT_LATENCY               8
0051 #define     U1_DEVICE_EXIT_LATENCY               0
0052     u32     usb2lpm;
0053 #define     USB_L1_LPM_HIRD                      2
0054 #define     USB_L1_LPM_REMOTE_WAKE               1
0055 #define     USB_L1_LPM_SUPPORT                   0
0056     u32     usb3belt;
0057 #define     BELT_MULTIPLIER                     10
0058 #define     BEST_EFFORT_LATENCY_TOLERANCE        0
0059     u32     usbctl2;
0060 #define     LTM_ENABLE                           7
0061 #define     U2_ENABLE                            6
0062 #define     U1_ENABLE                            5
0063 #define     FUNCTION_SUSPEND                     4
0064 #define     USB3_CORE_ENABLE                     3
0065 #define     USB2_CORE_ENABLE                     2
0066 #define     SERIAL_NUMBER_STRING_ENABLE          0
0067     u32     in_timeout;
0068 #define     GPEP3_TIMEOUT                       19
0069 #define     GPEP2_TIMEOUT                       18
0070 #define     GPEP1_TIMEOUT                       17
0071 #define     GPEP0_TIMEOUT                       16
0072 #define     GPEP3_TIMEOUT_VALUE                 13
0073 #define     GPEP3_TIMEOUT_ENABLE                12
0074 #define     GPEP2_TIMEOUT_VALUE                  9
0075 #define     GPEP2_TIMEOUT_ENABLE                 8
0076 #define     GPEP1_TIMEOUT_VALUE                  5
0077 #define     GPEP1_TIMEOUT_ENABLE                 4
0078 #define     GPEP0_TIMEOUT_VALUE                  1
0079 #define     GPEP0_TIMEOUT_ENABLE                 0
0080     u32     isodelay;
0081 #define     ISOCHRONOUS_DELAY                    0
0082 } __packed;
0083 
0084 struct usb338x_fifo_regs {
0085     /* offset 0x0500, 0x0520, 0x0540, 0x0560, 0x0580 */
0086     u32     ep_fifo_size_base;
0087 #define     IN_FIFO_BASE_ADDRESS                                22
0088 #define     IN_FIFO_SIZE                                        16
0089 #define     OUT_FIFO_BASE_ADDRESS                               6
0090 #define     OUT_FIFO_SIZE                                       0
0091     u32     ep_fifo_out_wrptr;
0092     u32     ep_fifo_out_rdptr;
0093     u32     ep_fifo_in_wrptr;
0094     u32     ep_fifo_in_rdptr;
0095     u32     unused[3];
0096 } __packed;
0097 
0098 
0099 /* Link layer */
0100 struct usb338x_ll_regs {
0101     /* offset 0x700 */
0102     u32   ll_ltssm_ctrl1;
0103     u32   ll_ltssm_ctrl2;
0104     u32   ll_ltssm_ctrl3;
0105     u32   unused1;
0106 
0107     /* 0x710 */
0108     u32   unused2;
0109     u32   ll_general_ctrl0;
0110     u32   ll_general_ctrl1;
0111 #define     PM_U3_AUTO_EXIT                                     29
0112 #define     PM_U2_AUTO_EXIT                                     28
0113 #define     PM_U1_AUTO_EXIT                                     27
0114 #define     PM_FORCE_U2_ENTRY                                   26
0115 #define     PM_FORCE_U1_ENTRY                                   25
0116 #define     PM_LGO_COLLISION_SEND_LAU                           24
0117 #define     PM_DIR_LINK_REJECT                                  23
0118 #define     PM_FORCE_LINK_ACCEPT                                22
0119 #define     PM_DIR_ENTRY_U3                                     20
0120 #define     PM_DIR_ENTRY_U2                                     19
0121 #define     PM_DIR_ENTRY_U1                                     18
0122 #define     PM_U2_ENABLE                                        17
0123 #define     PM_U1_ENABLE                                        16
0124 #define     SKP_THRESHOLD_ADJUST_FMW                            8
0125 #define     RESEND_DPP_ON_LRTY_FMW                              7
0126 #define     DL_BIT_VALUE_FMW                                    6
0127 #define     FORCE_DL_BIT                                        5
0128     u32   ll_general_ctrl2;
0129 #define     SELECT_INVERT_LANE_POLARITY                         7
0130 #define     FORCE_INVERT_LANE_POLARITY                          6
0131 
0132     /* 0x720 */
0133     u32   ll_general_ctrl3;
0134     u32   ll_general_ctrl4;
0135     u32   ll_error_gen;
0136     u32   unused3;
0137 
0138     /* 0x730 */
0139     u32   unused4[4];
0140 
0141     /* 0x740 */
0142     u32   unused5[2];
0143     u32   ll_lfps_5;
0144 #define     TIMER_LFPS_6US                                      16
0145     u32   ll_lfps_6;
0146 #define     TIMER_LFPS_80US                                     0
0147 
0148     /* 0x750 */
0149     u32   unused6[8];
0150 
0151     /* 0x770 */
0152     u32   unused7[3];
0153     u32   ll_tsn_counters_2;
0154 #define     HOT_TX_NORESET_TS2                                  24
0155 
0156     /* 0x780 */
0157     u32   ll_tsn_counters_3;
0158 #define     HOT_RX_RESET_TS2                                    0
0159     u32   unused8[3];
0160 
0161     /* 0x790 */
0162     u32   unused9;
0163     u32   ll_lfps_timers_2;
0164 #define     LFPS_TIMERS_2_WORKAROUND_VALUE          0x084d
0165     u32   unused10;
0166     u32   ll_tsn_chicken_bit;
0167 #define     RECOVERY_IDLE_TO_RECOVER_FMW                        3
0168 } __packed;
0169 
0170 /* protocol layer */
0171 struct usb338x_pl_regs {
0172     /* offset 0x800 */
0173     u32   pl_reg_1;
0174     u32   pl_reg_2;
0175     u32   pl_reg_3;
0176     u32   pl_reg_4;
0177     u32   pl_ep_ctrl;
0178     /* Protocol Layer Endpoint Control*/
0179 #define     PL_EP_CTRL                                  0x810
0180 #define     ENDPOINT_SELECT                             0
0181     /* [4:0] */
0182 #define     EP_INITIALIZED                              16
0183 #define     SEQUENCE_NUMBER_RESET                       17
0184 #define     CLEAR_ACK_ERROR_CODE                        20
0185     u32   pl_reg_6;
0186     u32   pl_reg_7;
0187     u32   pl_reg_8;
0188     u32   pl_ep_status_1;
0189     /* Protocol Layer Endpoint Status 1*/
0190 #define     PL_EP_STATUS_1                              0x820
0191 #define     STATE                                       16
0192 #define     ACK_GOOD_NORMAL                             0x11
0193 #define     ACK_GOOD_MORE_ACKS_TO_COME                  0x16
0194     u32   pl_ep_status_2;
0195     u32   pl_ep_status_3;
0196     /* Protocol Layer Endpoint Status 3*/
0197 #define     PL_EP_STATUS_3                              0x828
0198 #define     SEQUENCE_NUMBER                             0
0199     u32   pl_ep_status_4;
0200     /* Protocol Layer Endpoint Status 4*/
0201 #define     PL_EP_STATUS_4                              0x82c
0202     u32   pl_ep_cfg_4;
0203     /* Protocol Layer Endpoint Configuration 4*/
0204 #define     PL_EP_CFG_4                                 0x830
0205 #define     NON_CTRL_IN_TOLERATE_BAD_DIR                6
0206 } __packed;
0207 
0208 #endif /* __LINUX_USB_USB338X_H */