1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (c) 2011 The Chromium OS Authors.
4 * Copyright (c) 2013 NVIDIA Corporation
10 /* USB Controller (USBx_CONTROLLER_) regs */
50 uint periodic_list_base;
57 uint reserved6; /* is this port_sc1 on some controllers? */
64 uint endpt_nak_enable;
75 uint endpt_setup_stat;
81 uint reserved11[0x80];
91 uint periodic_list_base;
116 uint reserved10_1[2];
119 uint reserved10_2[4];
122 uint reserved10_3[4];
125 uint reserved10_4[4];
135 uint endpt_nak_enable;
136 uint endpt_setup_stat;
137 uint reserved11_1[0x7D];
142 uint phy_vbus_sensors;
143 uint phy_vbus_wakeup_id;
144 uint phy_alt_vbus_sys;
146 #ifdef CONFIG_TEGRA20
148 uint usb1_legacy_ctrl;
152 uint ulpi_timing_ctrl_0;
153 uint ulpi_timing_ctrl_1;
158 uint usb1_legacy_ctrl;
166 uint reserved14[64 * 3];
171 uint utmip_xcvr_cfg0;
172 uint utmip_bias_cfg0;
175 uint utmip_hsrx_cfg0;
176 uint utmip_hsrx_cfg1;
177 uint utmip_fslsrx_cfg0;
178 uint utmip_fslsrx_cfg1;
182 uint utmip_misc_cfg0;
183 uint utmip_misc_cfg1;
184 uint utmip_debounce_cfg0;
187 uint utmip_bat_chrg_cfg0;
188 uint utmip_spare_cfg0;
189 uint utmip_xcvr_cfg1;
190 uint utmip_bias_cfg1;
193 /* USB1_LEGACY_CTRL */
194 #define USB1_NO_LEGACY_MODE 1
196 #define VBUS_SENSE_CTL_SHIFT 1
197 #define VBUS_SENSE_CTL_MASK (3 << VBUS_SENSE_CTL_SHIFT)
198 #define VBUS_SENSE_CTL_VBUS_WAKEUP 0
199 #define VBUS_SENSE_CTL_AB_SESS_VLD_OR_VBUS_WAKEUP 1
200 #define VBUS_SENSE_CTL_AB_SESS_VLD 2
201 #define VBUS_SENSE_CTL_A_SESS_VLD 3
203 /* USBx_IF_USB_SUSP_CTRL_0 */
204 #define UTMIP_PHY_ENB (1 << 12)
205 #define UTMIP_RESET (1 << 11)
206 #define USB_PHY_CLK_VALID (1 << 7)
207 #define USB_SUSP_CLR (1 << 5)
209 #if defined(CONFIG_TEGRA20) || defined(CONFIG_TEGRA30)
210 /* USB2_IF_USB_SUSP_CTRL_0 */
211 #define ULPI_PHY_ENB (1 << 13)
213 /* USB2_IF_ULPI_TIMING_CTRL_0 */
214 #define ULPI_OUTPUT_PINMUX_BYP (1 << 10)
215 #define ULPI_CLKOUT_PINMUX_BYP (1 << 11)
217 /* USB2_IF_ULPI_TIMING_CTRL_1 */
218 #define ULPI_DATA_TRIMMER_LOAD (1 << 0)
219 #define ULPI_DATA_TRIMMER_SEL(x) (((x) & 0x7) << 1)
220 #define ULPI_STPDIRNXT_TRIMMER_LOAD (1 << 16)
221 #define ULPI_STPDIRNXT_TRIMMER_SEL(x) (((x) & 0x7) << 17)
222 #define ULPI_DIR_TRIMMER_LOAD (1 << 24)
223 #define ULPI_DIR_TRIMMER_SEL(x) (((x) & 0x7) << 25)
226 /* USBx_UTMIP_MISC_CFG0 */
227 #define UTMIP_SUSPEND_EXIT_ON_EDGE (1 << 22)
229 /* USBx_UTMIP_MISC_CFG1 */
230 #define UTMIP_PHY_XTAL_CLOCKEN (1 << 30)
233 * Tegra 3 and later: Moved to Clock and Reset register space, see
234 * CLK_RST_CONTROLLER_UTMIP_PLL_CFG2_0
236 #define UTMIP_PLLU_STABLE_COUNT_SHIFT 6
237 #define UTMIP_PLLU_STABLE_COUNT_MASK \
238 (0xfff << UTMIP_PLLU_STABLE_COUNT_SHIFT)
240 * Tegra 3 and later: Moved to Clock and Reset register space, see
241 * CLK_RST_CONTROLLER_UTMIP_PLL_CFG2_0
243 #define UTMIP_PLL_ACTIVE_DLY_COUNT_SHIFT 18
244 #define UTMIP_PLL_ACTIVE_DLY_COUNT_MASK \
245 (0x1f << UTMIP_PLL_ACTIVE_DLY_COUNT_SHIFT)
247 /* USBx_UTMIP_PLL_CFG1_0 */
248 /* Tegra 3 and later: Moved to Clock and Reset register space */
249 #define UTMIP_PLLU_ENABLE_DLY_COUNT_SHIFT 27
250 #define UTMIP_PLLU_ENABLE_DLY_COUNT_MASK \
251 (0x1f << UTMIP_PLLU_ENABLE_DLY_COUNT_SHIFT)
252 #define UTMIP_XTAL_FREQ_COUNT_SHIFT 0
253 #define UTMIP_XTAL_FREQ_COUNT_MASK 0xfff
255 /* USBx_UTMIP_BIAS_CFG0_0 */
256 #define UTMIP_HSDISCON_LEVEL_MSB (1 << 24)
257 #define UTMIP_OTGPD (1 << 11)
258 #define UTMIP_BIASPD (1 << 10)
259 #define UTMIP_HSDISCON_LEVEL_SHIFT 2
260 #define UTMIP_HSDISCON_LEVEL_MASK \
261 (0x3 << UTMIP_HSDISCON_LEVEL_SHIFT)
262 #define UTMIP_HSSQUELCH_LEVEL_SHIFT 0
263 #define UTMIP_HSSQUELCH_LEVEL_MASK \
264 (0x3 << UTMIP_HSSQUELCH_LEVEL_SHIFT)
266 /* USBx_UTMIP_BIAS_CFG1_0 */
267 #define UTMIP_FORCE_PDTRK_POWERDOWN 1
268 #define UTMIP_BIAS_DEBOUNCE_TIMESCALE_SHIFT 8
269 #define UTMIP_BIAS_DEBOUNCE_TIMESCALE_MASK \
270 (0x3f << UTMIP_BIAS_DEBOUNCE_TIMESCALE_SHIFT)
271 #define UTMIP_BIAS_PDTRK_COUNT_SHIFT 3
272 #define UTMIP_BIAS_PDTRK_COUNT_MASK \
273 (0x1f << UTMIP_BIAS_PDTRK_COUNT_SHIFT)
275 /* USBx_UTMIP_DEBOUNCE_CFG0_0 */
276 #define UTMIP_DEBOUNCE_CFG0_SHIFT 0
277 #define UTMIP_DEBOUNCE_CFG0_MASK 0xffff
279 /* USBx_UTMIP_TX_CFG0_0 */
280 #define UTMIP_FS_PREAMBLE_J (1 << 19)
282 /* USBx_UTMIP_BAT_CHRG_CFG0_0 */
283 #define UTMIP_PD_CHRG 1
285 /* USBx_UTMIP_SPARE_CFG0_0 */
286 #define FUSE_SETUP_SEL (1 << 3)
288 /* USBx_UTMIP_HSRX_CFG0_0 */
289 #define UTMIP_IDLE_WAIT_SHIFT 15
290 #define UTMIP_IDLE_WAIT_MASK (0x1f << UTMIP_IDLE_WAIT_SHIFT)
291 #define UTMIP_ELASTIC_LIMIT_SHIFT 10
292 #define UTMIP_ELASTIC_LIMIT_MASK \
293 (0x1f << UTMIP_ELASTIC_LIMIT_SHIFT)
295 /* USBx_UTMIP_HSRX_CFG1_0 */
296 #define UTMIP_HS_SYNC_START_DLY_SHIFT 1
297 #define UTMIP_HS_SYNC_START_DLY_MASK \
298 (0x1f << UTMIP_HS_SYNC_START_DLY_SHIFT)
300 /* USBx_CONTROLLER_2_USB2D_ICUSB_CTRL_0 */
301 #define IC_ENB1 (1 << 3)
303 #ifdef CONFIG_TEGRA20
305 #define PTS1_SHIFT 31
306 #define PTS1_MASK (1 << PTS1_SHIFT)
307 #define STS1 (1 << 30)
309 /* PORTSC, USB2, USB3 */
311 #define PTS_MASK (3U << PTS_SHIFT)
312 #define STS (1 << 29)
314 /* USB2D_HOSTPC1_DEVLC_0 */
316 #define PTS_MASK (0x7U << PTS_SHIFT)
317 #define STS (1 << 28)
321 #define PTS_RESERVED 1
323 #define PTS_ICUSB_SER 3
326 /* SB2_CONTROLLER_2_USB2D_PORTSC1_0 */
327 #define WKOC (1 << 22)
328 #define WKDS (1 << 21)
329 #define WKCN (1 << 20)
331 /* USBx_UTMIP_XCVR_CFG0_0 */
332 #define UTMIP_FORCE_PD_POWERDOWN (1 << 14)
333 #define UTMIP_FORCE_PD2_POWERDOWN (1 << 16)
334 #define UTMIP_FORCE_PDZI_POWERDOWN (1 << 18)
335 #define UTMIP_XCVR_LSBIAS_SE (1 << 21)
336 #define UTMIP_XCVR_HSSLEW_MSB_SHIFT 25
337 #define UTMIP_XCVR_HSSLEW_MSB_MASK \
338 (0x7f << UTMIP_XCVR_HSSLEW_MSB_SHIFT)
339 #define UTMIP_XCVR_SETUP_MSB_SHIFT 22
340 #define UTMIP_XCVR_SETUP_MSB_MASK (0x7 << UTMIP_XCVR_SETUP_MSB_SHIFT)
341 #define UTMIP_XCVR_SETUP_SHIFT 0
342 #define UTMIP_XCVR_SETUP_MASK (0xf << UTMIP_XCVR_SETUP_SHIFT)
344 /* USBx_UTMIP_XCVR_CFG1_0 */
345 #define UTMIP_XCVR_TERM_RANGE_ADJ_SHIFT 18
346 #define UTMIP_XCVR_TERM_RANGE_ADJ_MASK \
347 (0xf << UTMIP_XCVR_TERM_RANGE_ADJ_SHIFT)
348 #define UTMIP_FORCE_PDDISC_POWERDOWN (1 << 0)
349 #define UTMIP_FORCE_PDCHRP_POWERDOWN (1 << 2)
350 #define UTMIP_FORCE_PDDR_POWERDOWN (1 << 4)
352 /* USB3_IF_USB_PHY_VBUS_SENSORS_0 */
353 #define VBUS_VLD_STS (1 << 26)
354 #define VBUS_B_SESS_VLD_SW_VALUE (1 << 12)
355 #define VBUS_B_SESS_VLD_SW_EN (1 << 11)
357 /* Setup USB on the board */
358 int usb_process_devicetree(const void *blob);
360 #endif /* _TEGRA_USB_H_ */