[U-Boot] [PATCH 07/12] cmd_sf: Add ASR(Array Slow Read) read instruction support

Jagannadha Sutradharudu Teki jagannadh.teki at gmail.com
Mon Dec 31 12:13:46 CET 2012


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

'asr' is similar to afr(Array Fast Read) except that it's
operated under slow speeds.

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

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

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

diff --git a/common/cmd_sf.c b/common/cmd_sf.c
index b1f19ef..3d9c93e 100644
--- a/common/cmd_sf.c
+++ b/common/cmd_sf.c
@@ -279,6 +279,8 @@ static int sf_parse_rd_inst_arg(char *arg, u8 *rd_inst)
 {
 	if (strcmp(arg, "afr") == 0)
 		*rd_inst = CMD_READ_ARRAY_FAST;
+	else if (strcmp(arg, "asr") == 0)
+		*rd_inst = CMD_READ_ARRAY_SLOW;
 	else
 		return 1;
 
@@ -628,8 +630,9 @@ 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 `rd_inst' read instruction\n"
+	"				  afr | asr `rd_inst' read instructions\n"
 	"				  afr (Array Fast Read, 0bh)\n"
+	"				  asr (Array Slow Read, 02b)\n"
 	"sf write wr_inst addr offset len\n"
 	"				- write `len' bytes from memory\n"
 	"				  at `addr' to flash at `offset' using\n"
@@ -644,7 +647,8 @@ U_BOOT_CMD(
 	"				  pp | qpp `wr_inst' write instructions and\n"
 	"				  pp (Page Program, 02h)\n"
 	"				  qpp (Quad Page Program, 32h)\n"
-	"				  afr `rd_inst' read instruction\n"
-	"				  afr (Array Fast Read, 0bh)"
+	"				  afr | asr `rd_inst' read instructions\n"
+	"				  afr (Array Fast Read, 0bh)\n"
+	"				  asr (Array Slow Read, 02b)"
 	SF_TEST_HELP
 );
diff --git a/include/spi_flash_inst.h b/include/spi_flash_inst.h
index a530842..85c8e70 100644
--- a/include/spi_flash_inst.h
+++ b/include/spi_flash_inst.h
@@ -30,5 +30,6 @@
 
 /* Read commands */
 #define CMD_READ_ARRAY_FAST		0x0b
+#define CMD_READ_ARRAY_SLOW		0x03
 
 #endif /* _SPI_FLASH_INST_H_ */
-- 
1.7.0.4



More information about the U-Boot mailing list