summaryrefslogtreecommitdiff
path: root/src/soc/mediatek/mt8188/gpio.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/mediatek/mt8188/gpio.c')
-rw-r--r--src/soc/mediatek/mt8188/gpio.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/soc/mediatek/mt8188/gpio.c b/src/soc/mediatek/mt8188/gpio.c
new file mode 100644
index 0000000000..4c4ee31edc
--- /dev/null
+++ b/src/soc/mediatek/mt8188/gpio.c
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+/*
+ * This file is created based on MT8188 Functional Specification
+ * Chapter number: 5.2
+ */
+
+#include <device/mmio.h>
+#include <gpio.h>
+
+void *gpio_find_reg_addr(gpio_t gpio)
+{
+ void *reg_addr;
+ switch (gpio.base & 0x0f) {
+ case 1:
+ reg_addr = (void *)IOCFG_RM_BASE;
+ break;
+ case 2:
+ reg_addr = (void *)IOCFG_LT_BASE;
+ break;
+ case 3:
+ reg_addr = (void *)IOCFG_LM_BASE;
+ break;
+ case 4:
+ reg_addr = (void *)IOCFG_RT_BASE;
+ break;
+ default:
+ reg_addr = NULL;
+ break;
+ }
+
+ return reg_addr;
+}