2 * Copyright (c) 2011 The Chromium OS Authors.
3 * See file CREDITS for list of people who contributed to this
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of
9 * the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26 /* USB Controller (USBx_CONTROLLER_) regs */
62 uint periodic_list_base;
69 uint reserved6; /* is this port_sc1 on some controllers? */
76 uint endpt_nak_enable;
87 uint endpt_setup_stat;
93 uint reserved11[0x80];
97 uint phy_vbus_sensors;
98 uint phy_vbus_wakeup_id;
99 uint phy_alt_vbus_sys;
102 uint usb1_legacy_ctrl;
109 uint reserved14[64 * 3];
114 uint utmip_xcvr_cfg0;
115 uint utmip_bias_cfg0;
118 uint utmip_hsrx_cfg0;
119 uint utmip_hsrx_cfg1;
120 uint utmip_fslsrx_cfg0;
121 uint utmip_fslsrx_cfg1;
125 uint utmip_misc_cfg0;
126 uint utmip_misc_cfg1;
127 uint utmip_debounce_cfg0;
130 uint utmip_bat_chrg_cfg0;
131 uint utmip_spare_cfg0;
132 uint utmip_xcvr_cfg1;
133 uint utmip_bias_cfg1;
137 /* USB1_LEGACY_CTRL */
138 #define USB1_NO_LEGACY_MODE 1
140 #define VBUS_SENSE_CTL_SHIFT 1
141 #define VBUS_SENSE_CTL_MASK (3 << VBUS_SENSE_CTL_SHIFT)
142 #define VBUS_SENSE_CTL_VBUS_WAKEUP 0
143 #define VBUS_SENSE_CTL_AB_SESS_VLD_OR_VBUS_WAKEUP 1
144 #define VBUS_SENSE_CTL_AB_SESS_VLD 2
145 #define VBUS_SENSE_CTL_A_SESS_VLD 3
147 /* USBx_IF_USB_SUSP_CTRL_0 */
148 #define UTMIP_PHY_ENB (1 << 12)
149 #define UTMIP_RESET (1 << 11)
150 #define USB_PHY_CLK_VALID (1 << 7)
152 /* USBx_UTMIP_MISC_CFG1 */
153 #define UTMIP_PLLU_STABLE_COUNT_SHIFT 6
154 #define UTMIP_PLLU_STABLE_COUNT_MASK \
155 (0xfff << UTMIP_PLLU_STABLE_COUNT_SHIFT)
156 #define UTMIP_PLL_ACTIVE_DLY_COUNT_SHIFT 18
157 #define UTMIP_PLL_ACTIVE_DLY_COUNT_MASK \
158 (0x1f << UTMIP_PLL_ACTIVE_DLY_COUNT_SHIFT)
159 #define UTMIP_PHY_XTAL_CLOCKEN (1 << 30)
161 /* USBx_UTMIP_PLL_CFG1_0 */
162 #define UTMIP_PLLU_ENABLE_DLY_COUNT_SHIFT 27
163 #define UTMIP_PLLU_ENABLE_DLY_COUNT_MASK \
164 (0xf << UTMIP_PLLU_ENABLE_DLY_COUNT_SHIFT)
165 #define UTMIP_XTAL_FREQ_COUNT_SHIFT 0
166 #define UTMIP_XTAL_FREQ_COUNT_MASK 0xfff
168 /* USBx_UTMIP_BIAS_CFG1_0 */
169 #define UTMIP_BIAS_PDTRK_COUNT_SHIFT 3
170 #define UTMIP_BIAS_PDTRK_COUNT_MASK \
171 (0x1f << UTMIP_BIAS_PDTRK_COUNT_SHIFT)
173 #define UTMIP_DEBOUNCE_CFG0_SHIFT 0
174 #define UTMIP_DEBOUNCE_CFG0_MASK 0xffff
176 /* USBx_UTMIP_TX_CFG0_0 */
177 #define UTMIP_FS_PREAMBLE_J (1 << 19)
179 /* USBx_UTMIP_BAT_CHRG_CFG0_0 */
180 #define UTMIP_PD_CHRG 1
182 /* USBx_UTMIP_XCVR_CFG0_0 */
183 #define UTMIP_XCVR_LSBIAS_SE (1 << 21)
185 /* USBx_UTMIP_SPARE_CFG0_0 */
186 #define FUSE_SETUP_SEL (1 << 3)
188 /* USBx_UTMIP_HSRX_CFG0_0 */
189 #define UTMIP_IDLE_WAIT_SHIFT 15
190 #define UTMIP_IDLE_WAIT_MASK (0x1f << UTMIP_IDLE_WAIT_SHIFT)
191 #define UTMIP_ELASTIC_LIMIT_SHIFT 10
192 #define UTMIP_ELASTIC_LIMIT_MASK \
193 (0x1f << UTMIP_ELASTIC_LIMIT_SHIFT)
195 /* USBx_UTMIP_HSRX_CFG0_1 */
196 #define UTMIP_HS_SYNC_START_DLY_SHIFT 1
197 #define UTMIP_HS_SYNC_START_DLY_MASK \
198 (0xf << UTMIP_HS_SYNC_START_DLY_SHIFT)
200 /* USBx_CONTROLLER_2_USB2D_ICUSB_CTRL_0 */
201 #define IC_ENB1 (1 << 3)
203 /* SB2_CONTROLLER_2_USB2D_PORTSC1_0 */
205 #define PTS_MASK (3U << PTS_SHIFT)
207 #define PTS_RESERVED 1
209 #define PTS_ICUSB_SER 3
211 #define STS (1 << 29)
213 /* USBx_UTMIP_XCVR_CFG0_0 */
214 #define UTMIP_FORCE_PD_POWERDOWN (1 << 14)
215 #define UTMIP_FORCE_PD2_POWERDOWN (1 << 16)
216 #define UTMIP_FORCE_PDZI_POWERDOWN (1 << 18)
218 /* USBx_UTMIP_XCVR_CFG1_0 */
219 #define UTMIP_FORCE_PDDISC_POWERDOWN (1 << 0)
220 #define UTMIP_FORCE_PDCHRP_POWERDOWN (1 << 2)
221 #define UTMIP_FORCE_PDDR_POWERDOWN (1 << 4)
223 /* USB3_IF_USB_PHY_VBUS_SENSORS_0 */
224 #define VBUS_VLD_STS (1 << 26)
227 /* Change the USB host port into host mode */
228 void usb_set_host_mode(void);
230 /* Setup USB on the board */
231 int board_usb_init(const void *blob);
234 * Start up the given port number (ports are numbered from 0 on each board).
235 * This returns values for the appropriate hccr and hcor addresses to use for
236 * USB EHCI operations.
238 * @param portnum port number to start
239 * @param hccr returns start address of EHCI HCCR registers
240 * @param hcor returns start address of EHCI HCOR registers
241 * @return 0 if ok, -1 on error (generally invalid port number)
243 int tegrausb_start_port(unsigned portnum, u32 *hccr, u32 *hcor);
246 * Stop the current port
248 * @return 0 if ok, -1 if no port was active
250 int tegrausb_stop_port(void);
252 #endif /* _TEGRA_USB_H_ */