From 4e09cc1e2c5d22735d0fa3d2d1eaecd27e19948e Mon Sep 17 00:00:00 2001 From: Jagannadha Sutradharudu Teki Date: Sat, 11 Jan 2014 15:10:28 +0530 Subject: sf: Add extended read commands support Current sf uses FAST_READ command, this patch adds support to use the different/extended read command. This implementation will determine the fastest command by taking the supported commands from the flash and the controller, controller is always been a priority. Signed-off-by: Jagannadha Sutradharudu Teki --- include/spi_flash.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include/spi_flash.h') diff --git a/include/spi_flash.h b/include/spi_flash.h index afc3a58..692e143 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -19,6 +19,14 @@ #include #include +/* Enum list - Extended read commands */ +enum spi_read_cmds { + ARRAY_SLOW = 1 << 0, + DUAL_OUTPUT_FAST = 1 << 1, + DUAL_IO_FAST = 1 << 2, +}; +#define RD_EXTN ARRAY_SLOW | DUAL_OUTPUT_FAST | DUAL_IO_FAST + /** * struct spi_flash - SPI flash structure * @@ -33,6 +41,7 @@ * @bank_curr: Current flash bank * @poll_cmd: Poll cmd - for flash erase/program * @erase_cmd: Erase cmd 4K, 32K, 64K + * @read_cmd: Read cmd - Array Fast and Extn read * @memory_map: Address of read-only SPI flash access * @read: Flash read ops: Read len bytes at offset into buf * Supported cmds: Fast Array Read @@ -57,6 +66,7 @@ struct spi_flash { #endif u8 poll_cmd; u8 erase_cmd; + u8 read_cmd; void *memory_map; int (*read)(struct spi_flash *flash, u32 offset, size_t len, void *buf); -- cgit v1.1 From 3163aaa63fced54bbd6fd190ece0f89b473076ab Mon Sep 17 00:00:00 2001 From: Jagannadha Sutradharudu Teki Date: Sat, 11 Jan 2014 15:13:11 +0530 Subject: sf: Add quad read/write commands support This patch add quad commands support like - QUAD_PAGE_PROGRAM => for write program - QUAD_OUTPUT_FAST ->> for read program Signed-off-by: Jagannadha Sutradharudu Teki --- include/spi_flash.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'include/spi_flash.h') diff --git a/include/spi_flash.h b/include/spi_flash.h index 692e143..9fd9d3b 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -19,13 +19,18 @@ #include #include -/* Enum list - Extended read commands */ +/* No enum list for write commands only QPP */ +#define WR_QPP 1 << 4 + +/* Enum list - Full read commands */ enum spi_read_cmds { ARRAY_SLOW = 1 << 0, DUAL_OUTPUT_FAST = 1 << 1, DUAL_IO_FAST = 1 << 2, + QUAD_OUTPUT_FAST = 1 << 3, }; #define RD_EXTN ARRAY_SLOW | DUAL_OUTPUT_FAST | DUAL_IO_FAST +#define RD_FULL RD_EXTN | QUAD_OUTPUT_FAST /** * struct spi_flash - SPI flash structure @@ -41,7 +46,8 @@ enum spi_read_cmds { * @bank_curr: Current flash bank * @poll_cmd: Poll cmd - for flash erase/program * @erase_cmd: Erase cmd 4K, 32K, 64K - * @read_cmd: Read cmd - Array Fast and Extn read + * @read_cmd: Read cmd - Array Fast, Extn read and quad read. + * @write_cmd: Write cmd - page and quad program. * @memory_map: Address of read-only SPI flash access * @read: Flash read ops: Read len bytes at offset into buf * Supported cmds: Fast Array Read @@ -67,6 +73,7 @@ struct spi_flash { u8 poll_cmd; u8 erase_cmd; u8 read_cmd; + u8 write_cmd; void *memory_map; int (*read)(struct spi_flash *flash, u32 offset, size_t len, void *buf); -- cgit v1.1 From 33adfb5f9b06ac1a386dddc222cc50e24a9909e2 Mon Sep 17 00:00:00 2001 From: Jagannadha Sutradharudu Teki Date: Mon, 23 Dec 2013 23:34:42 +0530 Subject: sf: Separate the flash params table Moved the flash params table from sf_probe.c and placed on to sf_params.c, hence flash params file will alter based on new addons. Signed-off-by: Jagannadha Sutradharudu Teki --- include/spi_flash.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'include/spi_flash.h') diff --git a/include/spi_flash.h b/include/spi_flash.h index 9fd9d3b..8e0bb46 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -33,6 +33,29 @@ enum spi_read_cmds { #define RD_FULL RD_EXTN | QUAD_OUTPUT_FAST /** + * struct spi_flash_params - SPI/QSPI flash device params structure + * + * @name: Device name ([MANUFLETTER][DEVTYPE][DENSITY][EXTRAINFO]) + * @jedec: Device jedec ID (0x[1byte_manuf_id][2byte_dev_id]) + * @ext_jedec: Device ext_jedec ID + * @sector_size: Sector size of this device + * @nr_sectors: No.of sectors on this device + * @e_rd_cmd: Enum list for read commands + * @flags: Importent param, for flash specific behaviour + */ +struct spi_flash_params { + const char *name; + u32 jedec; + u16 ext_jedec; + u32 sector_size; + u32 nr_sectors; + u8 e_rd_cmd; + u16 flags; +}; + +extern const struct spi_flash_params spi_flash_params_table[]; + +/** * struct spi_flash - SPI flash structure * * @spi: SPI slave -- cgit v1.1 From c4ba0d82d329791c3f0456d88e93032b11e48535 Mon Sep 17 00:00:00 2001 From: Jagannadha Sutradharudu Teki Date: Tue, 24 Dec 2013 15:24:31 +0530 Subject: sf: Add QUAD_IO_FAST read support This patch adds support QUAD_IO_FAST read command. Signed-off-by: Jagannadha Sutradharudu Teki --- include/spi_flash.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/spi_flash.h') diff --git a/include/spi_flash.h b/include/spi_flash.h index 8e0bb46..99724a0 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -28,9 +28,10 @@ enum spi_read_cmds { DUAL_OUTPUT_FAST = 1 << 1, DUAL_IO_FAST = 1 << 2, QUAD_OUTPUT_FAST = 1 << 3, + QUAD_IO_FAST = 1 << 4, }; #define RD_EXTN ARRAY_SLOW | DUAL_OUTPUT_FAST | DUAL_IO_FAST -#define RD_FULL RD_EXTN | QUAD_OUTPUT_FAST +#define RD_FULL RD_EXTN | QUAD_OUTPUT_FAST | QUAD_IO_FAST /** * struct spi_flash_params - SPI/QSPI flash device params structure -- cgit v1.1 From ff063ed4808e4ead3021eaf53ee4fdb80c9e91f8 Mon Sep 17 00:00:00 2001 From: Jagannadha Sutradharudu Teki Date: Sat, 11 Jan 2014 16:50:45 +0530 Subject: sf: Discover read dummy_byte Discovered the read dummy_byte based on the configured read command. Signed-off-by: Jagannadha Sutradharudu Teki --- include/spi_flash.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/spi_flash.h') diff --git a/include/spi_flash.h b/include/spi_flash.h index 99724a0..437937c 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -72,6 +72,7 @@ extern const struct spi_flash_params spi_flash_params_table[]; * @erase_cmd: Erase cmd 4K, 32K, 64K * @read_cmd: Read cmd - Array Fast, Extn read and quad read. * @write_cmd: Write cmd - page and quad program. + * @dummy_byte: Dummy cycles for read operation. * @memory_map: Address of read-only SPI flash access * @read: Flash read ops: Read len bytes at offset into buf * Supported cmds: Fast Array Read @@ -98,6 +99,7 @@ struct spi_flash { u8 erase_cmd; u8 read_cmd; u8 write_cmd; + u8 dummy_byte; void *memory_map; int (*read)(struct spi_flash *flash, u32 offset, size_t len, void *buf); -- cgit v1.1 From 2ba863fae628bb5fe2ec4b803f639c1edb55ea33 Mon Sep 17 00:00:00 2001 From: Jagannadha Sutradharudu Teki Date: Sun, 12 Jan 2014 21:38:21 +0530 Subject: sf: Code cleanups - comment typo's - func args have a proper names Signed-off-by: Jagannadha Sutradharudu Teki --- include/spi_flash.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include/spi_flash.h') diff --git a/include/spi_flash.h b/include/spi_flash.h index 437937c..213d659 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -19,7 +19,10 @@ #include #include -/* No enum list for write commands only QPP */ +/* sf param flags */ +#define SECT_4K 1 << 1 +#define SECT_32K 1 << 2 +#define E_FSR 1 << 3 #define WR_QPP 1 << 4 /* Enum list - Full read commands */ -- cgit v1.1 From f77f469117ab3184ac45683a50dc446265be28cc Mon Sep 17 00:00:00 2001 From: Jagannadha Sutradharudu Teki Date: Sun, 12 Jan 2014 21:40:11 +0530 Subject: sf: Add dual memories support - DUAL_STACKED This patch added support for accessing dual memories in stacked connection with single chipselect line from controller. For more info - see doc/SPI/README.dual-flash Signed-off-by: Jagannadha Sutradharudu Teki --- include/spi_flash.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include/spi_flash.h') diff --git a/include/spi_flash.h b/include/spi_flash.h index 213d659..36f1f03 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -36,6 +36,12 @@ enum spi_read_cmds { #define RD_EXTN ARRAY_SLOW | DUAL_OUTPUT_FAST | DUAL_IO_FAST #define RD_FULL RD_EXTN | QUAD_OUTPUT_FAST | QUAD_IO_FAST +/* Dual SPI flash memories */ +enum spi_dual_flash { + SF_SINGLE_FLASH = 0, + SF_DUAL_STACKED_FLASH = 1 << 0, +}; + /** * struct spi_flash_params - SPI/QSPI flash device params structure * @@ -64,6 +70,7 @@ extern const struct spi_flash_params spi_flash_params_table[]; * * @spi: SPI slave * @name: Name of SPI flash + * @dual_flash: Indicates dual flash memories - dual stacked * @size: Total flash size * @page_size: Write (page) size * @sector_size: Sector size @@ -88,6 +95,7 @@ extern const struct spi_flash_params spi_flash_params_table[]; struct spi_flash { struct spi_slave *spi; const char *name; + u8 dual_flash; u32 size; u32 page_size; -- cgit v1.1 From 056fbc73d54df64adcb93c513cba708acb2683bd Mon Sep 17 00:00:00 2001 From: Jagannadha Sutradharudu Teki Date: Tue, 7 Jan 2014 00:11:35 +0530 Subject: sf: Add dual memories support - DUAL_PARALLEL This patch added support for accessing dual memories in parallel connection with single chipselect line from controller. For more info - see doc/SPI/README.dual-flash Signed-off-by: Jagannadha Sutradharudu Teki --- include/spi_flash.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include/spi_flash.h') diff --git a/include/spi_flash.h b/include/spi_flash.h index 36f1f03..f79f0ea 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -40,6 +40,7 @@ enum spi_read_cmds { enum spi_dual_flash { SF_SINGLE_FLASH = 0, SF_DUAL_STACKED_FLASH = 1 << 0, + SF_DUAL_PARALLEL_FLASH = 1 << 1, }; /** @@ -70,7 +71,8 @@ extern const struct spi_flash_params spi_flash_params_table[]; * * @spi: SPI slave * @name: Name of SPI flash - * @dual_flash: Indicates dual flash memories - dual stacked + * @dual_flash: Indicates dual flash memories - dual stacked, parallel + * @shift: Flash shift useful in dual parallel * @size: Total flash size * @page_size: Write (page) size * @sector_size: Sector size @@ -96,6 +98,7 @@ struct spi_flash { struct spi_slave *spi; const char *name; u8 dual_flash; + u8 shift; u32 size; u32 page_size; -- cgit v1.1