coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
gpio.h File Reference
#include <stdint.h>
Include dependency graph for gpio.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  am335x_gpio_regs
 

Enumerations

enum  { AM335X_GPIO_BITS_PER_BANK = 32 }
 

Functions

void am335x_disable_gpio_irqs (void)
 
int gpio_direction_input (unsigned int gpio)
 Make a GPIO an input. More...
 
int gpio_direction_output (unsigned int gpio, int value)
 Make a GPIO an output, and set its value. More...
 
int gpio_get_value (unsigned int gpio)
 Get a GPIO's value. More...
 
int gpio_set_value (unsigned int gpio, int value)
 Set an output GPIO's value. More...
 

Variables

struct am335x_gpio_regs __packed
 
static struct am335x_gpio_regs *const am335x_gpio_banks []
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
AM335X_GPIO_BITS_PER_BANK 

Definition at line 8 of file gpio.h.

Function Documentation

◆ am335x_disable_gpio_irqs()

void am335x_disable_gpio_irqs ( void  )

Definition at line 21 of file gpio.c.

References am335x_gpio_banks, ARRAY_SIZE, am335x_gpio_regs::irqstatus_clr_0, and write32().

Referenced by bootblock_mainboard_early_init().

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

◆ gpio_direction_input()

int gpio_direction_input ( unsigned int  gpio)

Make a GPIO an input.

Parameters
gpioGPIO number
Returns
0 if ok, -1 on error

Definition at line 144 of file gpio.c.

References gpio_cfg_pin(), GPIO_INPUT, gpio_regs_and_bit(), and setbits32.

Referenced by gpio_init(), gpio_read_mvl3(), and setup_gpio().

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

◆ gpio_direction_output()

int gpio_direction_output ( unsigned int  gpio,
int  value 
)

Make a GPIO an output, and set its value.

Parameters
gpioGPIO number
valueGPIO value (0 for low or 1 for high)
Returns
0 if ok, -1 on error

Definition at line 151 of file gpio.c.

References clrbits32, gpio_bank::dat, DAT_MASK, DAT_SET, GPIO_BIT, gpio_cfg_pin(), gpio_get_bank(), GPIO_OUTPUT, gpio_regs_and_bit(), read32(), val, value, and write32().

Referenced by backlight_en(), backlight_pwm(), beaglebone_leds_init(), disable_usb30_pll(), gpio_init(), setup_storage(), and setup_usb_host_phy().

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

◆ gpio_get_value()

int gpio_get_value ( unsigned int  gpio)

Get a GPIO's value.

This will work whether the GPIO is an input or an output.

Parameters
gpioGPIO number
Returns
0 if low, 1 if high, -1 on error

Definition at line 167 of file gpio.c.

References gpio_bank::dat, DAT_MASK, GPIO_BIT, gpio_get_bank(), gpio_regs_and_bit(), read32(), and value.

Referenced by exynos_dp_hotplug(), fill_lb_gpios(), get_ec_is_trusted(), get_recovery_mode_switch(), get_write_protect_state(), gpio_info(), gpio_read_mvl3(), parade_dp_bridge_setup(), and wakeup_need_reset().

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

◆ gpio_set_value()

int gpio_set_value ( unsigned int  gpio,
int  value 
)

Set an output GPIO's value.

The GPIO must already be an output or this function may have no effect.

Parameters
gpioGPIO number
valueGPIO value (0 for low or 1 for high)
Returns
0 if ok, -1 on error

Definition at line 176 of file gpio.c.

References gpio_bank::dat, DAT_MASK, DAT_SET, GPIO_BIT, gpio_get_bank(), gpio_regs_and_bit(), read32(), val, value, and write32().

Referenced by beaglebone_leds_set(), exynos_dp_bridge_init(), exynos_dp_bridge_setup(), exynos_dp_reset(), exynos_pinmux_backlight(), exynos_pinmux_lcd(), exynos_pinmux_sdmmc0(), and parade_dp_bridge_setup().

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

Variable Documentation

◆ __packed

◆ am335x_gpio_banks

struct am335x_gpio_regs* const am335x_gpio_banks[]
static
Initial value:
= {
(void *)0x44e07000, (void *)0x4804c000,
(void *)0x481ac000, (void *)0x481ae000
}

Definition at line 46 of file gpio.h.

Referenced by am335x_disable_gpio_irqs(), and gpio_regs_and_bit().