Changeset 3401 for trunk/util/flashrom/spi.c
- Timestamp:
- 07/01/08 01:45:22 (5 months ago)
- Files:
-
- 1 modified
-
trunk/util/flashrom/spi.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/util/flashrom/spi.c
r3399 r3401 35 35 int spi_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr) 36 36 { 37 if (it8716f_flashport) 37 switch (flashbus) { 38 case BUS_TYPE_IT87XX_SPI: 38 39 return it8716f_spi_command(writecnt, readcnt, writearr, readarr); 39 else if ((ich7_detected) || (viaspi_detected)) 40 return ich_spi_command(writecnt, readcnt, writearr, readarr); 41 else if (ich9_detected) 42 return ich_spi_command(writecnt, readcnt, writearr, readarr); 43 printf_debug("%s called, but no SPI chipset detected\n", __FUNCTION__); 40 case BUS_TYPE_ICH7_SPI: 41 case BUS_TYPE_ICH9_SPI: 42 case BUS_TYPE_VIA_SPI: 43 return ich_spi_command(writecnt, readcnt, writearr, readarr); 44 default: 45 printf_debug("%s called, but no SPI chipset/strapping detected\n", __FUNCTION__); 46 } 44 47 return 1; 45 48 } … … 136 139 137 140 /* only some SPI chipsets support 4 bytes commands */ 138 if (!((ich7_detected) || (ich9_detected) || (viaspi_detected))) 139 return 0; 140 return probe_spi_rdid_generic(flash, 4); 141 switch (flashbus) { 142 case BUS_TYPE_ICH7_SPI: 143 case BUS_TYPE_ICH9_SPI: 144 case BUS_TYPE_VIA_SPI: 145 return probe_spi_rdid_generic(flash, 4); 146 default: 147 printf_debug("4b ID not supported on this SPI controller\n"); 148 } 149 150 return 0; 141 151 } 142 152 … … 317 327 void spi_page_program(int block, uint8_t *buf, uint8_t *bios) 318 328 { 319 if (it8716f_flashport) { 329 switch (flashbus) { 330 case BUS_TYPE_IT87XX_SPI: 320 331 it8716f_spi_page_program(block, buf, bios); 321 return; 322 } 323 printf_debug("%s called, but no SPI chipset detected\n", __FUNCTION__); 332 break; 333 case BUS_TYPE_ICH7_SPI: 334 case BUS_TYPE_ICH9_SPI: 335 printf_debug("%s called, but not implemented for ICH\n", __FUNCTION__); 336 break; 337 default: 338 printf_debug("%s called, but no SPI chipset/strapping detected\n", __FUNCTION__); 339 } 324 340 } 325 341 … … 376 392 int spi_chip_read(struct flashchip *flash, uint8_t *buf) 377 393 { 378 if (it8716f_flashport) 394 395 switch (flashbus) { 396 case BUS_TYPE_IT87XX_SPI: 379 397 return it8716f_spi_chip_read(flash, buf); 380 else if ((ich7_detected) || (viaspi_detected)) 398 case BUS_TYPE_ICH7_SPI: 399 case BUS_TYPE_ICH9_SPI: 400 case BUS_TYPE_VIA_SPI: 381 401 return ich_spi_read(flash, buf); 382 else if (ich9_detected) 383 return ich_spi_read(flash, buf); 384 printf_debug("%s called, but no SPI chipset detected\n", __FUNCTION__); 402 default: 403 printf_debug("%s called, but no SPI chipset/strapping detected\n", __FUNCTION__); 404 } 405 385 406 return 1; 386 407 } … … 388 409 int spi_chip_write(struct flashchip *flash, uint8_t *buf) 389 410 { 390 if (it8716f_flashport) 411 switch (flashbus) { 412 case BUS_TYPE_IT87XX_SPI: 391 413 return it8716f_spi_chip_write(flash, buf); 392 else if ((ich7_detected) || (viaspi_detected)) 414 case BUS_TYPE_ICH7_SPI: 415 case BUS_TYPE_ICH9_SPI: 416 case BUS_TYPE_VIA_SPI: 393 417 return ich_spi_write(flash, buf); 394 else if (ich9_detected) 395 return ich_spi_write(flash, buf); 396 printf_debug("%s called, but no SPI chipset detected\n", __FUNCTION__); 418 default: 419 printf_debug("%s called, but no SPI chipset/strapping detected\n", __FUNCTION__); 420 } 421 397 422 return 1; 398 423 }
