summaryrefslogtreecommitdiff
path: root/src/soc/mediatek/common/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/mediatek/common/include')
-rw-r--r--src/soc/mediatek/common/include/soc/flash_controller_common.h8
-rw-r--r--src/soc/mediatek/common/include/soc/gpio_common.h12
2 files changed, 13 insertions, 7 deletions
diff --git a/src/soc/mediatek/common/include/soc/flash_controller_common.h b/src/soc/mediatek/common/include/soc/flash_controller_common.h
index c71ae1773d..69ff3c76e7 100644
--- a/src/soc/mediatek/common/include/soc/flash_controller_common.h
+++ b/src/soc/mediatek/common/include/soc/flash_controller_common.h
@@ -76,13 +76,7 @@ struct mtk_nor_regs {
};
check_member(mtk_nor_regs, fdma_end_dadr, 0x724);
-struct mtk_snfc_pad_func {
- gpio_t gpio;
- u8 func;
- enum pull_select select;
-};
-
int mtk_spi_flash_probe(const struct spi_slave *spi, struct spi_flash *flash);
-int mtk_snfc_init_pad_func(const struct mtk_snfc_pad_func *pad_func, enum gpio_drv strength);
+int mtk_snfc_init_pad_func(const struct pad_func *pad, enum gpio_drv strength);
#endif /* __SOC_MEDIATEK_COMMON_FLASH_CONTROLLER_COMMON_H__ */
diff --git a/src/soc/mediatek/common/include/soc/gpio_common.h b/src/soc/mediatek/common/include/soc/gpio_common.h
index 870dac59ea..dfac6f959e 100644
--- a/src/soc/mediatek/common/include/soc/gpio_common.h
+++ b/src/soc/mediatek/common/include/soc/gpio_common.h
@@ -50,6 +50,18 @@ struct gpio_drv_info {
uint8_t width;
};
+struct pad_func {
+ gpio_t gpio;
+ u8 func;
+ enum pull_select select;
+};
+
+#define GPIO_FUNC(name, func) PAD_##name##_FUNC_##func
+#define PAD_FUNC(name, func, select) { GPIO(name), GPIO_FUNC(name, func), select }
+#define PAD_FUNC_DOWN(name, func) PAD_FUNC(name, func, GPIO_PULL_DOWN)
+#define PAD_FUNC_UP(name, func) PAD_FUNC(name, func, GPIO_PULL_UP)
+#define PAD_FUNC_GPIO(name) { GPIO(name), 0 }
+
void gpio_set_pull(gpio_t gpio, enum pull_enable enable,
enum pull_select select);
void gpio_set_mode(gpio_t gpio, int mode);