u-boot/include/dwc3-uboot.h
Jagan Teki 6b7ebff001 usb: dwc3: Add phy interface for dwc3_uboot
U-Boot has two different variants of dwc3 initializations,
- with dm variant gadget, so the respective dm driver would
  call the dwc3_init in core.
- with non-dm variant gadget, so the usage board file would
  call dwc3_uboot_init in core.

The driver probe would handle all respective gadget properties
including phy interface via phy_type property and then trigger
dwc3_init for dm-variant gadgets.

So, to support the phy interface for non-dm variant gadgets,
the better option is dwc3_uboot_init since there is no
dedicated controller for non-dm variant gadgets.

This patch support for adding phy interface like 8/16-bit UTMI+
code for dwc3_uboot.

This change used Linux phy.h enum list, to make proper code
compatibility.

Cc: Marek Vasut <marex@denx.de>
Tested-by: Levin Du <djw@t-chip.com.cn>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2019-11-23 22:29:49 +08:00

62 lines
1.5 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
/* include/dwc3-uboot.h
*
* Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
*
* Designware SuperSpeed USB uboot init
*/
#ifndef __DWC3_UBOOT_H_
#define __DWC3_UBOOT_H_
#include <linux/usb/otg.h>
#include <linux/usb/phy.h>
struct dwc3_device {
unsigned long base;
enum usb_dr_mode dr_mode;
enum usb_phy_interface hsphy_mode;
u32 maximum_speed;
unsigned tx_fifo_resize:1;
unsigned has_lpm_erratum;
u8 lpm_nyet_threshold;
unsigned is_utmi_l1_suspend;
u8 hird_threshold;
unsigned disable_scramble_quirk;
unsigned u2exit_lfps_quirk;
unsigned u2ss_inp3_quirk;
unsigned req_p1p2p3_quirk;
unsigned del_p1p2p3_quirk;
unsigned del_phy_power_chg_quirk;
unsigned lfps_filter_quirk;
unsigned rx_detect_poll_quirk;
unsigned dis_u3_susphy_quirk;
unsigned dis_u2_susphy_quirk;
unsigned tx_de_emphasis_quirk;
unsigned tx_de_emphasis;
int index;
};
int dwc3_uboot_init(struct dwc3_device *dev);
void dwc3_uboot_exit(int index);
void dwc3_uboot_handle_interrupt(int index);
struct phy;
#if CONFIG_IS_ENABLED(PHY) && CONFIG_IS_ENABLED(DM_USB)
int dwc3_setup_phy(struct udevice *dev, struct phy **array, int *num_phys);
int dwc3_shutdown_phy(struct udevice *dev, struct phy *usb_phys, int num_phys);
#else
static inline int dwc3_setup_phy(struct udevice *dev, struct phy **array,
int *num_phys)
{
return -ENOTSUPP;
}
static inline int dwc3_shutdown_phy(struct udevice *dev, struct phy *usb_phys,
int num_phys)
{
return -ENOTSUPP;
}
#endif
#endif /* __DWC3_UBOOT_H_ */