• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <gpio.h>
4 #include <soc/addressmap.h>
5 #include <soc/grf.h>
6 #include <soc/pmu.h>
7 #include <soc/soc.h>
8 
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
19 };
20 
21 #define PMU_GPIO_PORT 0
22 
is_pmu_gpio(gpio_t gpio)23 int is_pmu_gpio(gpio_t gpio)
24 {
25 	if (gpio.port == PMU_GPIO_PORT)
26 		return 1;
27 	return 0;
28 }
29 
gpio_grf_reg(gpio_t gpio)30 void *gpio_grf_reg(gpio_t gpio)
31 {
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];
36 }
37 
gpio_get_pull_val(gpio_t gpio,enum gpio_pull pull)38 u32 gpio_get_pull_val(gpio_t gpio, enum gpio_pull pull)
39 {
40 	/* use the default gpio pull bias setting defined in soc/gpio.h */
41 	return pull;
42 }
43