coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
pcie.c File Reference
#include <commonlib/stdlib.h>
#include <console/console.h>
#include <device/mmio.h>
#include <device/resource.h>
#include <delay.h>
#include <soc/addressmap.h>
#include <soc/early_init.h>
#include <soc/gpio.h>
#include <soc/pcie.h>
#include <soc/pcie_common.h>
#include <stdlib.h>
#include <string.h>
Include dependency graph for pcie.c:

Go to the source code of this file.

Data Structures

struct  pad_func
 

Macros

#define PCIE_REG_BASE_PORT0   0x112f0000
 
#define PCIE_RST_CTRL_REG   (PCIE_REG_BASE_PORT0 + 0x148)
 
#define PCIE_MAC_RSTB   BIT(0)
 
#define PCIE_PHY_RSTB   BIT(1)
 
#define PCIE_BRG_RSTB   BIT(2)
 
#define PCIE_PE_RSTB   BIT(3)
 
#define PAD_FUNC(name, func)   {GPIO(name), PAD_##name##_FUNC_##func}
 

Functions

static void mtk_pcie_set_pinmux (uint8_t port)
 
void mtk_pcie_reset (uintptr_t reg, bool enable)
 
void mtk_pcie_pre_init (void)
 

Variables

static const struct pad_func pcie_pins [2][3]
 

Macro Definition Documentation

◆ PAD_FUNC

#define PAD_FUNC (   name,
  func 
)    {GPIO(name), PAD_##name##_FUNC_##func}

Definition at line 28 of file pcie.c.

◆ PCIE_BRG_RSTB

#define PCIE_BRG_RSTB   BIT(2)

Definition at line 20 of file pcie.c.

◆ PCIE_MAC_RSTB

#define PCIE_MAC_RSTB   BIT(0)

Definition at line 18 of file pcie.c.

◆ PCIE_PE_RSTB

#define PCIE_PE_RSTB   BIT(3)

Definition at line 21 of file pcie.c.

◆ PCIE_PHY_RSTB

#define PCIE_PHY_RSTB   BIT(1)

Definition at line 19 of file pcie.c.

◆ PCIE_REG_BASE_PORT0

#define PCIE_REG_BASE_PORT0   0x112f0000

Definition at line 16 of file pcie.c.

◆ PCIE_RST_CTRL_REG

#define PCIE_RST_CTRL_REG   (PCIE_REG_BASE_PORT0 + 0x148)

Definition at line 17 of file pcie.c.

Function Documentation

◆ mtk_pcie_pre_init()

void mtk_pcie_pre_init ( void  )

Definition at line 70 of file pcie.c.

References EARLY_INIT_PCIE, early_init_save_time(), mtk_pcie_reset(), mtk_pcie_set_pinmux(), and PCIE_RST_CTRL_REG.

Referenced by bootblock_mainboard_init().

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

◆ mtk_pcie_reset()

void mtk_pcie_reset ( uintptr_t  reg,
bool  enable 
)

Definition at line 54 of file pcie.c.

References PCIE_BRG_RSTB, PCIE_MAC_RSTB, PCIE_PE_RSTB, PCIE_PHY_RSTB, read32p(), val, and write32p().

Referenced by mtk_pcie_domain_enable(), and mtk_pcie_pre_init().

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

◆ mtk_pcie_set_pinmux()

static void mtk_pcie_set_pinmux ( uint8_t  port)
static

Definition at line 43 of file pcie.c.

References ARRAY_SIZE, pad_func::func, GPIO_PULL_ENABLE, GPIO_PULL_UP, gpio_set_mode(), gpio_set_pull(), pcie_pins, and pins.

Referenced by mtk_pcie_pre_init().

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

Variable Documentation

◆ pcie_pins

const struct pad_func pcie_pins[2][3]
static
Initial value:
= {
{
PAD_FUNC(PCIE_WAKE_N, WAKEN),
PAD_FUNC(PCIE_PERESET_N, PERSTN),
PAD_FUNC(PCIE_CLKREQ_N, CLKREQN),
},
{
PAD_FUNC(CMMCLK0, PERSTN_1),
PAD_FUNC(CMMCLK1, CLKREQN_1),
PAD_FUNC(CMMCLK2, WAKEN_1),
},
}
#define PAD_FUNC(name, func)
Definition: pcie.c:28

Definition at line 1 of file pcie.c.

Referenced by mtk_pcie_set_pinmux().