/* SPDX-License-Identifier: GPL-2.0-only */ #include #include #include #include #include #include #include void mb_set_up_early_espi(void) { /* * We don't need to initialize all of the GPIOs that are done * in bootblock_mainboard_early_init(), but we need to release * the EC eSPI reset and do the rest of the configuration. * * This will not be present in the normal boot flow. */ bootblock_mainboard_early_init(); } void bootblock_mainboard_early_init(void) { size_t num_gpios; uint32_t dword; const struct soc_amd_gpio *gpios; if (!CONFIG(VBOOT_STARTS_BEFORE_BOOTBLOCK)) { gpios = variant_early_gpio_table(&num_gpios); program_gpios(gpios, num_gpios); } printk(BIOS_DEBUG, "Bootblock configure eSPI\n"); dword = pci_read_config32(SOC_LPC_DEV, 0x78); dword &= 0xFFFFF9F3; dword |= 0x200; pci_write_config32(SOC_LPC_DEV, 0x78, dword); pci_write_config32(SOC_LPC_DEV, 0x44, 0); pci_write_config32(SOC_LPC_DEV, 0x48, 0); dword = pm_read32(0x90); dword |= 1 << 16; pm_write32(0x90, dword); dword = pm_read32(0x74); dword |= 3 << 10; pm_write32(0x74, dword); } void bootblock_mainboard_init(void) { /* Put FPMCU check after EC initialization */ if (variant_has_fpmcu()) variant_fpmcu_reset(); }