From 810e2cde30035d0de691805041ffeeff57f68027 Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Mon, 5 Dec 2016 20:32:24 -0800 Subject: 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 Reviewed-on: https://review.coreboot.org/17728 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin Reviewed-by: Paul Menzel Reviewed-by: Iru Cai --- src/southbridge/intel/common/spi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/southbridge/intel/common/spi.c') diff --git a/src/southbridge/intel/common/spi.c b/src/southbridge/intel/common/spi.c index 42a2a748de..c58f402195 100644 --- a/src/southbridge/intel/common/spi.c +++ b/src/southbridge/intel/common/spi.c @@ -733,7 +733,7 @@ static int ich_hwseq_erase(const struct spi_flash *flash, u32 offset, return -1; } - ret = spi_claim_bus(flash->spi); + ret = spi_claim_bus(&flash->spi); if (ret) { printk(BIOS_ERR, "SF: Unable to claim SPI bus\n"); return ret; @@ -766,7 +766,7 @@ static int ich_hwseq_erase(const struct spi_flash *flash, u32 offset, printk(BIOS_DEBUG, "SF: Successfully erased %zu bytes @ %#x\n", len, start); out: - spi_release_bus(flash->spi); + spi_release_bus(&flash->spi); return ret; } @@ -921,7 +921,7 @@ struct spi_flash *spi_flash_programmer_probe(struct spi_slave *spi, int force) return NULL; } - flash->spi = spi; + memcpy(&flash->spi, spi, sizeof(*spi)); flash->name = "Opaque HW-sequencing"; flash->internal_write = ich_hwseq_write; -- cgit v1.2.3