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 /* TODO: Check if this is still correct */
4 
5 #include <amdblocks/acpimmio.h>
6 #include <amdblocks/espi.h>
7 #include <amdblocks/i2c.h>
8 #include <amdblocks/lpc.h>
9 #include <amdblocks/pmlib.h>
10 #include <amdblocks/smbus.h>
11 #include <soc/i2c.h>
12 #include <soc/southbridge.h>
13 #include <soc/uart.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[] = {
23 };
24 
25 static void reset_i2c_peripherals(void)
26 {
27  const struct soc_amd_sabrina_config *cfg = config_of_soc();
28  struct soc_i2c_peripheral_reset_info reset_info;
29 
31  reset_info.i2c_scl = i2c_scl_pins;
32  reset_info.num_pins = ARRAY_SIZE(i2c_scl_pins);
33  sb_reset_i2c_peripherals(&reset_info);
34 }
35 
36 /* Before console init */
37 void fch_pre_init(void)
38 {
39  /* Enable_acpimmio_decode_pm04 to enable the ACPIMMIO decode which is needed to access
40  the GPIO registers. */
42  /* Setup SPI base by calling lpc_early_init before setting up eSPI. */
44 
45  /* Setup eSPI to enable port80 routing if the board is using eSPI and the eSPI
46  interface hasn't already been set up in verstage on PSP */
47  if (CONFIG(SOC_AMD_COMMON_BLOCK_USE_ESPI) && !CONFIG(VBOOT_STARTS_BEFORE_BOOTBLOCK))
49 
57 
58  /*
59  * On reset Range_0 defaults to enabled. We want to start with a clean
60  * slate to not have things unexpectedly enabled.
61  */
63 
64  if (CONFIG(AMD_SOC_CONSOLE_UART))
65  set_uart_config(CONFIG_UART_FOR_CONSOLE);
66 
67  /* disable the keyboard reset function before mainboard GPIO setup */
68  if (CONFIG(DISABLE_KEYBOARD_RESET_PIN))
70 }
71 
72 /* After console init */
73 void fch_early_init(void)
74 {
79 
80  if (CONFIG(DISABLE_SPI_FLASH_ROM_SHARING))
82 }
#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
void fch_disable_legacy_dma_io(void)
Definition: mmio_util.c:73
void pm_set_power_failure_state(void)
Definition: pmlib.c:16
void fch_print_pmxc0_status(void)
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:25
#define I2C0_SCL_PIN
Definition: i2c.h:16
#define GPIO_I2C0_SCL
Definition: i2c.h:9
#define GPIO_I2C1_SCL
Definition: i2c.h:10
#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
#define I2C1_SCL_PIN
Definition: i2c.h:17
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_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