Skip to contentSkip to conversation

cmd_sf: Add DIOFR(Dual IO Fast Read) read instruction support

PATCH New Jagannadha Sutradharudu Teki 1 participant 2 messages Dec 31, 2012

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 cmd_sf: Add DIOFR(Dual IO Fast Read) read instruction support

This patch provides a support to read a flash using 'diofr' read instruction(rd_inst) for 'sf read' and 'sf update' commands.

'diofr' is similar to the dofr(Dual Output Fast Read) except that it improves performance throughput by allowing input of the address bits using two bits per SCK via two input pins.

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

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

---
Changes in v2: Added command help on U_BOOT_CMD

 common/cmd_sf.c          |   12 ++++++++----
 include/spi_flash_inst.h |    1 +
 2 files changed, 9 insertions(+), 4 deletions(-)
common/cmd_sf.c +8 -4
index a07effd..20879e7 100644
@@ -293,7 +293,9 @@ static int sf_parse_rd_inst_arg(char *arg, u8 *rd_inst, u8 *rd_qeb_req)
 	else if (strcmp(arg, "qofr") == 0) {
 		*rd_inst = CMD_READ_QUAD_OUTPUT_FAST;
 		*rd_qeb_req = 1;
-	} else
+	} else if (strcmp(arg, "diofr") == 0)
+		*rd_inst = CMD_READ_DUAL_IO_FAST;
+	else
 		return 1;
 
 	return 0;
@@ -643,11 +645,12 @@ 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 | dofr | qofr `rd_inst' read instructions\n"
+	"				  afr | asr | dofr | qofr | diofr `rd_inst' read instructions\n"
 	"				  afr (Array Fast Read, 0bh)\n"
 	"				  asr (Array Slow Read, 02b)\n"
 	"				  dofr (Dual Output Fast Read, 3bh)\n"
 	"				  qofr (Quad Output Fast Read, 6bh)\n"
+	"				  diofr (Dual Input/Output Fast Read, bbh)\n"
 	"sf write wr_inst addr offset len\n"
 	"				- write `len' bytes from memory\n"
 	"				  at `addr' to flash at `offset' using\n"
@@ -662,10 +665,11 @@ U_BOOT_CMD(
 	"				  pp | qpp `wr_inst' write instructions and\n"
 	"				  pp (Page Program, 02h)\n"
 	"				  qpp (Quad Page Program, 32h)\n"
-	"				  afr | asr | dofr | qofr `rd_inst' read instructions\n"
+	"				  afr | asr | dofr | qofr | diofr `rd_inst' read instructions\n"
 	"				  afr (Array Fast Read, 0bh)\n"
 	"				  asr (Array Slow Read, 02b)\n"
 	"				  dofr (Dual Output Fast Read, 3bh)\n"
-	"				  qofr (Quad Output Fast Read, 6bh)"
+	"				  qofr (Quad Output Fast Read, 6bh)\n"
+	"				  diofr (Dual Input/Output Fast Read, bbh)"
 	SF_TEST_HELP
 );
include/spi_flash_inst.h +1 -0
index 67b22c8..e718e8e 100644
@@ -33,5 +33,6 @@
 #define CMD_READ_ARRAY_SLOW		0x03
 #define CMD_READ_DUAL_OUTPUT_FAST	0x3b
 #define CMD_READ_QUAD_OUTPUT_FAST	0x6b
+#define CMD_READ_DUAL_IO_FAST		0xbb
 
 #endif /* _SPI_FLASH_INST_H_ */
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH v2 2/2 cmd_sf: Add QIOFR(Quad IO Fast Read) read instruction support

This patch provides a support to read a flash using 'qiofr' read instruction(rd_inst) for 'sf read' and 'sf update' commands.

'qiofr' is similar to the qofr(Quad Output Fast Read) except that it improves performance throughput by allowing input of the address bits using four bits per SCK via four input pins.

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

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

---
Changes in v2: Added command help on U_BOOT_CMD

 common/cmd_sf.c          |   13 +++++++++----
 include/spi_flash_inst.h |    1 +
 2 files changed, 10 insertions(+), 4 deletions(-)
common/cmd_sf.c +9 -4
index 20879e7..67368c2 100644
@@ -295,7 +295,10 @@ static int sf_parse_rd_inst_arg(char *arg, u8 *rd_inst, u8 *rd_qeb_req)
 		*rd_qeb_req = 1;
 	} else if (strcmp(arg, "diofr") == 0)
 		*rd_inst = CMD_READ_DUAL_IO_FAST;
-	else
+	else if (strcmp(arg, "qiofr") == 0) {
+		*rd_inst = CMD_READ_QUAD_IO_FAST;
+		*rd_qeb_req = 1;
+	} else
 		return 1;
 
 	return 0;
@@ -645,12 +648,13 @@ 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 | dofr | qofr | diofr `rd_inst' read instructions\n"
+	"				  afr | asr | dofr | qofr | diofr | qiofr `rd_inst' read instructions\n"
 	"				  afr (Array Fast Read, 0bh)\n"
 	"				  asr (Array Slow Read, 02b)\n"
 	"				  dofr (Dual Output Fast Read, 3bh)\n"
 	"				  qofr (Quad Output Fast Read, 6bh)\n"
 	"				  diofr (Dual Input/Output Fast Read, bbh)\n"
+	"				  qiofr (Quad Input/Output Fast Read, ebh)\n"
 	"sf write wr_inst addr offset len\n"
 	"				- write `len' bytes from memory\n"
 	"				  at `addr' to flash at `offset' using\n"
@@ -665,11 +669,12 @@ U_BOOT_CMD(
 	"				  pp | qpp `wr_inst' write instructions and\n"
 	"				  pp (Page Program, 02h)\n"
 	"				  qpp (Quad Page Program, 32h)\n"
-	"				  afr | asr | dofr | qofr | diofr `rd_inst' read instructions\n"
+	"				  afr | asr | dofr | qofr | diofr | qiofr `rd_inst' read instructions\n"
 	"				  afr (Array Fast Read, 0bh)\n"
 	"				  asr (Array Slow Read, 02b)\n"
 	"				  dofr (Dual Output Fast Read, 3bh)\n"
 	"				  qofr (Quad Output Fast Read, 6bh)\n"
-	"				  diofr (Dual Input/Output Fast Read, bbh)"
+	"				  diofr (Dual Input/Output Fast Read, bbh)\n"
+	"				  qiofr (Quad Input/Output Fast Read, ebh)"
 	SF_TEST_HELP
 );
include/spi_flash_inst.h +1 -0
index e718e8e..556e179 100644
@@ -34,5 +34,6 @@
 #define CMD_READ_DUAL_OUTPUT_FAST	0x3b
 #define CMD_READ_QUAD_OUTPUT_FAST	0x6b
 #define CMD_READ_DUAL_IO_FAST		0xbb
+#define CMD_READ_QUAD_IO_FAST		0xeb
 
 #endif /* _SPI_FLASH_INST_H_ */
Signature · 1 line
1.7.0.4