All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jagan Teki <jteki@openedev.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 10/27] sf: Rename spi_flash_params => spi_flash_info
Date: Thu, 11 Aug 2016 13:37:32 +0530	[thread overview]
Message-ID: <1470902869-22570-10-git-send-email-jteki@openedev.com> (raw)
In-Reply-To: <1470902869-22570-1-git-send-email-jteki@openedev.com>

Renamed for more readability
- spi_flash_params => spi_flash_info
- params => info

Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: York Sun <york.sun@nxp.com>
Cc: Vignesh R <vigneshr@ti.com>
Cc: Mugunthan V N <mugunthanvnm@ti.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
---
 drivers/mtd/spi/sandbox.c     |  6 +++---
 drivers/mtd/spi/sf_internal.h | 10 +++++-----
 drivers/mtd/spi/sf_params.c   |  2 +-
 drivers/mtd/spi/spi_flash.c   | 46 +++++++++++++++++++++----------------------
 4 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/drivers/mtd/spi/sandbox.c b/drivers/mtd/spi/sandbox.c
index f59134f..cecebb0 100644
--- a/drivers/mtd/spi/sandbox.c
+++ b/drivers/mtd/spi/sandbox.c
@@ -88,7 +88,7 @@ struct sandbox_spi_flash {
 	/* The current flash status (see STAT_XXX defines above) */
 	u16 status;
 	/* Data describing the flash we're emulating */
-	const struct spi_flash_params *data;
+	const struct spi_flash_info *data;
 	/* The file on disk to serv up data from */
 	int fd;
 };
@@ -112,7 +112,7 @@ static int sandbox_sf_probe(struct udevice *dev)
 	struct sandbox_spi_flash *sbsf = dev_get_priv(dev);
 	const char *file;
 	size_t len, idname_len;
-	const struct spi_flash_params *data;
+	const struct spi_flash_info *data;
 	struct sandbox_spi_flash_plat_data *pdata = dev_get_platdata(dev);
 	struct sandbox_state *state = state_get_current();
 	struct udevice *bus = dev->parent;
@@ -168,7 +168,7 @@ static int sandbox_sf_probe(struct udevice *dev)
 	}
 	debug("%s: device='%s'\n", __func__, spec);
 
-	for (data = spi_flash_params_table; data->name; data++) {
+	for (data = spi_flash_ids; data->name; data++) {
 		len = strlen(data->name);
 		if (idname_len != len)
 			continue;
diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
index 966fd21..bb5251d 100644
--- a/drivers/mtd/spi/sf_internal.h
+++ b/drivers/mtd/spi/sf_internal.h
@@ -104,11 +104,11 @@ int sst_write_bp(struct spi_flash *flash, u32 offset, size_t len,
 #define CMD_SPANSION_WRAR	0x71 /* Write any device register */
 #endif
 
-#define JEDEC_ID(params)	(((params)->id[1]) << 8 | ((params)->id[2]))
-#define JEDEC_EXT(params)	(((params)->id[3]) << 8 | ((params)->id[4]))
+#define JEDEC_ID(info)		(((info)->id[1]) << 8 | ((info)->id[2]))
+#define JEDEC_EXT(info)		(((info)->id[3]) << 8 | ((info)->id[4]))
 
 /**
- * struct spi_flash_params - SPI/QSPI flash device params structure
+ * struct spi_flash_info - SPI/QSPI flash device params structure
  *
  * @name:		Device name ([MANUFLETTER][DEVTYPE][DENSITY][EXTRAINFO])
  * @sector_size:	Isn't necessarily a sector size from vendor,
@@ -116,7 +116,7 @@ int sst_write_bp(struct spi_flash *flash, u32 offset, size_t len,
  * @nr_sectors:		No.of sectors on this device
  * @flags:		Important param, for flash specific behaviour
  */
-struct spi_flash_params {
+struct spi_flash_info {
 	const char *name;
 
 	/*
@@ -144,7 +144,7 @@ struct spi_flash_params {
 #define RD_FULL			(RD_QUAD | RD_DUAL | RD_QUADIO | RD_DUALIO)
 };
 
-extern const struct spi_flash_params spi_flash_params_table[];
+extern const struct spi_flash_info spi_flash_ids[];
 
 /* Send a single-byte command to the device and read the response */
 int spi_flash_cmd(struct spi_slave *spi, u8 cmd, void *response, size_t len);
diff --git a/drivers/mtd/spi/sf_params.c b/drivers/mtd/spi/sf_params.c
index 70d9e18..7fcc3bc 100644
--- a/drivers/mtd/spi/sf_params.c
+++ b/drivers/mtd/spi/sf_params.c
@@ -28,7 +28,7 @@
 		.flags = (_flags),
 
 /* SPI/QSPI flash device params structure */
-const struct spi_flash_params spi_flash_params_table[] = {
+const struct spi_flash_info spi_flash_ids[] = {
 #ifdef CONFIG_SPI_FLASH_ATMEL		/* ATMEL */
 	{"AT45DB011D",	   INFO(0x1f2200, 0x0, 64 * 1024,     4, SECT_4K) },
 	{"AT45DB021D",	   INFO(0x1f2300, 0x0, 64 * 1024,     8, SECT_4K) },
diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index e979b8e..099714e 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -924,11 +924,11 @@ static int micron_quad_enable(struct spi_flash *flash)
 }
 #endif
 
-static const struct spi_flash_params *spi_flash_read_id(struct spi_flash *flash)
+static const struct spi_flash_info *spi_flash_read_id(struct spi_flash *flash)
 {
 	int				tmp;
 	u8				id[5];
-	const struct spi_flash_params	*params;
+	const struct spi_flash_info	*info;
 
 	tmp = spi_flash_cmd(flash->spi, CMD_READ_ID, id, 5);
 	if (tmp < 0) {
@@ -936,11 +936,11 @@ static const struct spi_flash_params *spi_flash_read_id(struct spi_flash *flash)
 		return ERR_PTR(tmp);
 	}
 
-	params = spi_flash_params_table;
-	for (; params->name != NULL; params++) {
-		if (params->id_len) {
-			if (!memcmp(params->id, id, params->id_len))
-				return params;
+	info = spi_flash_ids;
+	for (; info->name != NULL; info++) {
+		if (info->id_len) {
+			if (!memcmp(info->id, id, info->id_len))
+				return info;
 		}
 	}
 
@@ -1036,13 +1036,13 @@ static int spansion_s25fss_disable_4KB_erase(struct spi_slave *spi)
 int spi_flash_scan(struct spi_flash *flash)
 {
 	struct spi_slave *spi = flash->spi;
-	const struct spi_flash_params *params = NULL;
+	const struct spi_flash_info *info = NULL;
 	u16 jedec, ext_jedec;
 	u8 idcode[5];
 	int ret;
 
-	params = spi_flash_read_id(flash);
-	if (IS_ERR_OR_NULL(params))
+	info = spi_flash_read_id(flash);
+	if (IS_ERR_OR_NULL(info))
 		return -ENOENT;
 
 	jedec = idcode[1] << 8 | idcode[2];
@@ -1091,12 +1091,12 @@ int spi_flash_scan(struct spi_flash *flash)
 		write_sr(flash, 0);
 
 	/* Assign spi data */
-	flash->name = params->name;
+	flash->name = info->name;
 	flash->memory_map = spi->memory_map;
 	flash->dual_flash = spi->option;
 
 	/* Assign spi flash flags */
-	if (params->flags & SST_WR)
+	if (info->flags & SST_WR)
 		flash->flags |= SNOR_F_SST_WR;
 
 	/* Assign spi_flash ops */
@@ -1130,21 +1130,21 @@ int spi_flash_scan(struct spi_flash *flash)
 
 	/* Compute the flash size */
 	flash->shift = (flash->dual_flash & SF_DUAL_PARALLEL_FLASH) ? 1 : 0;
-	flash->page_size = params->page_size;
+	flash->page_size = info->page_size;
 	/*
 	 * The Spansion S25FL032P and S25FL064P have 256b pages, yet use the
 	 * 0x4d00 Extended JEDEC code. The rest of the Spansion flashes with
 	 * the 0x4d00 Extended JEDEC code have 512b pages. All of the others
 	 * have 256b pages.
 	 */
-	if (JEDEC_EXT(params) == 0x4d00) {
-		if ((JEDEC_ID(params) != 0x0215) &&
-		    (JEDEC_ID(params) != 0x0216))
+	if (JEDEC_EXT(info) == 0x4d00) {
+		if ((JEDEC_ID(info) != 0x0215) &&
+		    (JEDEC_ID(info) != 0x0216))
 			flash->page_size = 512;
 	}
 	flash->page_size <<= flash->shift;
-	flash->sector_size = params->sector_size << flash->shift;
-	flash->size = flash->sector_size * params->nr_sectors << flash->shift;
+	flash->sector_size = info->sector_size << flash->shift;
+	flash->size = flash->sector_size * info->nr_sectors << flash->shift;
 #ifdef CONFIG_SF_DUAL_FLASH
 	if (flash->dual_flash & SF_DUAL_STACKED_FLASH)
 		flash->size <<= 1;
@@ -1152,7 +1152,7 @@ int spi_flash_scan(struct spi_flash *flash)
 
 #ifdef CONFIG_SPI_FLASH_USE_4K_SECTORS
 	/* Compute erase sector and command */
-	if (params->flags & SECT_4K) {
+	if (info->flags & SECT_4K) {
 		flash->erase_cmd = CMD_ERASE_4K;
 		flash->erase_size = 4096 << flash->shift;
 	} else
@@ -1169,13 +1169,13 @@ int spi_flash_scan(struct spi_flash *flash)
 	flash->read_cmd = CMD_READ_ARRAY_FAST;
 	if (spi->mode & SPI_RX_SLOW)
 		flash->read_cmd = CMD_READ_ARRAY_SLOW;
-	else if (spi->mode & SPI_RX_QUAD && params->flags & RD_QUAD)
+	else if (spi->mode & SPI_RX_QUAD && info->flags & RD_QUAD)
 		flash->read_cmd = CMD_READ_QUAD_OUTPUT_FAST;
-	else if (spi->mode & SPI_RX_DUAL && params->flags & RD_DUAL)
+	else if (spi->mode & SPI_RX_DUAL && info->flags & RD_DUAL)
 		flash->read_cmd = CMD_READ_DUAL_OUTPUT_FAST;
 
 	/* Look for write commands */
-	if (params->flags & WR_QPP && spi->mode & SPI_TX_QUAD)
+	if (info->flags & WR_QPP && spi->mode & SPI_TX_QUAD)
 		flash->write_cmd = CMD_QUAD_PAGE_PROGRAM;
 	else
 		/* Go for default supported write cmd */
@@ -1212,7 +1212,7 @@ int spi_flash_scan(struct spi_flash *flash)
 	}
 
 #ifdef CONFIG_SPI_FLASH_STMICRO
-	if (params->flags & E_FSR)
+	if (info->flags & E_FSR)
 		flash->flags |= SNOR_F_USE_FSR;
 #endif
 
-- 
2.7.4

  parent reply	other threads:[~2016-08-11  8:07 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-11  8:07 [U-Boot] [PATCH v3 01/27] sf: Simplify fastest read cmd code Jagan Teki
2016-08-11  8:07 ` [U-Boot] [PATCH v3 02/27] sf: Remove e_rd_cmd from param table Jagan Teki
2016-08-11  8:07 ` [U-Boot] [PATCH v3 03/27] spi: Use mode for rx mode flags Jagan Teki
2016-08-11  8:07 ` [U-Boot] [PATCH v3 04/27] spi: Remove SPI_RX_FAST Jagan Teki
2016-08-11  8:07 ` [U-Boot] [PATCH v3 05/27] sf: Remove SECT_32K Jagan Teki
2016-08-11  8:07 ` [U-Boot] [PATCH v3 06/27] sf: Add CONFIG_SPI_FLASH_USE_4K_SECTORS in spi_flash Jagan Teki
2016-08-11  8:07 ` [U-Boot] [PATCH v3 07/27] sf: Move flags macro's to spi_flash_params{} members Jagan Teki
2016-08-11  8:07 ` [U-Boot] [PATCH v3 08/27] sf: Adopt flash table INFO macro from Linux Jagan Teki
2016-08-11  8:07 ` [U-Boot] [PATCH v3 09/27] sf: Add JEDEC_ID and JEDEC_EXT macro Jagan Teki
2016-08-11  8:07 ` Jagan Teki [this message]
2016-08-11  8:07 ` [U-Boot] [PATCH v3 11/27] sf: Add JEDEC_MFR Jagan Teki
2016-08-11  8:07 ` [U-Boot] [PATCH v3 12/27] sf: Simplify lock ops detection code Jagan Teki
2016-08-11  8:07 ` [U-Boot] [PATCH v3 13/27] sf: sandbox: Fix ID exctract from spi_flash_info Jagan Teki
2016-08-11  8:07 ` [U-Boot] [PATCH v3 14/27] sf: Cleanup spi_flash_info{} Jagan Teki
2016-08-11  8:07 ` [U-Boot] [PATCH v3 15/27] sf: Cleanup sf_params Jagan Teki
2016-08-11  8:07 ` [U-Boot] [PATCH v3 16/27] sf: nr_sectors -> n_sectors Jagan Teki
2016-08-11  8:07 ` [U-Boot] [PATCH v3 17/27] sf: Add SPI_FLASH_MAX_ID_LEN Jagan Teki
2016-08-11  8:07 ` [U-Boot] [PATCH v3 18/27] sf: Increase max id length by 1 byte Jagan Teki
2016-08-11  8:07 ` [U-Boot] [PATCH v3 19/27] sf: Add INFO6 flash_info macro Jagan Teki
2016-08-11  8:07 ` [U-Boot] [PATCH v3 20/27] sf: params: Add S25FS256S_64K spi flash support Jagan Teki
2016-08-11  8:07 ` [U-Boot] [PATCH v3 21/27] sf: Remove legacy idcode detection code Jagan Teki
2016-08-11  8:07 ` [U-Boot] [PATCH v3 22/27] sf: Remove non-meaningful comments Jagan Teki
2016-08-11  8:07 ` [U-Boot] [PATCH v3 23/27] sf: Rename sf_params.c to spi_flash_ids Jagan Teki
2016-08-11  8:07 ` [U-Boot] [PATCH v3 24/27] sf: ids: Use small letter's with flash name Jagan Teki
2016-08-11  8:07 ` [U-Boot] [PATCH v3 25/27] sf: ids: Use small letter in ext_jedec Jagan Teki
2016-08-11  8:07 ` [U-Boot] [PATCH v3 26/27] sf: Rename few local functions Jagan Teki
2016-08-11  8:07 ` [U-Boot] [PATCH v3 27/27] spi: Remove dual flash code Jagan Teki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1470902869-22570-10-git-send-email-jteki@openedev.com \
    --to=jteki@openedev.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.