coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
usb.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef _SOC_USB_H_
4 #define _SOC_USB_H_
5 
6 #include <stdint.h>
7 
8 /* Per Port HS Transmitter Emphasis */
9 #define USB2_EMP_OFF 0
10 #define USB2_DE_EMP_ON 1
11 #define USB2_PRE_EMP_ON 2
12 #define USB2_DE_EMP_ON_PRE_EMP_ON 3
13 
14 /* Per Port Half Bit Pre-emphasis */
15 #define USB2_FULL_BIT_PRE_EMP 0
16 #define USB2_HALF_BIT_PRE_EMP 1
17 
18 /* Per Port HS Preemphasis Bias */
19 #define USB2_BIAS_0MV 0
20 #define USB2_BIAS_11P25MV 1
21 #define USB2_BIAS_16P9MV 2
22 #define USB2_BIAS_28P15MV 3
23 #define USB2_BIAS_39P35MV 5
24 #define USB2_BIAS_45MV 6
25 #define USB2_BIAS_56P3MV 7
26 
27 struct usb2_port_config {
29  uint8_t ocpin;
35 };
36 
37 /* USB Overcurrent pins definition */
38 enum {
39  OC0 = 0,
40  OC1,
41  OC2,
42  OC3,
43  OC4,
44  OC5,
45  OC6,
46  OC7,
48  OC_SKIP = 0xff, /* Skip OC programming */
49 };
50 
51 /* Standard USB Port based on length:
52  * - External
53  * - Back Panel
54  * - OTG
55  * - M.2
56  * - Internal device down */
57 
58 #define USB2_PORT_EMPTY { \
59  .enable = 0, \
60  .ocpin = OC_SKIP, \
61  .tx_bias = USB2_BIAS_0MV, \
62  .tx_emp_enable = USB2_EMP_OFF, \
63  .pre_emp_bias = USB2_BIAS_0MV, \
64  .pre_emp_bit = USB2_HALF_BIT_PRE_EMP, \
65 }
66 
67 /* Length = 11.5"-12" */
68 #define USB2_PORT_LONG(pin) { \
69  .enable = 1, \
70  .ocpin = (pin), \
71  .tx_bias = USB2_BIAS_39P35MV, \
72  .tx_emp_enable = USB2_PRE_EMP_ON, \
73  .pre_emp_bias = USB2_BIAS_56P3MV, \
74  .pre_emp_bit = USB2_HALF_BIT_PRE_EMP, \
75 }
76 
77 /* Length = 6"-11.49" */
78 #define USB2_PORT_MID(pin) { \
79  .enable = 1, \
80  .ocpin = (pin), \
81  .tx_bias = USB2_BIAS_0MV, \
82  .tx_emp_enable = USB2_PRE_EMP_ON, \
83  .pre_emp_bias = USB2_BIAS_56P3MV, \
84  .pre_emp_bit = USB2_HALF_BIT_PRE_EMP, \
85 }
86 
87 /* Length = 3"-5.99" */
88 #define USB2_PORT_SHORT(pin) { \
89  .enable = 1, \
90  .ocpin = (pin), \
91  .tx_bias = USB2_BIAS_39P35MV, \
92  .tx_emp_enable = USB2_PRE_EMP_ON | USB2_DE_EMP_ON, \
93  .pre_emp_bias = USB2_BIAS_39P35MV, \
94  .pre_emp_bit = USB2_FULL_BIT_PRE_EMP, \
95 }
96 
97 /* Max TX and Pre-emp settings */
98 #define USB2_PORT_MAX(pin) { \
99  .enable = 1, \
100  .ocpin = (pin), \
101  .tx_bias = USB2_BIAS_56P3MV, \
102  .tx_emp_enable = USB2_PRE_EMP_ON, \
103  .pre_emp_bias = USB2_BIAS_56P3MV, \
104  .pre_emp_bit = USB2_HALF_BIT_PRE_EMP, \
105 }
106 
107 /* Type-C Port, no BC1.2 charge detect module / MUX
108  * Length = 3.0" - 9.00" */
109 #define USB2_PORT_TYPE_C(pin) { \
110  .enable = 1, \
111  .ocpin = (pin), \
112  .tx_bias = USB2_BIAS_0MV, \
113  .tx_emp_enable = USB2_PRE_EMP_ON, \
114  .pre_emp_bias = USB2_BIAS_56P3MV, \
115  .pre_emp_bit = USB2_HALF_BIT_PRE_EMP, \
116  .type_c = 1, \
117 }
118 
119 struct usb3_port_config {
120  uint8_t enable;
121  uint8_t ocpin;
124 };
125 
126 #define USB3_PORT_EMPTY { \
127  .enable = 0, \
128  .ocpin = OC_SKIP, \
129  .tx_de_emp = 0x00, \
130  .tx_downscale_amp = 0x00, \
131 }
132 
133 #define USB3_PORT_DEFAULT(pin) { \
134  .enable = 1, \
135  .ocpin = (pin), \
136  .tx_de_emp = 0x29, \
137  .tx_downscale_amp = 0x00, \
138 }
139 
140 struct tcss_port_config {
141  uint8_t enable;
142  uint8_t ocpin;
143 };
144 
145 #define TCSS_PORT_EMPTY { \
146  .enable = 0, \
147  .ocpin = OC_SKIP, \
148 }
149 
150 #define TCSS_PORT_DEFAULT(pin) { \
151  .enable = 1, \
152  .ocpin = (pin), \
153 }
154 
155 #endif
@ OC2
Definition: usb.h:41
@ OC7
Definition: usb.h:46
@ OC3
Definition: usb.h:42
@ OC5
Definition: usb.h:44
@ OCMAX
Definition: usb.h:47
@ OC0
Definition: usb.h:39
@ OC_SKIP
Definition: usb.h:48
@ OC1
Definition: usb.h:40
@ OC6
Definition: usb.h:45
@ OC4
Definition: usb.h:43
unsigned char uint8_t
Definition: stdint.h:8
uint8_t enable
Definition: usb.h:152
uint8_t ocpin
Definition: usb.h:153
uint8_t tx_bias
Definition: usb.h:30
uint8_t type_c
Definition: usb.h:34
uint8_t ocpin
Definition: usb.h:29
uint8_t pre_emp_bias
Definition: usb.h:32
uint8_t enable
Definition: usb.h:28
uint8_t pre_emp_bit
Definition: usb.h:33
uint8_t tx_emp_enable
Definition: usb.h:31
uint8_t ocpin
Definition: usb.h:132
uint8_t tx_downscale_amp
Definition: usb.h:134
uint8_t tx_de_emp
Definition: usb.h:133
uint8_t enable
Definition: usb.h:131