Debian Codegraph @

src/soc/amd/picasso/early_fch.c

raw symbols SCIP
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/spi.h>
11 #include <amdblocks/uart.h>
12 #include <soc/i2c.h>
13 #include <soc/southbridge.h>
14 #include <soc/uart.h>
15 #include <types.h>
16
17 #include "chip.h"
18
19 static void lpc_configure_decodes(void)
20 {
21 if (CONFIG(POST_IO) && (CONFIG_POST_IO_PORT == 0x80))
22 lpc_enable_port80();
23 }
24
25 /* Before console init */
26 void fch_pre_init(void)
27 {
28 /* Enable_acpimmio_decode_pm04 to enable the ACPIMMIO decode which is needed to access
29 the GPIO registers. */
30 enable_acpimmio_decode_pm04();
31 /* Setup SPI base by calling lpc_early_init before setting up eSPI. */
32 lpc_early_init();
33
34 /* Setup eSPI to enable port80 routing if the board is using eSPI and the eSPI
35 interface hasn't already been set up in verstage on PSP */
36 if (CONFIG(SOC_AMD_COMMON_BLOCK_USE_ESPI) && !CONFIG(VBOOT_STARTS_BEFORE_BOOTBLOCK))
37 configure_espi_with_mb_hook();
38
39 if (!CONFIG(SOC_AMD_COMMON_BLOCK_USE_ESPI))
40 lpc_configure_decodes();
41
42 fch_spi_early_init();
43 fch_smbus_init();
44 fch_enable_cf9_io();
45 fch_enable_legacy_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 */
63 void 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 }