From fec4db954e44a3fd23fedd2f51189c13c985eee9 Mon Sep 17 00:00:00 2001 From: Karthikeyan Ramasubramanian Date: Wed, 2 Jun 2021 16:14:39 -0600 Subject: soc/amd/cezanne: Configure I2C Pad RX Select through devicetree Some of the I2C buses are required to operate at different voltage level compared to other I2C buses eg. I2C bus to Google Security Chip (GSC) should be at 1.8V level. By default, all the I2C buses are initialized to operate at 3.3 V. Add support to configure I2C pad RX select through devicetree and update the concerned devicetree. BUG=b:188538373 TEST=Build and boot to OS in Guybrush. Ensure that the communication with GSC is fine. Build Majolica mainboard. Change-Id: I595a64736fdac0274abffb68c5e521302275b845 Signed-off-by: Karthikeyan Ramasubramanian Reviewed-on: https://review.coreboot.org/c/coreboot/+/55149 Tested-by: build bot (Jenkins) Reviewed-by: Raul Rangel Reviewed-by: Furquan Shaikh --- src/soc/amd/cezanne/chip.h | 1 + src/soc/amd/cezanne/i2c.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src/soc') diff --git a/src/soc/amd/cezanne/chip.h b/src/soc/amd/cezanne/chip.h index df2059a260..319ce4108e 100644 --- a/src/soc/amd/cezanne/chip.h +++ b/src/soc/amd/cezanne/chip.h @@ -14,6 +14,7 @@ struct soc_amd_cezanne_config { struct soc_amd_common_config common_config; u8 i2c_scl_reset; struct dw_i2c_bus_config i2c[I2C_CTRLR_COUNT]; + u8 i2c_pad_ctrl_rx_sel[I2C_CTRLR_COUNT]; /* Enable S0iX support */ bool s0ix_enable; diff --git a/src/soc/amd/cezanne/i2c.c b/src/soc/amd/cezanne/i2c.c index 6571ff50bd..008b26190b 100644 --- a/src/soc/amd/cezanne/i2c.c +++ b/src/soc/amd/cezanne/i2c.c @@ -37,9 +37,13 @@ __weak void mainboard_i2c_override(int bus, uint32_t *pad_settings) { } void soc_i2c_misc_init(unsigned int bus, const struct dw_i2c_bus_config *cfg) { + const struct soc_amd_cezanne_config *config = config_of_soc(); uint32_t pad_ctrl; int misc_reg; + if (bus >= ARRAY_SIZE(config->i2c_pad_ctrl_rx_sel)) + return; + misc_reg = MISC_I2C0_PAD_CTRL + sizeof(uint32_t) * bus; pad_ctrl = misc_read32(misc_reg); @@ -47,7 +51,7 @@ void soc_i2c_misc_init(unsigned int bus, const struct dw_i2c_bus_config *cfg) pad_ctrl |= I2C_PAD_CTRL_NG_NORMAL; pad_ctrl &= ~I2C_PAD_CTRL_RX_SEL_MASK; - pad_ctrl |= I2C_PAD_CTRL_RX_SEL_3_3V; + pad_ctrl |= config->i2c_pad_ctrl_rx_sel[bus]; pad_ctrl &= ~I2C_PAD_CTRL_FALLSLEW_MASK; pad_ctrl |= cfg->speed == I2C_SPEED_STANDARD ? -- cgit v1.2.3