mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-17 18:41:22 +00:00
i2c: preserve 1.8V flag during raw i2c gpio access
When we try to unwedge an i2c port, we change the pin type into a manually GPIO ODR. When we do that we should also carry over the 1.8V flag if it exists on the original GPIO definition. BRANCH=none BUG=b:109884927 TEST=verified with manually-created EC console command that low voltage register is not set when going into raw mode before this change and correctly sets the low voltage register after this change (when going into raw mode). Change-Id: I87515d53cc68ace3f69ea1058b83a378ef9a281c Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1093011 Reviewed-by: Justin TerAvest <teravest@chromium.org>
This commit is contained in:
@@ -380,6 +380,12 @@ int i2c_raw_mode(int port, int enable)
|
||||
return EC_ERROR_INVAL;
|
||||
|
||||
if (enable) {
|
||||
int raw_gpio_mode_flags = GPIO_ODR_HIGH;
|
||||
|
||||
/* If the CLK line is 1.8V, then ensure we set 1.8V mode */
|
||||
if ((gpio_list + scl)->flags & GPIO_SEL_1P8V)
|
||||
raw_gpio_mode_flags |= GPIO_SEL_1P8V;
|
||||
|
||||
/*
|
||||
* To enable raw mode, take out of alternate function mode and
|
||||
* set the flags to open drain output.
|
||||
@@ -387,8 +393,8 @@ int i2c_raw_mode(int port, int enable)
|
||||
ret_sda = gpio_config_pin(MODULE_I2C, sda, 0);
|
||||
ret_scl = gpio_config_pin(MODULE_I2C, scl, 0);
|
||||
|
||||
gpio_set_flags(scl, GPIO_ODR_HIGH);
|
||||
gpio_set_flags(sda, GPIO_ODR_HIGH);
|
||||
gpio_set_flags(scl, raw_gpio_mode_flags);
|
||||
gpio_set_flags(sda, raw_gpio_mode_flags);
|
||||
} else {
|
||||
/*
|
||||
* Configure the I2C pins to exit raw mode and return
|
||||
|
||||
Reference in New Issue
Block a user