 Chromium Code Reviews
 Chromium Code Reviews Issue 6698020:
  ichspi.c: lower down the ICH7 chipset CDS timeout from 60s to 1ms.  (Closed) 
  Base URL: ssh://git@gitrw.chromium.org:9222/flashrom.git@master
    
  
    Issue 6698020:
  ichspi.c: lower down the ICH7 chipset CDS timeout from 60s to 1ms.  (Closed) 
  Base URL: ssh://git@gitrw.chromium.org:9222/flashrom.git@master| 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 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 /* wait for cycle complete */ | 
| 574 » timeout = 100 * 1000 * 60;» // 60s is a looong timeout. | 574 » /* reduce timeout from 60 secs to 1 msec. | 
| 575 » * Formula: for the largest possible data length on SPI bus: | |
| 576 » * page read/write: Instruction (1B) + Address (3B) + data (256B) | |
| 577 » * bit count = (1+3+256) * 8 = 2080 | |
| 
dhendrix
2011/03/15 19:30:38
The longest instruction, JEDEC_AAI_WORD_PROGRAM, i
 | |
| 578 » * clock freq = 33MHz | |
| 
dhendrix
2011/03/15 19:30:38
SPI_CLK on the ICH7/NM10 is 17.86MHz according to
 | |
| 579 » * time needed: 2080 / 33Mhz = 63us | |
| 580 » */ | |
| 581 » timeout = 100; | |
| 575 while (((REGREAD16(ICH7_REG_SPIS) & SPIS_CDS) == 0) && --timeout) { | 582 while (((REGREAD16(ICH7_REG_SPIS) & SPIS_CDS) == 0) && --timeout) { | 
| 576 programmer_delay(10); | 583 programmer_delay(10); | 
| 577 } | 584 } | 
| 578 if (!timeout) { | 585 if (!timeout) { | 
| 579 » » msg_perr("timeout\n"); | 586 » » msg_perr("ICH7 CDS timeout\n"); | 
| 580 } | 587 } | 
| 581 | 588 | 
| 582 /* FIXME: make sure we do not needlessly cause transaction errors. */ | 589 /* FIXME: make sure we do not needlessly cause transaction errors. */ | 
| 583 if ((REGREAD16(ICH7_REG_SPIS) & SPIS_FCERR) != 0) { | 590 if ((REGREAD16(ICH7_REG_SPIS) & SPIS_FCERR) != 0) { | 
| 584 msg_pdbg("Transaction error!\n"); | 591 msg_pdbg("Transaction error!\n"); | 
| 585 return 1; | 592 return 1; | 
| 586 } | 593 } | 
| 587 | 594 | 
| 588 if ((!write_cmd) && (datalength != 0)) { | 595 if ((!write_cmd) && (datalength != 0)) { | 
| 589 for (a = 0; a < datalength; a++) { | 596 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"); | 1175 msg_pinfo("WARNING: SPI Configuration Lockdown activated.\n"); | 
| 1169 ichspi_lock = 1; | 1176 ichspi_lock = 1; | 
| 1170 } | 1177 } | 
| 1171 | 1178 | 
| 1172 ich_init_opcodes(); | 1179 ich_init_opcodes(); | 
| 1173 | 1180 | 
| 1174 return 0; | 1181 return 0; | 
| 1175 } | 1182 } | 
| 1176 | 1183 | 
| 1177 #endif | 1184 #endif | 
| OLD | NEW |