summaryrefslogtreecommitdiff
path: root/src/soc
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc')
-rw-r--r--src/soc/intel/apollolake/spi.c3
-rw-r--r--src/soc/intel/skylake/flash_controller.c4
-rw-r--r--src/soc/mediatek/mt8173/flash_controller.c6
3 files changed, 8 insertions, 5 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;
diff --git a/src/soc/mediatek/mt8173/flash_controller.c b/src/soc/mediatek/mt8173/flash_controller.c
index 3799c6ac10..2aee66834f 100644
--- a/src/soc/mediatek/mt8173/flash_controller.c
+++ b/src/soc/mediatek/mt8173/flash_controller.c
@@ -236,12 +236,13 @@ static int nor_erase(const struct spi_flash *flash, u32 offset, size_t len)
struct spi_flash *spi_flash_programmer_probe(struct spi_slave *spi, int force)
{
static struct spi_flash flash = {0};
+ static int done = 0;
- if (flash.spi)
+ if (done)
return &flash;
write32(&mt8173_nor->wrprot, SFLASH_COMMAND_ENABLE);
- flash.spi = spi;
+ memcpy(&flash.spi, spi, sizeof(*spi));
flash.name = "mt8173 flash controller";
flash.internal_write = nor_write;
flash.internal_erase = nor_erase;
@@ -250,5 +251,6 @@ struct spi_flash *spi_flash_programmer_probe(struct spi_slave *spi, int force)
flash.sector_size = 0x1000;
flash.erase_cmd = SECTOR_ERASE_CMD;
flash.size = CONFIG_ROM_SIZE;
+ done = 1;
return &flash;
}