diff options
Diffstat (limited to 'src/soc/mediatek/common')
-rw-r--r-- | src/soc/mediatek/common/flash_controller.c | 12 | ||||
-rw-r--r-- | src/soc/mediatek/common/include/soc/flash_controller_common.h | 8 | ||||
-rw-r--r-- | src/soc/mediatek/common/include/soc/gpio_common.h | 12 |
3 files changed, 19 insertions, 13 deletions
diff --git a/src/soc/mediatek/common/flash_controller.c b/src/soc/mediatek/common/flash_controller.c index 4eaa37d3c3..4f0d4b0dfa 100644 --- a/src/soc/mediatek/common/flash_controller.c +++ b/src/soc/mediatek/common/flash_controller.c @@ -224,20 +224,20 @@ int mtk_spi_flash_probe(const struct spi_slave *spi, return 0; } -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) { - gpio_set_pull(pad_func->gpio, GPIO_PULL_ENABLE, pad_func->select); - gpio_set_mode(pad_func->gpio, pad_func->func); + gpio_set_pull(pad->gpio, GPIO_PULL_ENABLE, pad->select); + gpio_set_mode(pad->gpio, pad->func); - if (gpio_set_driving(pad_func->gpio, strength) < 0) { + if (gpio_set_driving(pad->gpio, strength) < 0) { printk(BIOS_ERR, "%s: failed to set pin drive to %d for %d\n", - __func__, strength, pad_func->gpio.id); + __func__, strength, pad->gpio.id); return -1; } printk(BIOS_DEBUG, "%s: got pin drive: %#x\n", __func__, - gpio_get_driving(pad_func->gpio)); + gpio_get_driving(pad->gpio)); return 0; } 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); |