1 /* SPDX-License-Identifier: GPL-2.0-only */
3 /* TODO: Check if this is still correct */
5 #include <amdblocks/acpimmio.h>
6 #include <amdblocks/aoac.h>
7 #include <amdblocks/espi.h>
8 #include <amdblocks/i2c.h>
9 #include <amdblocks/lpc.h>
10 #include <amdblocks/pmlib.h>
11 #include <amdblocks/smbus.h>
12 #include <amdblocks/stb.h>
13 #include <amdblocks/uart.h>
15 #include <soc/southbridge.h>
20 /* Before console init */
21 void fch_pre_init(void)
23 /* Enable_acpimmio_decode_pm04 to enable the ACPIMMIO decode which is needed to access
24 the GPIO registers. */
25 enable_acpimmio_decode_pm04();
26 /* Setup SPI base by calling lpc_early_init before setting up eSPI. */
29 /* Setup eSPI to enable port80 routing if the board is using eSPI and the eSPI
30 interface hasn't already been set up in verstage on PSP */
31 if (CONFIG(SOC_AMD_COMMON_BLOCK_USE_ESPI
) && !CONFIG(VBOOT_STARTS_BEFORE_BOOTBLOCK
))
32 configure_espi_with_mb_hook();
37 fch_enable_legacy_io();
38 fch_disable_legacy_dma_io();
39 enable_aoac_devices();
42 * On reset Range_0 defaults to enabled. We want to start with a clean
43 * slate to not have things unexpectedly enabled.
45 clear_uart_legacy_config();
47 if (CONFIG(AMD_SOC_CONSOLE_UART
))
48 set_uart_config(CONFIG_UART_FOR_CONSOLE
);
50 /* disable the keyboard reset function before mainboard GPIO setup */
51 if (CONFIG(DISABLE_KEYBOARD_RESET_PIN
))
55 /* After console init */
56 void fch_early_init(void)
58 if (CONFIG(WRITE_STB_BUFFER_TO_CONSOLE
))
59 write_stb_to_console();
61 reset_i2c_peripherals();
62 pm_set_power_failure_state();
63 fch_print_pmxc0_status();
65 show_spi_speeds_and_modes();
67 if (CONFIG(DISABLE_SPI_FLASH_ROM_SHARING
))
68 lpc_disable_spi_rom_sharing();