summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Rudolph <patrick.rudolph@9elements.com>2018-12-03 09:41:06 +0100
committerPhilipp Deppenwiese <zaolin.daisuki@gmail.com>2018-12-04 07:11:45 +0000
commite736015fffc973ccbd6de54751e312a1fda387dc (patch)
tree5772c955e4fafeaa3aa9e120e275abec5c230024
parentcebf9e6f38aac484024711bd640f2135c8033935 (diff)
downloadcoreboot-e736015fffc973ccbd6de54751e312a1fda387dc.tar.xz
drivers/spi/winbond: Fix TB bit
The TB has to be inverted to actually protected the correct region. Tested on elgon using I67eb4ee8e0ad297a8d1984d55102146688c291fc. Change-Id: I715791b8ae5d1db1ef587321ae5c9daa10eb7dbc Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Reviewed-on: https://review.coreboot.org/c/30014 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com> Reviewed-by: David Hendricks <david.hendricks@gmail.com> Reviewed-by: Julius Werner <jwerner@chromium.org>
-rw-r--r--src/drivers/spi/winbond.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/drivers/spi/winbond.c b/src/drivers/spi/winbond.c
index 9eb335262d..f8ea247bb8 100644
--- a/src/drivers/spi/winbond.c
+++ b/src/drivers/spi/winbond.c
@@ -303,7 +303,7 @@ static void winbond_bpbits_to_region(const size_t granularity,
tb = !tb;
}
- out->offset = tb ? flash_size - protected_size : 0;
+ out->offset = tb ? 0 : flash_size - protected_size;
out->size = protected_size;
}
@@ -519,9 +519,9 @@ winbond_set_write_protection(const struct spi_flash *flash,
wp_region = *region;
if (region_offset(&wp_region) == 0)
- tb = 0;
- else
tb = 1;
+ else
+ tb = 0;
if (region_sz(&wp_region) > flash->size / 2) {
cmp = 1;