diff options
Diffstat (limited to 'src/soc')
-rw-r--r-- | src/soc/intel/common/block/fast_spi/fast_spi_flash.c | 13 | ||||
-rw-r--r-- | src/soc/mediatek/mt8173/flash_controller.c | 16 |
2 files changed, 19 insertions, 10 deletions
diff --git a/src/soc/intel/common/block/fast_spi/fast_spi_flash.c b/src/soc/intel/common/block/fast_spi/fast_spi_flash.c index fc36553d9c..6dac24e4e6 100644 --- a/src/soc/intel/common/block/fast_spi/fast_spi_flash.c +++ b/src/soc/intel/common/block/fast_spi/fast_spi_flash.c @@ -273,6 +273,13 @@ static int fast_spi_flash_status(const struct spi_flash *flash, return ret; } +const struct spi_flash_ops fast_spi_flash_ops = { + .read = fast_spi_flash_read, + .write = fast_spi_flash_write, + .erase = fast_spi_flash_erase, + .status = fast_spi_flash_status, +}; + /* * We can't use FDOC and FDOD to read FLCOMP, as previous platforms did. * For details see: @@ -307,11 +314,7 @@ static int fast_spi_flash_probe(const struct spi_slave *dev, * flash->status_cmd = ??? */ - flash->internal_write = fast_spi_flash_write; - flash->internal_erase = fast_spi_flash_erase; - flash->internal_read = fast_spi_flash_read; - flash->internal_status = fast_spi_flash_status; - + flash->ops = &fast_spi_flash_ops; return 0; } diff --git a/src/soc/mediatek/mt8173/flash_controller.c b/src/soc/mediatek/mt8173/flash_controller.c index f4c0de47d8..f77688563a 100644 --- a/src/soc/mediatek/mt8173/flash_controller.c +++ b/src/soc/mediatek/mt8173/flash_controller.c @@ -228,18 +228,24 @@ static int nor_erase(const struct spi_flash *flash, u32 offset, size_t len) return 0; } -int mtk_spi_flash_probe(const struct spi_slave *spi, struct spi_flash *flash) +const struct spi_flash_ops spi_flash_ops = { + .read = nor_read, + .write = nor_write, + .erase = nor_erase, +}; + +int mtk_spi_flash_probe(const struct spi_slave *spi, + struct spi_flash *flash) { write32(&mt8173_nor->wrprot, SFLASH_COMMAND_ENABLE); memcpy(&flash->spi, spi, sizeof(*spi)); + flash->name = "mt8173 flash controller"; - flash->internal_write = nor_write; - flash->internal_erase = nor_erase; - flash->internal_read = nor_read; - flash->internal_status = 0; flash->sector_size = 0x1000; flash->erase_cmd = SECTOR_ERASE_CMD; flash->size = CONFIG_ROM_SIZE; + flash->ops = &spi_flash_ops; + return 0; } |