summaryrefslogtreecommitdiff
path: root/drivers/mtd/spi
diff options
context:
space:
mode:
authorJagan Teki <jteki@openedev.com>2015-12-13 21:50:26 +0530
committerJagan Teki <jteki@openedev.com>2016-01-13 18:47:25 +0530
commitd25dd942985700bd5ff2e619aa7cefcd919d1508 (patch)
tree9192cea843f6938041e860eb60c6d67cc8ceceba /drivers/mtd/spi
parentcdf3393814d4d811772b4414def79a05ed75b749 (diff)
downloadu-boot-imx-d25dd942985700bd5ff2e619aa7cefcd919d1508.zip
u-boot-imx-d25dd942985700bd5ff2e619aa7cefcd919d1508.tar.gz
u-boot-imx-d25dd942985700bd5ff2e619aa7cefcd919d1508.tar.bz2
sf: Move spi_read_cmds_array locally
Since spi_read_cmds_array is used locally in spi_flash_scan, so move array to locally used function instead of defining global array. Tested-by: Jagan Teki <jteki@openedev.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Signed-off-by: Jagan Teki <jteki@openedev.com>
Diffstat (limited to 'drivers/mtd/spi')
-rw-r--r--drivers/mtd/spi/spi_flash.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 50011d9..f8180d9 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -29,16 +29,6 @@ static void spi_flash_addr(u32 addr, u8 *cmd)
cmd[3] = addr >> 0;
}
-/* Read commands array */
-static u8 spi_read_cmds_array[] = {
- CMD_READ_ARRAY_SLOW,
- CMD_READ_ARRAY_FAST,
- CMD_READ_DUAL_OUTPUT_FAST,
- CMD_READ_DUAL_IO_FAST,
- CMD_READ_QUAD_OUTPUT_FAST,
- CMD_READ_QUAD_IO_FAST,
-};
-
static int read_sr(struct spi_flash *flash, u8 *rs)
{
int ret;
@@ -909,9 +899,15 @@ int spi_flash_scan(struct spi_flash *flash)
struct spi_slave *spi = flash->spi;
const struct spi_flash_params *params;
u16 jedec, ext_jedec;
- u8 idcode[5];
- u8 cmd;
+ u8 cmd, idcode[5];
int ret;
+ static u8 spi_read_cmds_array[] = {
+ CMD_READ_ARRAY_SLOW,
+ CMD_READ_ARRAY_FAST,
+ CMD_READ_DUAL_OUTPUT_FAST,
+ CMD_READ_DUAL_IO_FAST,
+ CMD_READ_QUAD_OUTPUT_FAST,
+ CMD_READ_QUAD_IO_FAST };
/* Read the ID codes */
ret = spi_flash_cmd(spi, CMD_READ_ID, idcode, sizeof(idcode));