OLD | NEW |
1 /* | 1 /* |
2 * This file is part of the flashrom project. | 2 * This file is part of the flashrom project. |
3 * | 3 * |
4 * Copyright (C) 2008 Stefan Wildemann <stefan.wildemann@kontron.com> | 4 * Copyright (C) 2008 Stefan Wildemann <stefan.wildemann@kontron.com> |
5 * Copyright (C) 2008 Claus Gindhart <claus.gindhart@kontron.com> | 5 * Copyright (C) 2008 Claus Gindhart <claus.gindhart@kontron.com> |
6 * Copyright (C) 2008 Dominik Geyer <dominik.geyer@kontron.com> | 6 * Copyright (C) 2008 Dominik Geyer <dominik.geyer@kontron.com> |
7 * Copyright (C) 2008 coresystems GmbH <info@coresystems.de> | 7 * Copyright (C) 2008 coresystems GmbH <info@coresystems.de> |
8 * Copyright (C) 2009, 2010 Carl-Daniel Hailfinger | 8 * Copyright (C) 2009, 2010 Carl-Daniel Hailfinger |
9 * | 9 * |
10 * This program is free software; you can redistribute it and/or modify | 10 * This program is free software; you can redistribute it and/or modify |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 temp16 |= SPIC_ACS; | 563 temp16 |= SPIC_ACS; |
564 break; | 564 break; |
565 } | 565 } |
566 | 566 |
567 /* Start */ | 567 /* Start */ |
568 temp16 |= SPIC_SCGO; | 568 temp16 |= SPIC_SCGO; |
569 | 569 |
570 /* write it */ | 570 /* write it */ |
571 REGWRITE16(ICH7_REG_SPIC, temp16); | 571 REGWRITE16(ICH7_REG_SPIC, temp16); |
572 | 572 |
573 » /* wait for cycle complete */ | 573 » /* Original timeout is 60 minutes, which is too excessive. |
574 » timeout = 100 * 1000 * 60;» // 60s is a looong timeout. | 574 » * Reduce to 30 secs for chip full erase (around 10 secs). |
| 575 » * We also exit the loop if the error bit is set. |
| 576 » */ |
| 577 » timeout = 100 * 1000 * 30; |
575 while (((REGREAD16(ICH7_REG_SPIS) & SPIS_CDS) == 0) && --timeout) { | 578 while (((REGREAD16(ICH7_REG_SPIS) & SPIS_CDS) == 0) && --timeout) { |
576 programmer_delay(10); | 579 programmer_delay(10); |
| 580 if (REGREAD16(ICH7_REG_SPIS) & SPIS_FCERR) |
| 581 break; /* Transaction error */ |
577 } | 582 } |
578 if (!timeout) { | 583 if (!timeout) { |
579 » » msg_perr("timeout\n"); | 584 » » msg_perr("ICH7 CDS timeout\n"); |
580 } | 585 } |
581 | 586 |
582 /* FIXME: make sure we do not needlessly cause transaction errors. */ | 587 /* FIXME: make sure we do not needlessly cause transaction errors. */ |
583 if ((REGREAD16(ICH7_REG_SPIS) & SPIS_FCERR) != 0) { | 588 if ((REGREAD16(ICH7_REG_SPIS) & SPIS_FCERR) != 0) { |
584 msg_pdbg("Transaction error!\n"); | 589 msg_pdbg("Transaction error!\n"); |
585 return 1; | 590 return 1; |
586 } | 591 } |
587 | 592 |
588 if ((!write_cmd) && (datalength != 0)) { | 593 if ((!write_cmd) && (datalength != 0)) { |
589 for (a = 0; a < datalength; a++) { | 594 for (a = 0; a < datalength; a++) { |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 msg_pinfo("WARNING: SPI Configuration Lockdown activated.\n"); | 1173 msg_pinfo("WARNING: SPI Configuration Lockdown activated.\n"); |
1169 ichspi_lock = 1; | 1174 ichspi_lock = 1; |
1170 } | 1175 } |
1171 | 1176 |
1172 ich_init_opcodes(); | 1177 ich_init_opcodes(); |
1173 | 1178 |
1174 return 0; | 1179 return 0; |
1175 } | 1180 } |
1176 | 1181 |
1177 #endif | 1182 #endif |
OLD | NEW |