coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
usb_common.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef SOC_MEDIATEK_USB_COMMON_H
4 #define SOC_MEDIATEK_USB_COMMON_H
5 
6 #include <stddef.h>
7 
8 /* ip_pw_ctrl0 */
9 #define CTRL0_IP_SW_RST (0x1 << 0)
10 
11 /* ip_pw_ctrl1 */
12 #define CTRL1_IP_HOST_PDN (0x1 << 0)
13 
14 /* ip_pw_sts1 */
15 #define STS1_U3_MAC_RST (0x1 << 16)
16 #define STS1_SYS125_RST (0x1 << 10)
17 #define STS1_REF_RST (0x1 << 8)
18 #define STS1_SYSPLL_STABLE (0x1 << 0)
19 
20 /* ip_pw_sts2 */
21 #define STS2_U2_MAC_RST (0x1 << 0)
22 
23 /* ip_xhci_cap */
24 #define CAP_U3_PORT_NUM(p) ((p) & 0xff)
25 #define CAP_U2_PORT_NUM(p) (((p) >> 8) & 0xff)
26 
27 /* u3_ctrl_p */
28 #define CTRL_U3_PORT_HOST_SEL (0x1 << 2)
29 #define CTRL_U3_PORT_PDN (0x1 << 1)
30 #define CTRL_U3_PORT_DIS (0x1 << 0)
31 
32 /* u2_ctrl_p */
33 #define CTRL_U2_PORT_HOST_SEL (0x1 << 2)
34 #define CTRL_U2_PORT_PDN (0x1 << 1)
35 #define CTRL_U2_PORT_DIS (0x1 << 0)
36 
49 };
50 
51 /* U2PHY_COM USBPHYACR5 */
52 #define PA5_RG_U2_HSTX_SRCTRL (0x7 << 12)
53 #define PA5_RG_U2_HSTX_SRCTRL_VAL(x) ((0x7 & (x)) << 12)
54 #define PA5_RG_U2_HS_100U_U3_EN (0x1 << 11)
55 
56 /* U2PHY_COM USBPHYACR6 */
57 #define PA6_RG_U2_ISO_EN (0x1 << 31)
58 #define PA6_RG_U2_BC11_SW_EN (0x1 << 23)
59 #define PA6_RG_U2_OTG_VBUSCMP_EN (0x1 << 20)
60 #define PA6_RG_U2_DISCTH (0xf << 4)
61 #define PA6_RG_U2_DISCTH_VAL(x) ((0xf & (x)) << 4)
62 #define PA6_RG_U2_SQTH (0xf << 0)
63 #define PA6_RG_U2_SQTH_VAL(x) ((0xf & (x)) << 0)
64 
65 /* U2PHY_COM U2PHYACR4 */
66 #define P2C_RG_USB20_GPIO_CTL (0x1 << 9)
67 #define P2C_USB20_GPIO_MODE (0x1 << 8)
68 #define P2C_U2_GPIO_CTR_MSK (P2C_RG_USB20_GPIO_CTL | P2C_USB20_GPIO_MODE)
69 
70 /* U2PHY_COM U2PHYDTM0 */
71 #define P2C_FORCE_UART_EN (0x1 << 26)
72 #define P2C_FORCE_DATAIN (0x1 << 23)
73 #define P2C_FORCE_DM_PULLDOWN (0x1 << 21)
74 #define P2C_FORCE_DP_PULLDOWN (0x1 << 20)
75 #define P2C_FORCE_XCVRSEL (0x1 << 19)
76 #define P2C_FORCE_SUSPENDM (0x1 << 18)
77 #define P2C_FORCE_TERMSEL (0x1 << 17)
78 #define P2C_RG_DATAIN (0xf << 10)
79 #define P2C_RG_DATAIN_VAL(x) ((0xf & (x)) << 10)
80 #define P2C_RG_DMPULLDOWN (0x1 << 7)
81 #define P2C_RG_DPPULLDOWN (0x1 << 6)
82 #define P2C_RG_XCVRSEL (0x3 << 4)
83 #define P2C_RG_XCVRSEL_VAL(x) ((0x3 & (x)) << 4)
84 #define P2C_RG_SUSPENDM (0x1 << 3)
85 #define P2C_RG_TERMSEL (0x1 << 2)
86 #define P2C_DTM0_PART_MASK \
87  (P2C_FORCE_DATAIN | P2C_FORCE_DM_PULLDOWN | \
88  P2C_FORCE_DP_PULLDOWN | P2C_FORCE_XCVRSEL | \
89  P2C_FORCE_TERMSEL | P2C_RG_DMPULLDOWN | \
90  P2C_RG_TERMSEL)
91 
92 /* U2PHY_COM U2PHYDTM1 */
93 #define P2C_RG_UART_EN (0x1 << 16)
94 #define P2C_RG_VBUSVALID (0x1 << 5)
95 #define P2C_RG_SESSEND (0x1 << 4)
96 #define P2C_RG_AVALID (0x1 << 2)
97 
98 /* U3PHYA PHYA_REG0 */
99 #define P3A_RG_U3_VUSB10_ON (1 << 5)
100 
101 /* U3PHYA PHYA_REG6 */
102 #define P3A_RG_TX_EIDLE_CM (0xf << 28)
103 #define P3A_RG_TX_EIDLE_CM_VAL(x) ((0xf & (x)) << 28)
104 
105 /* U3PHYA PHYA_REG9 */
106 #define P3A_RG_RX_DAC_MUX (0x1f << 1)
107 #define P3A_RG_RX_DAC_MUX_VAL(x) ((0x1f & (x)) << 1)
108 
109 /* U3PHYA_DA REG0 */
110 #define P3A_RG_XTAL_EXT_EN_U3 (0x3 << 10)
111 #define P3A_RG_XTAL_EXT_EN_U3_VAL(x) ((0x3 & (x)) << 10)
112 
113 /* U3PHYD CDR1 */
114 #define P3D_RG_CDR_BIR_LTD1 (0x1f << 24)
115 #define P3D_RG_CDR_BIR_LTD1_VAL(x) ((0x1f & (x)) << 24)
116 #define P3D_RG_CDR_BIR_LTD0 (0x1f << 8)
117 #define P3D_RG_CDR_BIR_LTD0_VAL(x) ((0x1f & (x)) << 8)
118 
128  u32 reserved2[36]; /* 0x70 - 0xff */
129 };
130 check_member(sif_u2_phy_com, u2phydtm0, 0x68);
131 
132 struct sif_u3phyd {
140 };
141 
142 struct sif_u3phya {
149 };
150 
154 };
155 
156 /*
157  * This is defined as weak no-ops that can be overridden by legacy SOCs. Some
158  * legacy SOCs need specific settings before init USB. And we expect future
159  * SOCs will not need it.
160  */
161 void mtk_usb_prepare(void);
162 void mtk_usb_adjust_phy_shift(void);
163 
164 void setup_usb_host(void);
165 
166 #endif
check_member(sif_u2_phy_com, u2phydtm0, 0x68)
void setup_usb_host(void)
Definition: usb.c:153
void mtk_usb_adjust_phy_shift(void)
Definition: usb.c:148
void mtk_usb_prepare(void)
Definition: usb.c:143
uint64_t u64
Definition: stdint.h:54
uint32_t u32
Definition: stdint.h:51
u32 reserved0[5]
Definition: usb_common.h:120
u32 reserved2[36]
Definition: usb_common.h:128
u32 reserved1[17]
Definition: usb_common.h:125
u32 reserved[63]
Definition: usb_common.h:153
u32 reserved0[5]
Definition: usb_common.h:144
u32 phya_reg0
Definition: usb_common.h:143
u32 phya_reg6
Definition: usb_common.h:145
u32 reserved2[54]
Definition: usb_common.h:148
u32 phya_reg9
Definition: usb_common.h:147
u32 reserved1[2]
Definition: usb_common.h:146
u32 reserved0[4]
Definition: usb_common.h:133
u32 reserved2[41]
Definition: usb_common.h:139
u32 phyd_reserved
Definition: usb_common.h:137
u32 phyd_cal0
Definition: usb_common.h:134
u32 phyd_cal1
Definition: usb_common.h:135
u32 reserved1[15]
Definition: usb_common.h:136
u32 phyd_cdr1
Definition: usb_common.h:138
u64 u2_ctrl_p[6]
Definition: usb_common.h:48
u64 u3_ctrl_p[4]
Definition: usb_common.h:47
u32 reserved0[3]
Definition: usb_common.h:44
u32 reserved1[2]
Definition: usb_common.h:46