From 7f3156dad67ad35f02afedd85cdf4a19e3c0875e Mon Sep 17 00:00:00 2001 From: Duncan Laurie Date: Mon, 6 Jun 2016 17:13:42 -0700 Subject: skylake: gpio: Add support for setting 1.8V tolerant Add the voltage tolerance GPIO attribute for configuring I2C/I2S buses that are at 1.8V. This is currently done by passing in a value to FSP but it is needed earlier than FSP if the I2C bus is used in verstage. This does not remove the need for the FSP input parameter, that is still required so FSP doesn't disable what has been set in coreboot. The mainboards that are affected are updated in this commit. This was tested by exercising I2C transactions to the 1.8V codec while in verstage on the google/chell mainboard. Signed-off-by: Duncan Laurie Change-Id: I93d22c2e3bc0617c87f03c37a8746e22a112cc9c Reviewed-on: https://review.coreboot.org/15103 Reviewed-by: Aaron Durbin Tested-by: build bot (Jenkins) --- src/soc/intel/skylake/gpio.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/soc/intel/skylake/gpio.c') diff --git a/src/soc/intel/skylake/gpio.c b/src/soc/intel/skylake/gpio.c index a7d88326d1..78495c6467 100644 --- a/src/soc/intel/skylake/gpio.c +++ b/src/soc/intel/skylake/gpio.c @@ -305,9 +305,8 @@ static void gpio_configure_pad(const struct pad_config *cfg) { uint32_t *dw_regs; uint32_t reg; - uint32_t termination; uint32_t dw0; - const uint32_t termination_mask = PAD_TERM_MASK << PAD_TERM_SHIFT; + uint32_t mask; dw_regs = gpio_dw_regs(cfg->pad); @@ -318,10 +317,16 @@ static void gpio_configure_pad(const struct pad_config *cfg) write32(&dw_regs[0], dw0); reg = read32(&dw_regs[1]); - reg &= ~termination_mask; - termination = cfg->attrs; - termination &= termination_mask; - reg |= termination; + + /* Apply termination field */ + mask = PAD_TERM_MASK << PAD_TERM_SHIFT; + reg &= ~mask; + reg |= cfg->attrs & mask; + + /* Apply voltage tolerance field */ + mask = PAD_TOL_MASK << PAD_TOL_SHIFT; + reg &= ~mask; + reg |= cfg->attrs & mask; write32(&dw_regs[1], reg); gpio_handle_pad_mode(cfg); @@ -329,7 +334,7 @@ static void gpio_configure_pad(const struct pad_config *cfg) if ((dw0 & PAD_FIELD(GPIROUTSMI, MASK)) == PAD_FIELD(GPIROUTSMI, YES)) gpi_enable_smi(cfg->pad); - if(gpio_debug) + if (gpio_debug) printk(BIOS_DEBUG, "Write Pad: Base(%p) - conf0 = %x conf1= %x pad # = %d\n", &dw_regs[0], dw0, reg, cfg->pad); -- cgit v1.2.3