[U-Boot] [PATCH v7 55/87] x86: Drop using spi_flash_dm_ops
Jagan Teki
jteki at openedev.com
Tue Mar 22 08:38:07 CET 2016
Since spi-nor flash is part of MTD uclass, so replaced
UCLASS_SPI_FLASH with UCLASS_MTD and use respective
spi_flash operations as well.
Cc: Simon Glass <sjg at chromium.org>
Cc: Bin Meng <bmeng.cn at gmail.com>
Cc: Mugunthan V N <mugunthanvnm at ti.com>
Cc: Michal Simek <michal.simek at xilinx.com>
Cc: Siva Durga Prasad Paladugu <sivadur at xilinx.com>
Signed-off-by: Jagan Teki <jteki at openedev.com>
---
arch/arm/mach-rockchip/rk3288-board-spl.c | 2 +-
arch/x86/lib/mrccache.c | 9 ++++-----
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/arch/arm/mach-rockchip/rk3288-board-spl.c b/arch/arm/mach-rockchip/rk3288-board-spl.c
index e133cca..7aed5c6 100644
--- a/arch/arm/mach-rockchip/rk3288-board-spl.c
+++ b/arch/arm/mach-rockchip/rk3288-board-spl.c
@@ -53,7 +53,7 @@ u32 spl_boot_device(void)
}
debug("Found device %s\n", dev->name);
switch (device_get_uclass_id(dev)) {
- case UCLASS_SPI_FLASH:
+ case UCLASS_MTD:
return BOOT_DEVICE_SPI;
case UCLASS_MMC:
return BOOT_DEVICE_MMC1;
diff --git a/arch/x86/lib/mrccache.c b/arch/x86/lib/mrccache.c
index 67bace4..1d6ce35 100644
--- a/arch/x86/lib/mrccache.c
+++ b/arch/x86/lib/mrccache.c
@@ -109,6 +109,7 @@ static struct mrc_data_container *find_next_mrc_cache(struct mrc_region *entry,
int mrccache_update(struct udevice *sf, struct mrc_region *entry,
struct mrc_data_container *cur)
{
+ spi_flash_t *flash = dev_get_uclass_priv(sf);
struct mrc_data_container *cache;
ulong offset;
ulong base_addr;
@@ -139,7 +140,7 @@ int mrccache_update(struct udevice *sf, struct mrc_region *entry,
debug("Erasing the MRC cache region of %x bytes at %x\n",
entry->length, entry->offset);
- ret = spi_flash_erase_dm(sf, entry->offset, entry->length);
+ ret = spi_flash_erase(flash, entry->offset, entry->length);
if (ret) {
debug("Failed to erase flash region\n");
return ret;
@@ -150,8 +151,7 @@ int mrccache_update(struct udevice *sf, struct mrc_region *entry,
/* Write the data out */
offset = (ulong)cache - base_addr + entry->offset;
debug("Write MRC cache update to flash at %lx\n", offset);
- ret = spi_flash_write_dm(sf, offset, cur->data_size + sizeof(*cur),
- cur);
+ ret = spi_flash_write(flash, offset, cur->data_size + sizeof(*cur), cur);
if (ret) {
debug("Failed to write to SPI flash\n");
return ret;
@@ -216,8 +216,7 @@ int mrccache_get_region(struct udevice **devp, struct mrc_region *entry)
entry->length = reg[1];
if (devp) {
- ret = uclass_get_device_by_of_offset(UCLASS_SPI_FLASH, node,
- devp);
+ ret = uclass_get_device_by_of_offset(UCLASS_MTD, node, devp);
debug("ret = %d\n", ret);
if (ret)
return ret;
--
1.9.1
More information about the U-Boot
mailing list