2 * Freescale USB Controller
4 * Copyright 2013 Freescale Semiconductor, Inc.
6 * SPDX-License-Identifier: GPL-2.0+
9 #ifndef _ASM_FSL_USB_H_
10 #define _ASM_FSL_USB_H_
12 #ifdef CONFIG_SYS_FSL_USB_DUAL_PHY_ENABLE
13 struct ccsr_usb_port_ctrl {
32 struct ccsr_usb_port_ctrl port1;
40 struct ccsr_usb_port_ctrl port2;
44 #define CONFIG_SYS_FSL_USB_CTRL_PHY_EN (1 << 0)
45 #define CONFIG_SYS_FSL_USB_DRVVBUS_CR_EN (1 << 1)
46 #define CONFIG_SYS_FSL_USB_PWRFLT_CR_EN (1 << 1)
47 #define CONFIG_SYS_FSL_USB_PLLPRG1_PHY_DIV (1 << 0)
48 #define CONFIG_SYS_FSL_USB_PLLPRG2_PHY2_CLK_EN (1 << 0)
49 #define CONFIG_SYS_FSL_USB_PLLPRG2_PHY1_CLK_EN (1 << 1)
50 #define CONFIG_SYS_FSL_USB_PLLPRG2_FRAC_LPF_EN (1 << 13)
51 #ifdef CONFIG_SYS_FSL_SINGLE_SOURCE_CLK
52 #define CONFIG_SYS_FSL_USB_PLLPRG2_REF_DIV_INTERNAL_CLK (5 << 4)
53 #define CONFIG_SYS_FSL_USB_PLLPRG2_MFI_INTERNAL_CLK (6 << 16)
54 #define CONFIG_SYS_FSL_USB_INTERNAL_SOC_CLK_EN (1 << 20)
56 #define CONFIG_SYS_FSL_USB_PLLPRG2_REF_DIV (1 << 4)
57 #define CONFIG_SYS_FSL_USB_PLLPRG2_MFI (5 << 16)
58 #define CONFIG_SYS_FSL_USB_PLLPRG2_PLL_EN (1 << 21)
59 #define CONFIG_SYS_FSL_USB_SYS_CLK_VALID (1 << 0)
60 #define CONFIG_SYS_FSL_USB_XCVRPRG_HS_DCNT_PROG_EN (1 << 7)
61 #define CONFIG_SYS_FSL_USB_XCVRPRG_HS_DCNT_PROG_MASK (3 << 4)
63 #define INC_DCNT_THRESHOLD_25MV (0 << 4)
64 #define INC_DCNT_THRESHOLD_50MV (1 << 4)
65 #define DEC_DCNT_THRESHOLD_25MV (2 << 4)
66 #define DEC_DCNT_THRESHOLD_50MV (3 << 4)
75 u32 usb_enable_override;
78 #define CONFIG_SYS_FSL_USB_HS_DISCNCT_INC (3 << 22)
79 #define CONFIG_SYS_FSL_USB_RX_AUTO_CAL_RD_WR_SEL (1 << 20)
80 #define CONFIG_SYS_FSL_USB_SQUELCH_PROG_WR_0 13
81 #define CONFIG_SYS_FSL_USB_SQUELCH_PROG_WR_3 16
82 #define CONFIG_SYS_FSL_USB_SQUELCH_PROG_RD_0 0
83 #define CONFIG_SYS_FSL_USB_SQUELCH_PROG_RD_3 3
84 #define CONFIG_SYS_FSL_USB_ENABLE_OVERRIDE 1
85 #define CONFIG_SYS_FSL_USB_SQUELCH_PROG_MASK 0x07
88 /* USB Erratum Checking code */
90 static inline bool has_dual_phy(void)
93 u32 soc = SVR_SOC_VER(svr);
100 return IS_SVR_REV(svr, 1, 0);
107 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
111 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
117 static inline bool has_erratum_a006261(void)
120 u32 soc = SVR_SOC_VER(svr);
124 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
127 return IS_SVR_REV(svr, 1, 0) ||
128 IS_SVR_REV(svr, 1, 1) || IS_SVR_REV(svr, 2, 1);
130 return IS_SVR_REV(svr, 1, 0) ||
131 IS_SVR_REV(svr, 1, 1) ||
132 IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 2, 1);
136 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
140 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
142 return IS_SVR_REV(svr, 1, 0);
145 return IS_SVR_REV(svr, 1, 0);
147 return IS_SVR_REV(svr, 1, 0);
153 static inline bool has_erratum_a007075(void)
156 u32 soc = SVR_SOC_VER(svr);
161 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
163 return IS_SVR_REV(svr, 1, 0);
165 return IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 3, 0);
170 static inline bool has_erratum_a007798(void)
172 return SVR_SOC_VER(get_svr()) == SVR_T4240 &&
173 IS_SVR_REV(get_svr(), 2, 0);
176 static inline bool has_erratum_a007792(void)
179 u32 soc = SVR_SOC_VER(svr);
185 return IS_SVR_REV(svr, 2, 0);
188 return IS_SVR_REV(svr, 1, 0);
195 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
200 static inline bool has_erratum_a005697(void)
203 u32 soc = SVR_SOC_VER(svr);
208 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
213 static inline bool has_erratum_a004477(void)
216 u32 soc = SVR_SOC_VER(svr);
220 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
224 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
226 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0) ||
227 IS_SVR_REV(svr, 2, 1);
230 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
232 return IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 3, 0);
238 static inline bool has_dual_phy(void)
243 static inline bool has_erratum_a006261(void)
248 static inline bool has_erratum_a007075(void)
253 static inline bool has_erratum_a007798(void)
258 static inline bool has_erratum_a007792(void)
263 static inline bool has_erratum_a005697(void)
268 static inline bool has_erratum_a004477(void)
273 #endif /*_ASM_FSL_USB_H_ */