summaryrefslogtreecommitdiff
path: root/src/mainboard/google/cherry/bootblock.c
diff options
context:
space:
mode:
authorYidi Lin <yidilin@chromium.org>2024-09-05 17:10:33 +0800
committerFelix Held <felix-coreboot@felixheld.de>2024-09-12 16:57:11 +0000
commitf3b698462975a5b23004affca45a6dd1a3ff46a6 (patch)
treea94a1af1b963d6140081e5c4b8c2e4d50304d974 /src/mainboard/google/cherry/bootblock.c
parentffc48178de6eee2e4efd33b4943f922475badc71 (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/mainboard/google/cherry/bootblock.c')
-rw-r--r--src/mainboard/google/cherry/bootblock.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/src/mainboard/google/cherry/bootblock.c b/src/mainboard/google/cherry/bootblock.c
index 5091dcc6e5..39d5aa093e 100644
--- a/src/mainboard/google/cherry/bootblock.c
+++ b/src/mainboard/google/cherry/bootblock.c
@@ -9,30 +9,22 @@
#include "gpio.h"
-struct pad_func {
- u8 pin_id;
- u8 func;
-};
-
-#define PAD_FUNC(name, func) {PAD_##name##_ID, PAD_##name##_FUNC_##func}
-
static void nor_set_gpio_pinmux(void)
{
const struct pad_func *ptr = NULL;
/* GPIO 140 ~ 143 */
struct pad_func nor_pinmux[] = {
- PAD_FUNC(SPIM2_CSB, SPINOR_CS),
- PAD_FUNC(SPIM2_CLK, SPINOR_CK),
- PAD_FUNC(SPIM2_MO, SPINOR_IO0),
- PAD_FUNC(SPIM2_MI, SPINOR_IO1),
+ PAD_FUNC_UP(SPIM2_CSB, SPINOR_CS),
+ PAD_FUNC_UP(SPIM2_CLK, SPINOR_CK),
+ PAD_FUNC_UP(SPIM2_MO, SPINOR_IO0),
+ PAD_FUNC_UP(SPIM2_MI, SPINOR_IO1),
};
ptr = nor_pinmux;
for (size_t i = 0; i < ARRAY_SIZE(nor_pinmux); i++) {
- gpio_set_pull((gpio_t){.id = ptr[i].pin_id},
- GPIO_PULL_ENABLE, GPIO_PULL_UP);
- gpio_set_mode((gpio_t){.id = ptr[i].pin_id}, ptr[i].func);
+ gpio_set_pull(ptr[i].gpio, GPIO_PULL_ENABLE, ptr[i].select);
+ gpio_set_mode(ptr[i].gpio, ptr[i].func);
}
}