diff options
author | Yidi Lin <yidilin@chromium.org> | 2024-09-05 17:10:33 +0800 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2024-09-12 16:57:11 +0000 |
commit | f3b698462975a5b23004affca45a6dd1a3ff46a6 (patch) | |
tree | a94a1af1b963d6140081e5c4b8c2e4d50304d974 /src/soc/mediatek/common/include | |
parent | ffc48178de6eee2e4efd33b4943f922475badc71 (diff) |
soc/mediatek: Remove redundant struct pad_func and PAD_* definitions
Clean up redundant `struct pad_func` and `PAD_*` definitions. This patch
also refactors the PAD_* macros by,
- Repurposing PAD_FUNC and dropping PAD_FUNC_SEL.
- Adding PAD_FUNC_DOWN and PAD_FUNC_UP to avoid the implicit
initialization.
BUG=none
TEST=emerge-{elm, kukui, asurada, cherry, corsola, geralt, rauru} coreboot
Change-Id: I12b8f6749015bff52988208a7c3aa01e952612c6
Signed-off-by: Yidi Lin <yidilin@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84222
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/mediatek/common/include')
-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 |
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); |