sb/intel/common/gpio: Only set one bit at time

Make sure to set only one bit instead of arbitrary bits set in argument.

Change-Id: I39426193d15d8581f79bc2a45c0edb53b19a2cd3
Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-on: https://review.coreboot.org/20707
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Patrick Rudolph 2017-07-22 12:16:11 +02:00 committed by Martin Roth
parent 87863fd692
commit 0e4f83e7b0
1 changed files with 2 additions and 1 deletions

View File

@ -142,7 +142,8 @@ void set_gpio(int gpio_num, int value)
config = inl(gpio_base + gpio_reg_offsets[index]); config = inl(gpio_base + gpio_reg_offsets[index]);
config &= ~(1 << bit); config &= ~(1 << bit);
config |= value << bit; if (value != 0)
config |= (1 << bit);
outl(config, gpio_base + gpio_reg_offsets[index]); outl(config, gpio_base + gpio_reg_offsets[index]);
} }