drivers/wifi: Remove unnecessary data structure copy
[coreboot2.git] / src / soc / rockchip / rk3288 / gpio.c
bloba1da1d791ba3b2b22c3ec4c4d4be86c83be13b67
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <gpio.h>
4 #include <soc/addressmap.h>
5 #include <soc/grf.h>
6 #include <soc/pmu.h>
7 #include <soc/soc.h>
9 struct rockchip_gpio_regs *gpio_port[] = {
10 (struct rockchip_gpio_regs *)GPIO0_BASE,
11 (struct rockchip_gpio_regs *)GPIO1_BASE,
12 (struct rockchip_gpio_regs *)GPIO2_BASE,
13 (struct rockchip_gpio_regs *)GPIO3_BASE,
14 (struct rockchip_gpio_regs *)GPIO4_BASE,
15 (struct rockchip_gpio_regs *)GPIO5_BASE,
16 (struct rockchip_gpio_regs *)GPIO6_BASE,
17 (struct rockchip_gpio_regs *)GPIO7_BASE,
18 (struct rockchip_gpio_regs *)GPIO8_BASE
21 #define PMU_GPIO_PORT 0
23 int is_pmu_gpio(gpio_t gpio)
25 if (gpio.port == PMU_GPIO_PORT)
26 return 1;
27 return 0;
30 void *gpio_grf_reg(gpio_t gpio)
32 if (is_pmu_gpio(gpio))
33 return &rk3288_pmu->gpio0pull[gpio.bank];
34 /* There is one pmu gpio, gpio0, so " - 1" */
35 return &rk3288_grf->gpio1_p[(gpio.port - 1)][gpio.bank];
38 u32 gpio_get_pull_val(gpio_t gpio, enum gpio_pull pull)
40 /* use the default gpio pull bias setting defined in soc/gpio.h */
41 return pull;