Changeset 1201 for trunk/spi25.c
- Timestamp:
- Oct 8, 2010 2:37:55 AM (3 years ago)
- File:
-
- 1 edited
-
trunk/spi25.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/spi25.c
r1194 r1201 857 857 { 858 858 int result; 859 int i = 0; 859 860 struct spi_command cmds[] = { 860 861 { … … 880 881 msg_cerr("%s failed during command execution\n", 881 882 __func__); 882 } 883 /* WRSR performs a self-timed erase before the changes take effect. */ 883 /* No point in waiting for the command to complete if execution 884 * failed. 885 */ 886 return result; 887 } 888 /* WRSR performs a self-timed erase before the changes take effect. 889 * This may take 50-85 ms in most cases, and some chips apparently 890 * allow running RDSR only once. Therefore pick an initial delay of 891 * 100 ms, then wait in 10 ms steps until a total of 5 s have elapsed. 892 */ 884 893 programmer_delay(100 * 1000); 885 return result; 894 while (spi_read_status_register() & JEDEC_RDSR_BIT_WIP) { 895 if (++i > 490) { 896 msg_cerr("Error: WIP bit after WRSR never cleared\n"); 897 return TIMEOUT_ERROR; 898 } 899 programmer_delay(10 * 1000); 900 } 901 return 0; 886 902 } 887 903 … … 889 905 { 890 906 int result; 907 int i = 0; 891 908 struct spi_command cmds[] = { 892 909 { … … 912 929 msg_cerr("%s failed during command execution\n", 913 930 __func__); 914 } 915 /* WRSR performs a self-timed erase before the changes take effect. */ 931 /* No point in waiting for the command to complete if execution 932 * failed. 933 */ 934 return result; 935 } 936 /* WRSR performs a self-timed erase before the changes take effect. 937 * This may take 50-85 ms in most cases, and some chips apparently 938 * allow running RDSR only once. Therefore pick an initial delay of 939 * 100 ms, then wait in 10 ms steps until a total of 5 s have elapsed. 940 */ 916 941 programmer_delay(100 * 1000); 917 return result; 942 while (spi_read_status_register() & JEDEC_RDSR_BIT_WIP) { 943 if (++i > 490) { 944 msg_cerr("Error: WIP bit after WRSR never cleared\n"); 945 return TIMEOUT_ERROR; 946 } 947 programmer_delay(10 * 1000); 948 } 949 return 0; 918 950 } 919 951
Note: See TracChangeset
for help on using the changeset viewer.
