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

Go to the source code of this file.

Data Structures

struct  usb_qc_phy
 
struct  usb_dwc3
 

Macros

#define CRPORT_TX_OVRD_DRV_LO   0x1002
 
#define CRPORT_RX_OVRD_IN_HI   0x1006
 
#define CRPORT_TX_ALT_BLOCK   0x102d
 

Functions

 check_member (usb_qc_phy, crport_ack_write, 0x50)
 
 check_member (usb_dwc3, usb3pipectl, 0x1c0)
 
static void setup_dwc3 (struct usb_dwc3 *dwc3)
 
static void setup_phy (struct usb_qc_phy *phy)
 
static void crport_handshake (void *capture_reg, void *acknowledge_bit, u32 data)
 
static void crport_write (struct usb_qc_phy *phy, u16 addr, u16 data)
 
static void tune_phy (struct usb_qc_phy *phy)
 
void setup_usb_host1 (void)
 
void setup_usb_host2 (void)
 

Variables

static u32 *const tcsr_usb_sel = (void *)0x1a4000b0
 
static struct usb_qc_phy *const usb_host1_phy = (void *)USB_HOST1_PHY_BASE
 
static struct usb_qc_phy *const usb_host2_phy = (void *)USB_HOST2_PHY_BASE
 
static struct usb_dwc3 *const usb_host1_dwc3 = (void *)USB_HOST1_DWC3_BASE
 
static struct usb_dwc3 *const usb_host2_dwc3 = (void *)USB_HOST2_DWC3_BASE
 

Macro Definition Documentation

◆ CRPORT_RX_OVRD_IN_HI

#define CRPORT_RX_OVRD_IN_HI   0x1006

Definition at line 11 of file usb.c.

◆ CRPORT_TX_ALT_BLOCK

#define CRPORT_TX_ALT_BLOCK   0x102d

Definition at line 12 of file usb.c.

◆ CRPORT_TX_OVRD_DRV_LO

#define CRPORT_TX_OVRD_DRV_LO   0x1002

Definition at line 10 of file usb.c.

Function Documentation

◆ check_member() [1/2]

check_member ( usb_dwc3  ,
usb3pipectl  ,
0x1c0   
)

◆ check_member() [2/2]

check_member ( usb_qc_phy  ,
crport_ack_write  ,
0x50   
)

◆ crport_handshake()

static void crport_handshake ( void capture_reg,
void acknowledge_bit,
u32  data 
)
static

Definition at line 157 of file usb.c.

References BIOS_ERR, printk, read32(), udelay(), and write32().

Referenced by crport_write().

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

◆ crport_write()

static void crport_write ( struct usb_qc_phy phy,
u16  addr,
u16  data 
)
static

Definition at line 172 of file usb.c.

References addr, usb_qc_phy::crport_ack_write, usb_qc_phy::crport_cap_addr, usb_qc_phy::crport_cap_data, usb_qc_phy::crport_data_in, crport_handshake(), and NULL.

Referenced by tune_phy().

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

◆ setup_dwc3()

static void setup_dwc3 ( struct usb_dwc3 dwc3)
static

Definition at line 85 of file usb.c.

References clrbits32, usb_dwc3::ctl, usb_dwc3::uctl, udelay(), usb_dwc3::usb2phycfg, usb_dwc3::usb3pipectl, and write32().

Referenced by setup_usb_host1(), and setup_usb_host2().

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

◆ setup_phy()

static void setup_phy ( struct usb_qc_phy phy)
static

Definition at line 122 of file usb.c.

References clrbits32, usb_qc_phy::general_cfg, usb_qc_phy::hs_phy_ctrl, usb_qc_phy::ss_phy_ctrl, usb_qc_phy::ss_phy_param1, udelay(), and write32().

Referenced by setup_usb_host1(), and setup_usb_host2().

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

◆ setup_usb_host1()

void setup_usb_host1 ( void  )

Definition at line 193 of file usb.c.

References BIOS_INFO, dwc3_ipq40xx_enable_vbus_valid(), printk, setbits32, setup_dwc3(), setup_phy(), tcsr_usb_sel, tune_phy(), usb_host1_dwc3, and usb_host1_phy.

Referenced by setup_usb().

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

◆ setup_usb_host2()

void setup_usb_host2 ( void  )

Definition at line 202 of file usb.c.

References BIOS_INFO, printk, setbits32, setup_dwc3(), setup_phy(), tcsr_usb_sel, tune_phy(), usb_host2_dwc3, and usb_host2_phy.

Here is the call graph for this function:

◆ tune_phy()

static void tune_phy ( struct usb_qc_phy phy)
static

Definition at line 179 of file usb.c.

References CRPORT_RX_OVRD_IN_HI, CRPORT_TX_ALT_BLOCK, CRPORT_TX_OVRD_DRV_LO, and crport_write().

Referenced by setup_usb_host1(), and setup_usb_host2().

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

Variable Documentation

◆ tcsr_usb_sel

u32* const tcsr_usb_sel = (void *)0x1a4000b0
static

Definition at line 14 of file usb.c.

Referenced by setup_usb_host1(), and setup_usb_host2().

◆ usb_host1_dwc3

struct usb_dwc3* const usb_host1_dwc3 = (void *)USB_HOST1_DWC3_BASE
static

Definition at line 82 of file usb.c.

Referenced by setup_usb_host1().

◆ usb_host1_phy

struct usb_qc_phy* const usb_host1_phy = (void *)USB_HOST1_PHY_BASE
static

Definition at line 41 of file usb.c.

Referenced by setup_usb_host1().

◆ usb_host2_dwc3

struct usb_dwc3* const usb_host2_dwc3 = (void *)USB_HOST2_DWC3_BASE
static

Definition at line 83 of file usb.c.

Referenced by setup_usb_host2().

◆ usb_host2_phy

struct usb_qc_phy* const usb_host2_phy = (void *)USB_HOST2_PHY_BASE
static

Definition at line 42 of file usb.c.

Referenced by setup_usb_host2().