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

Go to the source code of this file.

Data Structures

struct  val_regs
 
struct  gpio_regs
 

Macros

#define IOCFG_TO_GPIO_BASE(x)   ((x >> 16) & 0xff)
 
#define GPIO_TO_IOCFG_BASE(x)
 
#define PIN(id, name, flag, bit, base, offset, func1, func2, func3, func4, func5, func6, func7)
 
#define GPIO(name)
 

Enumerations

enum  { MAX_GPIO_REG_BITS = 32 , MAX_GPIO_MODE_PER_REG = 8 , GPIO_MODE_BITS = 4 }
 
enum  {
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN ,
  PIN , PIN , PIN , PIN
}
 

Functions

 check_member (gpio_regs, mode[22].val, 0x460)
 
void gpio_set_i2c_eh_rsel (void)
 
void gpio_set_spi_driving (unsigned int bus, enum spi_pad_mask pad_select, unsigned int milliamps)
 

Variables

static struct gpio_regs *const mtk_gpio = (void *)(GPIO_BASE)
 

Macro Definition Documentation

◆ GPIO

#define GPIO (   name)
Value:
((gpio_t){ \
.id = PAD_##name##_ID, \
.flag = PAD_##name##_FLAG, \
.bit = PAD_##name##_BIT, \
.base = PAD_##name##_BASE, \
.offset = PAD_##name##_OFFSET \
})
const char * name
Definition: mmu.c:92
uint32_t gpio_t
Definition: gpio.h:9

Definition at line 36 of file gpio.h.

◆ GPIO_TO_IOCFG_BASE

#define GPIO_TO_IOCFG_BASE (   x)
Value:
((void *)(IOCFG_RT_BASE & 0xff000000) + \
((x) << 16))
int x
Definition: edid.c:994
@ IOCFG_RT_BASE
Definition: addressmap.h:38

Definition at line 18 of file gpio.h.

◆ IOCFG_TO_GPIO_BASE

#define IOCFG_TO_GPIO_BASE (   x)    ((x >> 16) & 0xff)

Definition at line 17 of file gpio.h.

◆ PIN

#define PIN (   id,
  name,
  flag,
  bit,
  base,
  offset,
  func1,
  func2,
  func3,
  func4,
  func5,
  func6,
  func7 
)
Value:
PAD_##name##_ID = id, \
PAD_##name##_FLAG = flag, \
PAD_##name##_BIT = bit, \
PAD_##name##_BASE = IOCFG_TO_GPIO_BASE(base), \
PAD_##name##_OFFSET = offset, \
PAD_##name##_FUNC_##func1 = 1, \
PAD_##name##_FUNC_##func2 = 2, \
PAD_##name##_FUNC_##func3 = 3, \
PAD_##name##_FUNC_##func4 = 4, \
PAD_##name##_FUNC_##func5 = 5, \
PAD_##name##_FUNC_##func6 = 6, \
PAD_##name##_FUNC_##func7 = 7
static size_t offset
Definition: flashconsole.c:16
uintptr_t base
Definition: uart.c:17
#define IOCFG_TO_GPIO_BASE(x)
Definition: gpio.h:17

Definition at line 21 of file gpio.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
MAX_GPIO_REG_BITS 
MAX_GPIO_MODE_PER_REG 
GPIO_MODE_BITS 

Definition at line 11 of file gpio.h.

◆ anonymous enum

anonymous enum
Enumerator
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 
PIN 

Definition at line 44 of file gpio.h.

Function Documentation

◆ check_member()

check_member ( gpio_regs  ,
mode.  val[22],
0x460   
)

◆ 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_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:

Variable Documentation

◆ mtk_gpio

struct gpio_regs* const mtk_gpio = (void *)(GPIO_BASE)
static

Definition at line 606 of file gpio.h.