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 /* Source : APQ8064 LK Boot */
2 /* SPDX-License-Identifier: BSD-3-Clause */
3 
4 #ifndef __SOC_QUALCOMM_IPQ40XX_GPIO_H_
5 #define __SOC_QUALCOMM_IPQ40XX_GPIO_H_
6 
7 #include <types.h>
8 
9 #define GPIO_FUNC_ENABLE 1
10 #define GPIO_FUNC_DISABLE 0
11 #define FUNC_SEL_1 1
12 #define FUNC_SEL_3 3
13 #define FUNC_SEL_GPIO 0
14 #define GPIO_DRV_STR_10MA 0x4
15 #define GPIO_DRV_STR_11MA 0x7
16 
17 /* GPIO TLMM: Direction */
18 #define GPIO_INPUT 0
19 #define GPIO_OUTPUT 1
20 
21 /* GPIO TLMM: Pullup/Pulldown */
22 #define GPIO_NO_PULL 0
23 #define GPIO_PULL_DOWN 1
24 #define GPIO_PULL_UP 2
25 
26 /* GPIO TLMM: Drive Strength */
27 #define GPIO_2MA 0
28 #define GPIO_4MA 1
29 #define GPIO_6MA 2
30 #define GPIO_8MA 3
31 #define GPIO_10MA 4
32 #define GPIO_12MA 5
33 #define GPIO_14MA 6
34 #define GPIO_16MA 7
35 
36 /* GPIO TLMM: Status */
37 #define GPIO_DISABLE 0
38 #define GPIO_ENABLE 1
39 
40 /* GPIO MAX Valid # */
41 #define GPIO_MAX_NUM 68
42 
43 /* GPIO TLMM: Mask */
44 #define GPIO_CFG_PULL_MASK 0x3
45 #define GPIO_CFG_FUNC_MASK 0xF
46 #define GPIO_CFG_DRV_MASK 0x7
47 #define GPIO_CFG_OE_MASK 0x1
48 #define GPIO_CFG_VM_MASK 0x1
49 #define GPIO_CFG_OD_EN_MASK 0x1
50 #define GPIO_CFG_PU_REMASKFT 0x3
51 
52 /* GPIO TLMM: Shift */
53 #define GPIO_CFG_PULL_SHIFT 0
54 #define GPIO_CFG_FUNC_SHIFT 2
55 #define GPIO_CFG_DRV_SHIFT 6
56 #define GPIO_CFG_OE_SHIFT 9
57 #define GPIO_CFG_VM_SHIFT 11
58 #define GPIO_CFG_OD_EN_SHIFT 12
59 #define GPIO_CFG_PU_RES_SHIFT 13
60 
61 /* GPIO IO: Mask */
62 #define GPIO_IO_IN_MASK 0x1
63 #define GPIO_IO_OUT_MASK 0x1
64 
65 /* GPIO IO: Shift */
66 #define GPIO_IO_IN_SHIFT 0
67 #define GPIO_IO_OUT_SHIFT 1
68 
69 typedef u32 gpio_t;
70 
71 void gpio_tlmm_config_set(gpio_t gpio, unsigned int func,
72  unsigned int pull, unsigned int drvstr,
73  unsigned int enable);
74 
75 void gpio_tlmm_config_get(gpio_t gpio, unsigned int *func,
76  unsigned int *pull, unsigned int *drvstr,
77  unsigned int *enable);
78 
79 void gpio_io_config_set(gpio_t gpio, unsigned int out);
80 
81 /* Keep this to maintain backwards compatibility with the vendor API. */
82 static inline void gpio_tlmm_config(unsigned int gpio, unsigned int func,
83  unsigned int dir, unsigned int pull,
84  unsigned int drvstr, unsigned int enable)
85 {
86  gpio_tlmm_config_set(gpio, func, pull, drvstr, enable);
87 }
88 
89 #endif // __SOC_QUALCOMM_IPQ40XX_GPIO_H_
#define pull
Definition: asmlib.h:26
uint32_t gpio_t
Definition: gpio.h:9
void gpio_tlmm_config_set(gpio_t gpio, unsigned int func, unsigned int pull, unsigned int drvstr, unsigned int enable)
Definition: gpio.c:32
void gpio_io_config_set(gpio_t gpio, unsigned int out)
void gpio_tlmm_config_get(gpio_t gpio, unsigned int *func, unsigned int *pull, unsigned int *drvstr, unsigned int *enable)
Definition: gpio.c:61
static void gpio_tlmm_config(unsigned int gpio, unsigned int func, unsigned int dir, unsigned int pull, unsigned int drvstr, unsigned int enable)
Definition: gpio.h:82
uint32_t u32
Definition: stdint.h:51
Definition: pinmux.c:36