soc/rockchip/rk3288/gpio.c: Use GPIOx_BASE macros
[coreboot.git] / src / soc / rockchip / rk3288 / gpio.c
blobed09d02fc4da639af149255b5132d72b4750c8bd
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <gpio.h>
4 #include <soc/addressmap.h>
5 #include <soc/gpio.h>
6 #include <soc/grf.h>
7 #include <soc/pmu.h>
8 #include <soc/soc.h>
10 struct rockchip_gpio_regs *gpio_port[] = {
11 (struct rockchip_gpio_regs *)GPIO0_BASE,
12 (struct rockchip_gpio_regs *)GPIO1_BASE,
13 (struct rockchip_gpio_regs *)GPIO2_BASE,
14 (struct rockchip_gpio_regs *)GPIO3_BASE,
15 (struct rockchip_gpio_regs *)GPIO4_BASE,
16 (struct rockchip_gpio_regs *)GPIO5_BASE,
17 (struct rockchip_gpio_regs *)GPIO6_BASE,
18 (struct rockchip_gpio_regs *)GPIO7_BASE,
19 (struct rockchip_gpio_regs *)GPIO8_BASE
22 #define PMU_GPIO_PORT 0
24 int is_pmu_gpio(gpio_t gpio)
26 if (gpio.port == PMU_GPIO_PORT)
27 return 1;
28 return 0;
31 void *gpio_grf_reg(gpio_t gpio)
33 if (is_pmu_gpio(gpio))
34 return &rk3288_pmu->gpio0pull[gpio.bank];
35 /* There is one pmu gpio, gpio0, so " - 1" */
36 return &rk3288_grf->gpio1_p[(gpio.port - 1)][gpio.bank];
39 u32 gpio_get_pull_val(gpio_t gpio, enum gpio_pull pull)
41 /* use the default gpio pull bias setting defined in soc/gpio.h */
42 return pull;