summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2011-06-07 06:56:27 (GMT)
committerH. Peter Anvin <hpa@zytor.com>2011-06-07 06:56:27 (GMT)
commitff466df3d3e6af333132e71409fa662e278e0ab5 (patch)
tree124b601df4fb0028095671616c16d3d038301bfa
parente9c700c69e5d8e53c386a051a96ac5935b6efeaa (diff)
downloadde1flash-cfi.zip
de1flash-cfi.tar.gz
de1flash-cfi.tar.bz2
de1flash-cfi.tar.xz
de1flash.tcl: Add code to query the CFI informationcfi
Add code to query the CFI information; unfortunately it seems the address that needs to be sent is dependent on the manufactured width of the device (not even the connected width) which makes things a bit complex...
-rw-r--r--de1flash.tcl21
1 files changed, 21 insertions, 0 deletions
diff --git a/de1flash.tcl b/de1flash.tcl
index 45c5d11..15b5178 100644
--- a/de1flash.tcl
+++ b/de1flash.tcl
@@ -135,6 +135,26 @@ proc fl_reset {} {
puts "done."
}
+# Query CFI information
+proc fl_cfi_query {} {
+
+ # Select CFI query (send commands for both x8 and x16 devices...)
+ fl_send 81AAAAAAAA00000098
+ # fl_send 815555555500000098
+
+ # Read enough data that we are guaranteed to get all erase block
+ # information even on a x32 device
+ fl_send D00000000000001100
+ set cfi_data [fl_recv_bulk 0x1100]
+
+ set f [open "cfi.bin" {WRONLY CREAT TRUNC BINARY}]
+ puts -nonewline $f $cfi_data
+ close $f
+
+ # Return the array to normal operation
+ fl_send 81F0F0F0F0000000F0
+}
+
# Sector erase
proc fl_erase addr {
set secsize [fl_sector_size $addr]
@@ -354,6 +374,7 @@ open_device -hardware_name $usbblaster_name -device_name $test_device
device_lock -timeout 120000
fl_reset
+fl_cfi_query
switch $fl_cmd {
write