usb: dwc_otg_310: support vbus controlled by both gpio and pmic
[firefly-linux-kernel-4.4.55.git] / drivers / usb / dwc_otg_310 / dwc_otg_core_if.h
1 /* ==========================================================================
2  * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_core_if.h $
3  * $Revision: #15 $
4  * $Date: 2012/12/10 $
5  * $Change: 2123206 $
6  *
7  * Synopsys HS OTG Linux Software Driver and documentation (hereinafter,
8  * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless
9  * otherwise expressly agreed to in writing between Synopsys and you.
10  *
11  * The Software IS NOT an item of Licensed Software or Licensed Product under
12  * any End User Software License Agreement or Agreement for Licensed Product
13  * with Synopsys or any supplement thereto. You are permitted to use and
14  * redistribute this Software in source and binary forms, with or without
15  * modification, provided that redistributions of source code must retain this
16  * notice. You may not view, use, disclose, copy or distribute this file or
17  * any information contained herein except pursuant to this license grant from
18  * Synopsys. If you do not agree with this notice, including the disclaimer
19  * below, then you are not authorized to use the Software.
20  *
21  * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT,
25  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
31  * DAMAGE.
32  * ========================================================================== */
33 #if !defined(__DWC_CORE_IF_H__)
34 #define __DWC_CORE_IF_H__
35
36 #include "common_port/dwc_os.h"
37
38 /** @file
39  * This file defines DWC_OTG Core API
40  */
41
42 struct dwc_otg_core_if;
43 typedef struct dwc_otg_core_if dwc_otg_core_if_t;
44
45 /** Maximum number of Periodic FIFOs */
46 #define MAX_PERIO_FIFOS 15
47 /** Maximum number of Periodic FIFOs */
48 #define MAX_TX_FIFOS 15
49
50 /** Maximum number of Endpoints/HostChannels */
51 #define MAX_EPS_CHANNELS 16
52
53 extern dwc_otg_core_if_t *dwc_otg_cil_init(const uint32_t *_reg_base_addr);
54 extern void dwc_otg_core_init(dwc_otg_core_if_t *_core_if);
55 extern void dwc_otg_core_init_no_reset(dwc_otg_core_if_t *_core_if);
56 extern void dwc_otg_cil_remove(dwc_otg_core_if_t *_core_if);
57
58 extern void dwc_otg_enable_global_interrupts(dwc_otg_core_if_t *_core_if);
59 extern void dwc_otg_disable_global_interrupts(dwc_otg_core_if_t *_core_if);
60
61 extern uint8_t dwc_otg_is_device_mode(dwc_otg_core_if_t *_core_if);
62 extern uint8_t dwc_otg_is_host_mode(dwc_otg_core_if_t *_core_if);
63
64 extern uint8_t dwc_otg_is_dma_enable(dwc_otg_core_if_t *core_if);
65
66 /** This function should be called on every hardware interrupt. */
67 extern int32_t dwc_otg_handle_common_intr(void *otg_dev);
68
69 /** @name OTG Core Parameters */
70 /** @{ */
71
72 /**
73  * Specifies the OTG capabilities. The driver will automatically
74  * detect the value for this parameter if none is specified.
75  * 0 - HNP and SRP capable (default)
76  * 1 - SRP Only capable
77  * 2 - No HNP/SRP capable
78  */
79 extern int dwc_otg_set_param_otg_cap(dwc_otg_core_if_t *core_if, int32_t val);
80 extern int32_t dwc_otg_get_param_otg_cap(dwc_otg_core_if_t *core_if);
81 #define DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE 0
82 #define DWC_OTG_CAP_PARAM_SRP_ONLY_CAPABLE 1
83 #define DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE 2
84 #define dwc_param_otg_cap_default DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE
85
86 extern int dwc_otg_set_param_opt(dwc_otg_core_if_t *core_if, int32_t val);
87 extern int32_t dwc_otg_get_param_opt(dwc_otg_core_if_t *core_if);
88 #define dwc_param_opt_default 1
89
90 /**
91  * Specifies whether to use slave or DMA mode for accessing the data
92  * FIFOs. The driver will automatically detect the value for this
93  * parameter if none is specified.
94  * 0 - Slave
95  * 1 - DMA (default, if available)
96  */
97 extern int dwc_otg_set_param_dma_enable(dwc_otg_core_if_t *core_if,
98                                         int32_t val);
99 extern int32_t dwc_otg_get_param_dma_enable(dwc_otg_core_if_t *core_if);
100 #define dwc_param_dma_enable_default 1
101
102 /**
103  * When DMA mode is enabled specifies whether to use
104  * address DMA or DMA Descritor mode for accessing the data
105  * FIFOs in device mode. The driver will automatically detect
106  * the value for this parameter if none is specified.
107  * 0 - address DMA
108  * 1 - DMA Descriptor(default, if available)
109  */
110 extern int dwc_otg_set_param_dma_desc_enable(dwc_otg_core_if_t *core_if,
111                                              int32_t val);
112 extern int32_t dwc_otg_get_param_dma_desc_enable(dwc_otg_core_if_t *core_if);
113 #define dwc_param_dma_desc_enable_default 0
114
115 /** The DMA Burst size (applicable only for External DMA
116  * Mode). 1, 4, 8 16, 32, 64, 128, 256 (default 32)
117  */
118 extern int dwc_otg_set_param_dma_burst_size(dwc_otg_core_if_t *core_if,
119                                             int32_t val);
120 extern int32_t dwc_otg_get_param_dma_burst_size(dwc_otg_core_if_t *core_if);
121 #define dwc_param_dma_burst_size_default 32
122
123 /**
124  * Specifies the maximum speed of operation in host and device mode.
125  * The actual speed depends on the speed of the attached device and
126  * the value of phy_type. The actual speed depends on the speed of the
127  * attached device.
128  * 0 - High Speed (default)
129  * 1 - Full Speed
130  */
131 extern int dwc_otg_set_param_speed(dwc_otg_core_if_t *core_if, int32_t val);
132 extern int32_t dwc_otg_get_param_speed(dwc_otg_core_if_t *core_if);
133 #define dwc_param_speed_default 0
134 #define DWC_SPEED_PARAM_HIGH 0
135 #define DWC_SPEED_PARAM_FULL 1
136
137 /** Specifies whether low power mode is supported when attached
138  *      to a Full Speed or Low Speed device in host mode.
139  * 0 - Don't support low power mode (default)
140  * 1 - Support low power mode
141  */
142 extern int dwc_otg_set_param_host_support_fs_ls_low_power(dwc_otg_core_if_t *
143                                                           core_if, int32_t val);
144 extern int32_t dwc_otg_get_param_host_support_fs_ls_low_power(dwc_otg_core_if_t
145                                                               *core_if);
146 #define dwc_param_host_support_fs_ls_low_power_default 0
147
148 /** Specifies the PHY clock rate in low power mode when connected to a
149  * Low Speed device in host mode. This parameter is applicable only if
150  * HOST_SUPPORT_FS_LS_LOW_POWER is enabled. If PHY_TYPE is set to FS
151  * then defaults to 6 MHZ otherwise 48 MHZ.
152  *
153  * 0 - 48 MHz
154  * 1 - 6 MHz
155  */
156 extern int dwc_otg_set_param_host_ls_low_power_phy_clk(dwc_otg_core_if_t *
157                                                        core_if, int32_t val);
158 extern int32_t dwc_otg_get_param_host_ls_low_power_phy_clk(dwc_otg_core_if_t *
159                                                            core_if);
160 #define dwc_param_host_ls_low_power_phy_clk_default 0
161 #define DWC_HOST_LS_LOW_POWER_PHY_CLK_PARAM_48MHZ 0
162 #define DWC_HOST_LS_LOW_POWER_PHY_CLK_PARAM_6MHZ 1
163
164 /**
165  * 0 - Use cC FIFO size parameters
166  * 1 - Allow dynamic FIFO sizing (default)
167  */
168 extern int dwc_otg_set_param_enable_dynamic_fifo(dwc_otg_core_if_t *core_if,
169                                                  int32_t val);
170 extern int32_t dwc_otg_get_param_enable_dynamic_fifo(dwc_otg_core_if_t *
171                                                      core_if);
172 #define dwc_param_enable_dynamic_fifo_default 1
173
174 /** Total number of 4-byte words in the data FIFO memory. This
175  * memory includes the Rx FIFO, non-periodic Tx FIFO, and periodic
176  * Tx FIFOs.
177  * 32 to 32768 (default 8192)
178  * Note: The total FIFO memory depth in the FPGA configuration is 8192.
179  */
180 extern int dwc_otg_set_param_data_fifo_size(dwc_otg_core_if_t *core_if,
181                                             int32_t val);
182 extern int32_t dwc_otg_get_param_data_fifo_size(dwc_otg_core_if_t *core_if);
183 #define dwc_param_data_fifo_size_default 8192
184
185 /** Number of 4-byte words in the Rx FIFO in device mode when dynamic
186  * FIFO sizing is enabled.
187  * 16 to 32768 (default 1064)
188  */
189 extern int dwc_otg_set_param_dev_rx_fifo_size(dwc_otg_core_if_t *core_if,
190                                               int32_t val);
191 extern int32_t dwc_otg_get_param_dev_rx_fifo_size(dwc_otg_core_if_t *core_if);
192 #define dwc_param_dev_rx_fifo_size_default 1064
193
194 /** Number of 4-byte words in the non-periodic Tx FIFO in device mode
195  * when dynamic FIFO sizing is enabled.
196  * 16 to 32768 (default 1024)
197  */
198 extern int dwc_otg_set_param_dev_nperio_tx_fifo_size(dwc_otg_core_if_t *
199                                                      core_if, int32_t val);
200 extern int32_t dwc_otg_get_param_dev_nperio_tx_fifo_size(dwc_otg_core_if_t *
201                                                          core_if);
202 #define dwc_param_dev_nperio_tx_fifo_size_default 1024
203
204 /** Number of 4-byte words in each of the periodic Tx FIFOs in device
205  * mode when dynamic FIFO sizing is enabled.
206  * 4 to 768 (default 256)
207  */
208 extern int dwc_otg_set_param_dev_perio_tx_fifo_size(dwc_otg_core_if_t *core_if,
209                                                     int32_t val, int fifo_num);
210 extern int32_t dwc_otg_get_param_dev_perio_tx_fifo_size(dwc_otg_core_if_t *
211                                                         core_if, int fifo_num);
212 #define dwc_param_dev_perio_tx_fifo_size_default 256
213
214 /** Number of 4-byte words in the Rx FIFO in host mode when dynamic
215  * FIFO sizing is enabled.
216  * 16 to 32768 (default 1024)
217  */
218 extern int dwc_otg_set_param_host_rx_fifo_size(dwc_otg_core_if_t *core_if,
219                                                int32_t val);
220 extern int32_t dwc_otg_get_param_host_rx_fifo_size(dwc_otg_core_if_t *core_if);
221 #define dwc_param_host_rx_fifo_size_default 1024
222
223 /** Number of 4-byte words in the non-periodic Tx FIFO in host mode
224  * when Dynamic FIFO sizing is enabled in the core.
225  * 16 to 32768 (default 1024)
226  */
227 extern int dwc_otg_set_param_host_nperio_tx_fifo_size(dwc_otg_core_if_t *
228                                                       core_if, int32_t val);
229 extern int32_t dwc_otg_get_param_host_nperio_tx_fifo_size(dwc_otg_core_if_t *
230                                                           core_if);
231 #define dwc_param_host_nperio_tx_fifo_size_default 1024
232
233 /** Number of 4-byte words in the host periodic Tx FIFO when dynamic
234  * FIFO sizing is enabled.
235  * 16 to 32768 (default 1024)
236  */
237 extern int dwc_otg_set_param_host_perio_tx_fifo_size(dwc_otg_core_if_t *
238                                                      core_if, int32_t val);
239 extern int32_t dwc_otg_get_param_host_perio_tx_fifo_size(dwc_otg_core_if_t *
240                                                          core_if);
241 #define dwc_param_host_perio_tx_fifo_size_default 1024
242
243 /** The maximum transfer size supported in bytes.
244  * 2047 to 65,535  (default 65,535)
245  */
246 extern int dwc_otg_set_param_max_transfer_size(dwc_otg_core_if_t *core_if,
247                                                int32_t val);
248 extern int32_t dwc_otg_get_param_max_transfer_size(dwc_otg_core_if_t *core_if);
249 #define dwc_param_max_transfer_size_default 65535
250
251 /** The maximum number of packets in a transfer.
252  * 15 to 511  (default 511)
253  */
254 extern int dwc_otg_set_param_max_packet_count(dwc_otg_core_if_t *core_if,
255                                               int32_t val);
256 extern int32_t dwc_otg_get_param_max_packet_count(dwc_otg_core_if_t *core_if);
257 #define dwc_param_max_packet_count_default 511
258
259 /** The number of host channel registers to use.
260  * 1 to 16 (default 12)
261  * Note: The FPGA configuration supports a maximum of 12 host channels.
262  */
263 extern int dwc_otg_set_param_host_channels(dwc_otg_core_if_t *core_if,
264                                            int32_t val);
265 extern int32_t dwc_otg_get_param_host_channels(dwc_otg_core_if_t *core_if);
266 #define dwc_param_host_channels_default 16
267
268 /** The number of endpoints in addition to EP0 available for device
269  * mode operations.
270  * 1 to 15 (default 6 IN and OUT)
271  * Note: The FPGA configuration supports a maximum of 6 IN and OUT
272  * endpoints in addition to EP0.
273  */
274 extern int dwc_otg_set_param_dev_endpoints(dwc_otg_core_if_t *core_if,
275                                            int32_t val);
276 extern int32_t dwc_otg_get_param_dev_endpoints(dwc_otg_core_if_t *core_if);
277 #define dwc_param_dev_endpoints_default 9
278
279 /**
280  * Specifies the type of PHY interface to use. By default, the driver
281  * will automatically detect the phy_type.
282  *
283  * 0 - Full Speed PHY
284  * 1 - UTMI+ (default)
285  * 2 - ULPI
286  */
287 extern int dwc_otg_set_param_phy_type(dwc_otg_core_if_t *core_if, int32_t val);
288 extern int32_t dwc_otg_get_param_phy_type(dwc_otg_core_if_t *core_if);
289 #define DWC_PHY_TYPE_PARAM_FS 0
290 #define DWC_PHY_TYPE_PARAM_UTMI 1
291 #define DWC_PHY_TYPE_PARAM_ULPI 2
292 #define dwc_param_phy_type_default DWC_PHY_TYPE_PARAM_UTMI
293
294 /**
295  * Specifies the UTMI+ Data Width. This parameter is
296  * applicable for a PHY_TYPE of UTMI+ or ULPI. (For a ULPI
297  * PHY_TYPE, this parameter indicates the data width between
298  * the MAC and the ULPI Wrapper.) Also, this parameter is
299  * applicable only if the OTG_HSPHY_WIDTH cC parameter was set
300  * to "8 and 16 bits", meaning that the core has been
301  * configured to work at either data path width.
302  *
303  * 8 or 16 bits (default 16)
304  */
305 extern int dwc_otg_set_param_phy_utmi_width(dwc_otg_core_if_t *core_if,
306                                             int32_t val);
307 extern int32_t dwc_otg_get_param_phy_utmi_width(dwc_otg_core_if_t *core_if);
308 #define dwc_param_phy_utmi_width_default 16
309
310 /**
311  * Specifies whether the ULPI operates at double or single
312  * data rate. This parameter is only applicable if PHY_TYPE is
313  * ULPI.
314  *
315  * 0 - single data rate ULPI interface with 8 bit wide data
316  * bus (default)
317  * 1 - double data rate ULPI interface with 4 bit wide data
318  * bus
319  */
320 extern int dwc_otg_set_param_phy_ulpi_ddr(dwc_otg_core_if_t *core_if,
321                                           int32_t val);
322 extern int32_t dwc_otg_get_param_phy_ulpi_ddr(dwc_otg_core_if_t *core_if);
323 #define dwc_param_phy_ulpi_ddr_default 0
324
325 /**
326  * Specifies whether to use the internal or external supply to
327  * drive the vbus with a ULPI phy.
328  */
329 extern int dwc_otg_set_param_phy_ulpi_ext_vbus(dwc_otg_core_if_t *core_if,
330                                                int32_t val);
331 extern int32_t dwc_otg_get_param_phy_ulpi_ext_vbus(dwc_otg_core_if_t *core_if);
332 #define DWC_PHY_ULPI_INTERNAL_VBUS 0
333 #define DWC_PHY_ULPI_EXTERNAL_VBUS 1
334 #define dwc_param_phy_ulpi_ext_vbus_default DWC_PHY_ULPI_INTERNAL_VBUS
335
336 /**
337  * Specifies whether to use the I2Cinterface for full speed PHY. This
338  * parameter is only applicable if PHY_TYPE is FS.
339  * 0 - No (default)
340  * 1 - Yes
341  */
342 extern int dwc_otg_set_param_i2c_enable(dwc_otg_core_if_t *core_if,
343                                         int32_t val);
344 extern int32_t dwc_otg_get_param_i2c_enable(dwc_otg_core_if_t *core_if);
345 #define dwc_param_i2c_enable_default 0
346
347 extern int dwc_otg_set_param_ulpi_fs_ls(dwc_otg_core_if_t *core_if,
348                                         int32_t val);
349 extern int32_t dwc_otg_get_param_ulpi_fs_ls(dwc_otg_core_if_t *core_if);
350 #define dwc_param_ulpi_fs_ls_default 0
351
352 extern int dwc_otg_set_param_ts_dline(dwc_otg_core_if_t *core_if, int32_t val);
353 extern int32_t dwc_otg_get_param_ts_dline(dwc_otg_core_if_t *core_if);
354 #define dwc_param_ts_dline_default 0
355
356 /**
357  * Specifies whether dedicated transmit FIFOs are
358  * enabled for non periodic IN endpoints in device mode
359  * 0 - No
360  * 1 - Yes
361  */
362 extern int dwc_otg_set_param_en_multiple_tx_fifo(dwc_otg_core_if_t *core_if,
363                                                  int32_t val);
364 extern int32_t dwc_otg_get_param_en_multiple_tx_fifo(dwc_otg_core_if_t *
365                                                      core_if);
366 #define dwc_param_en_multiple_tx_fifo_default 1
367
368 /** Number of 4-byte words in each of the Tx FIFOs in device
369  * mode when dynamic FIFO sizing is enabled.
370  * 4 to 768 (default 256)
371  */
372 extern int dwc_otg_set_param_dev_tx_fifo_size(dwc_otg_core_if_t *core_if,
373                                               int fifo_num, int32_t val);
374 extern int32_t dwc_otg_get_param_dev_tx_fifo_size(dwc_otg_core_if_t *core_if,
375                                                   int fifo_num);
376 #define dwc_param_dev_tx_fifo_size_default 256
377
378 /** Thresholding enable flag-
379  * bit 0 - enable non-ISO Tx thresholding
380  * bit 1 - enable ISO Tx thresholding
381  * bit 2 - enable Rx thresholding
382  */
383 extern int dwc_otg_set_param_thr_ctl(dwc_otg_core_if_t *core_if, int32_t val);
384 extern int32_t dwc_otg_get_thr_ctl(dwc_otg_core_if_t *core_if, int fifo_num);
385 #define dwc_param_thr_ctl_default 0
386
387 /** Thresholding length for Tx
388  * FIFOs in 32 bit DWORDs
389  */
390 extern int dwc_otg_set_param_tx_thr_length(dwc_otg_core_if_t *core_if,
391                                            int32_t val);
392 extern int32_t dwc_otg_get_tx_thr_length(dwc_otg_core_if_t *core_if);
393 #define dwc_param_tx_thr_length_default 64
394
395 /** Thresholding length for Rx
396  *      FIFOs in 32 bit DWORDs
397  */
398 extern int dwc_otg_set_param_rx_thr_length(dwc_otg_core_if_t *core_if,
399                                            int32_t val);
400 extern int32_t dwc_otg_get_rx_thr_length(dwc_otg_core_if_t *core_if);
401 #define dwc_param_rx_thr_length_default 64
402
403 /**
404  * Specifies whether LPM (Link Power Management) support is enabled
405  */
406 extern int dwc_otg_set_param_lpm_enable(dwc_otg_core_if_t *core_if,
407                                         int32_t val);
408 extern int32_t dwc_otg_get_param_lpm_enable(dwc_otg_core_if_t *core_if);
409 #define dwc_param_lpm_enable_default 1
410
411 /**
412  * Specifies whether LPM Errata (Link Power Management) support is enabled
413  */
414 extern int dwc_otg_set_param_besl_enable(dwc_otg_core_if_t *core_if,
415                                          int32_t val);
416 extern int32_t dwc_otg_get_param_besl_enable(dwc_otg_core_if_t *core_if);
417 #define dwc_param_besl_enable_default 0
418
419 /**
420  * Specifies baseline_besl default value
421  */
422 extern int dwc_otg_set_param_baseline_besl(dwc_otg_core_if_t *core_if,
423                                            int32_t val);
424 extern int32_t dwc_otg_get_param_baseline_besl(dwc_otg_core_if_t *core_if);
425 #define dwc_param_baseline_besl_default 0
426
427 /**
428  * Specifies deep_besl default value
429  */
430 extern int dwc_otg_set_param_deep_besl(dwc_otg_core_if_t *core_if,
431                                        int32_t val);
432 extern int32_t dwc_otg_get_param_deep_besl(dwc_otg_core_if_t *core_if);
433 #define dwc_param_deep_besl_default 15
434
435 /**
436  * Specifies whether PTI enhancement is enabled
437  */
438 extern int dwc_otg_set_param_pti_enable(dwc_otg_core_if_t *core_if,
439                                         int32_t val);
440 extern int32_t dwc_otg_get_param_pti_enable(dwc_otg_core_if_t *core_if);
441 #define dwc_param_pti_enable_default 0
442
443 /**
444  * Specifies whether MPI enhancement is enabled
445  */
446 extern int dwc_otg_set_param_mpi_enable(dwc_otg_core_if_t *core_if,
447                                         int32_t val);
448 extern int32_t dwc_otg_get_param_mpi_enable(dwc_otg_core_if_t *core_if);
449 #define dwc_param_mpi_enable_default 0
450
451 /**
452  * Specifies whether ADP capability is enabled
453  */
454 extern int dwc_otg_set_param_adp_enable(dwc_otg_core_if_t *core_if,
455                                         int32_t val);
456 extern int32_t dwc_otg_get_param_adp_enable(dwc_otg_core_if_t *core_if);
457 #define dwc_param_adp_enable_default 0
458
459 /**
460  * Specifies whether IC_USB capability is enabled
461  */
462
463 extern int dwc_otg_set_param_ic_usb_cap(dwc_otg_core_if_t *core_if,
464                                         int32_t val);
465 extern int32_t dwc_otg_get_param_ic_usb_cap(dwc_otg_core_if_t *core_if);
466 #define dwc_param_ic_usb_cap_default 0
467
468 extern int dwc_otg_set_param_ahb_thr_ratio(dwc_otg_core_if_t *core_if,
469                                            int32_t val);
470 extern int32_t dwc_otg_get_param_ahb_thr_ratio(dwc_otg_core_if_t *core_if);
471 #define dwc_param_ahb_thr_ratio_default 0
472
473 extern int dwc_otg_set_param_power_down(dwc_otg_core_if_t *core_if,
474                                         int32_t val);
475 extern int32_t dwc_otg_get_param_power_down(dwc_otg_core_if_t *core_if);
476 #define dwc_param_power_down_default 0
477
478 extern int dwc_otg_set_param_reload_ctl(dwc_otg_core_if_t *core_if,
479                                         int32_t val);
480 extern int32_t dwc_otg_get_param_reload_ctl(dwc_otg_core_if_t *core_if);
481 #define dwc_param_reload_ctl_default 0
482
483 extern int dwc_otg_set_param_dev_out_nak(dwc_otg_core_if_t *core_if,
484                                          int32_t val);
485 extern int32_t dwc_otg_get_param_dev_out_nak(dwc_otg_core_if_t *core_if);
486 #define dwc_param_dev_out_nak_default 0
487
488 extern int dwc_otg_set_param_cont_on_bna(dwc_otg_core_if_t *core_if,
489                                          int32_t val);
490 extern int32_t dwc_otg_get_param_cont_on_bna(dwc_otg_core_if_t *core_if);
491 #define dwc_param_cont_on_bna_default 0
492
493 extern int dwc_otg_set_param_ahb_single(dwc_otg_core_if_t *core_if,
494                                         int32_t val);
495 extern int32_t dwc_otg_get_param_ahb_single(dwc_otg_core_if_t *core_if);
496 #define dwc_param_ahb_single_default 0
497
498 extern int dwc_otg_set_param_otg_ver(dwc_otg_core_if_t *core_if, int32_t val);
499 extern int32_t dwc_otg_get_param_otg_ver(dwc_otg_core_if_t *core_if);
500 #define dwc_param_otg_ver_default 0
501
502 /** @} */
503
504 /** @name Access to registers and bit-fields */
505
506 /**
507  * Dump core registers and SPRAM
508  */
509 extern void dwc_otg_dump_dev_registers(dwc_otg_core_if_t *_core_if);
510 extern void dwc_otg_dump_spram(dwc_otg_core_if_t *_core_if);
511 extern void dwc_otg_dump_host_registers(dwc_otg_core_if_t *_core_if);
512 extern void dwc_otg_dump_global_registers(dwc_otg_core_if_t *_core_if);
513
514 /**
515  * Get host negotiation status.
516  */
517 extern uint32_t dwc_otg_get_hnpstatus(dwc_otg_core_if_t *core_if);
518
519 /**
520  * Get srp status
521  */
522 extern uint32_t dwc_otg_get_srpstatus(dwc_otg_core_if_t *core_if);
523
524 /**
525  * Set hnpreq bit in the GOTGCTL register.
526  */
527 extern void dwc_otg_set_hnpreq(dwc_otg_core_if_t *core_if, uint32_t val);
528
529 /**
530  * Get Content of SNPSID register.
531  */
532 extern uint32_t dwc_otg_get_gsnpsid(dwc_otg_core_if_t *core_if);
533
534 /**
535  * Get current mode.
536  * Returns 0 if in device mode, and 1 if in host mode.
537  */
538 extern uint32_t dwc_otg_get_mode(dwc_otg_core_if_t *core_if);
539
540 /**
541  * Get value of hnpcapable field in the GUSBCFG register
542  */
543 extern uint32_t dwc_otg_get_hnpcapable(dwc_otg_core_if_t *core_if);
544 /**
545  * Set value of hnpcapable field in the GUSBCFG register
546  */
547 extern void dwc_otg_set_hnpcapable(dwc_otg_core_if_t *core_if, uint32_t val);
548
549 /**
550  * Get value of srpcapable field in the GUSBCFG register
551  */
552 extern uint32_t dwc_otg_get_srpcapable(dwc_otg_core_if_t *core_if);
553 /**
554  * Set value of srpcapable field in the GUSBCFG register
555  */
556 extern void dwc_otg_set_srpcapable(dwc_otg_core_if_t *core_if, uint32_t val);
557
558 /**
559  * Get value of devspeed field in the DCFG register
560  */
561 extern uint32_t dwc_otg_get_devspeed(dwc_otg_core_if_t *core_if);
562 /**
563  * Set value of devspeed field in the DCFG register
564  */
565 extern void dwc_otg_set_devspeed(dwc_otg_core_if_t *core_if, uint32_t val);
566
567 /**
568  * Get the value of busconnected field from the HPRT0 register
569  */
570 extern uint32_t dwc_otg_get_busconnected(dwc_otg_core_if_t *core_if);
571
572 /**
573  * Gets the device enumeration Speed.
574  */
575 extern uint32_t dwc_otg_get_enumspeed(dwc_otg_core_if_t *core_if);
576
577 /**
578  * Get value of prtpwr field from the HPRT0 register
579  */
580 extern uint32_t dwc_otg_get_prtpower(dwc_otg_core_if_t *core_if);
581
582 /**
583  * Get value of flag indicating core state - hibernated or not
584  */
585 extern uint32_t dwc_otg_get_core_state(dwc_otg_core_if_t *core_if);
586
587 /**
588  * Set value of prtpwr field from the HPRT0 register
589  */
590 extern void dwc_otg_set_prtpower(dwc_otg_core_if_t *core_if, uint32_t val);
591
592 /**
593  * Get value of prtsusp field from the HPRT0 regsiter
594  */
595 extern uint32_t dwc_otg_get_prtsuspend(dwc_otg_core_if_t *core_if);
596 /**
597  * Set value of prtpwr field from the HPRT0 register
598  */
599 extern void dwc_otg_set_prtsuspend(dwc_otg_core_if_t *core_if, uint32_t val);
600
601 /**
602  * Get value of ModeChTimEn field from the HCFG regsiter
603  */
604 extern uint32_t dwc_otg_get_mode_ch_tim(dwc_otg_core_if_t *core_if);
605 /**
606  * Set value of ModeChTimEn field from the HCFG regsiter
607  */
608 extern void dwc_otg_set_mode_ch_tim(dwc_otg_core_if_t *core_if, uint32_t val);
609
610 /**
611  * Get value of Fram Interval field from the HFIR regsiter
612  */
613 extern uint32_t dwc_otg_get_fr_interval(dwc_otg_core_if_t *core_if);
614 /**
615  * Set value of Frame Interval field from the HFIR regsiter
616  */
617 extern void dwc_otg_set_fr_interval(dwc_otg_core_if_t *core_if, uint32_t val);
618
619 /**
620  * Set value of prtres field from the HPRT0 register
621  *FIXME Remove?
622  */
623 extern void dwc_otg_set_prtresume(dwc_otg_core_if_t *core_if, uint32_t val);
624
625 /**
626  * Get value of rmtwkupsig bit in DCTL register
627  */
628 extern uint32_t dwc_otg_get_remotewakesig(dwc_otg_core_if_t *core_if);
629
630 /**
631  * Get value of besl_reject bit in DCTL register
632  */
633
634 extern uint32_t dwc_otg_get_beslreject(dwc_otg_core_if_t *core_if);
635
636 /**
637  * Set value of besl_reject bit in DCTL register
638  */
639
640 extern void dwc_otg_set_beslreject(dwc_otg_core_if_t *core_if, uint32_t val);
641
642 /**
643  * Get value of prt_sleep_sts field from the GLPMCFG register
644  */
645 extern uint32_t dwc_otg_get_lpm_portsleepstatus(dwc_otg_core_if_t *core_if);
646
647 /**
648  * Get value of rem_wkup_en field from the GLPMCFG register
649  */
650 extern uint32_t dwc_otg_get_lpm_remotewakeenabled(dwc_otg_core_if_t *core_if);
651
652 /**
653  * Get value of appl_resp field from the GLPMCFG register
654  */
655 extern uint32_t dwc_otg_get_lpmresponse(dwc_otg_core_if_t *core_if);
656 /**
657  * Set value of appl_resp field from the GLPMCFG register
658  */
659 extern void dwc_otg_set_lpmresponse(dwc_otg_core_if_t *core_if, uint32_t val);
660
661 /**
662  * Get value of hsic_connect field from the GLPMCFG register
663  */
664 extern uint32_t dwc_otg_get_hsic_connect(dwc_otg_core_if_t *core_if);
665 /**
666  * Set value of hsic_connect field from the GLPMCFG register
667  */
668 extern void dwc_otg_set_hsic_connect(dwc_otg_core_if_t *core_if, uint32_t val);
669
670 /**
671  * Get value of inv_sel_hsic field from the GLPMCFG register.
672  */
673 extern uint32_t dwc_otg_get_inv_sel_hsic(dwc_otg_core_if_t *core_if);
674 /**
675  * Set value of inv_sel_hsic field from the GLPMFG register.
676  */
677 extern void dwc_otg_set_inv_sel_hsic(dwc_otg_core_if_t *core_if, uint32_t val);
678 /**
679  * Set value of hird_thresh field from the GLPMFG register.
680  */
681 extern void dwc_otg_set_hirdthresh(dwc_otg_core_if_t *core_if, uint32_t val);
682 /**
683  * Get value of hird_thresh field from the GLPMFG register.
684  */
685 extern uint32_t dwc_otg_get_hirdthresh(dwc_otg_core_if_t *core_if);
686
687 /*
688  * Some functions for accessing registers
689  */
690
691 /**
692  *  GOTGCTL register
693  */
694 extern uint32_t dwc_otg_get_gotgctl(dwc_otg_core_if_t *core_if);
695 extern void dwc_otg_set_gotgctl(dwc_otg_core_if_t *core_if, uint32_t val);
696
697 /**
698  * GUSBCFG register
699  */
700 extern uint32_t dwc_otg_get_gusbcfg(dwc_otg_core_if_t *core_if);
701 extern void dwc_otg_set_gusbcfg(dwc_otg_core_if_t *core_if, uint32_t val);
702
703 /**
704  * GRXFSIZ register
705  */
706 extern uint32_t dwc_otg_get_grxfsiz(dwc_otg_core_if_t *core_if);
707 extern void dwc_otg_set_grxfsiz(dwc_otg_core_if_t *core_if, uint32_t val);
708
709 /**
710  * GNPTXFSIZ register
711  */
712 extern uint32_t dwc_otg_get_gnptxfsiz(dwc_otg_core_if_t *core_if);
713 extern void dwc_otg_set_gnptxfsiz(dwc_otg_core_if_t *core_if, uint32_t val);
714
715 extern uint32_t dwc_otg_get_gpvndctl(dwc_otg_core_if_t *core_if);
716 extern void dwc_otg_set_gpvndctl(dwc_otg_core_if_t *core_if, uint32_t val);
717
718 /**
719  * GGPIO register
720  */
721 extern uint32_t dwc_otg_get_ggpio(dwc_otg_core_if_t *core_if);
722 extern void dwc_otg_set_ggpio(dwc_otg_core_if_t *core_if, uint32_t val);
723
724 /**
725  * GUID register
726  */
727 extern uint32_t dwc_otg_get_guid(dwc_otg_core_if_t *core_if);
728 extern void dwc_otg_set_guid(dwc_otg_core_if_t *core_if, uint32_t val);
729
730 /**
731  * HPRT0 register
732  */
733 extern uint32_t dwc_otg_get_hprt0(dwc_otg_core_if_t *core_if);
734 extern void dwc_otg_set_hprt0(dwc_otg_core_if_t *core_if, uint32_t val);
735
736 /**
737  * GHPTXFSIZE
738  */
739 extern uint32_t dwc_otg_get_hptxfsiz(dwc_otg_core_if_t *core_if);
740
741 /** @} */
742
743 #endif /* __DWC_CORE_IF_H__ */