mb/system76/cml-u/dt: Make use of chipset devicetree
[coreboot.git] / src / soc / mediatek / mt8192 / gpio.c
blobb10ff5873181d2571322cbfab9627d6efd0c020b
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <device/mmio.h>
4 #include <gpio.h>
5 #include <assert.h>
7 void *gpio_find_reg_addr(gpio_t gpio)
9 void *reg_addr;
10 switch (gpio.base & 0x0f) {
11 case 0:
12 reg_addr = (void *)IOCFG_RM_BASE;
13 break;
14 case 1:
15 reg_addr = (void *)IOCFG_BM_BASE;
16 break;
17 case 2:
18 reg_addr = (void *)IOCFG_BL_BASE;
19 break;
20 case 3:
21 reg_addr = (void *)IOCFG_BR_BASE;
22 break;
23 case 4:
24 reg_addr = (void *)IOCFG_LM_BASE;
25 break;
26 case 5:
27 reg_addr = (void *)IOCFG_LB_BASE;
28 break;
29 case 6:
30 reg_addr = (void *)IOCFG_RT_BASE;
31 break;
32 case 7:
33 reg_addr = (void *)IOCFG_LT_BASE;
34 break;
35 case 8:
36 reg_addr = (void *)IOCFG_TL_BASE;
37 break;
38 default:
39 reg_addr = NULL;
40 break;
43 return reg_addr;