aboutsummaryrefslogtreecommitdiff
path: root/src/soc/intel
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@chromium.org>2016-12-05 20:32:24 -0800
committerFurquan Shaikh <furquan@google.com>2016-12-06 07:17:28 +0100
commit810e2cde30035d0de691805041ffeeff57f68027 (patch)
tree99706a026be4551118b334773ccb61a6f5772005 /src/soc/intel
parentd3d1f13599a042bfd7ecb5f11f5a8a76853b7f88 (diff)
spi_flash: Make a deep copy of spi_slave structure
Commit 36b81af (spi: Pass pointer to spi_slave structure in spi_setup_slave) changes the way spi_setup_slave handles the spi_slave structure. Instead of expecting spi controller drivers to maintain spi_slave structure in CAR_GLOBAL/data section, caller is expected to manage the spi_slave structure. This requires that spi_flash drivers maintain spi_slave structure and flash probe function needs to make a copy of the passed in spi_slave structure. This change fixes the regression on Lenovo X230 and other mainboards. Change-Id: I0ad971eecaf3bfe301e9f95badc043193cc27cab Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://review.coreboot.org/17728 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Iru Cai <mytbk920423@gmail.com>
Diffstat (limited to 'src/soc/intel')
-rw-r--r--src/soc/intel/apollolake/spi.c3
-rw-r--r--src/soc/intel/skylake/flash_controller.c4
2 files changed, 4 insertions, 3 deletions
diff --git a/src/soc/intel/apollolake/spi.c b/src/soc/intel/apollolake/spi.c
index 8992fa55ca..f9c17cdc2a 100644
--- a/src/soc/intel/apollolake/spi.c
+++ b/src/soc/intel/apollolake/spi.c
@@ -352,7 +352,8 @@ struct spi_flash *spi_flash_programmer_probe(struct spi_slave *spi, int force)
flash_bits = read_spi_sfdp_param(ctx, 0x04);
flash->size = (flash_bits >> 3) + 1;
- flash->spi = spi;
+ memcpy(&flash->spi, spi, sizeof(*spi));
+
flash->name = "Apollolake hardware sequencer";
/* Can erase both 4 KiB and 64 KiB chunks. Declare the smaller size. */
diff --git a/src/soc/intel/skylake/flash_controller.c b/src/soc/intel/skylake/flash_controller.c
index e0ac93da03..994aec6b5d 100644
--- a/src/soc/intel/skylake/flash_controller.c
+++ b/src/soc/intel/skylake/flash_controller.c
@@ -191,7 +191,7 @@ int pch_hwseq_erase(const struct spi_flash *flash, u32 offset, size_t len)
len, start);
out:
- spi_release_bus(flash->spi);
+ spi_release_bus(&flash->spi);
return ret;
}
@@ -335,7 +335,7 @@ struct spi_flash *spi_flash_programmer_probe(struct spi_slave *spi, int force)
/* Ensure writes can take place to the flash. */
spi_init();
- flash->spi = spi;
+ memcpy(&flash->spi, spi, sizeof(*spi));
flash->name = "Opaque HW-sequencing";
flash->internal_write = pch_hwseq_write;