summaryrefslogtreecommitdiff
path: root/src/soc/mediatek/mt8192/gpio.c
blob: 600964539ad8243274b3c1d02d4a9ee14b8e5217 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* SPDX-License-Identifier: GPL-2.0-only */

#include <device/mmio.h>
#include <gpio.h>

void *gpio_find_reg_addr(gpio_t gpio)
{
	void *reg_addr;
	switch (gpio.base & 0x0f) {
	case 0:
		reg_addr = (void *)IOCFG_RM_BASE;
		break;
	case 1:
		reg_addr = (void *)IOCFG_BM_BASE;
		break;
	case 2:
		reg_addr = (void *)IOCFG_BL_BASE;
		break;
	case 3:
		reg_addr = (void *)IOCFG_BR_BASE;
		break;
	case 4:
		reg_addr = (void *)IOCFG_LM_BASE;
		break;
	case 5:
		reg_addr = (void *)IOCFG_LB_BASE;
		break;
	case 6:
		reg_addr = (void *)IOCFG_RT_BASE;
		break;
	case 7:
		reg_addr = (void *)IOCFG_LT_BASE;
		break;
	case 8:
		reg_addr = (void *)IOCFG_TL_BASE;
		break;
	default:
		reg_addr = NULL;
		break;
	}

	return reg_addr;
}