Changeset 727
Legend:
- Unmodified
- Added
- Removed
-
trunk/flash.h
r724 r727 499 499 int (*command)(unsigned int writecnt, unsigned int readcnt, 500 500 const unsigned char *writearr, unsigned char *readarr); 501 int (*multicommand)(struct spi_command * spicommands);501 int (*multicommand)(struct spi_command *cmds); 502 502 503 503 /* Optimized functions for this programmer */ … … 515 515 int spi_send_command(unsigned int writecnt, unsigned int readcnt, 516 516 const unsigned char *writearr, unsigned char *readarr); 517 int spi_send_multicommand(struct spi_command * spicommands);517 int spi_send_multicommand(struct spi_command *cmds); 518 518 int spi_write_enable(void); 519 519 int spi_write_disable(void); … … 540 540 int default_spi_send_command(unsigned int writecnt, unsigned int readcnt, 541 541 const unsigned char *writearr, unsigned char *readarr); 542 int default_spi_send_multicommand(struct spi_command * spicommands);542 int default_spi_send_multicommand(struct spi_command *cmds); 543 543 544 544 /* 82802ab.c */ … … 566 566 int ich_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len); 567 567 int ich_spi_write_256(struct flashchip *flash, uint8_t * buf); 568 int ich_spi_send_multicommand(struct spi_command * spicommands);568 int ich_spi_send_multicommand(struct spi_command *cmds); 569 569 570 570 /* it87spi.c */ -
trunk/ichspi.c
r711 r727 743 743 } 744 744 745 int ich_spi_send_multicommand(struct spi_command * spicommands)745 int ich_spi_send_multicommand(struct spi_command *cmds) 746 746 { 747 747 int ret = 0; 748 while ((spicommands->writecnt || spicommands->readcnt) && !ret) { 749 ret = ich_spi_send_command(spicommands->writecnt, spicommands->readcnt, 750 spicommands->writearr, spicommands->readarr); 751 /* This awful hack needs to be smarter. 752 */ 753 if ((ret == SPI_INVALID_OPCODE) && 754 ((spicommands->writearr[0] == JEDEC_WREN) || 755 (spicommands->writearr[0] == JEDEC_EWSR))) { 756 printf_debug(" due to SPI master limitation, ignoring" 757 " and hoping it will be run as PREOP\n"); 758 ret = 0; 759 } 760 spicommands++; 748 int oppos, preoppos; 749 for (; (cmds->writecnt || cmds->readcnt) && !ret; cmds++) { 750 /* Is the next command valid or a terminator? */ 751 if ((cmds + 1)->writecnt || (cmds + 1)->readcnt) { 752 preoppos = find_preop(curopcodes, cmds->writearr[0]); 753 oppos = find_opcode(curopcodes, (cmds + 1)->writearr[0]); 754 /* Is the opcode of the current command listed in the 755 * ICH struct OPCODES as associated preopcode for the 756 * opcode of the next command? 757 */ 758 if ((oppos != -1) && (preoppos != -1) && 759 (curopcodes->opcode[oppos].atomic - 1 == preoppos)) { 760 printf_debug("opcode 0x%02x will be run as PREOP\n", 761 cmds->writearr[0]); 762 continue; 763 } 764 } 765 766 ret = ich_spi_send_command(cmds->writecnt, cmds->readcnt, 767 cmds->writearr, cmds->readarr); 761 768 } 762 769 return ret; -
trunk/spi.c
r724 r727 119 119 } 120 120 121 int spi_send_multicommand(struct spi_command * spicommands)121 int spi_send_multicommand(struct spi_command *cmds) 122 122 { 123 123 if (!spi_programmer[spi_controller].multicommand) { … … 127 127 } 128 128 129 return spi_programmer[spi_controller].multicommand( spicommands);129 return spi_programmer[spi_controller].multicommand(cmds); 130 130 } 131 131 … … 149 149 } 150 150 151 int default_spi_send_multicommand(struct spi_command * spicommands)151 int default_spi_send_multicommand(struct spi_command *cmds) 152 152 { 153 153 int result = 0; 154 while ((spicommands->writecnt || spicommands->readcnt) && !result) { 155 result = spi_send_command(spicommands->writecnt, spicommands->readcnt, 156 spicommands->writearr, spicommands->readarr); 157 spicommands++; 154 for (; (cmds->writecnt || cmds->readcnt) && !result; cmds++) { 155 result = spi_send_command(cmds->writecnt, cmds->readcnt, 156 cmds->writearr, cmds->readarr); 158 157 } 159 158 return result; … … 495 494 { 496 495 int result; 497 struct spi_command spicommands[] = {496 struct spi_command cmds[] = { 498 497 { 499 498 .writecnt = JEDEC_WREN_OUTSIZE, … … 519 518 } 520 519 521 result = spi_send_multicommand( spicommands);520 result = spi_send_multicommand(cmds); 522 521 if (result) { 523 522 fprintf(stderr, "%s failed during command execution\n", … … 541 540 { 542 541 int result; 543 struct spi_command spicommands[] = {542 struct spi_command cmds[] = { 544 543 { 545 544 .writecnt = JEDEC_WREN_OUTSIZE, … … 565 564 } 566 565 567 result = spi_send_multicommand( spicommands);566 result = spi_send_multicommand(cmds); 568 567 if (result) { 569 568 fprintf(stderr, "%s failed during command execution\n", __func__); … … 597 596 { 598 597 int result; 599 struct spi_command spicommands[] = {598 struct spi_command cmds[] = { 600 599 { 601 600 .writecnt = JEDEC_WREN_OUTSIZE, … … 615 614 }}; 616 615 617 result = spi_send_multicommand( spicommands);616 result = spi_send_multicommand(cmds); 618 617 if (result) { 619 618 fprintf(stderr, "%s failed during command execution\n", … … 641 640 { 642 641 int result; 643 struct spi_command spicommands[] = {642 struct spi_command cmds[] = { 644 643 { 645 644 .writecnt = JEDEC_WREN_OUTSIZE, … … 659 658 }}; 660 659 661 result = spi_send_multicommand( spicommands);660 result = spi_send_multicommand(cmds); 662 661 if (result) { 663 662 fprintf(stderr, "%s failed during command execution\n", __func__); … … 703 702 { 704 703 int result; 705 struct spi_command spicommands[] = {704 struct spi_command cmds[] = { 706 705 { 707 706 .writecnt = JEDEC_WREN_OUTSIZE, … … 721 720 }}; 722 721 723 result = spi_send_multicommand( spicommands);722 result = spi_send_multicommand(cmds); 724 723 if (result) { 725 724 fprintf(stderr, "%s failed during command execution\n", … … 780 779 { 781 780 int result; 782 struct spi_command spicommands[] = {781 struct spi_command cmds[] = { 783 782 { 784 783 .writecnt = JEDEC_EWSR_OUTSIZE, … … 798 797 }}; 799 798 800 result = spi_send_multicommand( spicommands);799 result = spi_send_multicommand(cmds); 801 800 if (result) { 802 801 fprintf(stderr, "%s failed during command execution\n", … … 809 808 { 810 809 int result; 811 struct spi_command spicommands[] = {810 struct spi_command cmds[] = { 812 811 { 813 812 .writecnt = JEDEC_WREN_OUTSIZE, … … 827 826 }}; 828 827 829 result = spi_send_multicommand( spicommands);828 result = spi_send_multicommand(cmds); 830 829 if (result) { 831 830 fprintf(stderr, "%s failed during command execution\n", … … 845 844 (address >> 0) & 0xff, 846 845 }; 847 struct spi_command spicommands[] = {846 struct spi_command cmds[] = { 848 847 { 849 848 .writecnt = JEDEC_WREN_OUTSIZE, … … 874 873 memcpy(&cmd[4], bytes, len); 875 874 876 result = spi_send_multicommand( spicommands);875 result = spi_send_multicommand(cmds); 877 876 if (result) { 878 877 fprintf(stderr, "%s failed during command execution\n",
Note: See TracChangeset
for help on using the changeset viewer.
