coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
usb.h File Reference
#include <soc/addressmap.h>
Include dependency graph for usb.h:

Go to the source code of this file.

Data Structures

struct  rockchip_usb_dwc3
 
struct  rk3399_tcphy
 

Macros

#define DWC3_GSNPSID_MASK   0xffff0000
 
#define DWC3_GSNPSID_SHIFT   16
 
#define DWC3_GSNPSREV_MASK   0xffff
 
#define DWC3_GCTL_PWRDNSCALE(n)   ((n) << 19)
 
#define DWC3_GCTL_U2RSTECN   (1 << 16)
 
#define DWC3_GCTL_RAMCLKSEL(x)    (((x) & DWC3_GCTL_CLK_MASK) << 6)
 
#define DWC3_GCTL_CLK_BUS   (0)
 
#define DWC3_GCTL_CLK_PIPE   (1)
 
#define DWC3_GCTL_CLK_PIPEHALF   (2)
 
#define DWC3_GCTL_CLK_MASK   (3)
 
#define DWC3_GCTL_PRTCAP_MASK   (3 << 12)
 
#define DWC3_GCTL_PRTCAP_HOST   (1 << 12)
 
#define DWC3_GCTL_PRTCAP_DEVICE   (2 << 12)
 
#define DWC3_GCTL_PRTCAP_OTG   (3 << 12)
 
#define DWC3_GCTL_CORESOFTRESET   (1 << 11)
 
#define DWC3_GCTL_SCALEDOWN(n)   ((n) << 4)
 
#define DWC3_GCTL_SCALEDOWN_MASK   DWC3_GCTL_SCALEDOWN(3)
 
#define DWC3_GCTL_DISSCRAMBLE   (1 << 3)
 
#define DWC3_GCTL_DSBLCLKGTNG   (1 << 0)
 
#define DWC3_GHWPARAMS1_EN_PWROPT(n)   (((n) & (3 << 24)) >> 24)
 
#define DWC3_GHWPARAMS1_EN_PWROPT_NO   0
 
#define DWC3_GHWPARAMS1_EN_PWROPT_CLK   1
 
#define DWC3_GUSB2PHYCFG_PHYSOFTRST   (1 << 31)
 
#define DWC3_GUSB2PHYCFG_U2_FREECLK_EXISTS   (1 << 30)
 
#define DWC3_GUSB2PHYCFG_USBTRDTIM(n)   ((n) << 10)
 
#define DWC3_GUSB2PHYCFG_USB2TRDTIM_MASK   DWC3_GUSB2PHYCFG_USBTRDTIM(0xf)
 
#define DWC3_GUSB2PHYCFG_SUSPHY   (1 << 6)
 
#define DWC3_GUSB2PHYCFG_PHYIF(n)   ((n) << 3)
 
#define DWC3_GUSB2PHYCFG_PHYIF_MASK   DWC3_GUSB2PHYCFG_PHYIF(1)
 
#define USBTRDTIM_UTMI_8_BIT   9
 
#define USBTRDTIM_UTMI_16_BIT   5
 
#define DWC3_GUSB3PIPECTL_PHYSOFTRST   (1 << 31)
 
#define DWC3_GUSB3PIPECTL_SUSPHY   (1 << 17)
 
#define TCPHY_ISOLATION_CTRL_EN   (1 << 15)
 
#define TCPHY_ISOLATION_CTRL_CMN_EN   (1 << 14)
 
#define TCPHY_ISOLATION_CTRL_MODE_SEL   (1 << 12)
 
#define TCPHY_ISOLATION_CTRL_LN_EN(ln)   (1 << (ln))
 
#define TCPHY_CMN_HSCLK_PLL_CONFIG   0x30
 
#define TCPHY_CMN_HSCLK_PLL_MASK   0x33
 

Functions

 check_member (rk3399_tcphy, lane[2].tx_diag_tx_drv, 0x11784)
 
 check_member (rk3399_tcphy, isolation_ctrl, 0x3207c)
 
void reset_usb_otg0 (void)
 
void reset_usb_otg1 (void)
 
void setup_usb_otg0 (void)
 
void setup_usb_otg1 (void)
 

Variables

static struct rockchip_usb_dwc3 *const rockchip_usb_otg0_dwc3
 
static struct rockchip_usb_dwc3 *const rockchip_usb_otg1_dwc3
 
static struct rk3399_tcphy *const rockchip_usb_otg0_phy
 
static struct rk3399_tcphy *const rockchip_usb_otg1_phy
 

Macro Definition Documentation

◆ DWC3_GCTL_CLK_BUS

#define DWC3_GCTL_CLK_BUS   (0)

Definition at line 18 of file usb.h.

◆ DWC3_GCTL_CLK_MASK

#define DWC3_GCTL_CLK_MASK   (3)

Definition at line 21 of file usb.h.

◆ DWC3_GCTL_CLK_PIPE

#define DWC3_GCTL_CLK_PIPE   (1)

Definition at line 19 of file usb.h.

◆ DWC3_GCTL_CLK_PIPEHALF

#define DWC3_GCTL_CLK_PIPEHALF   (2)

Definition at line 20 of file usb.h.

◆ DWC3_GCTL_CORESOFTRESET

#define DWC3_GCTL_CORESOFTRESET   (1 << 11)

Definition at line 26 of file usb.h.

◆ DWC3_GCTL_DISSCRAMBLE

#define DWC3_GCTL_DISSCRAMBLE   (1 << 3)

Definition at line 29 of file usb.h.

◆ DWC3_GCTL_DSBLCLKGTNG

#define DWC3_GCTL_DSBLCLKGTNG   (1 << 0)

Definition at line 30 of file usb.h.

◆ DWC3_GCTL_PRTCAP_DEVICE

#define DWC3_GCTL_PRTCAP_DEVICE   (2 << 12)

Definition at line 24 of file usb.h.

◆ DWC3_GCTL_PRTCAP_HOST

#define DWC3_GCTL_PRTCAP_HOST   (1 << 12)

Definition at line 23 of file usb.h.

◆ DWC3_GCTL_PRTCAP_MASK

#define DWC3_GCTL_PRTCAP_MASK   (3 << 12)

Definition at line 22 of file usb.h.

◆ DWC3_GCTL_PRTCAP_OTG

#define DWC3_GCTL_PRTCAP_OTG   (3 << 12)

Definition at line 25 of file usb.h.

◆ DWC3_GCTL_PWRDNSCALE

#define DWC3_GCTL_PWRDNSCALE (   n)    ((n) << 19)

Definition at line 14 of file usb.h.

◆ DWC3_GCTL_RAMCLKSEL

#define DWC3_GCTL_RAMCLKSEL (   x)     (((x) & DWC3_GCTL_CLK_MASK) << 6)

Definition at line 16 of file usb.h.

◆ DWC3_GCTL_SCALEDOWN

#define DWC3_GCTL_SCALEDOWN (   n)    ((n) << 4)

Definition at line 27 of file usb.h.

◆ DWC3_GCTL_SCALEDOWN_MASK

#define DWC3_GCTL_SCALEDOWN_MASK   DWC3_GCTL_SCALEDOWN(3)

Definition at line 28 of file usb.h.

◆ DWC3_GCTL_U2RSTECN

#define DWC3_GCTL_U2RSTECN   (1 << 16)

Definition at line 15 of file usb.h.

◆ DWC3_GHWPARAMS1_EN_PWROPT

#define DWC3_GHWPARAMS1_EN_PWROPT (   n)    (((n) & (3 << 24)) >> 24)

Definition at line 33 of file usb.h.

◆ DWC3_GHWPARAMS1_EN_PWROPT_CLK

#define DWC3_GHWPARAMS1_EN_PWROPT_CLK   1

Definition at line 35 of file usb.h.

◆ DWC3_GHWPARAMS1_EN_PWROPT_NO

#define DWC3_GHWPARAMS1_EN_PWROPT_NO   0

Definition at line 34 of file usb.h.

◆ DWC3_GSNPSID_MASK

#define DWC3_GSNPSID_MASK   0xffff0000

Definition at line 9 of file usb.h.

◆ DWC3_GSNPSID_SHIFT

#define DWC3_GSNPSID_SHIFT   16

Definition at line 10 of file usb.h.

◆ DWC3_GSNPSREV_MASK

#define DWC3_GSNPSREV_MASK   0xffff

Definition at line 11 of file usb.h.

◆ DWC3_GUSB2PHYCFG_PHYIF

#define DWC3_GUSB2PHYCFG_PHYIF (   n)    ((n) << 3)

Definition at line 43 of file usb.h.

◆ DWC3_GUSB2PHYCFG_PHYIF_MASK

#define DWC3_GUSB2PHYCFG_PHYIF_MASK   DWC3_GUSB2PHYCFG_PHYIF(1)

Definition at line 44 of file usb.h.

◆ DWC3_GUSB2PHYCFG_PHYSOFTRST

#define DWC3_GUSB2PHYCFG_PHYSOFTRST   (1 << 31)

Definition at line 38 of file usb.h.

◆ DWC3_GUSB2PHYCFG_SUSPHY

#define DWC3_GUSB2PHYCFG_SUSPHY   (1 << 6)

Definition at line 42 of file usb.h.

◆ DWC3_GUSB2PHYCFG_U2_FREECLK_EXISTS

#define DWC3_GUSB2PHYCFG_U2_FREECLK_EXISTS   (1 << 30)

Definition at line 39 of file usb.h.

◆ DWC3_GUSB2PHYCFG_USB2TRDTIM_MASK

#define DWC3_GUSB2PHYCFG_USB2TRDTIM_MASK   DWC3_GUSB2PHYCFG_USBTRDTIM(0xf)

Definition at line 41 of file usb.h.

◆ DWC3_GUSB2PHYCFG_USBTRDTIM

#define DWC3_GUSB2PHYCFG_USBTRDTIM (   n)    ((n) << 10)

Definition at line 40 of file usb.h.

◆ DWC3_GUSB3PIPECTL_PHYSOFTRST

#define DWC3_GUSB3PIPECTL_PHYSOFTRST   (1 << 31)

Definition at line 49 of file usb.h.

◆ DWC3_GUSB3PIPECTL_SUSPHY

#define DWC3_GUSB3PIPECTL_SUSPHY   (1 << 17)

Definition at line 50 of file usb.h.

◆ TCPHY_CMN_HSCLK_PLL_CONFIG

#define TCPHY_CMN_HSCLK_PLL_CONFIG   0x30

Definition at line 105 of file usb.h.

◆ TCPHY_CMN_HSCLK_PLL_MASK

#define TCPHY_CMN_HSCLK_PLL_MASK   0x33

Definition at line 106 of file usb.h.

◆ TCPHY_ISOLATION_CTRL_CMN_EN

#define TCPHY_ISOLATION_CTRL_CMN_EN   (1 << 14)

Definition at line 102 of file usb.h.

◆ TCPHY_ISOLATION_CTRL_EN

#define TCPHY_ISOLATION_CTRL_EN   (1 << 15)

Definition at line 101 of file usb.h.

◆ TCPHY_ISOLATION_CTRL_LN_EN

#define TCPHY_ISOLATION_CTRL_LN_EN (   ln)    (1 << (ln))

Definition at line 104 of file usb.h.

◆ TCPHY_ISOLATION_CTRL_MODE_SEL

#define TCPHY_ISOLATION_CTRL_MODE_SEL   (1 << 12)

Definition at line 103 of file usb.h.

◆ USBTRDTIM_UTMI_16_BIT

#define USBTRDTIM_UTMI_16_BIT   5

Definition at line 46 of file usb.h.

◆ USBTRDTIM_UTMI_8_BIT

#define USBTRDTIM_UTMI_8_BIT   9

Definition at line 45 of file usb.h.

Function Documentation

◆ check_member() [1/2]

check_member ( rk3399_tcphy  ,
isolation_ctrl  ,
0x3207c   
)

◆ check_member() [2/2]

check_member ( rk3399_tcphy  ,
lane.  tx_diag_tx_drv[2],
0x11784   
)

◆ reset_usb_otg0()

void reset_usb_otg0 ( void  )

Definition at line 112 of file usb.c.

References BIOS_DEBUG, cru_ptr, printk, reset_dwc3(), rk3399_grf, RK_CLRBITS, RK_CLRSETBITS, RK_SETBITS, rockchip_usb_otg0_dwc3, rockchip_usb_otg0_phy, tcphy_phy_init(), rk3399_grf_regs::usb3otg0_con1, and write32().

Referenced by prepare_usb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset_usb_otg1()

void reset_usb_otg1 ( void  )

Definition at line 130 of file usb.c.

References BIOS_DEBUG, cru_ptr, printk, reset_dwc3(), rk3399_grf, RK_CLRBITS, RK_CLRSETBITS, RK_SETBITS, rockchip_usb_otg1_dwc3, rockchip_usb_otg1_phy, tcphy_phy_init(), rk3399_grf_regs::usb3otg1_con1, and write32().

Referenced by prepare_usb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setup_usb_otg0()

void setup_usb_otg0 ( void  )

Definition at line 148 of file usb.c.

References BIOS_DEBUG, cru_ptr, printk, RK_CLRBITS, rockchip_usb_otg0_dwc3, setup_dwc3(), and write32().

Referenced by setup_usb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setup_usb_otg1()

void setup_usb_otg1 ( void  )

Definition at line 157 of file usb.c.

References BIOS_DEBUG, cru_ptr, printk, RK_CLRBITS, rockchip_usb_otg1_dwc3, setup_dwc3(), and write32().

Referenced by setup_usb().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ rockchip_usb_otg0_dwc3

struct rockchip_usb_dwc3* const rockchip_usb_otg0_dwc3
static
Initial value:
=
#define USB_OTG0_DWC3_BASE
Definition: addressmap.h:61

Definition at line 96 of file usb.h.

Referenced by reset_usb_otg0(), and setup_usb_otg0().

◆ rockchip_usb_otg0_phy

struct rk3399_tcphy* const rockchip_usb_otg0_phy
static
Initial value:
=
#define USB_OTG0_TCPHY_BASE
Definition: addressmap.h:63

Definition at line 132 of file usb.h.

Referenced by reset_usb_otg0().

◆ rockchip_usb_otg1_dwc3

struct rockchip_usb_dwc3* const rockchip_usb_otg1_dwc3
static
Initial value:
=
#define USB_OTG1_DWC3_BASE
Definition: addressmap.h:62

Definition at line 98 of file usb.h.

Referenced by reset_usb_otg1(), and setup_usb_otg1().

◆ rockchip_usb_otg1_phy

struct rk3399_tcphy* const rockchip_usb_otg1_phy
static
Initial value:
=
#define USB_OTG1_TCPHY_BASE
Definition: addressmap.h:64

Definition at line 134 of file usb.h.

Referenced by reset_usb_otg1().