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 __COREBOOT_SRC_SOC_ROCKCHIP_COMMON_INCLUDE_SOC_GPIO_H
4 #define __COREBOOT_SRC_SOC_ROCKCHIP_COMMON_INCLUDE_SOC_GPIO_H
5 
6 #include <types.h>
7 
8 #define GPIO(p, b, i) ((gpio_t){.port = p, .bank = GPIO_##b, .idx = i})
9 
13  u32 reserved0[(0x30 - 0x08) / 4];
23  u32 reserved1[(0x60 - 0x54) / 4];
25 };
27 
28 typedef union {
29  u32 raw;
30  struct {
31  union {
32  struct {
33  u32 num : 5;
34  u32 reserved1 : 27;
35  };
36  struct {
37  u32 idx : 3;
38  u32 bank : 2;
39  u32 port : 4;
40  u32 reserved2 : 23;
41  };
42  };
43  };
44 } gpio_t;
45 
46 enum {
47  GPIO_A = 0,
51 };
52 
53 extern struct rockchip_gpio_regs *gpio_port[];
54 
55 /* Check if the gpio port is a pmu gpio */
57 
58 /* Return the io addr of gpio register */
59 void *gpio_grf_reg(gpio_t gpio);
60 
61 enum gpio_pull {
65 };
66 
67 enum gpio_dir {
70 };
71 
77 };
78 
79 /* Setup and enable irq */
81 
82 /* Check and clear irq status */
84 
85 /* The gpio pull bias setting may be different between SoCs */
87 
88 #endif
u8 raw[sizeof(struct arm64_kernel_header)+0x100]
Definition: fit_payload.c:31
#define pull
Definition: asmlib.h:26
unsigned int type
Definition: edid.c:57
gpio_irq_type
Definition: gpio_common.h:54
gpio_pull
Definition: gpio_common.h:61
uint32_t gpio_t
Definition: gpio.h:9
check_member(gpio_regs, msdc2_ctrl5, 0xcb0)
void gpio_input_irq(gpio_t gpio, enum gpio_irq_type type, uint32_t pull)
Definition: gpio.c:65
int gpio_irq_status(gpio_t gpio)
Definition: gpio.c:79
int is_pmu_gpio(gpio_t gpio)
Definition: gpio.c:24
gpio_dir
Definition: gpio.h:67
@ GPIO_INPUT
Definition: gpio.h:68
@ GPIO_OUTPUT
Definition: gpio.h:69
@ GPIO_B
Definition: gpio.h:48
@ GPIO_D
Definition: gpio.h:50
@ GPIO_C
Definition: gpio.h:49
@ GPIO_A
Definition: gpio.h:47
@ IRQ_TYPE_EDGE_RISING
Definition: gpio.h:73
@ IRQ_TYPE_EDGE_FALLING
Definition: gpio.h:74
@ IRQ_TYPE_LEVEL_HIGH
Definition: gpio.h:75
@ IRQ_TYPE_LEVEL_LOW
Definition: gpio.h:76
u32 gpio_get_pull_val(gpio_t gpio, enum gpio_pull pull)
Definition: gpio.c:39
void * gpio_grf_reg(gpio_t gpio)
Definition: gpio.c:31
struct rockchip_gpio_regs * gpio_port[]
Definition: gpio.c:10
@ GPIO_PULLNONE
Definition: gpio.h:62
@ GPIO_PULLDOWN
Definition: gpio.h:64
@ GPIO_PULLUP
Definition: gpio.h:63
uint32_t u32
Definition: stdint.h:51
u32 port
Definition: gpio.h:39
u32 num
Definition: gpio.h:33
u32 bank
Definition: gpio.h:38
u32 reserved2
Definition: gpio.h:40
u32 reserved1
Definition: gpio.h:34
u32 idx
Definition: gpio.h:37
Definition: pinmux.c:36
u32 reserved0[(0x30 - 0x08)/4]
Definition: gpio.h:13
u32 int_polarity
Definition: gpio.h:17
u32 int_rawstatus
Definition: gpio.h:19
u32 swporta_dr
Definition: gpio.h:11
u32 inttype_level
Definition: gpio.h:16
u32 swporta_ddr
Definition: gpio.h:12
u32 reserved1[(0x60 - 0x54)/4]
Definition: gpio.h:23
u32 int_status
Definition: gpio.h:18