blob: bb0436c09737a4afef3c5cbfbb20c1c40071e489 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0 */
Kishon Vijay Abraham Ida0d9e42015-02-23 18:40:03 +05302/* include/dwc3-uboot.h
3 *
4 * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
5 *
6 * Designware SuperSpeed USB uboot init
Kishon Vijay Abraham Ida0d9e42015-02-23 18:40:03 +05307 */
8
9#ifndef __DWC3_UBOOT_H_
10#define __DWC3_UBOOT_H_
11
Chunfeng Yun6dfb8a82020-05-02 11:35:13 +020012#include <generic-phy.h>
Kishon Vijay Abraham Ida0d9e42015-02-23 18:40:03 +053013#include <linux/usb/otg.h>
Jagan Teki6b7ebff2019-11-19 13:56:20 +053014#include <linux/usb/phy.h>
Kishon Vijay Abraham Ida0d9e42015-02-23 18:40:03 +053015
16struct dwc3_device {
Siva Durga Prasad Paladugu4835c732016-05-12 08:57:13 +020017 unsigned long base;
Kishon Vijay Abraham Ida0d9e42015-02-23 18:40:03 +053018 enum usb_dr_mode dr_mode;
Jagan Teki6b7ebff2019-11-19 13:56:20 +053019 enum usb_phy_interface hsphy_mode;
Kishon Vijay Abraham Ida0d9e42015-02-23 18:40:03 +053020 u32 maximum_speed;
21 unsigned tx_fifo_resize:1;
22 unsigned has_lpm_erratum;
23 u8 lpm_nyet_threshold;
24 unsigned is_utmi_l1_suspend;
25 u8 hird_threshold;
26 unsigned disable_scramble_quirk;
27 unsigned u2exit_lfps_quirk;
28 unsigned u2ss_inp3_quirk;
29 unsigned req_p1p2p3_quirk;
30 unsigned del_p1p2p3_quirk;
31 unsigned del_phy_power_chg_quirk;
32 unsigned lfps_filter_quirk;
33 unsigned rx_detect_poll_quirk;
34 unsigned dis_u3_susphy_quirk;
35 unsigned dis_u2_susphy_quirk;
Jagan Teki73ca0142020-05-06 13:20:25 +053036 unsigned dis_del_phy_power_chg_quirk;
Jagan Tekidc184132020-05-26 11:33:48 +080037 unsigned dis_tx_ipgap_linecheck_quirk;
Frank Wang7bb62702020-05-26 11:33:46 +080038 unsigned dis_enblslpm_quirk;
Frank Wangb34f8b52020-05-26 11:33:47 +080039 unsigned dis_u2_freeclk_exists_quirk;
Kishon Vijay Abraham Ida0d9e42015-02-23 18:40:03 +053040 unsigned tx_de_emphasis_quirk;
41 unsigned tx_de_emphasis;
Kishon Vijay Abraham I793d3472015-02-23 18:40:05 +053042 int index;
Kishon Vijay Abraham Ida0d9e42015-02-23 18:40:03 +053043};
44
45int dwc3_uboot_init(struct dwc3_device *dev);
Kishon Vijay Abraham I793d3472015-02-23 18:40:05 +053046void dwc3_uboot_exit(int index);
Marek Vasut2caf9742023-09-01 11:50:03 +020047void dwc3_uboot_handle_interrupt(struct udevice *dev);
Jean-Jacques Hiblotd648a502018-11-29 10:52:45 +010048
49struct phy;
50#if CONFIG_IS_ENABLED(PHY) && CONFIG_IS_ENABLED(DM_USB)
Chunfeng Yun6dfb8a82020-05-02 11:35:13 +020051int dwc3_setup_phy(struct udevice *dev, struct phy_bulk *phys);
52int dwc3_shutdown_phy(struct udevice *dev, struct phy_bulk *phys);
Jean-Jacques Hiblotd648a502018-11-29 10:52:45 +010053#else
Chunfeng Yun6dfb8a82020-05-02 11:35:13 +020054static inline int dwc3_setup_phy(struct udevice *dev, struct phy_bulk *phys)
Jean-Jacques Hiblotd648a502018-11-29 10:52:45 +010055{
56 return -ENOTSUPP;
57}
58
Chunfeng Yun6dfb8a82020-05-02 11:35:13 +020059static inline int dwc3_shutdown_phy(struct udevice *dev, struct phy_bulk *phys)
Jean-Jacques Hiblotd648a502018-11-29 10:52:45 +010060{
61 return -ENOTSUPP;
62}
63#endif
64
Kishon Vijay Abraham Ida0d9e42015-02-23 18:40:03 +053065#endif /* __DWC3_UBOOT_H_ */