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

Go to the source code of this file.

Macros

#define I2C_EH_RSL_MASK(name)    (EH_MASK << name##_EH | RSEL_MASK << name##_RSEL)
 
#define I2C_EH_RSL_VAL(name)    (EH_VAL << name##_EH | RSEL_VAL << name##_RSEL)
 

Enumerations

enum  {
  EN_OFFSET = 0x60 , SEL_OFFSET = 0x80 , EH_RSEL_OFFSET = 0xF0 , GPIO_DRV0_OFFSET = 0xA0 ,
  GPIO_DRV1_OFFSET = 0xB0
}
 
enum  {
  EH_VAL = 0x0 , RSEL_VAL = 0x3 , EH_MASK = 0x7 , RSEL_MASK = 0x3 ,
  SCL0_EH = 19 , SCL0_RSEL = 15 , SDA0_EH = 9 , SDA0_RSEL = 5 ,
  SCL1_EH = 22 , SCL1_RSEL = 17 , SDA1_EH = 12 , SDA1_RSEL = 7 ,
  SCL2_EH = 24 , SCL2_RSEL = 20 , SDA2_EH = 14 , SDA2_RSEL = 10 ,
  SCL3_EH = 12 , SCL3_RSEL = 10 , SDA3_EH = 7 , SDA3_RSEL = 5 ,
  SCL4_EH = 27 , SCL4_RSEL = 22 , SDA4_EH = 17 , SDA4_RSEL = 12 ,
  SCL5_EH = 20 , SCL5_RSEL = 18 , SDA5_EH = 15 , SDA5_RSEL = 13
}
 

Functions

static void gpio_set_pull_pupd (gpio_t gpio, enum pull_enable enable, enum pull_select select)
 
static void gpio_set_pull_en_sel (gpio_t gpio, enum pull_enable enable, enum pull_select select)
 
void gpio_set_pull (gpio_t gpio, enum pull_enable enable, enum pull_select select)
 
void gpio_set_i2c_eh_rsel (void)
 
void gpio_set_spi_driving (unsigned int bus, enum spi_pad_mask pad_select, unsigned int milliamps)
 

Macro Definition Documentation

◆ I2C_EH_RSL_MASK

#define I2C_EH_RSL_MASK (   name)     (EH_MASK << name##_EH | RSEL_MASK << name##_RSEL)

Definition at line 94 of file gpio.c.

◆ I2C_EH_RSL_VAL

#define I2C_EH_RSL_VAL (   name)     (EH_VAL << name##_EH | RSEL_VAL << name##_RSEL)

Definition at line 97 of file gpio.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
EN_OFFSET 
SEL_OFFSET 
EH_RSEL_OFFSET 
GPIO_DRV0_OFFSET 
GPIO_DRV1_OFFSET 

Definition at line 8 of file gpio.c.

◆ anonymous enum

anonymous enum
Enumerator
EH_VAL 
RSEL_VAL 
EH_MASK 
RSEL_MASK 
SCL0_EH 
SCL0_RSEL 
SDA0_EH 
SDA0_RSEL 
SCL1_EH 
SCL1_RSEL 
SDA1_EH 
SDA1_RSEL 
SCL2_EH 
SCL2_RSEL 
SDA2_EH 
SDA2_RSEL 
SCL3_EH 
SCL3_RSEL 
SDA3_EH 
SDA3_RSEL 
SCL4_EH 
SCL4_RSEL 
SDA4_EH 
SDA4_RSEL 
SCL5_EH 
SCL5_RSEL 
SDA5_EH 
SDA5_RSEL 

Definition at line 63 of file gpio.c.

Function Documentation

◆ gpio_set_i2c_eh_rsel()

void gpio_set_i2c_eh_rsel ( void  )

Definition at line 100 of file gpio.c.

References clrsetbits32, EH_RSEL_OFFSET, I2C_EH_RSL_MASK, I2C_EH_RSL_VAL, IOCFG_BL_BASE, IOCFG_LB_BASE, IOCFG_RB_BASE, and IOCFG_RM_BASE.

Referenced by mt8183_early_init().

Here is the caller graph for this function:

◆ gpio_set_pull()

void gpio_set_pull ( gpio_t  gpio,
enum pull_enable  enable,
enum pull_select  select 
)

Definition at line 54 of file gpio.c.

References gpio_set_pull_en_sel(), and gpio_set_pull_pupd().

Here is the call graph for this function:

◆ gpio_set_pull_en_sel()

static void gpio_set_pull_en_sel ( gpio_t  gpio,
enum pull_enable  enable,
enum pull_select  select 
)
static

Definition at line 35 of file gpio.c.

References clrbits32, EN_OFFSET, GPIO_PULL_DOWN, GPIO_PULL_ENABLE, GPIO_TO_IOCFG_BASE, SEL_OFFSET, and setbits32.

Referenced by gpio_set_pull().

Here is the caller graph for this function:

◆ gpio_set_pull_pupd()

static void gpio_set_pull_pupd ( gpio_t  gpio,
enum pull_enable  enable,
enum pull_select  select 
)
static

Definition at line 16 of file gpio.c.

References clrbits32, clrsetbits32, GPIO_PULL_DOWN, GPIO_PULL_ENABLE, GPIO_TO_IOCFG_BASE, and setbits32.

Referenced by gpio_set_pull().

Here is the caller graph for this function:

◆ gpio_set_spi_driving()

void gpio_set_spi_driving ( unsigned int  bus,
enum spi_pad_mask  pad_select,
unsigned int  milliamps 
)

Definition at line 123 of file gpio.c.

References assert, clrsetbits32, GPIO_DRV0_OFFSET, GPIO_DRV1_OFFSET, IOCFG_LM_BASE, IOCFG_RB_BASE, IOCFG_RM_BASE, NULL, offset, SPI_BUS_NUMBER, SPI_PAD0_MASK, and SPI_PAD1_MASK.

Referenced by bootblock_mainboard_init().

Here is the caller graph for this function: