[U-Boot] [PATCH v6 13/76] sf: Rename erase_size to erasesize

Jagan Teki jteki at openedev.com
Sun Feb 14 21:48:12 CET 2016


erasesize name looks similar as the way mtd_info{}
used so renamed erase_size to erasesize and more over
the spi-flash will use mtd in future patches.

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>
---
 drivers/mtd/spi/sf_dataflash.c |  4 ++--
 drivers/mtd/spi/spi_flash.c    | 14 +++++++-------
 include/spi_flash.h            |  4 ++--
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/mtd/spi/sf_dataflash.c b/drivers/mtd/spi/sf_dataflash.c
index b2a56da..0f66b99 100644
--- a/drivers/mtd/spi/sf_dataflash.c
+++ b/drivers/mtd/spi/sf_dataflash.c
@@ -427,12 +427,12 @@ static int add_dataflash(struct udevice *dev, char *name, int nr_pages,
 	spi_flash->name = name;
 	spi_flash->page_size = pagesize;
 	spi_flash->size = nr_pages * pagesize;
-	spi_flash->erase_size = pagesize;
+	spi_flash->erasesize = pagesize;
 
 #ifndef CONFIG_SPL_BUILD
 	printf("SPI DataFlash: Detected %s with page size ", spi_flash->name);
 	print_size(spi_flash->page_size, ", erase size ");
-	print_size(spi_flash->erase_size, ", total ");
+	print_size(spi_flash->erasesize, ", total ");
 	print_size(spi_flash->size, "");
 	printf(", revision %c", revision);
 	puts("\n");
diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 8a60c72..17eb0e9 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -328,7 +328,7 @@ int spi_flash_cmd_erase_ops(struct spi_flash *flash, u32 offset, size_t len)
 	u8 cmd[SPI_FLASH_CMD_LEN];
 	int ret = -1;
 
-	erase_size = flash->erase_size;
+	erase_size = flash->erasesize;
 	if (offset % erase_size || len % erase_size) {
 		debug("SF: Erase offset/length not multiple of erase size\n");
 		return -1;
@@ -795,7 +795,7 @@ int stm_unlock(struct spi_flash *flash, u32 ofs, size_t len)
 		return ret;
 
 	/* Cannot unlock; would unlock larger region than requested */
-	if (stm_is_locked_sr(flash, ofs - flash->erase_size, flash->erase_size,
+	if (stm_is_locked_sr(flash, ofs - flash->erasesize, flash->erasesize,
 			     status_old))
 		return -EINVAL;
 	/*
@@ -1082,17 +1082,17 @@ int spi_flash_scan(struct spi_flash *flash)
 	/* Compute erase sector and command */
 	if (params->flags & SECT_4K) {
 		flash->erase_cmd = CMD_ERASE_4K;
-		flash->erase_size = 4096 << flash->shift;
+		flash->erasesize = 4096 << flash->shift;
 	} else if (params->flags & SECT_32K) {
 		flash->erase_cmd = CMD_ERASE_32K;
-		flash->erase_size = 32768 << flash->shift;
+		flash->erasesize = 32768 << flash->shift;
 	} else {
 		flash->erase_cmd = CMD_ERASE_64K;
-		flash->erase_size = flash->sector_size;
+		flash->erasesize = flash->sector_size;
 	}
 
 	/* Now erase size becomes valid sector size */
-	flash->sector_size = flash->erase_size;
+	flash->sector_size = flash->erasesize;
 
 	/* Look for the fastest read cmd */
 	cmd = fls(params->e_rd_cmd & spi->mode_rx);
@@ -1164,7 +1164,7 @@ int spi_flash_scan(struct spi_flash *flash)
 #ifndef CONFIG_SPL_BUILD
 	printf("SF: Detected %s with page size ", flash->name);
 	print_size(flash->page_size, ", erase size ");
-	print_size(flash->erase_size, ", total ");
+	print_size(flash->erasesize, ", total ");
 	print_size(flash->size, "");
 	if (flash->memory_map)
 		printf(", mapped at %p", flash->memory_map);
diff --git a/include/spi_flash.h b/include/spi_flash.h
index 1165199..c68df26 100644
--- a/include/spi_flash.h
+++ b/include/spi_flash.h
@@ -40,7 +40,7 @@ struct spi_slave;
  * @size:		Total flash size
  * @page_size:		Write (page) size
  * @sector_size:	Sector size
- * @erase_size:		Erase size
+ * @erasesize:		Erase size
  * @bank_read_cmd:	Bank read cmd
  * @bank_write_cmd:	Bank write cmd
  * @bank_curr:		Current flash bank
@@ -73,7 +73,7 @@ struct spi_flash {
 	u32 size;
 	u32 page_size;
 	u32 sector_size;
-	u32 erase_size;
+	u32 erasesize;
 #ifdef CONFIG_SPI_FLASH_BAR
 	u8 bank_read_cmd;
 	u8 bank_write_cmd;
-- 
1.9.1



More information about the U-Boot mailing list