Rex-BC Chen has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/58838 )
Change subject: mb/google/corsola: Add NOR-Flash support ......................................................................
mb/google/corsola: Add NOR-Flash support
Add NOR-Flash drivers to pass verification of flash at verstage.
TEST=boot to romstage BUG=b:202871018
Signed-off-by: Rex-BC Chen rex-bc.chen@mediatek.com Change-Id: Iee3dd336632b0cf998f5f7c1d118e01e8270e815 --- M src/mainboard/google/corsola/Kconfig M src/mainboard/google/corsola/bootblock.c 2 files changed, 31 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/38/58838/1
diff --git a/src/mainboard/google/corsola/Kconfig b/src/mainboard/google/corsola/Kconfig index 8b38d2b..bfdc8ee 100644 --- a/src/mainboard/google/corsola/Kconfig +++ b/src/mainboard/google/corsola/Kconfig @@ -22,4 +22,8 @@ config MAINBOARD_PART_NUMBER string default "Corsola" if BOARD_GOOGLE_CORSOLA + +config BOOT_DEVICE_SPI_FLASH_BUS + int + default 7 endif diff --git a/src/mainboard/google/corsola/bootblock.c b/src/mainboard/google/corsola/bootblock.c index 99947c0..81af529 100644 --- a/src/mainboard/google/corsola/bootblock.c +++ b/src/mainboard/google/corsola/bootblock.c @@ -2,7 +2,34 @@
#include <bootblock_common.h> #include <device/mmio.h> +#include <soc/gpio.h>
+struct pad_func { + gpio_t gpio; + u8 func; +}; + +#define PAD_FUNC(name, func) {GPIO(name), PAD_##name##_FUNC_##func} + +static void nor_set_gpio_pinmux(void) +{ + const struct pad_func *ptr = NULL; + + /* GPIO 36 ~ 39 */ + struct pad_func nor_pinmux[] = { + PAD_FUNC(SPI0_CLK, SPINOR_CK), + PAD_FUNC(SPI0_CSB, SPINOR_CS), + PAD_FUNC(SPI0_MO, SPINOR_IO0), + PAD_FUNC(SPI0_MI, SPINOR_IO1), + }; + + ptr = nor_pinmux; + for (size_t i = 0; i < ARRAY_SIZE(nor_pinmux); i++) { + gpio_set_pull(nor_pinmux[i].gpio, GPIO_PULL_ENABLE, GPIO_PULL_UP); + gpio_set_mode(nor_pinmux[i].gpio, ptr[i].func); + } +} void bootblock_mainboard_init(void) { + nor_set_gpio_pinmux(); }