diff options
Diffstat (limited to 'firmware/target/arm/ata-sd-pp.c')
-rw-r--r-- | firmware/target/arm/ata-sd-pp.c | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/firmware/target/arm/ata-sd-pp.c b/firmware/target/arm/ata-sd-pp.c index af8c20d534..8ebec39fa8 100644 --- a/firmware/target/arm/ata-sd-pp.c +++ b/firmware/target/arm/ata-sd-pp.c | |||
@@ -181,7 +181,7 @@ static int sd_command(unsigned int cmd, unsigned long arg1, | |||
181 | /* Error sending command */ | 181 | /* Error sending command */ |
182 | return -EC_COMMAND - (STATUS_REG & ERROR_BITS)*100; | 182 | return -EC_COMMAND - (STATUS_REG & ERROR_BITS)*100; |
183 | 183 | ||
184 | if (cmd == GO_IDLE_STATE) | 184 | if (cmd == SD_GO_IDLE_STATE) |
185 | return 0; /* no response here */ | 185 | return 0; /* no response here */ |
186 | 186 | ||
187 | words = (type == 2) ? 9 : 3; | 187 | words = (type == 2) ? 9 : 3; |
@@ -226,7 +226,7 @@ static int sd_command(unsigned int cmd, unsigned long arg1, | |||
226 | * [12:9] CURRENT_STATE | 226 | * [12:9] CURRENT_STATE |
227 | * [8] READY_FOR_DATA | 227 | * [8] READY_FOR_DATA |
228 | * [7:6] | 228 | * [7:6] |
229 | * [5] APP_CMD | 229 | * [5] SD_APP_CMD |
230 | * [4] | 230 | * [4] |
231 | * [3] AKE_SEQ_ERROR | 231 | * [3] AKE_SEQ_ERROR |
232 | * [2] Reserved | 232 | * [2] Reserved |
@@ -252,7 +252,7 @@ static int sd_wait_for_state(unsigned int state, int id) | |||
252 | 252 | ||
253 | while (1) | 253 | while (1) |
254 | { | 254 | { |
255 | int ret = sd_command(SEND_STATUS, currcard->rca, &response, 1); | 255 | int ret = sd_command(SD_SEND_STATUS, currcard->rca, &response, 1); |
256 | long us; | 256 | long us; |
257 | 257 | ||
258 | if (ret < 0) | 258 | if (ret < 0) |
@@ -442,7 +442,7 @@ static int sd_select_bank(unsigned char bank) | |||
442 | 442 | ||
443 | memset(card_data, 0, 512); | 443 | memset(card_data, 0, 512); |
444 | 444 | ||
445 | ret = sd_wait_for_state(TRAN, EC_TRAN_SEL_BANK); | 445 | ret = sd_wait_for_state(SD_TRAN, EC_TRAN_SEL_BANK); |
446 | if (ret < 0) | 446 | if (ret < 0) |
447 | return ret; | 447 | return ret; |
448 | 448 | ||
@@ -453,7 +453,7 @@ static int sd_select_bank(unsigned char bank) | |||
453 | if (ret < 0) | 453 | if (ret < 0) |
454 | return ret; | 454 | return ret; |
455 | 455 | ||
456 | SD_STATE_REG = PRG; | 456 | SD_STATE_REG = SD_PRG; |
457 | 457 | ||
458 | card_data[0] = bank; | 458 | card_data[0] = bank; |
459 | 459 | ||
@@ -569,11 +569,11 @@ static void sd_init_device(int card_no) | |||
569 | DEV_RS |= DEV_ATA; /* Reset controller */ | 569 | DEV_RS |= DEV_ATA; /* Reset controller */ |
570 | DEV_RS &=~DEV_ATA; /* Clear Reset */ | 570 | DEV_RS &=~DEV_ATA; /* Clear Reset */ |
571 | 571 | ||
572 | SD_STATE_REG = TRAN; | 572 | SD_STATE_REG = SD_TRAN; |
573 | 573 | ||
574 | REG_5 = 0xf; | 574 | REG_5 = 0xf; |
575 | 575 | ||
576 | ret = sd_command(GO_IDLE_STATE, 0, NULL, 256); | 576 | ret = sd_command(SD_GO_IDLE_STATE, 0, NULL, 256); |
577 | if (ret < 0) | 577 | if (ret < 0) |
578 | goto card_init_error; | 578 | goto card_init_error; |
579 | 579 | ||
@@ -581,19 +581,19 @@ static void sd_init_device(int card_no) | |||
581 | 581 | ||
582 | #ifdef HAVE_HOTSWAP | 582 | #ifdef HAVE_HOTSWAP |
583 | /* Check for SDHC: | 583 | /* Check for SDHC: |
584 | - non-SDHC cards simply ignore SEND_IF_COND (CMD8) and we get error -219, | 584 | - non-SDHC cards simply ignore SD_SEND_IF_COND (CMD8) and we get error -219, |
585 | which we can just ignore and assume we're dealing with standard SD. | 585 | which we can just ignore and assume we're dealing with standard SD. |
586 | - SDHC cards echo back the argument into the response. This is how we | 586 | - SDHC cards echo back the argument into the response. This is how we |
587 | tell if the card is SDHC. | 587 | tell if the card is SDHC. |
588 | */ | 588 | */ |
589 | ret = sd_command(SEND_IF_COND,0x1aa, &response,7); | 589 | ret = sd_command(SD_SEND_IF_COND,0x1aa, &response,7); |
590 | if ( (ret < 0) && (ret!=-219) ) | 590 | if ( (ret < 0) && (ret!=-219) ) |
591 | goto card_init_error; | 591 | goto card_init_error; |
592 | #endif | 592 | #endif |
593 | 593 | ||
594 | while ((currcard->ocr & (1 << 31)) == 0) /* until card is powered up */ | 594 | while ((currcard->ocr & (1 << 31)) == 0) /* until card is powered up */ |
595 | { | 595 | { |
596 | ret = sd_command(APP_CMD, currcard->rca, NULL, 1); | 596 | ret = sd_command(SD_APP_CMD, currcard->rca, NULL, 1); |
597 | if (ret < 0) | 597 | if (ret < 0) |
598 | goto card_init_error; | 598 | goto card_init_error; |
599 | 599 | ||
@@ -621,15 +621,15 @@ static void sd_init_device(int card_no) | |||
621 | } | 621 | } |
622 | } | 622 | } |
623 | 623 | ||
624 | ret = sd_command(ALL_SEND_CID, 0, currcard->cid, 2); | 624 | ret = sd_command(SD_ALL_SEND_CID, 0, currcard->cid, 2); |
625 | if (ret < 0) | 625 | if (ret < 0) |
626 | goto card_init_error; | 626 | goto card_init_error; |
627 | 627 | ||
628 | ret = sd_command(SEND_RELATIVE_ADDR, 0, &currcard->rca, 1); | 628 | ret = sd_command(SD_SEND_RELATIVE_ADDR, 0, &currcard->rca, 1); |
629 | if (ret < 0) | 629 | if (ret < 0) |
630 | goto card_init_error; | 630 | goto card_init_error; |
631 | 631 | ||
632 | ret = sd_command(SEND_CSD, currcard->rca, currcard->csd, 2); | 632 | ret = sd_command(SD_SEND_CSD, currcard->rca, currcard->csd, 2); |
633 | if (ret < 0) | 633 | if (ret < 0) |
634 | goto card_init_error; | 634 | goto card_init_error; |
635 | 635 | ||
@@ -658,19 +658,19 @@ static void sd_init_device(int card_no) | |||
658 | 658 | ||
659 | REG_1 = 0; | 659 | REG_1 = 0; |
660 | 660 | ||
661 | ret = sd_command(SELECT_CARD, currcard->rca, NULL, 129); | 661 | ret = sd_command(SD_SELECT_CARD, currcard->rca, NULL, 129); |
662 | if (ret < 0) | 662 | if (ret < 0) |
663 | goto card_init_error; | 663 | goto card_init_error; |
664 | 664 | ||
665 | ret = sd_command(APP_CMD, currcard->rca, NULL, 1); | 665 | ret = sd_command(SD_APP_CMD, currcard->rca, NULL, 1); |
666 | if (ret < 0) | 666 | if (ret < 0) |
667 | goto card_init_error; | 667 | goto card_init_error; |
668 | 668 | ||
669 | ret = sd_command(SET_BUS_WIDTH, currcard->rca | 2, NULL, 1); /* 4 bit */ | 669 | ret = sd_command(SD_SET_BUS_WIDTH, currcard->rca | 2, NULL, 1); /* 4 bit */ |
670 | if (ret < 0) | 670 | if (ret < 0) |
671 | goto card_init_error; | 671 | goto card_init_error; |
672 | 672 | ||
673 | ret = sd_command(SET_BLOCKLEN, currcard->block_size, NULL, 1); | 673 | ret = sd_command(SD_SET_BLOCKLEN, currcard->block_size, NULL, 1); |
674 | if (ret < 0) | 674 | if (ret < 0) |
675 | goto card_init_error; | 675 | goto card_init_error; |
676 | 676 | ||
@@ -680,10 +680,10 @@ static void sd_init_device(int card_no) | |||
680 | if( (currcard->numblocks >= BLOCKS_PER_BANK) && | 680 | if( (currcard->numblocks >= BLOCKS_PER_BANK) && |
681 | ((currcard->ocr & (1<<30)) == 0) ) | 681 | ((currcard->ocr & (1<<30)) == 0) ) |
682 | { | 682 | { |
683 | SD_STATE_REG = TRAN; | 683 | SD_STATE_REG = SD_TRAN; |
684 | BLOCK_COUNT_REG = 1; | 684 | BLOCK_COUNT_REG = 1; |
685 | 685 | ||
686 | ret = sd_command(SWITCH_FUNC, 0x80ffffef, NULL, 0x1c05); | 686 | ret = sd_command(SD_SWITCH_FUNC, 0x80ffffef, NULL, 0x1c05); |
687 | if (ret < 0) | 687 | if (ret < 0) |
688 | goto card_init_error; | 688 | goto card_init_error; |
689 | 689 | ||
@@ -794,7 +794,7 @@ sd_read_retry: | |||
794 | start -= bank * BLOCKS_PER_BANK; | 794 | start -= bank * BLOCKS_PER_BANK; |
795 | } | 795 | } |
796 | 796 | ||
797 | ret = sd_wait_for_state(TRAN, EC_TRAN_READ_ENTRY); | 797 | ret = sd_wait_for_state(SD_TRAN, EC_TRAN_READ_ENTRY); |
798 | if (ret < 0) | 798 | if (ret < 0) |
799 | goto sd_read_error; | 799 | goto sd_read_error; |
800 | 800 | ||
@@ -804,12 +804,12 @@ sd_read_retry: | |||
804 | if(currcard->ocr & (1<<30) ) | 804 | if(currcard->ocr & (1<<30) ) |
805 | { | 805 | { |
806 | /* SDHC */ | 806 | /* SDHC */ |
807 | ret = sd_command(READ_MULTIPLE_BLOCK, start, NULL, 0x1c25); | 807 | ret = sd_command(SD_READ_MULTIPLE_BLOCK, start, NULL, 0x1c25); |
808 | } | 808 | } |
809 | else | 809 | else |
810 | #endif | 810 | #endif |
811 | { | 811 | { |
812 | ret = sd_command(READ_MULTIPLE_BLOCK, start * BLOCK_SIZE, NULL, 0x1c25); | 812 | ret = sd_command(SD_READ_MULTIPLE_BLOCK, start * BLOCK_SIZE, NULL, 0x1c25); |
813 | } | 813 | } |
814 | if (ret < 0) | 814 | if (ret < 0) |
815 | goto sd_read_error; | 815 | goto sd_read_error; |
@@ -833,11 +833,11 @@ sd_read_retry: | |||
833 | 833 | ||
834 | last_disk_activity = current_tick; | 834 | last_disk_activity = current_tick; |
835 | 835 | ||
836 | ret = sd_command(STOP_TRANSMISSION, 0, NULL, 1); | 836 | ret = sd_command(SD_STOP_TRANSMISSION, 0, NULL, 1); |
837 | if (ret < 0) | 837 | if (ret < 0) |
838 | goto sd_read_error; | 838 | goto sd_read_error; |
839 | 839 | ||
840 | ret = sd_wait_for_state(TRAN, EC_TRAN_READ_EXIT); | 840 | ret = sd_wait_for_state(SD_TRAN, EC_TRAN_READ_EXIT); |
841 | if (ret < 0) | 841 | if (ret < 0) |
842 | goto sd_read_error; | 842 | goto sd_read_error; |
843 | 843 | ||
@@ -909,7 +909,7 @@ sd_write_retry: | |||
909 | 909 | ||
910 | check_time[EC_WRITE_TIMEOUT] = USEC_TIMER; | 910 | check_time[EC_WRITE_TIMEOUT] = USEC_TIMER; |
911 | 911 | ||
912 | ret = sd_wait_for_state(TRAN, EC_TRAN_WRITE_ENTRY); | 912 | ret = sd_wait_for_state(SD_TRAN, EC_TRAN_WRITE_ENTRY); |
913 | if (ret < 0) | 913 | if (ret < 0) |
914 | goto sd_write_error; | 914 | goto sd_write_error; |
915 | 915 | ||
@@ -919,12 +919,12 @@ sd_write_retry: | |||
919 | if(currcard->ocr & (1<<30) ) | 919 | if(currcard->ocr & (1<<30) ) |
920 | { | 920 | { |
921 | /* SDHC */ | 921 | /* SDHC */ |
922 | ret = sd_command(WRITE_MULTIPLE_BLOCK, start, NULL, 0x1c2d); | 922 | ret = sd_command(SD_WRITE_MULTIPLE_BLOCK, start, NULL, 0x1c2d); |
923 | } | 923 | } |
924 | else | 924 | else |
925 | #endif | 925 | #endif |
926 | { | 926 | { |
927 | ret = sd_command(WRITE_MULTIPLE_BLOCK, start*BLOCK_SIZE, NULL, 0x1c2d); | 927 | ret = sd_command(SD_WRITE_MULTIPLE_BLOCK, start*BLOCK_SIZE, NULL, 0x1c2d); |
928 | } | 928 | } |
929 | if (ret < 0) | 929 | if (ret < 0) |
930 | goto sd_write_error; | 930 | goto sd_write_error; |
@@ -935,8 +935,8 @@ sd_write_retry: | |||
935 | { | 935 | { |
936 | if (buf == buf_end) | 936 | if (buf == buf_end) |
937 | { | 937 | { |
938 | /* Set SD_STATE_REG to PRG for the last buffer fill */ | 938 | /* Set SD_STATE_REG to SD_PRG for the last buffer fill */ |
939 | SD_STATE_REG = PRG; | 939 | SD_STATE_REG = SD_PRG; |
940 | } | 940 | } |
941 | 941 | ||
942 | udelay(2); /* needed here (loop is too fast :-) */ | 942 | udelay(2); /* needed here (loop is too fast :-) */ |
@@ -961,11 +961,11 @@ sd_write_retry: | |||
961 | goto sd_write_error; | 961 | goto sd_write_error; |
962 | } | 962 | } |
963 | 963 | ||
964 | ret = sd_command(STOP_TRANSMISSION, 0, NULL, 1); | 964 | ret = sd_command(SD_STOP_TRANSMISSION, 0, NULL, 1); |
965 | if (ret < 0) | 965 | if (ret < 0) |
966 | goto sd_write_error; | 966 | goto sd_write_error; |
967 | 967 | ||
968 | ret = sd_wait_for_state(TRAN, EC_TRAN_WRITE_EXIT); | 968 | ret = sd_wait_for_state(SD_TRAN, EC_TRAN_WRITE_EXIT); |
969 | if (ret < 0) | 969 | if (ret < 0) |
970 | goto sd_write_error; | 970 | goto sd_write_error; |
971 | 971 | ||