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_IPQ806X_GPIO_H_
5 #define __SOC_QUALCOMM_IPQ806X_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_KEEPER 2
25 #define GPIO_PULL_UP 3
26 
27 /* GPIO TLMM: Drive Strength */
28 #define GPIO_2MA 0
29 #define GPIO_4MA 1
30 #define GPIO_6MA 2
31 #define GPIO_8MA 3
32 #define GPIO_10MA 4
33 #define GPIO_12MA 5
34 #define GPIO_14MA 6
35 #define GPIO_16MA 7
36 
37 /* GPIO TLMM: Status */
38 #define GPIO_DISABLE 0
39 #define GPIO_ENABLE 1
40 
41 /* GPIO MAX Valid # */
42 #define GPIO_MAX_NUM 68
43 
44 /* GPIO TLMM: Mask */
45 #define GPIO_CFG_PULL_MASK 0x3
46 #define GPIO_CFG_FUNC_MASK 0xF
47 #define GPIO_CFG_DRV_MASK 0x7
48 #define GPIO_CFG_OE_MASK 0x1
49 
50 /* GPIO TLMM: Shift */
51 #define GPIO_CFG_PULL_SHIFT 0
52 #define GPIO_CFG_FUNC_SHIFT 2
53 #define GPIO_CFG_DRV_SHIFT 6
54 #define GPIO_CFG_OE_SHIFT 9
55 
56 /* GPIO IO: Mask */
57 #define GPIO_IO_IN_MASK 0x1
58 #define GPIO_IO_OUT_MASK 0x1
59 
60 /* GPIO IO: Shift */
61 #define GPIO_IO_IN_SHIFT 0
62 #define GPIO_IO_OUT_SHIFT 1
63 
64 typedef u32 gpio_t;
65 
66 void gpio_tlmm_config_set(gpio_t gpio, unsigned int func,
67  unsigned int pull, unsigned int drvstr,
68  unsigned int enable);
69 
70 void gpio_tlmm_config_get(gpio_t gpio, unsigned int *func,
71  unsigned int *pull, unsigned int *drvstr,
72  unsigned int *enable);
73 
74 void gpio_io_config_set(gpio_t gpio, unsigned int out);
75 
76 /* Keep this to maintain backwards compatibility with the vendor API. */
77 static inline void gpio_tlmm_config(unsigned int gpio, unsigned int func,
78  unsigned int dir, unsigned int pull,
79  unsigned int drvstr, unsigned int enable)
80 {
81  gpio_tlmm_config_set(gpio, func, pull, drvstr, enable);
82 }
83 #endif // __SOC_QUALCOMM_IPQ806X_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:77
uint32_t u32
Definition: stdint.h:51
Definition: pinmux.c:36