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 dependency graph for gpio.c:

Go to the source code of this file.

Functions

 _Static_assert (ARRAY_SIZE(gpio_driving_info)==GPIO_NUM, "gpio_driving_info array size not match")
 
static voidgpio_find_reg_addr (gpio_t gpio)
 
static void gpio_set_spec_pull_pupd (gpio_t gpio, enum pull_enable enable, enum pull_select select)
 
static void gpio_set_pull_pu_pd (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)
 
static bool is_valid_drv (uint8_t drv)
 
static bool is_valid_drv_adv (enum gpio_drv_adv drv)
 
int gpio_set_driving (gpio_t gpio, uint8_t drv)
 
int gpio_get_driving (gpio_t gpio)
 
int gpio_set_driving_adv (gpio_t gpio, enum gpio_drv_adv drv)
 
int gpio_get_driving_adv (gpio_t gpio)
 

Variables

static const struct gpio_drv_info gpio_driving_info []
 
static const struct gpio_drv_info gpio_driving_adv_info [GPIO_NUM]
 

Function Documentation

◆ _Static_assert()

_Static_assert ( ARRAY_SIZE(gpio_driving_info = =GPIO_NUM,
"gpio_driving_info array size not match"   
)

◆ gpio_find_reg_addr()

static void* gpio_find_reg_addr ( gpio_t  gpio)
static

◆ gpio_get_driving()

int gpio_get_driving ( gpio_t  gpio)

Definition at line 354 of file gpio.c.

References BIT, gpio_driving_info, gpio_find_reg_addr(), info, and read32().

Referenced by mtk_snfc_init().

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

◆ gpio_get_driving_adv()

int gpio_get_driving_adv ( gpio_t  gpio)

Definition at line 393 of file gpio.c.

References BIT, gpio_driving_adv_info, gpio_find_reg_addr(), gpio_drv_info::offset, read32(), gpio_drv_info::shift, and gpio_drv_info::width.

Here is the call graph for this function:

◆ gpio_set_driving()

int gpio_set_driving ( gpio_t  gpio,
uint8_t  drv 
)

Definition at line 324 of file gpio.c.

References BIT, clrbits32, clrsetbits32, gpio_driving_adv_info, gpio_driving_info, gpio_find_reg_addr(), info, is_valid_drv(), mask, gpio_drv_info::offset, gpio_drv_info::shift, and gpio_drv_info::width.

Referenced by mtk_snfc_init().

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

◆ gpio_set_driving_adv()

int gpio_set_driving_adv ( gpio_t  gpio,
enum gpio_drv_adv  drv 
)

Definition at line 366 of file gpio.c.

References BIT, clrsetbits32, gpio_driving_adv_info, gpio_find_reg_addr(), is_valid_drv_adv(), mask, gpio_drv_info::offset, gpio_drv_info::shift, and gpio_drv_info::width.

Here is the call 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 305 of file gpio.c.

References gpio_set_pull_pu_pd(), and gpio_set_spec_pull_pupd().

Here is the call graph for this function:

◆ gpio_set_pull_pu_pd()

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

Definition at line 281 of file gpio.c.

References BIT, clrbits32, gpio_find_reg_addr(), GPIO_PULL_DOWN, GPIO_PULL_ENABLE, and setbits32.

Referenced by gpio_set_pull().

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

◆ gpio_set_spec_pull_pupd()

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

Definition at line 256 of file gpio.c.

References BIT, clrbits32, gpio_find_reg_addr(), GPIO_PULL_DOWN, GPIO_PULL_ENABLE, and setbits32.

Referenced by gpio_set_pull().

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

◆ is_valid_drv()

static bool is_valid_drv ( uint8_t  drv)
inlinestatic

Definition at line 314 of file gpio.c.

References GPIO_DRV_16_MA.

Referenced by gpio_set_driving().

Here is the caller graph for this function:

◆ is_valid_drv_adv()

static bool is_valid_drv_adv ( enum gpio_drv_adv  drv)
inlinestatic

Definition at line 319 of file gpio.c.

References GPIO_DRV_ADV_125_UA.

Referenced by gpio_set_driving_adv().

Here is the caller graph for this function:

Variable Documentation

◆ gpio_driving_adv_info

const struct gpio_drv_info gpio_driving_adv_info[GPIO_NUM]
static
Initial value:
= {
[127] = { 0x30, 0, 3, },
[128] = { 0x30, 6, 3, },
[129] = { 0x30, 0, 3, },
[130] = { 0x30, 6, 3, },
[131] = { 0x30, 3, 3, },
[132] = { 0x30, 9, 3, },
[133] = { 0x30, 0, 3, },
[134] = { 0x30, 6, 3, },
[135] = { 0x20, 0, 3, },
[136] = { 0x20, 9, 3, },
[137] = { 0x30, 3, 3, },
[138] = { 0x30, 9, 3, },
[139] = { 0x20, 0, 3, },
[140] = { 0x20, 3, 3, },
[141] = { 0x30, 3, 3, },
[142] = { 0x30, 9, 3, },
[143] = { 0x20, 3, 3, },
[144] = { 0x20, 12, 3, },
[145] = { 0x20, 6, 3, },
[146] = { 0x20, 15, 3, },
}

Definition at line 199 of file gpio.c.

Referenced by gpio_get_driving_adv(), gpio_set_driving(), and gpio_set_driving_adv().

◆ gpio_driving_info

const struct gpio_drv_info gpio_driving_info[]
static

Definition at line 1 of file gpio.c.

Referenced by gpio_get_driving(), and gpio_set_driving().