coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
early_fch.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <amdblocks/acpimmio.h>
4 #include <amdblocks/espi.h>
5 #include <amdblocks/i2c.h>
6 #include <amdblocks/lpc.h>
7 #include <amdblocks/pmlib.h>
8 #include <amdblocks/smbus.h>
9 #include <amdblocks/spi.h>
10 #include <soc/i2c.h>
11 #include <soc/southbridge.h>
12 #include <soc/uart.h>
13 #include <types.h>
14 
15 #include "chip.h"
16 
17 /* Table to switch SCL pins to outputs to initially reset the I2C peripherals */
18 static const struct soc_i2c_scl_pin i2c_scl_pins[] = {
21  /* I2C4 is a peripheral device only */
22 };
23 
24 static void lpc_configure_decodes(void)
25 {
26  if (CONFIG(POST_IO) && (CONFIG_POST_IO_PORT == 0x80))
28 }
29 
30 static void reset_i2c_peripherals(void)
31 {
32  const struct soc_amd_picasso_config *cfg = config_of_soc();
33  struct soc_i2c_peripheral_reset_info reset_info;
34 
36  reset_info.i2c_scl = i2c_scl_pins;
37  reset_info.num_pins = ARRAY_SIZE(i2c_scl_pins);
38  sb_reset_i2c_peripherals(&reset_info);
39 }
40 
41 /* Before console init */
42 void fch_pre_init(void)
43 {
44  /* Enable_acpimmio_decode_pm04 to enable the ACPIMMIO decode which is needed to access
45  the GPIO registers. */
47  /* Setup SPI base by calling lpc_early_init before setting up eSPI. */
49 
50  /* Setup eSPI to enable port80 routing if the board is using eSPI and the eSPI
51  interface hasn't already been set up in verstage on PSP */
52  if (CONFIG(SOC_AMD_COMMON_BLOCK_USE_ESPI) && !CONFIG(VBOOT_STARTS_BEFORE_BOOTBLOCK))
54 
55  if (!CONFIG(SOC_AMD_COMMON_BLOCK_USE_ESPI))
57 
64 
65  /*
66  * On reset Range_0 defaults to enabled. We want to start with a clean
67  * slate to not have things unexpectedly enabled.
68  */
70 
71  if (CONFIG(AMD_SOC_CONSOLE_UART))
72  set_uart_config(CONFIG_UART_FOR_CONSOLE);
73 
74  /* disable the keyboard reset function before mainboard GPIO setup */
75  if (CONFIG(DISABLE_KEYBOARD_RESET_PIN))
77 }
78 
79 /* After console init */
80 void fch_early_init(void)
81 {
86 
87  if (CONFIG(DISABLE_SPI_FLASH_ROM_SHARING))
89 }
#define ARRAY_SIZE(a)
Definition: helpers.h:12
void enable_aoac_devices(void)
Definition: aoac.c:41
void fch_pre_init(void)
Definition: early_fch.c:35
void fch_early_init(void)
Definition: early_fch.c:71
@ CONFIG
Definition: dsi_common.h:201
#define config_of_soc()
Definition: device.h:394
void fch_enable_cf9_io(void)
Definition: mmio_util.c:63
void fch_enable_legacy_io(void)
Definition: mmio_util.c:68
void enable_acpimmio_decode_pm04(void)
Definition: mmio_util.c:54
void fch_disable_kb_rst(void)
Definition: mmio_util.c:97
static const struct soc_i2c_scl_pin i2c_scl_pins[]
Definition: early_fch.c:18
static void reset_i2c_peripherals(void)
Definition: early_fch.c:30
static void lpc_configure_decodes(void)
Definition: early_fch.c:24
void pm_set_power_failure_state(void)
Definition: pmlib.c:16
void fch_print_pmxc0_status(void)
#define GPIO_I2C2_SCL
Definition: i2c.h:11
#define GPIO_I2C3_SCL
Definition: i2c.h:12
#define GPIO_I2C_MASK
Definition: i2c.h:13
#define I2C2_SCL_PIN
Definition: i2c.h:18
#define I2C3_SCL_PIN
Definition: i2c.h:19
void set_uart_config(unsigned int idx)
Definition: uart.c:43
void clear_uart_legacy_config(void)
Definition: uart.c:38
void sb_reset_i2c_peripherals(const struct soc_i2c_peripheral_reset_info *reset_info)
Definition: i2c.c:148
void i2c_soc_early_init(void)
Definition: i2c.c:108
void configure_espi_with_mb_hook(void)
Definition: espi_util.c:1052
#define I2C_RESET_SCL_PIN(pin_name, pin_mask_value)
Definition: i2c.h:39
void lpc_early_init(void)
Definition: lpc_util.c:355
void lpc_enable_port80(void)
Definition: lpc_util.c:139
void lpc_disable_spi_rom_sharing(void)
Definition: lpc_util.c:296
void fch_smbus_init(void)
void fch_spi_early_init(void)
Definition: fch_spi.c:122
void show_spi_speeds_and_modes(void)
Definition: fch_spi.c:35
Information about I2C peripherals that need to be reset.
Definition: i2c.h:53
const struct soc_i2c_scl_pin * i2c_scl
Definition: i2c.h:55
uint8_t i2c_scl_reset_mask
Definition: i2c.h:54
Data structure to identify GPIO to be toggled to reset peripherals on an I2C bus.
Definition: i2c.h:33