1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 3 #include <amdblocks/acpimmio.h> 4 #include <amdblocks/aoac.h> 5 #include <amdblocks/espi.h> 6 #include <amdblocks/i2c.h> 7 #include <amdblocks/lpc.h> 8 #include <amdblocks/pmlib.h> 9 #include <amdblocks/smbus.h> 10 #include <amdblocks/uart.h> 11 #include <soc/i2c.h> 12 #include <soc/southbridge.h> 13 #include <soc/uart.h> 14 15 #include "chip.h" 16 17 lpc_configure_decodes(void)18static void lpc_configure_decodes(void) 19 { 20 if (CONFIG(POST_IO) && (CONFIG_POST_IO_PORT == 0x80)) 21 lpc_enable_port80(); 22 } 23 24 /* Before console init */ fch_pre_init(void)25void fch_pre_init(void) 26 { 27 /* Enable_acpimmio_decode_pm04 to enable the ACPIMMIO decode which is needed to access 28 the GPIO registers. */ 29 enable_acpimmio_decode_pm04(); 30 /* Setup SPI base by calling lpc_early_init before setting up eSPI. */ 31 lpc_early_init(); 32 33 /* Setup eSPI to enable port80 routing if the board is using eSPI and the eSPI 34 interface hasn't already been set up in verstage on PSP */ 35 if (CONFIG(SOC_AMD_COMMON_BLOCK_USE_ESPI) && !CONFIG(VBOOT_STARTS_BEFORE_BOOTBLOCK)) 36 configure_espi_with_mb_hook(); 37 38 if (!CONFIG(SOC_AMD_COMMON_BLOCK_USE_ESPI)) 39 lpc_configure_decodes(); 40 41 fch_spi_early_init(); 42 fch_smbus_init(); 43 fch_enable_cf9_io(); 44 fch_enable_legacy_io(); 45 fch_disable_legacy_dma_io(); 46 enable_aoac_devices(); 47 48 /* 49 * On reset Range_0 defaults to enabled. We want to start with a clean 50 * slate to not have things unexpectedly enabled. 51 */ 52 clear_uart_legacy_config(); 53 54 if (CONFIG(AMD_SOC_CONSOLE_UART)) 55 set_uart_config(CONFIG_UART_FOR_CONSOLE); 56 57 /* disable the keyboard reset function before mainboard GPIO setup */ 58 if (CONFIG(DISABLE_KEYBOARD_RESET_PIN)) 59 fch_disable_kb_rst(); 60 } 61 62 /* After console init */ fch_early_init(void)63void fch_early_init(void) 64 { 65 reset_i2c_peripherals(); 66 pm_set_power_failure_state(); 67 fch_print_pmxc0_status(); 68 i2c_soc_early_init(); 69 show_spi_speeds_and_modes(); 70 71 if (CONFIG(DISABLE_SPI_FLASH_ROM_SHARING)) 72 lpc_disable_spi_rom_sharing(); 73 } 74