coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
gpio.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef AMD_BLOCK_GPIO_BANKS_H
4 #define AMD_BLOCK_GPIO_BANKS_H
5 
6 #include <types.h>
7 #include "gpio_defs.h"
8 
9 typedef uint32_t gpio_t;
10 
11 struct soc_amd_gpio {
13  uint8_t function;
16 };
17 
21 };
22 
23 struct soc_amd_event {
26 };
27 
31  /* Number of wake_gpio with a valid setting. */
33  /* GPIO index number that caused a wake. */
35 };
36 
37 /* Fill gpio_wake_state object for future event reporting. */
39 /* Add gpio events to the eventlog. */
40 void gpio_add_events(void);
41 
42 static inline bool is_gpio_event_level_triggered(uint32_t flags)
43 {
45 }
46 
47 static inline bool is_gpio_event_edge_triggered(uint32_t flags)
48 {
50 }
51 
52 static inline bool is_gpio_event_active_high(uint32_t flags)
53 {
55 }
56 
57 static inline bool is_gpio_event_active_low(uint32_t flags)
58 {
60 }
61 
62 /*
63  * gpio_configure_pads_with_override accepts as input two GPIO tables:
64  * 1. Base config
65  * 2. Override config
66  *
67  * This function configures raw pads in base config and applies override in
68  * override config if any. Thus, for every GPIO_x in base config, this function
69  * looks up the GPIO in override config and if it is present there, then applies
70  * the configuration from override config. GPIOs that are only specified in the
71  * override, but not in the base configuration, will be ignored.
72  */
73 void gpio_configure_pads_with_override(const struct soc_amd_gpio *base_cfg,
74  size_t base_num_pads,
75  const struct soc_amd_gpio *override_cfg,
76  size_t override_num_pads);
77 
78 /**
79  * @brief program a particular set of GPIO
80  *
81  * @param gpio_list_ptr = pointer to array of gpio configurations
82  * @param size = number of entries in array
83  *
84  * @return none
85  */
86 void gpio_configure_pads(const struct soc_amd_gpio *gpio_list_ptr, size_t size);
87 /* Return the interrupt status and clear if set. */
89 /* Implemented by soc, provides table of available GPIO mapping to Gevents */
90 void soc_get_gpio_event_table(const struct soc_amd_event **table, size_t *items);
91 
94 
95 #endif /* AMD_BLOCK_GPIO_BANKS_H */
state
Definition: raminit.c:1787
void gpio_restore_pin_registers(gpio_t gpio, struct soc_amd_gpio_register_save *save)
Definition: gpio.c:217
static bool is_gpio_event_level_triggered(uint32_t flags)
Definition: gpio.h:42
void gpio_save_pin_registers(gpio_t gpio, struct soc_amd_gpio_register_save *save)
Definition: gpio.c:211
void gpio_fill_wake_state(struct gpio_wake_state *state)
Definition: gpio.c:362
static bool is_gpio_event_edge_triggered(uint32_t flags)
Definition: gpio.h:47
static bool is_gpio_event_active_low(uint32_t flags)
Definition: gpio.h:57
void soc_get_gpio_event_table(const struct soc_amd_event **table, size_t *items)
Definition: gpio.c:35
static bool is_gpio_event_active_high(uint32_t flags)
Definition: gpio.h:52
uint32_t gpio_t
Definition: gpio.h:9
int gpio_interrupt_status(gpio_t gpio)
Definition: gpio.c:312
void gpio_configure_pads(const struct soc_amd_gpio *gpio_list_ptr, size_t size)
program a particular set of GPIO
Definition: gpio.c:307
void gpio_configure_pads_with_override(const struct soc_amd_gpio *base_cfg, size_t base_num_pads, const struct soc_amd_gpio *override_cfg, size_t override_num_pads)
Definition: gpio.c:262
void gpio_add_events(void)
Definition: gpio.c:382
#define GPIO_FLAG_EVENT_ACTIVE_MASK
Definition: gpio_defs.h:92
#define GPIO_FLAG_EVENT_TRIGGER_EDGE
Definition: gpio_defs.h:88
#define GPIO_FLAG_EVENT_ACTIVE_LOW
Definition: gpio_defs.h:91
#define GPIO_FLAG_EVENT_ACTIVE_HIGH
Definition: gpio_defs.h:90
#define GPIO_FLAG_EVENT_TRIGGER_MASK
Definition: gpio_defs.h:89
#define GPIO_FLAG_EVENT_TRIGGER_LEVEL
Definition: gpio_defs.h:87
unsigned int uint32_t
Definition: stdint.h:14
unsigned char uint8_t
Definition: stdint.h:8
uint32_t control_switch
Definition: gpio.h:29
gpio_t wake_gpios[16]
Definition: gpio.h:34
uint32_t wake_stat[2]
Definition: gpio.h:30
uint32_t num_valid_wake_gpios
Definition: gpio.h:32
Definition: pinmux.c:36
uint8_t event
Definition: gpio.h:25
gpio_t gpio
Definition: gpio.h:24
uint32_t control_value
Definition: gpio.h:19
uint32_t control
Definition: gpio.h:14
uint32_t flags
Definition: gpio.h:15
gpio_t gpio
Definition: gpio.h:12