Attention is currently required from: Hung-Te Lin, Jarried Lin, Paul Menzel.
Yu-Ping Wu has posted comments on this change by Jarried Lin. ( https://review.coreboot.org/c/coreboot/+/83923?usp=email )
Change subject: soc/mediatek/mt8196: Add NOR-Flash support ......................................................................
Patch Set 7: -Code-Review
(1 comment)
File src/soc/mediatek/mt8196/spi.c:
https://review.coreboot.org/c/coreboot/+/83923/comment/141d67b3_30772206?usp... : PS5, Line 33: void mtk_snfc_init(void) : { : const struct pad_func *ptr; : : for (size_t i = 0; i < ARRAY_SIZE(nor_pinmux); i++) { : ptr = &nor_pinmux[i]; : : gpio_set_pull(ptr->gpio, GPIO_PULL_ENABLE, ptr->select); : gpio_set_mode(ptr->gpio, ptr->func); : : if (gpio_set_driving(ptr->gpio, GPIO_DRV_14_MA) < 0) : printk(BIOS_ERR, : "%s: failed to set pin drive to 14 mA for %d\n", : __func__, ptr->gpio.id); : else : printk(BIOS_DEBUG, "%s: got pin drive: %#x\n", __func__, : gpio_get_driving(ptr->gpio)); : } : }
- It would be nice to make them as similar as possible. […]
I agree that part of the code (and the `pad_func` struct) can be moved to the common code (but of course after `gpio_t` is moved to common code, as suggested in CB:83922), so that it could be shared among mt8186, mt8188 and mt8196. How about we add
``` // Whatever name you prefer void mtk_snfc_init_pad_func(const struct pad_func *pad_func); ```
to the common code, and then here the code can be simplified:
``` void mtk_snfc_init(void) { for (...) mtk_snfc_init_pad_func(&nor_pinmux[i]); } ```