From f3b698462975a5b23004affca45a6dd1a3ff46a6 Mon Sep 17 00:00:00 2001 From: Yidi Lin Date: Thu, 5 Sep 2024 17:10:33 +0800 Subject: 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/84222 Reviewed-by: Yu-Ping Wu Tested-by: build bot (Jenkins) --- src/soc/mediatek/mt8188/spi.c | 54 ++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 32 deletions(-) (limited to 'src/soc/mediatek/mt8188/spi.c') diff --git a/src/soc/mediatek/mt8188/spi.c b/src/soc/mediatek/mt8188/spi.c index 0596bb9b7f..994663d02c 100644 --- a/src/soc/mediatek/mt8188/spi.c +++ b/src/soc/mediatek/mt8188/spi.c @@ -41,61 +41,51 @@ struct mtk_spi_bus spi_bus[SPI_BUS_NUMBER] = { }, }; -struct pad_func { - gpio_t gpio; - u8 func; - enum pull_select select; -}; - -#define PAD_FUNC_SEL(name, func, sel) {GPIO(name), PAD_##name##_FUNC_##func, sel} -#define PAD_FUNC(name, func) {GPIO(name), PAD_##name##_FUNC_##func} -#define PAD_FUNC_GPIO(name) {GPIO(name), 0} - static const struct pad_func pad_funcs[SPI_BUS_NUMBER][4] = { { - PAD_FUNC(SPIM0_MISO, SPIM0_MISO), + PAD_FUNC_DOWN(SPIM0_MISO, SPIM0_MISO), PAD_FUNC_GPIO(SPIM0_CSB), - PAD_FUNC(SPIM0_MOSI, SPIM0_MOSI), - PAD_FUNC(SPIM0_CLK, SPIM0_CLK), + PAD_FUNC_DOWN(SPIM0_MOSI, SPIM0_MOSI), + PAD_FUNC_DOWN(SPIM0_CLK, SPIM0_CLK), }, { - PAD_FUNC(SPIM1_MISO, SPIM1_MISO), + PAD_FUNC_DOWN(SPIM1_MISO, SPIM1_MISO), PAD_FUNC_GPIO(SPIM1_CSB), - PAD_FUNC(SPIM1_MOSI, SPIM1_MOSI), - PAD_FUNC(SPIM1_CLK, SPIM1_CLK), + PAD_FUNC_DOWN(SPIM1_MOSI, SPIM1_MOSI), + PAD_FUNC_DOWN(SPIM1_CLK, SPIM1_CLK), }, { - PAD_FUNC(SPIM2_MISO, SPIM2_MISO), + PAD_FUNC_DOWN(SPIM2_MISO, SPIM2_MISO), PAD_FUNC_GPIO(SPIM2_CSB), - PAD_FUNC(SPIM2_MOSI, SPIM2_MOSI), - PAD_FUNC(SPIM2_CLK, SPIM2_CLK), + PAD_FUNC_DOWN(SPIM2_MOSI, SPIM2_MOSI), + PAD_FUNC_DOWN(SPIM2_CLK, SPIM2_CLK), }, { - PAD_FUNC(DPI_D15, SPIM3_MISO), + PAD_FUNC_DOWN(DPI_D15, SPIM3_MISO), PAD_FUNC_GPIO(DPI_D12), - PAD_FUNC(DPI_D14, SPIM3_MOSI), - PAD_FUNC(DPI_D13, SPIM3_CLK), + PAD_FUNC_DOWN(DPI_D14, SPIM3_MOSI), + PAD_FUNC_DOWN(DPI_D13, SPIM3_CLK), }, { - PAD_FUNC(GPIO15, SPIM4_MISO), + PAD_FUNC_DOWN(GPIO15, SPIM4_MISO), PAD_FUNC_GPIO(GPIO12), - PAD_FUNC(GPIO14, SPIM4_MOSI), - PAD_FUNC(GPIO13, SPIM4_CLK), + PAD_FUNC_DOWN(GPIO14, SPIM4_MOSI), + PAD_FUNC_DOWN(GPIO13, SPIM4_CLK), }, { - PAD_FUNC(GPIO03, SPIM5_MISO), + PAD_FUNC_DOWN(GPIO03, SPIM5_MISO), PAD_FUNC_GPIO(GPIO00), - PAD_FUNC(GPIO02, SPIM5_MOSI), - PAD_FUNC(GPIO01, SPIM5_CLK), + PAD_FUNC_DOWN(GPIO02, SPIM5_MOSI), + PAD_FUNC_DOWN(GPIO01, SPIM5_CLK), }, }; static const struct pad_func nor_pinmux[4] = { /* GPIO 125 ~ 128 */ - PAD_FUNC_SEL(DMIC1_CLK, SPINOR_CK, GPIO_PULL_DOWN), - PAD_FUNC_SEL(DMIC1_DAT, SPINOR_CS, GPIO_PULL_UP), - PAD_FUNC_SEL(DMIC1_DAT_R, SPINOR_IO0, GPIO_PULL_DOWN), - PAD_FUNC_SEL(DMIC2_CLK, SPINOR_IO1, GPIO_PULL_DOWN), + PAD_FUNC(DMIC1_CLK, SPINOR_CK, GPIO_PULL_DOWN), + PAD_FUNC(DMIC1_DAT, SPINOR_CS, GPIO_PULL_UP), + PAD_FUNC(DMIC1_DAT_R, SPINOR_IO0, GPIO_PULL_DOWN), + PAD_FUNC(DMIC2_CLK, SPINOR_IO1, GPIO_PULL_DOWN), }; void mtk_snfc_init(void) -- cgit v1.2.3