Simon Glass | 08d6ec2 | 2012-02-27 10:52:49 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2011 The Chromium OS Authors. |
Jim Lin | 2fefb8b | 2013-06-21 19:05:47 +0800 | [diff] [blame] | 3 | * Copyright (c) 2013 NVIDIA Corporation |
Simon Glass | 08d6ec2 | 2012-02-27 10:52:49 +0000 | [diff] [blame] | 4 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Simon Glass | 08d6ec2 | 2012-02-27 10:52:49 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #ifndef _TEGRA_USB_H_ |
| 9 | #define _TEGRA_USB_H_ |
| 10 | |
Simon Glass | 08d6ec2 | 2012-02-27 10:52:49 +0000 | [diff] [blame] | 11 | /* USB1_LEGACY_CTRL */ |
| 12 | #define USB1_NO_LEGACY_MODE 1 |
| 13 | |
| 14 | #define VBUS_SENSE_CTL_SHIFT 1 |
| 15 | #define VBUS_SENSE_CTL_MASK (3 << VBUS_SENSE_CTL_SHIFT) |
| 16 | #define VBUS_SENSE_CTL_VBUS_WAKEUP 0 |
| 17 | #define VBUS_SENSE_CTL_AB_SESS_VLD_OR_VBUS_WAKEUP 1 |
| 18 | #define VBUS_SENSE_CTL_AB_SESS_VLD 2 |
| 19 | #define VBUS_SENSE_CTL_A_SESS_VLD 3 |
| 20 | |
| 21 | /* USBx_IF_USB_SUSP_CTRL_0 */ |
| 22 | #define UTMIP_PHY_ENB (1 << 12) |
| 23 | #define UTMIP_RESET (1 << 11) |
| 24 | #define USB_PHY_CLK_VALID (1 << 7) |
Lucas Stach | f31e411 | 2012-10-01 00:44:35 +0200 | [diff] [blame] | 25 | #define USB_SUSP_CLR (1 << 5) |
Simon Glass | 08d6ec2 | 2012-02-27 10:52:49 +0000 | [diff] [blame] | 26 | |
Jim Lin | 2fefb8b | 2013-06-21 19:05:47 +0800 | [diff] [blame] | 27 | /* USB2_IF_USB_SUSP_CTRL_0 */ |
| 28 | #define ULPI_PHY_ENB (1 << 13) |
| 29 | |
| 30 | /* USBx_UTMIP_MISC_CFG0 */ |
| 31 | #define UTMIP_SUSPEND_EXIT_ON_EDGE (1 << 22) |
| 32 | |
Simon Glass | 08d6ec2 | 2012-02-27 10:52:49 +0000 | [diff] [blame] | 33 | /* USBx_UTMIP_MISC_CFG1 */ |
| 34 | #define UTMIP_PLLU_STABLE_COUNT_SHIFT 6 |
| 35 | #define UTMIP_PLLU_STABLE_COUNT_MASK \ |
| 36 | (0xfff << UTMIP_PLLU_STABLE_COUNT_SHIFT) |
| 37 | #define UTMIP_PLL_ACTIVE_DLY_COUNT_SHIFT 18 |
| 38 | #define UTMIP_PLL_ACTIVE_DLY_COUNT_MASK \ |
| 39 | (0x1f << UTMIP_PLL_ACTIVE_DLY_COUNT_SHIFT) |
| 40 | #define UTMIP_PHY_XTAL_CLOCKEN (1 << 30) |
| 41 | |
| 42 | /* USBx_UTMIP_PLL_CFG1_0 */ |
| 43 | #define UTMIP_PLLU_ENABLE_DLY_COUNT_SHIFT 27 |
| 44 | #define UTMIP_PLLU_ENABLE_DLY_COUNT_MASK \ |
Jim Lin | 2fefb8b | 2013-06-21 19:05:47 +0800 | [diff] [blame] | 45 | (0x1f << UTMIP_PLLU_ENABLE_DLY_COUNT_SHIFT) |
Simon Glass | 08d6ec2 | 2012-02-27 10:52:49 +0000 | [diff] [blame] | 46 | #define UTMIP_XTAL_FREQ_COUNT_SHIFT 0 |
| 47 | #define UTMIP_XTAL_FREQ_COUNT_MASK 0xfff |
| 48 | |
Jim Lin | 2fefb8b | 2013-06-21 19:05:47 +0800 | [diff] [blame] | 49 | /* USBx_UTMIP_BIAS_CFG0_0 */ |
| 50 | #define UTMIP_HSDISCON_LEVEL_MSB (1 << 24) |
| 51 | #define UTMIP_OTGPD (1 << 11) |
| 52 | #define UTMIP_BIASPD (1 << 10) |
| 53 | #define UTMIP_HSDISCON_LEVEL_SHIFT 2 |
| 54 | #define UTMIP_HSDISCON_LEVEL_MASK \ |
| 55 | (0x3 << UTMIP_HSDISCON_LEVEL_SHIFT) |
| 56 | #define UTMIP_HSSQUELCH_LEVEL_SHIFT 0 |
| 57 | #define UTMIP_HSSQUELCH_LEVEL_MASK \ |
| 58 | (0x3 << UTMIP_HSSQUELCH_LEVEL_SHIFT) |
| 59 | |
Simon Glass | 08d6ec2 | 2012-02-27 10:52:49 +0000 | [diff] [blame] | 60 | /* USBx_UTMIP_BIAS_CFG1_0 */ |
Jim Lin | 2fefb8b | 2013-06-21 19:05:47 +0800 | [diff] [blame] | 61 | #define UTMIP_FORCE_PDTRK_POWERDOWN 1 |
Simon Glass | 08d6ec2 | 2012-02-27 10:52:49 +0000 | [diff] [blame] | 62 | #define UTMIP_BIAS_PDTRK_COUNT_SHIFT 3 |
| 63 | #define UTMIP_BIAS_PDTRK_COUNT_MASK \ |
| 64 | (0x1f << UTMIP_BIAS_PDTRK_COUNT_SHIFT) |
| 65 | |
Jim Lin | 2fefb8b | 2013-06-21 19:05:47 +0800 | [diff] [blame] | 66 | /* USBx_UTMIP_DEBOUNCE_CFG0_0 */ |
Simon Glass | 08d6ec2 | 2012-02-27 10:52:49 +0000 | [diff] [blame] | 67 | #define UTMIP_DEBOUNCE_CFG0_SHIFT 0 |
| 68 | #define UTMIP_DEBOUNCE_CFG0_MASK 0xffff |
| 69 | |
| 70 | /* USBx_UTMIP_TX_CFG0_0 */ |
| 71 | #define UTMIP_FS_PREAMBLE_J (1 << 19) |
| 72 | |
| 73 | /* USBx_UTMIP_BAT_CHRG_CFG0_0 */ |
| 74 | #define UTMIP_PD_CHRG 1 |
| 75 | |
Simon Glass | 08d6ec2 | 2012-02-27 10:52:49 +0000 | [diff] [blame] | 76 | /* USBx_UTMIP_SPARE_CFG0_0 */ |
| 77 | #define FUSE_SETUP_SEL (1 << 3) |
| 78 | |
| 79 | /* USBx_UTMIP_HSRX_CFG0_0 */ |
| 80 | #define UTMIP_IDLE_WAIT_SHIFT 15 |
| 81 | #define UTMIP_IDLE_WAIT_MASK (0x1f << UTMIP_IDLE_WAIT_SHIFT) |
| 82 | #define UTMIP_ELASTIC_LIMIT_SHIFT 10 |
| 83 | #define UTMIP_ELASTIC_LIMIT_MASK \ |
| 84 | (0x1f << UTMIP_ELASTIC_LIMIT_SHIFT) |
| 85 | |
Jim Lin | 2fefb8b | 2013-06-21 19:05:47 +0800 | [diff] [blame] | 86 | /* USBx_UTMIP_HSRX_CFG1_0 */ |
Simon Glass | 08d6ec2 | 2012-02-27 10:52:49 +0000 | [diff] [blame] | 87 | #define UTMIP_HS_SYNC_START_DLY_SHIFT 1 |
| 88 | #define UTMIP_HS_SYNC_START_DLY_MASK \ |
Jim Lin | 2fefb8b | 2013-06-21 19:05:47 +0800 | [diff] [blame] | 89 | (0x1f << UTMIP_HS_SYNC_START_DLY_SHIFT) |
Simon Glass | 08d6ec2 | 2012-02-27 10:52:49 +0000 | [diff] [blame] | 90 | |
| 91 | /* USBx_CONTROLLER_2_USB2D_ICUSB_CTRL_0 */ |
| 92 | #define IC_ENB1 (1 << 3) |
| 93 | |
Jim Lin | 2fefb8b | 2013-06-21 19:05:47 +0800 | [diff] [blame] | 94 | /* PORTSC1, USB1, defined for Tegra20 */ |
| 95 | #define PTS1_SHIFT 31 |
| 96 | #define PTS1_MASK (1 << PTS1_SHIFT) |
| 97 | #define STS1 (1 << 30) |
| 98 | |
| 99 | #define PTS_UTMI 0 |
Simon Glass | 08d6ec2 | 2012-02-27 10:52:49 +0000 | [diff] [blame] | 100 | #define PTS_RESERVED 1 |
Jim Lin | 2fefb8b | 2013-06-21 19:05:47 +0800 | [diff] [blame] | 101 | #define PTS_ULPI 2 |
Simon Glass | 08d6ec2 | 2012-02-27 10:52:49 +0000 | [diff] [blame] | 102 | #define PTS_ICUSB_SER 3 |
Jim Lin | 2fefb8b | 2013-06-21 19:05:47 +0800 | [diff] [blame] | 103 | #define PTS_HSIC 4 |
Simon Glass | 08d6ec2 | 2012-02-27 10:52:49 +0000 | [diff] [blame] | 104 | |
Jim Lin | 2fefb8b | 2013-06-21 19:05:47 +0800 | [diff] [blame] | 105 | /* SB2_CONTROLLER_2_USB2D_PORTSC1_0 */ |
Lucas Stach | f31e411 | 2012-10-01 00:44:35 +0200 | [diff] [blame] | 106 | #define WKOC (1 << 22) |
| 107 | #define WKDS (1 << 21) |
| 108 | #define WKCN (1 << 20) |
Simon Glass | 08d6ec2 | 2012-02-27 10:52:49 +0000 | [diff] [blame] | 109 | |
| 110 | /* USBx_UTMIP_XCVR_CFG0_0 */ |
| 111 | #define UTMIP_FORCE_PD_POWERDOWN (1 << 14) |
| 112 | #define UTMIP_FORCE_PD2_POWERDOWN (1 << 16) |
| 113 | #define UTMIP_FORCE_PDZI_POWERDOWN (1 << 18) |
Jim Lin | 2fefb8b | 2013-06-21 19:05:47 +0800 | [diff] [blame] | 114 | #define UTMIP_XCVR_LSBIAS_SE (1 << 21) |
| 115 | #define UTMIP_XCVR_HSSLEW_MSB_SHIFT 25 |
| 116 | #define UTMIP_XCVR_HSSLEW_MSB_MASK \ |
| 117 | (0x7f << UTMIP_XCVR_HSSLEW_MSB_SHIFT) |
| 118 | #define UTMIP_XCVR_SETUP_MSB_SHIFT 22 |
| 119 | #define UTMIP_XCVR_SETUP_MSB_MASK (0x7 << UTMIP_XCVR_SETUP_MSB_SHIFT) |
| 120 | #define UTMIP_XCVR_SETUP_SHIFT 0 |
| 121 | #define UTMIP_XCVR_SETUP_MASK (0xf << UTMIP_XCVR_SETUP_SHIFT) |
Simon Glass | 08d6ec2 | 2012-02-27 10:52:49 +0000 | [diff] [blame] | 122 | |
| 123 | /* USBx_UTMIP_XCVR_CFG1_0 */ |
Jim Lin | 2fefb8b | 2013-06-21 19:05:47 +0800 | [diff] [blame] | 124 | #define UTMIP_XCVR_TERM_RANGE_ADJ_SHIFT 18 |
| 125 | #define UTMIP_XCVR_TERM_RANGE_ADJ_MASK \ |
| 126 | (0xf << UTMIP_XCVR_TERM_RANGE_ADJ_SHIFT) |
Simon Glass | 08d6ec2 | 2012-02-27 10:52:49 +0000 | [diff] [blame] | 127 | #define UTMIP_FORCE_PDDISC_POWERDOWN (1 << 0) |
| 128 | #define UTMIP_FORCE_PDCHRP_POWERDOWN (1 << 2) |
| 129 | #define UTMIP_FORCE_PDDR_POWERDOWN (1 << 4) |
| 130 | |
| 131 | /* USB3_IF_USB_PHY_VBUS_SENSORS_0 */ |
| 132 | #define VBUS_VLD_STS (1 << 26) |
| 133 | |
Simon Glass | 08d6ec2 | 2012-02-27 10:52:49 +0000 | [diff] [blame] | 134 | /* Setup USB on the board */ |
Mateusz Zalega | d862f89 | 2013-10-04 19:22:26 +0200 | [diff] [blame] | 135 | int usb_process_devicetree(const void *blob); |
Simon Glass | 08d6ec2 | 2012-02-27 10:52:49 +0000 | [diff] [blame] | 136 | |
Simon Glass | 08d6ec2 | 2012-02-27 10:52:49 +0000 | [diff] [blame] | 137 | #endif /* _TEGRA_USB_H_ */ |