Patchwork [U-Boot,08/12] cmd_sf: Add DOFR(Dual Output Fast Read) read instruction support

login
register
mail settings
Submitter Jagannadha Sutradharudu Teki
Date Dec. 31, 2012, 11:13 a.m.
Message ID <1356952428-19824-9-git-send-email-jagannadh.teki@gmail.com>
Download mbox | patch
Permalink /patch/208838/
State Superseded
Delegated to: Jagannadha Sutradharudu Teki
Headers show

Comments

Jagannadha Sutradharudu Teki - Dec. 31, 2012, 11:13 a.m.
This patch provides a support to read a flash using 'dofr'
read instruction(rd_inst) for 'sf read' and 'sf update' commands.

'dofr' will effectively increases the data transfer rate
by up to two times, as compared to the afr(Array Fast Read).

Example:
read 0x2000 length bytes starting at offset 0x0 to memory at 0x10000
using dofr read instruction.
u-boot> sf read dofr 0x10000 0x0 0x2000

erase and write 0x2000 length bytes from memory at 0x10000 address to
flash offset at 0x0 using pp write instruction and dofr read instruction.
u-boot> sf update pp dofr 0x10000 0x0 0x2000

Signed-off-by: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
---
 common/cmd_sf.c          |   10 +++++++---
 include/spi_flash_inst.h |    1 +
 2 files changed, 8 insertions(+), 3 deletions(-)

Patch

diff --git a/common/cmd_sf.c b/common/cmd_sf.c
index 3d9c93e..b971d2a 100644
--- a/common/cmd_sf.c
+++ b/common/cmd_sf.c
@@ -281,6 +281,8 @@  static int sf_parse_rd_inst_arg(char *arg, u8 *rd_inst)
 		*rd_inst = CMD_READ_ARRAY_FAST;
 	else if (strcmp(arg, "asr") == 0)
 		*rd_inst = CMD_READ_ARRAY_SLOW;
+	else if (strcmp(arg, "dofr") == 0)
+		*rd_inst = CMD_READ_DUAL_OUTPUT_FAST;
 	else
 		return 1;
 
@@ -630,9 +632,10 @@  U_BOOT_CMD(
 	"sf read rd_inst addr offset len\n"
 	"				- read `len' bytes starting at\n"
 	"				  `offset' to memory at `addr' using\n"
-	"				  afr | asr `rd_inst' read instructions\n"
+	"				  afr | asr | dofr `rd_inst' read instructions\n"
 	"				  afr (Array Fast Read, 0bh)\n"
 	"				  asr (Array Slow Read, 02b)\n"
+	"				  dofr (Dual Output Fast Read, 3bh)\n"
 	"sf write wr_inst addr offset len\n"
 	"				- write `len' bytes from memory\n"
 	"				  at `addr' to flash at `offset' using\n"
@@ -647,8 +650,9 @@  U_BOOT_CMD(
 	"				  pp | qpp `wr_inst' write instructions and\n"
 	"				  pp (Page Program, 02h)\n"
 	"				  qpp (Quad Page Program, 32h)\n"
-	"				  afr | asr `rd_inst' read instructions\n"
+	"				  afr | asr | dofr `rd_inst' read instructions\n"
 	"				  afr (Array Fast Read, 0bh)\n"
-	"				  asr (Array Slow Read, 02b)"
+	"				  asr (Array Slow Read, 02b)\n"
+	"				  dofr (Dual Output Fast Read, 3bh)"
 	SF_TEST_HELP
 );
diff --git a/include/spi_flash_inst.h b/include/spi_flash_inst.h
index 85c8e70..f8fcf5e 100644
--- a/include/spi_flash_inst.h
+++ b/include/spi_flash_inst.h
@@ -31,5 +31,6 @@ 
 /* Read commands */
 #define CMD_READ_ARRAY_FAST		0x0b
 #define CMD_READ_ARRAY_SLOW		0x03
+#define CMD_READ_DUAL_OUTPUT_FAST	0x3b
 
 #endif /* _SPI_FLASH_INST_H_ */